rk3188 ds1006h: add 3G MT6229 in the board file
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rk3188 / board-rk3188-ds1006h.c
1 /*
2  *
3  * Copyright (C) 2012 ROCKCHIP, Inc.
4  *
5  * This software is licensed under the terms of the GNU General Public
6  * License version 2, as published by the Free Software Foundation, and
7  * may be copied, distributed, and modified under those terms.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  */
15
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/platform_device.h>
19 #include <linux/input.h>
20 #include <linux/io.h>
21 #include <linux/delay.h>
22 #include <linux/i2c.h>
23 #include <linux/skbuff.h>
24 #include <linux/spi/spi.h>
25 #include <linux/mmc/host.h>
26 #include <linux/ion.h>
27 #include <linux/cpufreq.h>
28 #include <linux/clk.h>
29 #include <mach/dvfs.h>
30
31 #include <asm/setup.h>
32 #include <asm/mach-types.h>
33 #include <asm/mach/arch.h>
34 #include <asm/mach/map.h>
35 #include <asm/mach/flash.h>
36 #include <asm/hardware/gic.h>
37
38 #include <mach/board.h>
39 #include <mach/hardware.h>
40 #include <mach/io.h>
41 #include <mach/gpio.h>
42 #include <mach/iomux.h>
43 #include <linux/rk_fb.h>
44 #include <linux/regulator/machine.h>
45 #include <linux/rfkill-rk.h>
46 #include <linux/sensor-dev.h>
47 #include <linux/mfd/tps65910.h>
48 #include <linux/regulator/act8846.h>
49 #include <linux/regulator/rk29-pwm-regulator.h>
50 #if defined(CONFIG_CT36X_TS)
51 #include <linux/ct36x.h>
52 #endif
53 #if defined(CONFIG_MFD_RK610)
54 #include <linux/mfd/rk610_core.h>
55 #endif
56
57 #if defined(CONFIG_RK_HDMI)
58         #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
59 #endif
60
61 #if defined(CONFIG_SPIM_RK29)
62 #include "../../../drivers/spi/rk29_spim.h"
63 #endif
64 #if defined(CONFIG_MT6229)
65 #include <linux/mt6229.h>
66 #endif
67 #if defined(CONFIG_GPS_RK)
68 #include "../../../drivers/misc/gps/rk_gps/rk_gps.h"
69 #endif
70
71 #if defined(CONFIG_MT6620)
72 #include <linux/gps.h>
73 #endif
74
75 #include "../mach-rk30/board-rk3168-ds1006h-camera.c"
76 #include <plat/key.h>
77
78 static struct rk29_keys_button key_button[] = {
79         {
80                 .desc   = "play",
81                 .code   = KEY_POWER,
82                 .gpio   = RK30_PIN0_PA4, 
83                 .active_low = PRESS_LEV_LOW,
84                 .wakeup = 1,
85         },
86         {
87                 .desc   = "esc",
88                 .code   = KEY_BACK,
89                 .adc_value      = 1,
90                 .gpio = INVALID_GPIO,
91                 .active_low = PRESS_LEV_LOW,
92         },
93 };
94 struct rk29_keys_platform_data rk29_keys_pdata = {
95         .buttons        = key_button,
96         .nbuttons       = ARRAY_SIZE(key_button),
97         .chn    = 1,  //chn: 0-7, if do not use ADC,set 'chn' -1
98 };
99
100 #if defined(CONFIG_CT36X_TS)
101
102 #define TOUCH_MODEL             363
103 #define TOUCH_MAX_X             1280
104 #define TOUCH_MAX_y             800
105 #define TOUCH_RESET_PIN         RK30_PIN0_PB6
106 #define TOUCH_INT_PIN           RK30_PIN1_PB7
107
108 static struct ct36x_platform_data ct36x_info = {
109         .model   = TOUCH_MODEL,
110         .x_max   = TOUCH_MAX_X,
111         .y_max   = TOUCH_MAX_y,
112
113         .rst_io = {
114                 .gpio = TOUCH_RESET_PIN,
115                 .active_low = 1,
116         },
117         .irq_io = {
118                 .gpio = TOUCH_INT_PIN,
119                 .active_low = 1,
120         },
121         .orientation = {1, 0, 1, 0},
122 };
123 #endif
124 static struct spi_board_info board_spi_devices[] = {
125 };
126
127 /***********************************************************
128 *       rk30  backlight
129 ************************************************************/
130 #ifdef CONFIG_BACKLIGHT_RK29_BL
131 #define PWM_ID            3
132 #define PWM_MODE          PWM3
133 #define PWM_EFFECT_VALUE  1
134
135 #define LCD_DISP_ON_PIN
136
137 #ifdef  LCD_DISP_ON_PIN
138 #define BL_EN_PIN         RK30_PIN0_PA2
139 #define BL_EN_VALUE       GPIO_HIGH
140 #endif
141 static int rk29_backlight_io_init(void)
142 {
143         int ret = 0;
144
145         iomux_set(PWM_MODE);
146 #ifdef  LCD_DISP_ON_PIN
147         ret = gpio_request(BL_EN_PIN, NULL);
148         if (ret != 0) {
149                 gpio_free(BL_EN_PIN);
150         }
151
152         gpio_direction_output(BL_EN_PIN, 0);
153         gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
154 #endif
155
156         return ret;
157 }
158
159 static int rk29_backlight_io_deinit(void)
160 {
161         int ret = 0, pwm_gpio;
162
163 #ifdef  LCD_DISP_ON_PIN
164         gpio_free(BL_EN_PIN);
165 #endif
166
167         pwm_gpio = iomux_mode_to_gpio(PWM_MODE);
168         gpio_request(pwm_gpio, NULL);
169         gpio_direction_output(pwm_gpio, GPIO_LOW);
170         return ret;
171 }
172
173 static int rk29_backlight_pwm_suspend(void)
174 {
175         int ret = 0, pwm_gpio;
176
177         pwm_gpio = iomux_mode_to_gpio(PWM_MODE);
178         if (gpio_request(pwm_gpio, NULL)) {
179                 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
180                 return -1;
181         }
182         gpio_direction_output(pwm_gpio, GPIO_LOW);
183 #ifdef  LCD_DISP_ON_PIN
184         gpio_direction_output(BL_EN_PIN, 0);
185         gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
186 #endif
187         return ret;
188 }
189
190 static int rk29_backlight_pwm_resume(void)
191 {
192         int pwm_gpio = iomux_mode_to_gpio(PWM_MODE);
193
194         gpio_free(pwm_gpio);
195         iomux_set(PWM_MODE);
196 #ifdef  LCD_DISP_ON_PIN
197         msleep(30);
198         gpio_direction_output(BL_EN_PIN, 1);
199         gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
200 #endif
201         return 0;
202 }
203
204 static struct rk29_bl_info rk29_bl_info = {
205         .min_brightness = 65,
206         .max_brightness = 150,
207         .brightness_mode =BRIGHTNESS_MODE_CONIC,
208         .pre_div = 40 * 1000,  // pwm output clk: 40k;
209         .pwm_id = PWM_ID,
210         .bl_ref = PWM_EFFECT_VALUE,
211         .io_init = rk29_backlight_io_init,
212         .io_deinit = rk29_backlight_io_deinit,
213         .pwm_suspend = rk29_backlight_pwm_suspend,
214         .pwm_resume = rk29_backlight_pwm_resume,
215 };
216
217 static struct platform_device rk29_device_backlight = {
218         .name   = "rk29_backlight",
219         .id     = -1,
220         .dev    = {
221                 .platform_data  = &rk29_bl_info,
222         }
223 };
224
225 #endif
226
227 /*MMA8452 gsensor*/
228 #if defined (CONFIG_GS_MMA8452)
229 #define MMA8452_INT_PIN   RK30_PIN0_PB7
230
231 static int mma8452_init_platform_hw(void)
232 {
233         return 0;
234 }
235
236 static struct sensor_platform_data mma8452_info = {
237         .type = SENSOR_TYPE_ACCEL,
238         .irq_enable = 1,
239         .poll_delay_ms = 30,
240         .init_platform_hw = mma8452_init_platform_hw,
241         .orientation = {-1, 0, 0, 0, 0, -1, 0, 1, 0},
242 };
243 #endif
244 #if defined (CONFIG_GS_LIS3DH)
245 #define LIS3DH_INT_PIN   RK30_PIN0_PB7
246
247 static int lis3dh_init_platform_hw(void)
248 {
249
250         return 0;
251 }
252
253 static struct sensor_platform_data lis3dh_info = {
254         .type = SENSOR_TYPE_ACCEL,
255         .irq_enable = 1,
256         .poll_delay_ms = 30,
257         .init_platform_hw = lis3dh_init_platform_hw,
258         .orientation = {-1, 0, 0, 0, 0, -1, 0, 1, 0},
259 };
260 #endif
261
262 #if (defined(CONFIG_SENSORS_AK8963) || defined(CONFIG_SENSORS_AK8963_MODULE)) 
263 static struct akm8963_platform_data akm_platform_data_8963 = { 
264                  .gpio_DRDY      = RK30_PIN3_PD7, 
265                  .gpio_RST        = 0, 
266                  .layout              = 3, 
267                  .outbit           = 1, 
268 }; 
269 #endif
270
271 #if defined(CONFIG_LS_PHOTORESISTOR)
272 static struct sensor_platform_data light_photoresistor_info = {
273         .type = SENSOR_TYPE_LIGHT,
274         .irq_enable = 0,
275         .address = 2   ,
276         .poll_delay_ms = 200,
277 };
278 #endif
279
280 #if defined (CONFIG_COMPASS_AK8975)
281 static struct sensor_platform_data akm8975_info =
282 {
283         .type = SENSOR_TYPE_COMPASS,
284         .irq_enable = 1,
285         .poll_delay_ms = 30,
286         .m_layout = 
287         {
288                 {
289                         {1, 0, 0},
290                         {0, 1, 0},
291                         {0, 0, 1},
292                 },
293
294                 {
295                         {1, 0, 0},
296                         {0, 1, 0},
297                         {0, 0, 1},
298                 },
299
300                 {
301                         {1, 0, 0},
302                         {0, 1, 0},
303                         {0, 0, 1},
304                 },
305
306                 {
307                         {1, 0, 0},
308                         {0, 1, 0},
309                         {0, 0, 1},
310                 },
311         }
312 };
313
314 #endif
315
316 #if defined(CONFIG_MT6229)
317 static int mt6229_io_init(void)
318 {
319       #if 0
320         rk30_mux_api_set(GPIO2B6_LCDC1DATA14_SMCADDR18_TSSYNC_NAME, GPIO2B_GPIO2B6);
321       k30_mux_api_set(GPIO4D2_SMCDATA10_TRACEDATA10_NAME, GPIO4D_GPIO4D2);
322         rk30_mux_api_set(GPIO2B7_LCDC1DATA15_SMCADDR19_HSADCDATA7_NAME, GPIO2B_GPIO2B7);
323         rk30_mux_api_set(GPIO2C0_LCDCDATA16_GPSCLK_HSADCCLKOUT_NAME, GPIO2C_GPIO2C0);
324         rk30_mux_api_set(GPIO2C1_LCDC1DATA17_SMCBLSN0_HSADCDATA6_NAME, GPIO2C_GPIO2C1);
325         rk30_mux_api_set(GPIO2C1_LCDC1DATA17_SMCBLSN0_HSADCDATA6_NAME, GPIO2C_GPIO2C1);
326       #endif
327          return 0;
328 }
329
330 static int mt6229_io_deinit(void)
331 {
332         
333         return 0;
334 }
335  
336 struct rk29_mt6229_data rk29_mt6229_info = {
337         .io_init = mt6229_io_init,
338         .io_deinit = mt6229_io_deinit,
339         .modem_power_en = RK30_PIN0_PC6,
340         .bp_power = RK30_PIN2_PD5,
341         .modem_usb_en = RK30_PIN0_PC7,
342         .modem_uart_en = RK30_PIN2_PD4,
343         .bp_wakeup_ap = RK30_PIN0_PC5,
344         .ap_ready = RK30_PIN0_PC4,
345
346 };
347 struct platform_device rk29_device_mt6229 = {   
348         .name = "mt6229",       
349         .id = -1,       
350         .dev            = {
351                 .platform_data = &rk29_mt6229_info,
352         }       
353     };
354 #endif
355
356 #if defined(CONFIG_GYRO_L3G4200D)
357
358 #include <linux/l3g4200d.h>
359 #define L3G4200D_INT_PIN  RK30_PIN0_PB4
360
361 static int l3g4200d_init_platform_hw(void)
362 {
363         return 0;
364 }
365
366 static struct sensor_platform_data l3g4200d_info = {
367         .type = SENSOR_TYPE_GYROSCOPE,
368         .irq_enable = 1,
369         .poll_delay_ms = 0,
370         .orientation = {1, 0, 0 , 0 , -1, 0, 0, 0, -1},
371         .init_platform_hw = l3g4200d_init_platform_hw,
372         .x_min = 40,//x_min,y_min,z_min = (0-100) according to hardware
373         .y_min = 40,
374         .z_min = 20,
375 };
376
377 #endif
378
379 #ifdef CONFIG_LS_CM3217
380 static struct sensor_platform_data cm3217_info = {
381         .type = SENSOR_TYPE_LIGHT,
382         .irq_enable = 0,
383         .poll_delay_ms = 500,
384 };
385
386 #endif
387
388 #ifdef CONFIG_FB_ROCKCHIP
389
390 #define LCD_CS_PIN         INVALID_GPIO
391 #define LCD_CS_VALUE       GPIO_HIGH
392
393 #define LCD_EN_PIN         RK30_PIN0_PB0
394 #define LCD_EN_VALUE       GPIO_LOW
395
396 static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
397 {
398         int ret = 0;
399
400         if(LCD_CS_PIN !=INVALID_GPIO)
401         {
402                 ret = gpio_request(LCD_CS_PIN, NULL);
403                 if (ret != 0)
404                 {
405                         gpio_free(LCD_CS_PIN);
406                         printk(KERN_ERR "request lcd cs pin fail!\n");
407                         return -1;
408                 }
409                 else
410                 {
411                         gpio_direction_output(LCD_CS_PIN, LCD_CS_VALUE);
412                 }
413         }
414
415         if(LCD_EN_PIN !=INVALID_GPIO)
416         {
417                 ret = gpio_request(LCD_EN_PIN, NULL);
418                 if (ret != 0)
419                 {
420                         gpio_free(LCD_EN_PIN);
421                         printk(KERN_ERR "request lcd en pin fail!\n");
422                         return -1;
423                 }
424                 else
425                 {
426                         gpio_direction_output(LCD_EN_PIN, LCD_EN_VALUE);
427                 }
428         }
429         return 0;
430 }
431 static int rk_fb_io_disable(void)
432 {
433         if(LCD_CS_PIN !=INVALID_GPIO)
434         {
435                 gpio_set_value(LCD_CS_PIN, !LCD_CS_VALUE);
436         }
437         if(LCD_EN_PIN !=INVALID_GPIO)
438         {
439                 gpio_set_value(LCD_EN_PIN, !LCD_EN_VALUE);
440         }
441         return 0;
442 }
443 static int rk_fb_io_enable(void)
444 {
445         if(LCD_CS_PIN !=INVALID_GPIO)
446         {
447                 gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE);
448         }
449         if(LCD_EN_PIN !=INVALID_GPIO)
450         {
451                 gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE);
452         }
453         return 0;
454 }
455
456 #if defined(CONFIG_LCDC0_RK3188)
457 struct rk29fb_info lcdc0_screen_info = {
458         .prop           = EXTEND,       //extend display device
459        .lcd_info  = NULL,
460        .set_screen_info = hdmi_init_lcdc,
461
462 };
463 #endif
464
465 #if defined(CONFIG_LCDC1_RK3188)
466 struct rk29fb_info lcdc1_screen_info = {
467         .prop      = PRMRY,             //primary display device
468         .io_init   = rk_fb_io_init,
469         .io_disable = rk_fb_io_disable,
470         .io_enable = rk_fb_io_enable,
471         .set_screen_info = set_lcd_info,
472         
473 };
474 #endif
475
476 static struct resource resource_fb[] = {
477         [0] = {
478                 .name  = "fb0 buf",
479                 .start = 0,
480                 .end   = 0,//RK30_FB0_MEM_SIZE - 1,
481                 .flags = IORESOURCE_MEM,
482         },
483         [1] = {
484                 .name  = "ipp buf",  //for rotate
485                 .start = 0,
486                 .end   = 0,//RK30_FB0_MEM_SIZE - 1,
487                 .flags = IORESOURCE_MEM,
488         },
489         [2] = {
490                 .name  = "fb2 buf",
491                 .start = 0,
492                 .end   = 0,//RK30_FB0_MEM_SIZE - 1,
493                 .flags = IORESOURCE_MEM,
494         },
495 };
496
497 static struct platform_device device_fb = {
498         .name           = "rk-fb",
499         .id             = -1,
500         .num_resources  = ARRAY_SIZE(resource_fb),
501         .resource       = resource_fb,
502 };
503 #endif
504
505 #if defined(CONFIG_LCDC0_RK3188)
506 static struct resource resource_lcdc0[] = {
507         [0] = {
508                 .name  = "lcdc0 reg",
509                 .start = RK30_LCDC0_PHYS,
510                 .end   = RK30_LCDC0_PHYS + RK30_LCDC0_SIZE - 1,
511                 .flags = IORESOURCE_MEM,
512         },
513         
514         [1] = {
515                 .name  = "lcdc0 irq",
516                 .start = IRQ_LCDC0,
517                 .end   = IRQ_LCDC0,
518                 .flags = IORESOURCE_IRQ,
519         },
520 };
521
522 static struct platform_device device_lcdc0 = {
523         .name             = "rk30-lcdc",
524         .id               = 0,
525         .num_resources    = ARRAY_SIZE(resource_lcdc0),
526         .resource         = resource_lcdc0,
527         .dev            = {
528                 .platform_data = &lcdc0_screen_info,
529         },
530 };
531 #endif
532 #if defined(CONFIG_LCDC1_RK3188) 
533 static struct resource resource_lcdc1[] = {
534         [0] = {
535                 .name  = "lcdc1 reg",
536                 .start = RK30_LCDC1_PHYS,
537                 .end   = RK30_LCDC1_PHYS + RK30_LCDC1_SIZE - 1,
538                 .flags = IORESOURCE_MEM,
539         },
540         [1] = {
541                 .name  = "lcdc1 irq",
542                 .start = IRQ_LCDC1,
543                 .end   = IRQ_LCDC1,
544                 .flags = IORESOURCE_IRQ,
545         },
546 };
547
548 static struct platform_device device_lcdc1 = {
549         .name             = "rk30-lcdc",
550         .id               = 1,
551         .num_resources    = ARRAY_SIZE(resource_lcdc1),
552         .resource         = resource_lcdc1,
553         .dev            = {
554                 .platform_data = &lcdc1_screen_info,
555         },
556 };
557 #endif
558
559 #if defined(CONFIG_MFD_RK610)
560 #define RK610_RST_PIN                   RK30_PIN3_PB2
561 static int rk610_power_on_init(void)
562 {
563         int ret;
564         if(RK610_RST_PIN != INVALID_GPIO)
565         {
566                 ret = gpio_request(RK610_RST_PIN, "rk610 reset");
567                 if (ret)
568                 {
569                         printk(KERN_ERR "rk610_control_probe request gpio fail\n");
570                 }
571                 else 
572                 {
573                         gpio_direction_output(RK610_RST_PIN, GPIO_HIGH);
574                         msleep(100);
575                         gpio_direction_output(RK610_RST_PIN, GPIO_LOW);
576                         msleep(100);
577                         gpio_set_value(RK610_RST_PIN, GPIO_HIGH);
578                 }
579         }
580
581         return 0;
582         
583 }
584
585
586 static struct rk610_ctl_platform_data rk610_ctl_pdata = {
587         .rk610_power_on_init = rk610_power_on_init,
588 };
589 #endif
590
591 #ifdef CONFIG_SND_SOC_RK610
592 static int rk610_codec_io_init(void)
593 {
594 //if need iomux.
595 //Must not gpio_request
596         return 0;
597 }
598
599 static struct rk610_codec_platform_data rk610_codec_pdata = {
600         .spk_ctl_io = RK30_PIN2_PD7,
601         .io_init = rk610_codec_io_init,
602         .boot_depop = 1,
603 };
604 #endif
605
606 #ifdef CONFIG_RK_HDMI
607 #define RK_HDMI_RST_PIN                         RK30_PIN3_PB2
608 static int rk_hdmi_power_init(void)
609 {
610         int ret;
611
612         if(RK_HDMI_RST_PIN != INVALID_GPIO)
613         {
614                 if (gpio_request(RK_HDMI_RST_PIN, NULL)) {
615                         printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
616                         return -1;
617                 }
618                 gpio_direction_output(RK_HDMI_RST_PIN, GPIO_LOW);
619                 gpio_set_value(RK_HDMI_RST_PIN, GPIO_LOW);
620                 msleep(100);
621                 gpio_set_value(RK_HDMI_RST_PIN, GPIO_HIGH);
622                 msleep(50);
623         }
624         return 0;
625 }
626 static struct rk_hdmi_platform_data rk_hdmi_pdata = {
627         //.io_init = rk_hdmi_power_init,
628 };
629 #endif
630 #ifdef CONFIG_ION
631 #define ION_RESERVE_SIZE        (80 * SZ_1M)
632 static struct ion_platform_data rk30_ion_pdata = {
633         .nr = 1,
634         .heaps = {
635                 {
636                         .type = ION_HEAP_TYPE_CARVEOUT,
637                         .id = ION_NOR_HEAP_ID,
638                         .name = "norheap",
639                         .size = ION_RESERVE_SIZE,
640                 }
641         },
642 };
643
644 static struct platform_device device_ion = {
645         .name = "ion-rockchip",
646         .id = 0,
647         .dev = {
648                 .platform_data = &rk30_ion_pdata,
649         },
650 };
651 #endif
652
653 /**************************************************************************************************
654  * SDMMC devices,  include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
655 **************************************************************************************************/
656 #ifdef CONFIG_SDMMC_RK29
657 #include "board-rk3188-ds1006h-sdmmc-config.c"
658 #include "../plat-rk/rk-sdmmc-ops.c"
659 #include "../plat-rk/rk-sdmmc-wifi.c"
660 #endif //endif ---#ifdef CONFIG_SDMMC_RK29
661
662 #ifdef CONFIG_SDMMC0_RK29
663 static int rk29_sdmmc0_cfg_gpio(void)
664 {
665 #ifdef CONFIG_SDMMC_RK29_OLD
666         iomux_set(MMC0_CMD);
667         iomux_set(MMC0_CLKOUT);
668         iomux_set(MMC0_D0);
669         iomux_set(MMC0_D1);
670         iomux_set(MMC0_D2);
671         iomux_set(MMC0_D3);
672
673         iomux_set_gpio_mode(iomux_mode_to_gpio(MMC0_DETN));
674
675         gpio_request(RK30_PIN3_PA7, "sdmmc-power");
676         gpio_direction_output(RK30_PIN3_PA7, GPIO_LOW);
677
678 #else
679         rk29_sdmmc_set_iomux(0, 0xFFFF);
680
681     #if defined(CONFIG_SDMMC0_RK29_SDCARD_DET_FROM_GPIO)
682         #if SDMMC_USE_NEW_IOMUX_API
683         iomux_set_gpio_mode(iomux_gpio_to_mode(RK29SDK_SD_CARD_DETECT_N));
684         #else
685         rk30_mux_api_set(RK29SDK_SD_CARD_DETECT_PIN_NAME, RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO);
686         #endif
687     #else
688         #if SDMMC_USE_NEW_IOMUX_API       
689         iomux_set(MMC0_DETN);
690         #else
691         rk30_mux_api_set(RK29SDK_SD_CARD_DETECT_PIN_NAME, RK29SDK_SD_CARD_DETECT_IOMUX_FMUX);
692         #endif
693     #endif      
694
695 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
696         gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
697         gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
698 #endif
699
700 #endif
701
702         return 0;
703 }
704
705 #define CONFIG_SDMMC0_USE_DMA
706 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
707         .host_ocr_avail =
708             (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
709              MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
710              MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
711         .host_caps =
712             (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
713         .io_init = rk29_sdmmc0_cfg_gpio,
714
715 #if !defined(CONFIG_SDMMC_RK29_OLD)
716         .set_iomux = rk29_sdmmc_set_iomux,
717 #endif
718
719         .dma_name = "sd_mmc",
720 #ifdef CONFIG_SDMMC0_USE_DMA
721         .use_dma = 1,
722 #else
723         .use_dma = 0,
724 #endif
725
726 #if defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC) && defined(CONFIG_USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD)
727     .status = rk29sdk_wifi_mmc0_status,
728     .register_status_notify = rk29sdk_wifi_mmc0_status_register,
729 #endif
730
731 #if defined(RK29SDK_SD_CARD_PWR_EN) || (INVALID_GPIO != RK29SDK_SD_CARD_PWR_EN)
732     .power_en = RK29SDK_SD_CARD_PWR_EN,
733     .power_en_level = RK29SDK_SD_CARD_PWR_EN_LEVEL,
734 #else
735     .power_en = INVALID_GPIO,
736     .power_en_level = GPIO_LOW,
737 #endif    
738         .enable_sd_wakeup = 0,
739
740 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
741         .write_prt = SDMMC0_WRITE_PROTECT_PIN,
742         .write_prt_enalbe_level = SDMMC0_WRITE_PROTECT_ENABLE_VALUE;
743 #else
744         .write_prt = INVALID_GPIO,
745 #endif
746
747     .det_pin_info = {    
748     #if defined(RK29SDK_SD_CARD_DETECT_N) || (INVALID_GPIO != RK29SDK_SD_CARD_DETECT_N)  
749         .io             = RK29SDK_SD_CARD_DETECT_N, //INVALID_GPIO,
750         .enable         = RK29SDK_SD_CARD_INSERT_LEVEL,
751         #ifdef RK29SDK_SD_CARD_DETECT_PIN_NAME
752         .iomux          = {
753             .name       = RK29SDK_SD_CARD_DETECT_PIN_NAME,
754             #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO
755             .fgpio      = RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO,
756             #endif
757             #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FMUX
758             .fmux       = RK29SDK_SD_CARD_DETECT_IOMUX_FMUX,
759             #endif
760         },
761         #endif
762     #else
763         .io             = INVALID_GPIO,
764         .enable         = GPIO_LOW,
765     #endif    
766     }, 
767
768 };
769 #endif // CONFIG_SDMMC0_RK29
770
771 #ifdef CONFIG_SDMMC1_RK29
772 #define CONFIG_SDMMC1_USE_DMA
773 static int rk29_sdmmc1_cfg_gpio(void)
774 {
775 #if defined(CONFIG_SDMMC_RK29_OLD)
776         iomux_set(MMC1_CMD);
777         iomux_set(MMC1_CLKOUT);
778         iomux_set(MMC1_D0);
779         iomux_set(MMC1_D1);
780         iomux_set(MMC1_D2);
781         iomux_set(MMC1_D3);
782 #else
783
784 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
785         gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp");
786         gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN);
787 #endif
788
789 #endif
790
791         return 0;
792 }
793
794 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
795         .host_ocr_avail =
796             (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
797              MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
798              MMC_VDD_33_34),
799
800 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
801         .host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |
802                       MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
803 #else
804         .host_caps =
805             (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
806 #endif
807
808         .io_init = rk29_sdmmc1_cfg_gpio,
809
810 #if !defined(CONFIG_SDMMC_RK29_OLD)
811         .set_iomux = rk29_sdmmc_set_iomux,
812 #endif
813
814         .dma_name = "sdio",
815 #ifdef CONFIG_SDMMC1_USE_DMA
816         .use_dma = 1,
817 #else
818         .use_dma = 0,
819 #endif
820
821 #if defined(CONFIG_WIFI_CONTROL_FUNC) || defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC)
822     .status = rk29sdk_wifi_status,
823     .register_status_notify = rk29sdk_wifi_status_register,
824 #endif
825
826 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
827         .write_prt = SDMMC1_WRITE_PROTECT_PIN,
828             .write_prt_enalbe_level = SDMMC1_WRITE_PROTECT_ENABLE_VALUE;
829 #else
830         .write_prt = INVALID_GPIO,
831 #endif
832
833     #if defined(CONFIG_RK29_SDIO_IRQ_FROM_GPIO)
834         .sdio_INT_gpio = RK29SDK_WIFI_SDIO_CARD_INT,
835     #endif
836
837     .det_pin_info = {    
838 #if defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
839      #if defined(RK29SDK_SD_CARD_DETECT_N) || (INVALID_GPIO != RK29SDK_SD_CARD_DETECT_N)  
840         .io             = RK29SDK_SD_CARD_DETECT_N,
841      #else
842          .io             = INVALID_GPIO,
843      #endif   
844
845         .enable         = RK29SDK_SD_CARD_INSERT_LEVEL,
846         #ifdef RK29SDK_SD_CARD_DETECT_PIN_NAME
847         .iomux          = {
848             .name       = RK29SDK_SD_CARD_DETECT_PIN_NAME,
849             #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO
850             .fgpio      = RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO,
851             #endif
852             #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FMUX
853             .fmux       = RK29SDK_SD_CARD_DETECT_IOMUX_FMUX,
854             #endif
855         },
856         #endif
857  #else
858         .io             = INVALID_GPIO,
859         .enable         = GPIO_LOW,
860 #endif
861     },
862    
863         .enable_sd_wakeup = 0,
864 };
865 #endif //endif--#ifdef CONFIG_SDMMC1_RK29
866
867 /**************************************************************************************************
868  * the end of setting for SDMMC devices
869 **************************************************************************************************/
870
871 #ifdef CONFIG_BATTERY_RK30_ADC_FAC
872 static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
873         .dc_det_pin      = RK30_PIN0_PB2,
874         .batt_low_pin    = INVALID_GPIO, 
875         .charge_set_pin  = INVALID_GPIO,
876         .charge_ok_pin   = RK30_PIN0_PA6,
877          .usb_det_pin = INVALID_GPIO,
878         .dc_det_level    = GPIO_LOW,
879         .charge_ok_level = GPIO_HIGH,
880
881         .reference_voltage = 1800, // the rK2928 is 3300;RK3066 and rk29 are 2500;rk3066B is 1800;
882        .pull_up_res = 200,     //divider resistance ,  pull-up resistor
883        .pull_down_res = 120, //divider resistance , pull-down resistor
884
885         .is_reboot_charging = 1,
886         .save_capacity   = 1 ,
887         .low_voltage_protection = 3600,    
888 };
889
890 static struct platform_device rk30_device_adc_battery = {
891         .name   = "rk30-battery",
892         .id     = -1,
893         .dev = {
894                 .platform_data = &rk30_adc_battery_platdata,
895         },
896 };
897 #endif
898 #ifdef CONFIG_RK30_PWM_REGULATOR
899 static int pwm_voltage_map[] = {
900         800000,825000,850000, 875000,900000, 925000 ,950000, 975000,1000000, 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, 1300000, 1325000, 1350000,1375000
901 };
902
903 static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
904         {
905                 .supply = "vdd_cpu",
906         }
907 };
908
909 struct regulator_init_data pwm_regulator_init_dcdc[1] =
910 {
911         {
912                 .constraints = {
913                         .name = "PWM_DCDC1",
914                         .min_uV = 600000,
915                         .max_uV = 1800000,      //0.6-1.8V
916                         .apply_uV = true,
917                         .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
918                 },
919                 .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
920                 .consumer_supplies = pwm_dcdc1_consumers,
921         },
922 };
923
924 static struct pwm_platform_data pwm_regulator_info[1] = {
925         {
926                 .pwm_id = 1,
927                 .pwm_gpio = RK30_PIN3_PD4,
928                 .pwm_iomux_pwm = PWM1,
929                 .pwm_iomux_gpio = GPIO3_D4,
930                 .pwm_voltage = 1100000,
931                 .suspend_voltage = 1000000,
932                 .min_uV = 800000,
933                 .max_uV = 1375000,
934                 .coefficient = 575,     //57.5%
935                 .pwm_voltage_map = pwm_voltage_map,
936                 .init_data      = &pwm_regulator_init_dcdc[0],
937         },
938 };
939
940 struct platform_device pwm_regulator_device[1] = {
941         {
942                 .name = "pwm-voltage-regulator",
943                 .id = 0,
944                 .dev            = {
945                         .platform_data = &pwm_regulator_info[0],
946                 }
947         },
948 };
949 #endif
950
951 #ifdef CONFIG_RFKILL_RK
952 // bluetooth rfkill device, its driver in net/rfkill/rfkill-rk.c
953 static struct rfkill_rk_platform_data rfkill_rk_platdata = {
954     .type               = RFKILL_TYPE_BLUETOOTH,
955
956     .poweron_gpio       = { // BT_REG_ON
957         .io             = INVALID_GPIO, //RK30_PIN3_PC7,
958         .enable         = GPIO_HIGH,
959         .iomux          = {
960             .name       = "bt_poweron",
961             .fgpio      = GPIO3_C7,
962         },
963     },
964
965     .reset_gpio         = { // BT_RST
966         .io             = RK30_PIN3_PD1, // set io to INVALID_GPIO for disable it
967         .enable         = GPIO_LOW,
968         .iomux          = {
969             .name       = "bt_reset",
970             .fgpio      = GPIO3_D1,
971        },
972    }, 
973
974     .wake_gpio          = { // BT_WAKE, use to control bt's sleep and wakeup
975         .io             = RK30_PIN3_PC6, // set io to INVALID_GPIO for disable it
976         .enable         = GPIO_HIGH,
977         .iomux          = {
978             .name       = "bt_wake",
979             .fgpio      = GPIO3_C6,
980         },
981     },
982
983     .wake_host_irq      = { // BT_HOST_WAKE, for bt wakeup host when it is in deep sleep
984         .gpio           = {
985             .io         = RK30_PIN0_PA5, // set io to INVALID_GPIO for disable it
986             .enable     = GPIO_LOW,      // set GPIO_LOW for falling, set 0 for rising
987             .iomux      = {
988                 .name   = NULL,
989             },
990         },
991     },
992
993     .rts_gpio           = { // UART_RTS, enable or disable BT's data coming
994         .io             = RK30_PIN1_PA3, // set io to INVALID_GPIO for disable it
995         .enable         = GPIO_LOW,
996         .iomux          = {
997             .name       = "bt_rts",
998             .fgpio      = GPIO1_A3,
999             .fmux       = UART0_RTSN,
1000         },
1001     },
1002 };
1003
1004 static struct platform_device device_rfkill_rk = {
1005     .name   = "rfkill_rk",
1006     .id     = -1,
1007     .dev    = {
1008         .platform_data = &rfkill_rk_platdata,
1009     },
1010 };
1011 #endif
1012
1013 #if defined(CONFIG_GPS_RK)
1014 int rk_gps_io_init(void)
1015 {
1016         printk("%s \n", __FUNCTION__);
1017         
1018         rk30_mux_api_set(GPIO1B5_UART3RTSN_NAME, GPIO1B_GPIO1B5);//VCC_EN
1019         gpio_request(RK30_PIN1_PB5, NULL);
1020         gpio_direction_output(RK30_PIN1_PB5, GPIO_LOW);
1021
1022         rk30_mux_api_set(GPIO1B4_UART3CTSN_GPSRFCLK_NAME, GPIO1B_GPSRFCLK);//GPS_CLK
1023         rk30_mux_api_set(GPIO1B2_UART3SIN_GPSMAG_NAME, GPIO1B_GPSMAG);//GPS_MAG
1024         rk30_mux_api_set(GPIO1B3_UART3SOUT_GPSSIG_NAME, GPIO1B_GPSSIG);//GPS_SIGN
1025
1026         rk30_mux_api_set(GPIO1A6_UART1CTSN_SPI0CLK_NAME, GPIO1A_GPIO1A6);//SPI_CLK
1027         gpio_request(RK30_PIN1_PA6, NULL);
1028         gpio_direction_output(RK30_PIN1_PA6, GPIO_LOW);
1029
1030         rk30_mux_api_set(GPIO1A5_UART1SOUT_SPI0TXD_NAME, GPIO1A_GPIO1A5);//SPI_MOSI
1031         gpio_request(RK30_PIN1_PA5, NULL);
1032         gpio_direction_output(RK30_PIN1_PA5, GPIO_LOW); 
1033
1034         rk30_mux_api_set(GPIO1A7_UART1RTSN_SPI0CSN0_NAME, GPIO1A_GPIO1A7);//SPI_CS
1035         gpio_request(RK30_PIN1_PA7, NULL);
1036         gpio_direction_output(RK30_PIN1_PA7, GPIO_LOW);         
1037         return 0;
1038 }
1039 int rk_gps_power_up(void)
1040 {
1041         printk("%s \n", __FUNCTION__);
1042
1043         return 0;
1044 }
1045
1046 int rk_gps_power_down(void)
1047 {
1048         printk("%s \n", __FUNCTION__);
1049
1050         return 0;
1051 }
1052
1053 int rk_gps_reset_set(int level)
1054 {
1055         return 0;
1056 }
1057 int rk_enable_hclk_gps(void)
1058 {
1059         printk("%s \n", __FUNCTION__);
1060         clk_enable(clk_get(NULL, "hclk_gps"));
1061         return 0;
1062 }
1063 int rk_disable_hclk_gps(void)
1064 {
1065         printk("%s \n", __FUNCTION__);
1066         clk_disable(clk_get(NULL, "hclk_gps"));
1067         return 0;
1068 }
1069 struct rk_gps_data rk_gps_info = {
1070         .io_init = rk_gps_io_init,
1071         .power_up = rk_gps_power_up,
1072         .power_down = rk_gps_power_down,
1073         .reset = rk_gps_reset_set,
1074         .enable_hclk_gps = rk_enable_hclk_gps,
1075         .disable_hclk_gps = rk_disable_hclk_gps,
1076         .GpsSign = RK30_PIN1_PB3,
1077         .GpsMag = RK30_PIN1_PB2,        //GPIO index
1078         .GpsClk = RK30_PIN1_PB4,        //GPIO index
1079         .GpsVCCEn = RK30_PIN1_PB5,     //GPIO index
1080         .GpsSpi_CSO = RK30_PIN1_PA4,    //GPIO index
1081         .GpsSpiClk = RK30_PIN1_PA5,     //GPIO index
1082         .GpsSpiMOSI = RK30_PIN1_PA7,      //GPIO index
1083         .GpsIrq = IRQ_GPS,
1084         .GpsSpiEn = 0,
1085         .GpsAdcCh = 2,
1086         .u32GpsPhyAddr = RK30_GPS_PHYS,
1087         .u32GpsPhySize = RK30_GPS_SIZE,
1088 };
1089
1090 struct platform_device rk_device_gps = {
1091         .name = "gps_hv5820b",
1092         .id = -1,
1093         .dev            = {
1094         .platform_data = &rk_gps_info,
1095                 }
1096         };
1097 #endif
1098
1099 #if defined(CONFIG_MT5931_MT6622)
1100 static struct mt6622_platform_data mt6622_platdata = {
1101                     .power_gpio         = { // BT_REG_ON
1102                         .io             = RK30_PIN3_PD5, // set io to INVALID_GPIO for disable it
1103                             .enable         = GPIO_HIGH,
1104                             .iomux          = {
1105                                     .name       = NULL,
1106                                 },
1107                     },
1108
1109                     .reset_gpio         = { // BT_RST
1110                         .io             = RK30_PIN0_PD7,
1111                         .enable         = GPIO_HIGH,
1112                         .iomux          = {
1113                             .name       = NULL,
1114                         },
1115                     },
1116
1117                     .irq_gpio           = {
1118                             .io             = RK30_PIN3_PD2,
1119                             .enable         = GPIO_HIGH,
1120                             .iomux          = {
1121                                     .name       = NULL,
1122                                 },
1123                     }
1124 };
1125
1126 static struct platform_device device_mt6622 = {
1127                     .name   = "mt6622",
1128                         .id     = -1,
1129                         .dev    = {
1130                                .platform_data = &mt6622_platdata,
1131                         },
1132 };      
1133 #endif
1134
1135 static struct platform_device *devices[] __initdata = {
1136
1137 #ifdef CONFIG_ION
1138         &device_ion,
1139 #endif
1140 #ifdef CONFIG_WIFI_CONTROL_FUNC
1141         &rk29sdk_wifi_device,
1142 #endif
1143
1144 #if defined(CONFIG_MT6620)
1145             &mt3326_device_gps,
1146 #endif
1147
1148 #ifdef CONFIG_BATTERY_RK30_ADC_FAC
1149         &rk30_device_adc_battery,
1150 #endif
1151 #ifdef CONFIG_RFKILL_RK
1152         &device_rfkill_rk,
1153 #endif
1154 #ifdef CONFIG_GPS_RK
1155         &rk_device_gps,
1156 #endif
1157 #ifdef CONFIG_MT5931_MT6622
1158         &device_mt6622,
1159 #endif
1160 #if defined(CONFIG_MT6229)
1161         &rk29_device_mt6229,
1162 #endif
1163
1164 };
1165
1166
1167 static int rk_platform_add_display_devices(void)
1168 {
1169         struct platform_device *fb = NULL;  //fb
1170         struct platform_device *lcdc0 = NULL; //lcdc0
1171         struct platform_device *lcdc1 = NULL; //lcdc1
1172         struct platform_device *bl = NULL; //backlight
1173 #ifdef CONFIG_FB_ROCKCHIP
1174         fb = &device_fb;
1175 #endif
1176
1177 #if defined(CONFIG_LCDC0_RK3188)
1178         lcdc0 = &device_lcdc0,
1179 #endif
1180
1181 #if defined(CONFIG_LCDC1_RK3188)
1182         lcdc1 = &device_lcdc1,
1183 #endif
1184
1185 #ifdef CONFIG_BACKLIGHT_RK29_BL
1186         bl = &rk29_device_backlight,
1187 #endif
1188         __rk_platform_add_display_devices(fb,lcdc0,lcdc1,bl);
1189
1190         return 0;
1191         
1192 }
1193
1194 // i2c
1195 #ifdef CONFIG_I2C0_RK30
1196 static struct i2c_board_info __initdata i2c0_info[] = {
1197 #if defined (CONFIG_GS_MMA8452)
1198         {
1199                 .type           = "gs_mma8452",
1200                 .addr           = 0x1d,
1201                 .flags          = 0,
1202                 .irq            = MMA8452_INT_PIN,
1203                 .platform_data = &mma8452_info,
1204         },
1205 #endif
1206 #if defined (CONFIG_LS_US5151)
1207         {    
1208                 .type           = "us5151",
1209                 .addr           = 0x10,
1210                 .flags          = 0, 
1211         },   
1212 #endif
1213
1214 #if defined (CONFIG_GS_LIS3DH)
1215         {
1216                 .type           = "gs_lis3dh",
1217                 .addr           = 0x19,   //0x19(SA0-->VCC), 0x18(SA0-->GND)
1218                 .flags          = 0,
1219                 .irq            = LIS3DH_INT_PIN,
1220                 .platform_data = &lis3dh_info,
1221         },
1222 #endif
1223 #if defined (CONFIG_SENSORS_AK8963)
1224         {
1225                 .type             = "akm8963",
1226                 .addr           = 0x0d,
1227                 .flags           = I2C_CLIENT_WAKE,
1228                .irq             = RK30_PIN3_PD7,
1229               .platform_data = &akm_platform_data_8963,
1230         },
1231 #endif
1232 #if defined (CONFIG_LS_PHOTORESISTOR)
1233         {
1234                 .type           = "ls_photoresistor",
1235                 .addr           = 0x5e,            
1236                 .flags          = 0,
1237                 .irq            = INVALID_GPIO, 
1238                 .platform_data = &light_photoresistor_info,
1239         },
1240 #endif
1241
1242 #if defined (CONFIG_COMPASS_AK8975)
1243         {
1244                 .type          = "ak8975",
1245                 .addr          = 0x0d,
1246                 .flags         = 0,
1247                 .irq           = RK30_PIN3_PD7, 
1248                 .platform_data = &akm8975_info,
1249                 .irq           = RK30_PIN3_PD7, 
1250                 .platform_data = &akm8975_info,
1251         },
1252 #endif
1253 #if defined (CONFIG_GYRO_L3G4200D)
1254         {
1255                 .type          = "l3g4200d_gryo",
1256                 .addr          = 0x69,
1257                 .flags         = 0,
1258                 .irq           = L3G4200D_INT_PIN,
1259                 .platform_data = &l3g4200d_info,
1260         },
1261 #endif
1262 #if defined (CONFIG_SND_SOC_RK1000)
1263         {
1264                 .type          = "rk1000_i2c_codec",
1265                 .addr          = 0x60,
1266                 .flags         = 0,
1267         },
1268         {
1269                 .type          = "rk1000_control",
1270                 .addr          = 0x40,
1271                 .flags         = 0,
1272         },
1273 #endif
1274 #if defined (CONFIG_SND_SOC_RT5631)
1275         {
1276                 .type                   = "rt5631",
1277                 .addr                   = 0x1a,
1278                 .flags                  = 0,
1279         },
1280 #endif
1281 };
1282 #endif
1283
1284 int __sramdata g_pmic_type =  0;
1285 #ifdef CONFIG_I2C1_RK30
1286 #ifdef CONFIG_REGULATOR_ACT8846
1287 #define PMU_POWER_SLEEP RK30_PIN0_PA1
1288 #define PMU_VSEL RK30_PIN3_PD3
1289 #define ACT8846_HOST_IRQ                RK30_PIN0_PB3
1290
1291 static struct pmu_info  act8846_dcdc_info[] = {
1292         {
1293                 .name          = "act_dcdc1",   //ddr
1294                 .min_uv          = 1200000,
1295                 .max_uv         = 1200000,
1296                 .suspend_vol  =   1200000,
1297         },
1298         {
1299                 .name          = "vdd_core",    //logic
1300                 .min_uv          = 1000000,
1301                 .max_uv         = 1000000,
1302                 #ifdef CONFIG_ACT8846_SUPPORT_RESET
1303                 .suspend_vol  =  1200000,
1304                 #else
1305                 .suspend_vol  =  900000,
1306                 #endif
1307         },
1308         {
1309                 .name          = "vdd_cpu",   //arm
1310                 .min_uv          = 1000000,
1311                 .max_uv         = 1000000,
1312                 #ifdef CONFIG_ACT8846_SUPPORT_RESET
1313                 .suspend_vol  =  1200000,
1314                 #else
1315                 .suspend_vol  =  900000,
1316                 #endif
1317         },
1318         {
1319                 .name          = "act_dcdc4",   //vccio
1320                 .min_uv          = 3000000,
1321                 .max_uv         = 3000000,
1322                 #ifdef CONFIG_ACT8846_SUPPORT_RESET
1323                 .suspend_vol  =  3000000,
1324                 #else
1325                 .suspend_vol  =  2800000,
1326                 #endif
1327         },
1328         
1329 };
1330 static  struct pmu_info  act8846_ldo_info[] = {
1331         {
1332                 .name          = "act_ldo1",   //vdd10
1333                 .min_uv          = 1000000,
1334                 .max_uv         = 1000000,
1335         },
1336         {
1337                 .name          = "act_ldo2",    //vdd12
1338                 .min_uv          = 1200000,
1339                 .max_uv         = 1200000,
1340         },
1341         {
1342                 .name          = "act_ldo3",   //vcc18_cif
1343                 .min_uv          = 1800000,
1344                 .max_uv         = 1800000,
1345         },
1346         {
1347                 .name          = "act_ldo4",   //vcca33
1348                 .min_uv          = 3300000,
1349                 .max_uv         = 3300000,
1350         },
1351         {
1352                 .name          = "act_ldo5",   //vcctp
1353                 .min_uv          = 3300000,
1354                 .max_uv         = 3300000,
1355         },
1356         {
1357                 .name          = "act_ldo6",   //vcc_jetta
1358                 .min_uv          = 3300000,
1359                 .max_uv         = 3300000,
1360         },
1361         {
1362                 .name          = "act_ldo7",   //vcc18
1363                 .min_uv          = 1800000,
1364                 .max_uv         = 1800000,
1365         },
1366         {
1367                 .name          = "act_ldo8",   //vcc28_cif
1368                 .min_uv          = 2800000,
1369                 .max_uv         = 2800000,
1370         },
1371  };
1372
1373 #include "../mach-rk30/board-pmu-act8846.c"
1374 #endif
1375
1376 #ifdef CONFIG_MFD_WM831X_I2C
1377 #define PMU_POWER_SLEEP                 RK30_PIN0_PA1 
1378
1379 static struct pmu_info  wm8326_dcdc_info[] = {
1380         {
1381                 .name          = "vdd_core",   //logic
1382                 .min_uv          = 1000000,
1383                 .max_uv         = 1000000,
1384                 .suspend_vol  =  950000,
1385         },
1386         {
1387                 .name          = "vdd_cpu",    //arm
1388                 .min_uv          = 1000000,
1389                 .max_uv         = 1000000,
1390                 .suspend_vol  =  950000,
1391         },
1392         {
1393                 .name          = "dcdc3",   //ddr
1394                 .min_uv          = 1150000,
1395                 .max_uv         = 1150000,
1396                 .suspend_vol  =  1150000,
1397         },
1398         #ifdef CONFIG_MACH_RK3066_SDK
1399         {
1400                 .name          = "dcdc4",   //vcc_io
1401                 .min_uv          = 3300000,
1402                 .max_uv         = 3300000,
1403                 .suspend_vol  =  3000000,
1404         },
1405         #else
1406         {
1407                 .name          = "dcdc4",   //vcc_io
1408                 .min_uv          = 3000000,
1409                 .max_uv         = 3000000,
1410                 .suspend_vol  =  2800000,
1411         },
1412         #endif
1413 };
1414
1415 static struct pmu_info  wm8326_ldo_info[] = {
1416         {
1417                 .name          = "ldo1",   //vcc18_cif
1418                 .min_uv          = 1800000,
1419                 .max_uv         = 1800000,
1420                 .suspend_vol  =  1800000,
1421         },
1422         {
1423                 .name          = "ldo2",    //vccio_wl
1424                 .min_uv          = 1800000,
1425                 .max_uv         = 1800000,
1426                 .suspend_vol  =  1800000,
1427         },
1428         {
1429                 .name          = "ldo3",   //
1430                 .min_uv          = 1100000,
1431                 .max_uv         = 1100000,
1432                 .suspend_vol  =  1100000,
1433         },
1434         {
1435                 .name          = "ldo4",   //vdd11
1436                 .min_uv          = 1000000,
1437                 .max_uv         = 1000000,
1438                 .suspend_vol  =  1000000,
1439         },
1440         {
1441                 .name          = "ldo5",   //vcc25
1442                 .min_uv          = 1800000,
1443                 .max_uv         = 1800000,
1444                 .suspend_vol  =  1800000,
1445         },
1446         {
1447                 .name          = "ldo6",   //vcc33
1448                 .min_uv          = 3300000,
1449                 .max_uv         = 3300000,
1450                 .suspend_vol  =  3300000,
1451         },
1452         {
1453                 .name          = "ldo7",   //vcc28_cif
1454                 .min_uv          = 2800000,
1455                 .max_uv         = 2800000,
1456                 .suspend_vol  =  2800000,
1457         },
1458         {
1459                 .name          = "ldo8",   //vcca33
1460                 .min_uv          = 3300000,
1461                 .max_uv         = 3300000,
1462                 .suspend_vol  =  3300000,
1463         },
1464         {
1465                 .name          = "ldo9",   //vcc_tp
1466                 .min_uv          = 3300000,
1467                 .max_uv         = 3300000,
1468                 .suspend_vol  =  3300000,
1469         },
1470         {
1471                 .name          = "ldo10",   //flash_io
1472                 .min_uv          = 1800000,
1473                 .max_uv         = 1800000,
1474                 .suspend_vol  =  1800000,
1475         },
1476 };
1477
1478 #include "../mach-rk30/board-pmu-wm8326.c"
1479 #endif
1480
1481 #ifdef CONFIG_MFD_TPS65910
1482 #ifdef CONFIG_ARCH_RK3188
1483 #define TPS65910_HOST_IRQ        RK30_PIN0_PB3
1484 #else
1485 #define TPS65910_HOST_IRQ        RK30_PIN6_PA4
1486 #endif
1487
1488 #define PMU_POWER_SLEEP RK30_PIN0_PA1
1489
1490 static struct pmu_info  tps65910_dcdc_info[] = {
1491         {
1492                 .name          = "vdd_core",   //logic
1493                 .min_uv          = 1100000,
1494                 .max_uv         = 1100000,
1495         },
1496         {
1497                 .name          = "vdd2",    //ddr
1498                 .min_uv          = 1200000,
1499                 .max_uv         = 1200000,
1500         },
1501         {
1502                 .name          = "vio",   //vcc_io
1503                 .min_uv          = 2500000,
1504                 .max_uv         = 2500000,
1505         },
1506         
1507 };
1508 static  struct pmu_info  tps65910_ldo_info[] = {
1509         {
1510                 .name          = "vpll",   //vdd10
1511                 .min_uv          = 1000000,
1512                 .max_uv         = 1000000,
1513         },
1514         {
1515                 .name          = "vdig1",    //vcc18_cif
1516                 .min_uv          = 1800000,
1517                 .max_uv         = 1800000,
1518         },
1519         {
1520                 .name          = "vdig2",   //vdd_jetta
1521                 .min_uv          = 1200000,
1522                 .max_uv         = 1200000,
1523         },
1524         {
1525                 .name          = "vaux1",   //vcc28_cif
1526                 .min_uv          = 2800000,
1527                 .max_uv         = 2800000,
1528         },
1529         {
1530                 .name          = "vaux2",   //vcca33
1531                 .min_uv          = 3300000,
1532                 .max_uv         = 3300000,
1533         },
1534         {
1535                 .name          = "vaux33",   //vcc_tp
1536                 .min_uv          = 3300000,
1537                 .max_uv         = 3300000,
1538         },
1539         {
1540                 .name          = "vmmc",   //vcc30
1541                 .min_uv          = 3000000,
1542                 .max_uv         = 3000000,
1543         },
1544         {
1545                 .name          = "vdac",   //vcc18
1546                 .min_uv          = 1800000,
1547                 .max_uv         = 1800000,
1548         },
1549  };
1550
1551 #include "../mach-rk30/board-pmu-tps65910.c"
1552 #endif
1553
1554 static struct i2c_board_info __initdata i2c1_info[] = {
1555 #if defined (CONFIG_REGULATOR_ACT8846)
1556         {
1557                 .type                   = "act8846",
1558                 .addr           = 0x5a, 
1559                 .flags                  = 0,
1560                 .irq            = ACT8846_HOST_IRQ,
1561                 .platform_data=&act8846_data,
1562         },
1563 #endif
1564 #if defined (CONFIG_RTC_HYM8563)
1565         {
1566                 .type                   = "rtc_hym8563",
1567                 .addr           = 0x51,
1568                 .flags                  = 0,
1569                 .irq            = RK30_PIN0_PB5,
1570         },
1571 #endif
1572 #if defined (CONFIG_MFD_WM831X_I2C)
1573         {
1574                 .type          = "wm8326",
1575                 .addr          = 0x34,
1576                 .flags         = 0,
1577                 .irq           = RK30_PIN0_PB3,
1578                 .platform_data = &wm831x_platdata,
1579         },
1580 #endif
1581 #if defined (CONFIG_MFD_TPS65910)
1582         {
1583         .type           = "tps65910",
1584         .addr           = TPS65910_I2C_ID0,
1585         .flags          = 0,
1586         .irq            = TPS65910_HOST_IRQ,
1587         .platform_data = &tps65910_data,
1588         },
1589 #endif
1590 };
1591 #endif
1592
1593 void __sramfunc board_pmu_suspend(void)
1594 {      
1595         #if defined (CONFIG_REGULATOR_ACT8846)
1596        if(pmic_is_act8846())
1597        board_pmu_act8846_suspend(); 
1598        #endif
1599         #if defined (CONFIG_MFD_WM831X_I2C)
1600        if(pmic_is_wm8326())
1601        board_pmu_wm8326_suspend();
1602         #endif
1603         #if defined (CONFIG_MFD_TPS65910)
1604        if(pmic_is_tps65910())
1605        board_pmu_tps65910_suspend(); 
1606     #endif   
1607 }
1608
1609 void __sramfunc board_pmu_resume(void)
1610 {      
1611         #if defined (CONFIG_REGULATOR_ACT8846)
1612        if(pmic_is_act8846())
1613        board_pmu_act8846_resume(); 
1614        #endif
1615         #if defined (CONFIG_MFD_WM831X_I2C)
1616        if(pmic_is_wm8326())
1617        board_pmu_wm8326_resume();
1618         #endif
1619         #if defined (CONFIG_MFD_TPS65910)
1620        if(pmic_is_tps65910())
1621        board_pmu_tps65910_resume(); 
1622         #endif
1623 }
1624
1625  int __sramdata gpio3d6_iomux,gpio3d6_do,gpio3d6_dir,gpio3d6_en;
1626
1627 #define grf_readl(offset)       readl_relaxed(RK30_GRF_BASE + offset)
1628 #define grf_writel(v, offset)   do { writel_relaxed(v, RK30_GRF_BASE + offset); dsb(); } while (0)
1629  
1630 void __sramfunc rk30_pwm_logic_suspend_voltage(void)
1631 {
1632 #ifdef CONFIG_RK30_PWM_REGULATOR
1633
1634 //      int gpio0d7_iomux,gpio0d7_do,gpio0d7_dir,gpio0d7_en;
1635         sram_udelay(10000);
1636         gpio3d6_iomux = grf_readl(GRF_GPIO3D_IOMUX);
1637         gpio3d6_do = grf_readl(GRF_GPIO3H_DO);
1638         gpio3d6_dir = grf_readl(GRF_GPIO3H_DIR);
1639         gpio3d6_en = grf_readl(GRF_GPIO3H_EN);
1640
1641         grf_writel((1<<28), GRF_GPIO3D_IOMUX);
1642         grf_writel((1<<30)|(1<<14), GRF_GPIO3H_DIR);
1643         grf_writel((1<<30)|(1<<14), GRF_GPIO3H_DO);
1644         grf_writel((1<<30)|(1<<14), GRF_GPIO3H_EN);
1645 #endif 
1646 }
1647 void __sramfunc rk30_pwm_logic_resume_voltage(void)
1648 {
1649 #ifdef CONFIG_RK30_PWM_REGULATOR
1650         grf_writel((1<<28)|gpio3d6_iomux, GRF_GPIO3D_IOMUX);
1651         grf_writel((1<<30)|gpio3d6_en, GRF_GPIO3H_EN);
1652         grf_writel((1<<30)|gpio3d6_dir, GRF_GPIO3H_DIR);
1653         grf_writel((1<<30)|gpio3d6_do, GRF_GPIO3H_DO);
1654         sram_udelay(10000);
1655
1656 #endif
1657
1658 }
1659 extern void pwm_suspend_voltage(void);
1660 extern void pwm_resume_voltage(void);
1661 void  rk30_pwm_suspend_voltage_set(void)
1662 {
1663 #ifdef CONFIG_RK30_PWM_REGULATOR
1664         pwm_suspend_voltage();
1665 #endif
1666 }
1667 void  rk30_pwm_resume_voltage_set(void)
1668 {
1669 #ifdef CONFIG_RK30_PWM_REGULATOR
1670         pwm_resume_voltage();
1671 #endif
1672 }
1673
1674
1675 #ifdef CONFIG_I2C2_RK30
1676 static struct i2c_board_info __initdata i2c2_info[] = {
1677 #if defined (CONFIG_CT36X_TS)
1678         {
1679                 .type          = CT36X_NAME,
1680                 .addr          = 0x01,
1681                 .flags         = 0,
1682                 .platform_data = &ct36x_info,
1683         },
1684 #endif
1685 #if defined (CONFIG_LS_CM3217)
1686         {
1687                 .type          = "lightsensor",
1688                 .addr          = 0x10,
1689                 .flags         = 0,
1690                 .platform_data = &cm3217_info,
1691         },
1692 #endif
1693 #if defined(CONFIG_HDMI_CAT66121)
1694         {
1695                 .type           = "cat66121_hdmi",
1696                 .addr           = 0x4c,
1697                 .flags          = 0,
1698                 .irq            = RK30_PIN2_PD6,
1699                 .platform_data  = &rk_hdmi_pdata,
1700         },
1701 #endif
1702 };
1703 #endif
1704
1705 #ifdef CONFIG_I2C3_RK30
1706 static struct i2c_board_info __initdata i2c3_info[] = {
1707 };
1708 #endif
1709
1710 #ifdef CONFIG_I2C4_RK30
1711 static struct i2c_board_info __initdata i2c4_info[] = {
1712 #ifdef CONFIG_MFD_RK610
1713                 {
1714                         .type                   = "rk610_ctl",
1715                         .addr                   = 0x40,
1716                         .flags                  = 0,
1717                         .platform_data          = &rk610_ctl_pdata,
1718                 },
1719 #ifdef CONFIG_RK610_TVOUT
1720                 {
1721                         .type                   = "rk610_tvout",
1722                         .addr                   = 0x42,
1723                         .flags                  = 0,
1724                 },
1725 #endif
1726 #ifdef CONFIG_HDMI_RK610
1727                 {
1728                         .type                   = "rk610_hdmi",
1729                         .addr                   = 0x46,
1730                         .flags                  = 0,
1731                         .irq                    = INVALID_GPIO,
1732                 },
1733 #endif
1734 #ifdef CONFIG_SND_SOC_RK610
1735                 {//RK610_CODEC addr  from 0x60 to 0x80 (0x60~0x80)
1736                         .type                   = "rk610_i2c_codec",
1737                         .addr                   = 0x60,
1738                         .flags                  = 0,
1739                         .platform_data          = &rk610_codec_pdata,                   
1740                 },
1741 #endif
1742 #endif
1743
1744 };
1745 #endif
1746
1747 #ifdef CONFIG_I2C_GPIO_RK30
1748 #define I2C_SDA_PIN     INVALID_GPIO// RK30_PIN2_PD6   //set sda_pin here
1749 #define I2C_SCL_PIN     INVALID_GPIO//RK30_PIN2_PD7   //set scl_pin here
1750 static int rk30_i2c_io_init(void)
1751 {
1752         //set iomux (gpio) here
1753         //rk30_mux_api_set(GPIO2D7_I2C1SCL_NAME, GPIO2D_GPIO2D7);
1754         //rk30_mux_api_set(GPIO2D6_I2C1SDA_NAME, GPIO2D_GPIO2D6);
1755
1756         return 0;
1757 }
1758 struct i2c_gpio_platform_data default_i2c_gpio_data = {
1759        .sda_pin = I2C_SDA_PIN,
1760        .scl_pin = I2C_SCL_PIN,
1761        .udelay = 5, // clk = 500/udelay = 100Khz
1762        .timeout = 100,//msecs_to_jiffies(100),
1763        .bus_num    = 5,
1764        .io_init = rk30_i2c_io_init,
1765 };
1766 static struct i2c_board_info __initdata i2c_gpio_info[] = {
1767 };
1768 #endif
1769
1770 static void __init rk30_i2c_register_board_info(void)
1771 {
1772 #ifdef CONFIG_I2C0_RK30
1773         i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
1774 #endif
1775 #ifdef CONFIG_I2C1_RK30
1776         i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
1777 #endif
1778 #ifdef CONFIG_I2C2_RK30
1779         i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
1780 #endif
1781 #ifdef CONFIG_I2C3_RK30
1782         i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
1783 #endif
1784 #ifdef CONFIG_I2C4_RK30
1785         i2c_register_board_info(4, i2c4_info, ARRAY_SIZE(i2c4_info));
1786 #endif
1787 #ifdef CONFIG_I2C_GPIO_RK30
1788         i2c_register_board_info(5, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
1789 #endif
1790 }
1791 //end of i2c
1792
1793 #define POWER_ON_PIN RK30_PIN0_PA0   //power_hold
1794 static void rk30_pm_power_off(void)
1795 {
1796         printk(KERN_ERR "rk30_pm_power_off start...\n");
1797 #if defined(CONFIG_MFD_WM831X)
1798         wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000);  //set sys_pwr 0
1799         wm831x_device_shutdown(Wm831x);//wm8326 shutdown
1800 #endif
1801 #if defined(CONFIG_REGULATOR_ACT8846)
1802        if (pmic_is_act8846()) {
1803                printk("enter dcdet===========\n");
1804                if(gpio_get_value (RK30_PIN0_PB2) == GPIO_LOW)
1805                {
1806                        printk("enter restart===========\n");
1807                        arm_pm_restart(0, NULL);
1808                }
1809                else
1810                 {
1811                         act8846_device_shutdown();
1812                 }
1813        }
1814 #endif
1815         gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
1816         while (1);
1817 }
1818
1819 static void __init machine_rk30_board_init(void)
1820 {
1821         //avs_init();
1822         gpio_request(POWER_ON_PIN, "poweronpin");
1823         gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
1824         
1825         pm_power_off = rk30_pm_power_off;
1826         
1827         gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
1828
1829
1830         rk30_i2c_register_board_info();
1831         spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
1832         platform_add_devices(devices, ARRAY_SIZE(devices));
1833         rk_platform_add_display_devices();
1834         board_usb_detect_init(RK30_PIN0_PA7);
1835
1836 #ifdef CONFIG_WIFI_CONTROL_FUNC
1837         rk29sdk_wifi_bt_gpio_control_init();
1838 #endif
1839
1840 #if defined(CONFIG_MT6620)
1841             clk_set_rate(clk_get_sys("rk_serial.1", "uart"), 48*1000000);
1842 #endif
1843
1844 #if defined(CONFIG_MT5931_MT6622)
1845                 clk_set_rate(clk_get_sys("rk_serial.0", "uart"), 24*1000000);
1846 #endif          
1847 }
1848
1849 static void __init rk30_reserve(void)
1850 {
1851 #ifdef CONFIG_ION
1852         rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
1853 #endif
1854
1855 #ifdef CONFIG_FB_ROCKCHIP
1856         resource_fb[0].start = board_mem_reserve_add("fb0 buf", get_fb_size());
1857         resource_fb[0].end = resource_fb[0].start + get_fb_size()- 1;
1858 #if 0
1859         resource_fb[1].start = board_mem_reserve_add("ipp buf", RK30_FB0_MEM_SIZE);
1860         resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1;
1861 #endif
1862
1863 #if defined(CONFIG_FB_ROTATE) || !defined(CONFIG_THREE_FB_BUFFER)
1864         resource_fb[2].start = board_mem_reserve_add("fb2 buf",get_fb_size());
1865         resource_fb[2].end = resource_fb[2].start + get_fb_size() - 1;
1866 #endif
1867 #endif
1868
1869
1870 #ifdef CONFIG_VIDEO_RK29
1871         rk30_camera_request_reserve_mem();
1872 #endif
1873         
1874 #ifdef CONFIG_GPS_RK
1875         //it must be more than 8MB
1876         rk_gps_info.u32MemoryPhyAddr = board_mem_reserve_add("gps", SZ_8M);
1877 #endif
1878         board_mem_reserved();
1879 }
1880
1881 /**
1882  * dvfs_cpu_logic_table: table for arm and logic dvfs 
1883  * @frequency   : arm frequency
1884  * @cpu_volt    : arm voltage depend on frequency
1885  * @logic_volt  : logic voltage arm requests depend on frequency
1886  * comments     : min arm/logic voltage
1887  */
1888 static struct cpufreq_frequency_table dvfs_arm_table[] = {
1889 #if 0
1890         {.frequency = 312 * 1000,       .index = 850 * 1000},
1891         {.frequency = 504 * 1000,       .index = 900 * 1000},
1892         {.frequency = 816 * 1000,       .index = 950 * 1000},
1893         {.frequency = 1008 * 1000,      .index = 1025 * 1000},
1894         {.frequency = 1200 * 1000,      .index = 1100 * 1000},
1895         {.frequency = 1416 * 1000,      .index = 1200 * 1000},
1896         //{.frequency = 1608 * 1000,      .index = 1300 * 1000},
1897 #else
1898         {.frequency = 312 * 1000,       .index = 800 * 1000},
1899         {.frequency = 504 * 1000,       .index = 850 * 1000},
1900         {.frequency = 816 * 1000,       .index = 950 * 1000},
1901         {.frequency = 1008 * 1000,      .index = 1000 * 1000},
1902         {.frequency = 1200 * 1000,      .index = 1075 * 1000},
1903         {.frequency = 1416 * 1000,      .index = 1175 * 1000},
1904         {.frequency = 1608 * 1000,      .index = 1275 * 1000},
1905
1906 #endif
1907         {.frequency = CPUFREQ_TABLE_END},
1908 };
1909
1910 static struct cpufreq_frequency_table dvfs_gpu_table[] = {
1911         {.frequency = 100 * 1000,       .index = 950 * 1000},
1912        {.frequency = 150 * 1000,       .index = 975 * 1000},
1913        {.frequency = 200 * 1000,       .index = 975 * 1000},  
1914        {.frequency = 240 * 1000,       .index = 1000 * 1000},  
1915        {.frequency = 300 * 1000,       .index = 1050 * 1000},  
1916        {.frequency = 400 * 1000,       .index = 1100 * 1000},
1917        {.frequency = 600 * 1000,       .index = 1200 * 1000},
1918         {.frequency = CPUFREQ_TABLE_END},
1919 };
1920
1921 static struct cpufreq_frequency_table dvfs_ddr_table[] = {
1922         //{.frequency = 200 * 1000 + DDR_FREQ_SUSPEND,    .index = 950 * 1000},
1923         {.frequency = 300 * 1000 + DDR_FREQ_VIDEO,      .index = 1000 * 1000},
1924         {.frequency = 400 * 1000 + DDR_FREQ_NORMAL,     .index = 1100 * 1000},
1925         {.frequency = CPUFREQ_TABLE_END},
1926 };
1927
1928 //#define DVFS_CPU_TABLE_SIZE   (ARRAY_SIZE(dvfs_cpu_logic_table))
1929 //static struct cpufreq_frequency_table cpu_dvfs_table[DVFS_CPU_TABLE_SIZE];
1930 //static struct cpufreq_frequency_table dep_cpu2core_table[DVFS_CPU_TABLE_SIZE];
1931
1932 void __init board_clock_init(void)
1933 {
1934         rk30_clock_data_init(periph_pll_default, codec_pll_default, RK30_CLOCKS_DEFAULT_FLAGS);
1935         //dvfs_set_arm_logic_volt(dvfs_cpu_logic_table, cpu_dvfs_table, dep_cpu2core_table);
1936         dvfs_set_freq_volt_table(clk_get(NULL, "cpu"), dvfs_arm_table);
1937         dvfs_set_freq_volt_table(clk_get(NULL, "gpu"), dvfs_gpu_table);
1938         dvfs_set_freq_volt_table(clk_get(NULL, "ddr"), dvfs_ddr_table);
1939 }
1940
1941 MACHINE_START(RK30, "RK30board")
1942         .boot_params    = PLAT_PHYS_OFFSET + 0x800,
1943         .fixup          = rk30_fixup,
1944         .reserve        = &rk30_reserve,
1945         .map_io         = rk30_map_io,
1946         .init_irq       = rk30_init_irq,
1947         .timer          = &rk30_timer,
1948         .init_machine   = machine_rk30_board_init,
1949 MACHINE_END