rk3026: i2s add several attempts to double confirm i2s frac effect
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rk3188 / board-rk3188-jettaplus.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/mfd/rk808.h>
50 #include <linux/regulator/rk29-pwm-regulator.h>
51
52 #ifdef CONFIG_CW2015_BATTERY
53 #include <linux/power/cw2015_battery.h>
54 #endif
55 #if defined(CONFIG_MFD_RK610)
56 #include <linux/mfd/rk610_core.h>
57 #endif
58
59 #if defined(CONFIG_MFD_RK616)
60 #include <linux/mfd/rk616.h>
61 #endif
62
63
64 #if defined(CONFIG_RK_HDMI)
65         #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
66 #endif
67
68 #if defined(CONFIG_SPIM_RK29)
69 #include "../../../drivers/spi/rk29_spim.h"
70 #endif
71 #if defined(CONFIG_GPS_RK)
72 #include "../../../drivers/misc/gps/rk_gps/rk_gps.h"
73 #endif
74 #if defined(CONFIG_MU509)
75 #include <linux/mu509.h>
76 #endif
77 #if defined(CONFIG_MW100)
78 #include <linux/mw100.h>
79 #endif
80 #if defined(CONFIG_MT6229)
81 #include <linux/mt6229.h>
82 #endif
83 #if defined(CONFIG_ANDROID_TIMED_GPIO)
84 #include "../../../drivers/staging/android/timed_gpio.h"
85 #endif
86
87 #if defined(CONFIG_MT6620)
88 #include <linux/gps.h>
89 #endif
90 #include "../mach-rk30/board-rk3168-tb-camera.c"
91
92 #if defined(CONFIG_TOUCHSCREEN_GT8XX)
93 #define TOUCH_RESET_PIN  RK30_PIN0_PB6
94 #define TOUCH_PWR_PIN    RK30_PIN0_PC5   // need to fly line by hardware engineer
95
96 /* Android Parameter */
97 static int ap_mdm = 0;
98 module_param(ap_mdm, int, 0644);
99 static int ap_has_alsa = 0;
100 module_param(ap_has_alsa, int, 0644);
101 static int ap_data_only = 2;
102 module_param(ap_data_only, int, 0644);
103 static int ap_has_earphone = 0;
104 module_param(ap_has_earphone, int, 0644);
105
106
107 static int goodix_init_platform_hw(void)
108 {
109         int ret;
110         
111         if (TOUCH_PWR_PIN != INVALID_GPIO) {
112                 ret = gpio_request(TOUCH_PWR_PIN, "goodix power pin");
113                 if (ret != 0) {
114                         gpio_free(TOUCH_PWR_PIN);
115                         printk("goodix power error\n");
116                         return -EIO;
117                 }
118                 gpio_direction_output(TOUCH_PWR_PIN, 0);
119                 gpio_set_value(TOUCH_PWR_PIN, GPIO_LOW);
120                 msleep(100);
121         }
122
123         if (TOUCH_RESET_PIN != INVALID_GPIO) {
124                 ret = gpio_request(TOUCH_RESET_PIN, "goodix reset pin");
125                 if (ret != 0) {
126                         gpio_free(TOUCH_RESET_PIN);
127                         printk("goodix gpio_request error\n");
128                         return -EIO;
129                 }
130                 gpio_direction_output(TOUCH_RESET_PIN, 1);
131                 msleep(100);
132                 //gpio_set_value(TOUCH_RESET_PIN, GPIO_LOW);
133                 //msleep(100);
134                 //gpio_set_value(TOUCH_RESET_PIN, GPIO_HIGH);
135                 //msleep(500);
136         }
137         return 0;
138 }
139
140 struct goodix_platform_data goodix_info = {
141         .model = 8105,
142         .irq_pin = RK30_PIN1_PB7,
143         .rest_pin = TOUCH_RESET_PIN,
144         .init_platform_hw = goodix_init_platform_hw,
145 };
146 #endif
147
148 static struct spi_board_info board_spi_devices[] = {
149 };
150
151 /***********************************************************
152 *       rk30  backlight
153 ************************************************************/
154 #ifdef CONFIG_BACKLIGHT_RK29_BL
155 #define PWM_ID            3
156 #define PWM_MODE          PWM3
157 #define PWM_EFFECT_VALUE  1
158
159 #define LCD_DISP_ON_PIN
160
161 #ifdef  LCD_DISP_ON_PIN
162 #define BL_EN_PIN         RK30_PIN0_PA2
163 #define BL_EN_VALUE       GPIO_HIGH
164 #endif
165 static int rk29_backlight_io_init(void)
166 {
167         int ret = 0;
168
169         iomux_set(PWM_MODE);
170 #ifdef  LCD_DISP_ON_PIN
171         ret = gpio_request(BL_EN_PIN, "bl_en");
172         if (ret == 0) {
173                 gpio_direction_output(BL_EN_PIN, BL_EN_VALUE);
174         }
175 #endif
176         return ret;
177 }
178
179 static int rk29_backlight_io_deinit(void)
180 {
181         int ret = 0, pwm_gpio;
182 #ifdef  LCD_DISP_ON_PIN
183         gpio_free(BL_EN_PIN);
184 #endif
185         pwm_gpio = iomux_mode_to_gpio(PWM_MODE);
186         gpio_request(pwm_gpio, "bl_pwm");
187         gpio_direction_output(pwm_gpio, GPIO_LOW);
188         return ret;
189 }
190
191 static int rk29_backlight_pwm_suspend(void)
192 {
193         int ret, pwm_gpio = iomux_mode_to_gpio(PWM_MODE);
194
195         ret = gpio_request(pwm_gpio, "bl_pwm");
196         if (ret) {
197                 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
198                 return ret;
199         }
200         gpio_direction_output(pwm_gpio, GPIO_LOW);
201 #ifdef  LCD_DISP_ON_PIN
202         gpio_direction_output(BL_EN_PIN, !BL_EN_VALUE);
203 #endif
204         return ret;
205 }
206
207 static int rk29_backlight_pwm_resume(void)
208 {
209         int pwm_gpio = iomux_mode_to_gpio(PWM_MODE);
210
211         gpio_free(pwm_gpio);
212         iomux_set(PWM_MODE);
213 #ifdef  LCD_DISP_ON_PIN
214         msleep(30);
215         gpio_direction_output(BL_EN_PIN, BL_EN_VALUE);
216 #endif
217         return 0;
218 }
219
220 static struct rk29_bl_info rk29_bl_info = {
221         .pwm_id = PWM_ID,
222         .min_brightness=20,
223         .max_brightness=255,
224         .brightness_mode =BRIGHTNESS_MODE_CONIC,
225         .bl_ref = PWM_EFFECT_VALUE,
226         .io_init = rk29_backlight_io_init,
227         .io_deinit = rk29_backlight_io_deinit,
228         .pwm_suspend = rk29_backlight_pwm_suspend,
229         .pwm_resume = rk29_backlight_pwm_resume,
230 };
231
232 static struct platform_device rk29_device_backlight = {
233         .name   = "rk29_backlight",
234         .id     = -1,
235         .dev    = {
236                 .platform_data  = &rk29_bl_info,
237         }
238 };
239
240 #endif
241
242 #ifdef CONFIG_RK29_SUPPORT_MODEM
243
244 #define RK30_MODEM_POWER        RK30_PIN0_PC6
245 #define RK30_MODEM_POWER_IOMUX  iomux_set(GPIO0_C6)
246
247 static int rk30_modem_io_init(void)
248 {
249     printk("%s\n", __FUNCTION__);
250     RK30_MODEM_POWER_IOMUX;
251
252         return 0;
253 }
254
255 static struct rk29_io_t rk30_modem_io = {
256     .io_addr    = RK30_MODEM_POWER,
257     .enable     = GPIO_HIGH,
258     .disable    = GPIO_LOW,
259     .io_init    = rk30_modem_io_init,
260 };
261
262 static struct platform_device rk30_device_modem = {
263         .name   = "rk30_modem",
264         .id     = -1,
265         .dev    = {
266                 .platform_data  = &rk30_modem_io,
267         }
268 };
269 #endif
270 #if defined(CONFIG_MU509)
271 static int mu509_io_init(void)
272 {
273
274         iomux_set(GPIO2_D5);
275         iomux_set(GPIO0_C6);
276         iomux_set(GPIO2_D4);
277         iomux_set(GPIO0_C4);
278         iomux_set(GPIO0_C5);
279         return 0;
280 }
281
282 static int mu509_io_deinit(void)
283 {
284         
285         return 0;
286 }
287  
288 struct rk29_mu509_data rk29_mu509_info = {
289         .io_init = mu509_io_init,
290         .io_deinit = mu509_io_deinit,
291         .modem_power_en = RK30_PIN2_PD5,   
292         .bp_power = RK30_PIN0_PC6,              
293         .bp_reset = RK30_PIN2_PD4,              
294         .ap_wakeup_bp = RK30_PIN0_PC4,  
295         .bp_wakeup_ap = RK30_PIN0_PC5,  
296 };
297 struct platform_device rk29_device_mu509 = {    
298         .name = "mu509",        
299         .id = -1,       
300         .dev            = {
301                 .platform_data = &rk29_mu509_info,
302         }       
303     };
304 #endif
305 #if defined(CONFIG_MW100)
306 static int mw100_io_init(void)
307 {
308         iomux_set(GPIO2_D5);
309         iomux_set(GPIO0_C6);
310         iomux_set(GPIO2_D4);
311         iomux_set(GPIO0_C4);
312         iomux_set(GPIO0_C5);
313         return 0;
314 }
315
316 static int mw100_io_deinit(void)
317 {
318         
319         return 0;
320 }
321  
322 struct rk29_mw100_data rk29_mw100_info = {
323         .io_init = mw100_io_init,
324         .io_deinit = mw100_io_deinit,
325         .modem_power_en = RK30_PIN2_PD5,
326         .bp_power = RK30_PIN0_PC6,
327         .bp_reset = RK30_PIN2_PD4,
328         .ap_wakeup_bp = RK30_PIN0_PC4,
329         .bp_wakeup_ap = RK30_PIN0_PC5,
330 };
331 struct platform_device rk29_device_mw100 = {    
332         .name = "mw100",        
333         .id = -1,       
334         .dev            = {
335                 .platform_data = &rk29_mw100_info,
336         }       
337     };
338 #endif
339 #if defined(CONFIG_MT6229)
340 static int mt6229_io_init(void)
341 {
342         iomux_set(GPIO2_D5);
343         iomux_set(GPIO0_C6);
344         iomux_set(GPIO2_D4);
345         iomux_set(GPIO0_C4);
346         iomux_set(GPIO0_C5);
347         return 0;
348 }
349
350 static int mt6229_io_deinit(void)
351 {
352         
353         return 0;
354 }
355  
356 struct rk29_mt6229_data rk29_mt6229_info = {
357         .io_init = mt6229_io_init,
358         .io_deinit = mt6229_io_deinit,
359         .modem_power_en = RK30_PIN2_PD5,
360         .bp_power = RK30_PIN0_PC6,
361         .bp_reset = RK30_PIN2_PD4,
362         .ap_wakeup_bp = RK30_PIN0_PC4,
363         .bp_wakeup_ap = RK30_PIN0_PC5,
364 };
365 struct platform_device rk29_device_mt6229 = {   
366         .name = "mt6229",       
367         .id = -1,       
368         .dev            = {
369                 .platform_data = &rk29_mt6229_info,
370         }       
371     };
372 #endif
373
374 /*MMA8452 gsensor*/
375 #if defined (CONFIG_GS_MMA8452)
376 #define MMA8452_INT_PIN   RK30_PIN0_PB7
377
378 static int mma8452_init_platform_hw(void)
379 {
380         return 0;
381 }
382
383 static struct sensor_platform_data mma8452_info = {
384         .type = SENSOR_TYPE_ACCEL,
385         .irq_enable = 1,
386         .poll_delay_ms = 30,
387         .init_platform_hw = mma8452_init_platform_hw,
388         .orientation = {-1, 0, 0, 0, -1, 0, 0, 0, 1},
389 };
390 #endif
391 #if defined (CONFIG_GS_LIS3DH)
392 #define LIS3DH_INT_PIN   RK30_PIN0_PB7
393
394 static int lis3dh_init_platform_hw(void)
395 {
396
397         return 0;
398 }
399
400 static struct sensor_platform_data lis3dh_info = {
401         .type = SENSOR_TYPE_ACCEL,
402         .irq_enable = 1,
403         .poll_delay_ms = 30,
404         .init_platform_hw = lis3dh_init_platform_hw,
405         .orientation = {-1, 0, 0, 0, -1, 0, 0, 0, 1},
406 };
407 #endif
408 #if defined (CONFIG_COMPASS_AK8975)
409 static struct sensor_platform_data akm8975_info =
410 {
411         .type = SENSOR_TYPE_COMPASS,
412         .irq_enable = 1,
413         .poll_delay_ms = 30,
414         .m_layout = 
415         {
416                 {
417                         {1, 0, 0},
418                         {0, 1, 0},
419                         {0, 0, 1},
420                 },
421
422                 {
423                         {1, 0, 0},
424                         {0, 1, 0},
425                         {0, 0, 1},
426                 },
427
428                 {
429                         {1, 0, 0},
430                         {0, 1, 0},
431                         {0, 0, 1},
432                 },
433
434                 {
435                         {1, 0, 0},
436                         {0, 1, 0},
437                         {0, 0, 1},
438                 },
439         }
440 };
441
442 #endif
443
444 #if defined(CONFIG_GYRO_L3G4200D)
445
446 #include <linux/l3g4200d.h>
447 #define L3G4200D_INT_PIN  RK30_PIN0_PB4
448
449 static int l3g4200d_init_platform_hw(void)
450 {
451         return 0;
452 }
453
454 static struct sensor_platform_data l3g4200d_info = {
455         .type = SENSOR_TYPE_GYROSCOPE,
456         .irq_enable = 1,
457         .poll_delay_ms = 30,
458         .orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1},
459         .init_platform_hw = l3g4200d_init_platform_hw,
460         .x_min = 40,//x_min,y_min,z_min = (0-100) according to hardware
461         .y_min = 40,
462         .z_min = 20,
463 };
464
465 #endif
466
467 #ifdef CONFIG_LS_CM3217
468 static struct sensor_platform_data cm3217_info = {
469         .type = SENSOR_TYPE_LIGHT,
470         .irq_enable = 0,
471         .poll_delay_ms = 500,
472 };
473
474 #endif
475
476 #ifdef CONFIG_FB_ROCKCHIP
477
478 #define LCD_CS_PIN         INVALID_GPIO
479 #define LCD_CS_VALUE       GPIO_HIGH
480
481 #define LCD_EN_PIN         RK30_PIN0_PB0 
482 #if defined(CONFIG_MACH_RK3188_RK618)
483 #define MIPI_LCD_RST_PIN   RK30_PIN0_PC3   //mipi lcd's reset pin, if no reset pin, set's  INVALID_GPIO
484 #define LCD_EN_VALUE       GPIO_LOW
485 #else
486 #define LCD_EN_VALUE       GPIO_HIGH 
487 #endif
488
489 static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
490 {
491         int ret = 0;
492
493     
494         if(LCD_CS_PIN !=INVALID_GPIO)
495         {
496                 ret = gpio_request(LCD_CS_PIN, NULL);
497                 if (ret != 0)
498                 {
499                         gpio_free(LCD_CS_PIN);
500                         printk(KERN_ERR "request lcd cs pin fail!\n");
501                         return -1;
502                 }
503                 else
504                 {
505                         gpio_direction_output(LCD_CS_PIN, LCD_CS_VALUE);
506                 }
507         }
508
509         if(LCD_EN_PIN !=INVALID_GPIO)
510         {
511                 ret = gpio_request(LCD_EN_PIN, NULL);
512                 if (ret != 0)
513                 {
514                         gpio_free(LCD_EN_PIN);
515                         printk(KERN_ERR "request lcd en pin fail!\n");
516                         return -1;
517                 }
518                 else
519                 {
520                         gpio_direction_output(LCD_EN_PIN, LCD_EN_VALUE);
521                 }
522         }
523
524     if(MIPI_LCD_RST_PIN !=INVALID_GPIO)
525         {
526                 ret = gpio_request(MIPI_LCD_RST_PIN, NULL);
527                 if (ret != 0)
528                 {
529                         gpio_free(MIPI_LCD_RST_PIN);
530                         printk(KERN_ERR "request mipi lcd rst pin fail!\n");
531                         return -1;
532                 }
533         
534                 else
535                 {
536             gpio_set_value(MIPI_LCD_RST_PIN, !GPIO_LOW);
537             msleep(20);
538                 }
539         }
540         return 0;
541 }
542 static int rk_fb_io_disable(void)
543 {
544         if(LCD_CS_PIN !=INVALID_GPIO)
545         {
546                 gpio_set_value(LCD_CS_PIN, !LCD_CS_VALUE);
547         }
548     
549         if(LCD_EN_PIN !=INVALID_GPIO)
550         {
551                 gpio_set_value(LCD_EN_PIN, !LCD_EN_VALUE);
552         }
553
554     if(MIPI_LCD_RST_PIN !=INVALID_GPIO)
555         {
556                 gpio_set_value(MIPI_LCD_RST_PIN, GPIO_LOW);
557         msleep(10);
558         }
559     
560         return 0;
561 }
562 static int rk_fb_io_enable(void)
563 {
564         if(LCD_CS_PIN !=INVALID_GPIO)
565         {
566                 gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE);
567         }
568     
569         if(LCD_EN_PIN !=INVALID_GPIO)
570         {
571                 gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE);
572         }
573
574     if(MIPI_LCD_RST_PIN !=INVALID_GPIO)
575         {
576         gpio_set_value(MIPI_LCD_RST_PIN, !GPIO_LOW);
577         msleep(10);
578      }
579         return 0;
580 }
581
582 #if defined(CONFIG_LCDC0_RK3066B) || defined(CONFIG_LCDC0_RK3188)
583 struct rk29fb_info lcdc0_screen_info = {
584 #if defined(CONFIG_RK_HDMI) && defined(CONFIG_HDMI_SOURCE_LCDC0) && defined(CONFIG_DUAL_LCDC_DUAL_DISP_IN_KERNEL)
585         .prop      = EXTEND,    //extend display device
586         .io_init    = NULL,
587         .io_disable = NULL,
588         .io_enable = NULL,
589         .set_screen_info = hdmi_init_lcdc,
590 #else
591         .prop      = PRMRY,             //primary display device
592         .io_init   = rk_fb_io_init,
593         .io_disable = rk_fb_io_disable,
594         .io_enable = rk_fb_io_enable,
595         .set_screen_info = set_lcd_info,
596 #endif
597 };
598 #endif
599
600 #if defined(CONFIG_LCDC1_RK3066B) || defined(CONFIG_LCDC1_RK3188)
601 struct rk29fb_info lcdc1_screen_info = {
602 #if defined(CONFIG_RK_HDMI) && defined(CONFIG_HDMI_SOURCE_LCDC1) && defined(CONFIG_DUAL_LCDC_DUAL_DISP_IN_KERNEL)
603         .prop      = EXTEND,    //extend display device
604         .io_init    = NULL,
605         .io_disable = NULL,
606         .io_enable = NULL,
607         .set_screen_info = hdmi_init_lcdc,
608 #else
609         .prop      = PRMRY,             //primary display device
610         .io_init   = rk_fb_io_init,
611         .io_disable = rk_fb_io_disable,
612         .io_enable = rk_fb_io_enable,
613         .set_screen_info = set_lcd_info,
614 #endif
615 };
616 #endif
617
618
619 static struct resource resource_fb[] = {
620         [0] = {
621                 .name  = "fb0 buf",
622                 .start = 0,
623                 .end   = 0,//RK30_FB0_MEM_SIZE - 1,
624                 .flags = IORESOURCE_MEM,
625         },
626         [1] = {
627                 .name  = "ipp buf",  //for rotate
628                 .start = 0,
629                 .end   = 0,//RK30_FB0_MEM_SIZE - 1,
630                 .flags = IORESOURCE_MEM,
631         },
632         [2] = {
633                 .name  = "fb2 buf",
634                 .start = 0,
635                 .end   = 0,//RK30_FB0_MEM_SIZE - 1,
636                 .flags = IORESOURCE_MEM,
637         },
638 };
639
640 static struct platform_device device_fb = {
641         .name           = "rk-fb",
642         .id             = -1,
643         .num_resources  = ARRAY_SIZE(resource_fb),
644         .resource       = resource_fb,
645 };
646 #endif
647 #if defined(CONFIG_ARCH_RK3188)
648 static struct resource resource_mali[] = {
649         [0] = {
650         .name  = "ump buf",
651         .start = 0,
652         .end   = 0,
653         .flags = IORESOURCE_MEM,
654         },
655
656 };
657
658 static struct platform_device device_mali= {
659         .name           = "mali400_ump",
660         .id             = -1,
661         .num_resources  = ARRAY_SIZE(resource_mali),
662         .resource       = resource_mali,
663 };
664 #endif
665
666 #if defined(CONFIG_LCDC0_RK3066B) || defined(CONFIG_LCDC0_RK3188)
667 static struct resource resource_lcdc0[] = {
668         [0] = {
669                 .name  = "lcdc0 reg",
670                 .start = RK30_LCDC0_PHYS,
671                 .end   = RK30_LCDC0_PHYS + RK30_LCDC0_SIZE - 1,
672                 .flags = IORESOURCE_MEM,
673         },
674         
675         [1] = {
676                 .name  = "lcdc0 irq",
677                 .start = IRQ_LCDC0,
678                 .end   = IRQ_LCDC0,
679                 .flags = IORESOURCE_IRQ,
680         },
681 };
682
683 static struct platform_device device_lcdc0 = {
684         .name             = "rk30-lcdc",
685         .id               = 0,
686         .num_resources    = ARRAY_SIZE(resource_lcdc0),
687         .resource         = resource_lcdc0,
688         .dev            = {
689                 .platform_data = &lcdc0_screen_info,
690         },
691 };
692 #endif
693 #if defined(CONFIG_LCDC1_RK3066B) || defined(CONFIG_LCDC1_RK3188)
694 static struct resource resource_lcdc1[] = {
695         [0] = {
696                 .name  = "lcdc1 reg",
697                 .start = RK30_LCDC1_PHYS,
698                 .end   = RK30_LCDC1_PHYS + RK30_LCDC1_SIZE - 1,
699                 .flags = IORESOURCE_MEM,
700         },
701         [1] = {
702                 .name  = "lcdc1 irq",
703                 .start = IRQ_LCDC1,
704                 .end   = IRQ_LCDC1,
705                 .flags = IORESOURCE_IRQ,
706         },
707 };
708
709 static struct platform_device device_lcdc1 = {
710         .name             = "rk30-lcdc",
711         .id               = 1,
712         .num_resources    = ARRAY_SIZE(resource_lcdc1),
713         .resource         = resource_lcdc1,
714         .dev            = {
715                 .platform_data = &lcdc1_screen_info,
716         },
717 };
718 #endif
719
720 #if defined(CONFIG_MFD_RK610)
721 #define RK610_RST_PIN                   RK30_PIN2_PC5
722 static int rk610_power_on_init(void)
723 {
724         int ret;
725         if(RK610_RST_PIN != INVALID_GPIO)
726         {
727                 ret = gpio_request(RK610_RST_PIN, "rk610 reset");
728                 if (ret)
729                 {
730                         printk(KERN_ERR "rk610_control_probe request gpio fail\n");
731                 }
732                 else 
733                 {
734                         gpio_direction_output(RK610_RST_PIN, GPIO_HIGH);
735                         msleep(100);
736                         gpio_direction_output(RK610_RST_PIN, GPIO_LOW);
737                         msleep(100);
738                         gpio_set_value(RK610_RST_PIN, GPIO_HIGH);
739                 }
740         }
741
742         return 0;
743         
744 }
745
746
747 static struct rk610_ctl_platform_data rk610_ctl_pdata = {
748         .rk610_power_on_init = rk610_power_on_init,
749 };
750 #endif
751
752 #if defined(CONFIG_MFD_RK616)
753 #define RK616_RST_PIN                   RK30_PIN3_PB2
754
755 #if defined(CONFIG_MACH_RK3188_RK618)
756 #define RK616_PWREN_PIN                 INVALID_GPIO
757 #else
758 #define RK616_PWREN_PIN                 RK30_PIN0_PA3
759 #endif
760 #define RK616_SCL_RATE                  (100*1000)   //i2c scl rate
761 static int rk616_power_on_init(void)
762 {
763         int ret;
764
765         if(RK616_PWREN_PIN != INVALID_GPIO)
766         {
767                 ret = gpio_request(RK616_PWREN_PIN, "rk616 pwren");
768                 if (ret)
769                 {
770                         printk(KERN_ERR "rk616 pwren gpio request fail\n");
771                 }
772                 else 
773                 {
774                         gpio_direction_output(RK616_PWREN_PIN,GPIO_HIGH);
775                 }
776         }
777         
778         if(RK616_RST_PIN != INVALID_GPIO)
779         {
780                 ret = gpio_request(RK616_RST_PIN, "rk616 reset");
781                 if (ret)
782                 {
783                         printk(KERN_ERR "rk616 reset gpio request fail\n");
784                 }
785                 else 
786                 {
787                         gpio_direction_output(RK616_RST_PIN, GPIO_HIGH);
788                         msleep(2);
789                         gpio_direction_output(RK616_RST_PIN, GPIO_LOW);
790                         msleep(10);
791                         gpio_set_value(RK616_RST_PIN, GPIO_HIGH);
792                 }
793         }
794
795         return 0;
796         
797 }
798
799
800 static int rk616_power_deinit(void)
801 {
802         gpio_set_value(RK616_PWREN_PIN,GPIO_LOW);
803         gpio_set_value(RK616_RST_PIN,GPIO_LOW);
804         gpio_free(RK616_PWREN_PIN);
805         gpio_free(RK616_RST_PIN);
806         
807         return 0;
808 }
809
810 static struct rk616_platform_data rk616_pdata = {
811         .power_init = rk616_power_on_init,
812         .power_deinit = rk616_power_deinit,
813         .scl_rate   = RK616_SCL_RATE,
814         .lcd0_func = INPUT,             //port lcd0 as input
815         .lcd1_func = INPUT,             //port lcd1 as input
816         .lvds_ch_nr = 1,                //the number of used lvds channel  
817         .hdmi_irq = RK30_PIN2_PD6,
818         .spk_ctl_gpio = RK30_PIN2_PD7,
819         .hp_ctl_gpio = RK30_PIN2_PD7,
820 };
821 #endif
822
823 #ifdef CONFIG_SND_SOC_RK610
824 static int rk610_codec_io_init(void)
825 {
826 //if need iomux.
827 //Must not gpio_request
828         return 0;
829 }
830
831 static struct rk610_codec_platform_data rk610_codec_pdata = {
832         .spk_ctl_io = RK30_PIN2_PD7,
833         .io_init = rk610_codec_io_init,
834 };
835 #endif
836
837 #ifdef CONFIG_ANDROID_TIMED_GPIO
838 static struct timed_gpio timed_gpios[] = {
839         {
840                 .name = "vibrator",
841                 .gpio = INVALID_GPIO,
842                 .max_timeout = 1000,
843                 .active_low = 0,
844                 .adjust_time =20,      //adjust for diff product
845         },
846 };
847
848 static struct timed_gpio_platform_data rk29_vibrator_info = {
849         .num_gpios = 1,
850         .gpios = timed_gpios,
851 };
852
853 static struct platform_device rk29_device_vibrator = {
854         .name = "timed-gpio",
855         .id = -1,
856         .dev = {
857                 .platform_data = &rk29_vibrator_info,
858         },
859
860 };
861 #endif
862
863 #ifdef CONFIG_LEDS_GPIO_PLATFORM
864 static struct gpio_led rk29_leds[] = {
865         {
866                 .name = "button-backlight",
867                 .gpio = INVALID_GPIO,
868                 .default_trigger = "timer",
869                 .active_low = 0,
870                 .retain_state_suspended = 0,
871                 .default_state = LEDS_GPIO_DEFSTATE_OFF,
872         },
873 };
874
875 static struct gpio_led_platform_data rk29_leds_pdata = {
876         .leds = rk29_leds,
877         .num_leds = ARRAY_SIZE(rk29_leds),
878 };
879
880 static struct platform_device rk29_device_gpio_leds = {
881         .name   = "leds-gpio",
882         .id     = -1,
883         .dev    = {
884                 .platform_data  = &rk29_leds_pdata,
885         },
886 };
887 #endif
888
889 #ifdef CONFIG_RK_IRDA
890 #define IRDA_IRQ_PIN           INVALID_GPIO //RK30_PIN0_PA3
891
892 static int irda_iomux_init(void)
893 {
894         int ret = 0;
895
896         //irda irq pin
897         ret = gpio_request(IRDA_IRQ_PIN, NULL);
898         if (ret != 0) {
899                 gpio_free(IRDA_IRQ_PIN);
900                 printk(">>>>>> IRDA_IRQ_PIN gpio_request err \n ");
901         }
902         gpio_pull_updown(IRDA_IRQ_PIN, PullDisable);
903         gpio_direction_input(IRDA_IRQ_PIN);
904
905         return 0;
906 }
907
908 static int irda_iomux_deinit(void)
909 {
910         gpio_free(IRDA_IRQ_PIN);
911         return 0;
912 }
913
914 static struct irda_info rk29_irda_info = {
915         .intr_pin = IRDA_IRQ_PIN,
916         .iomux_init = irda_iomux_init,
917         .iomux_deinit = irda_iomux_deinit,
918         //.irda_pwr_ctl = bu92747guw_power_ctl,
919 };
920
921 static struct platform_device irda_device = {
922 #ifdef CONFIG_RK_IRDA_NET
923         .name = "rk_irda",
924 #else
925         .name = "bu92747_irda",
926 #endif
927         .id = -1,
928         .dev = {
929                 .platform_data = &rk29_irda_info,
930         }
931 };
932 #endif
933
934 #ifdef CONFIG_ION
935 #define ION_RESERVE_SIZE        (80 * SZ_1M)
936 static struct ion_platform_data rk30_ion_pdata = {
937         .nr = 1,
938         .heaps = {
939                 {
940                         .type = ION_HEAP_TYPE_CARVEOUT,
941                         .id = ION_NOR_HEAP_ID,
942                         .name = "norheap",
943                         .size = ION_RESERVE_SIZE,
944                 }
945         },
946 };
947
948 static struct platform_device device_ion = {
949         .name = "ion-rockchip",
950         .id = 0,
951         .dev = {
952                 .platform_data = &rk30_ion_pdata,
953         },
954 };
955 #endif
956
957 /**************************************************************************************************
958  * SDMMC devices,  include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
959 **************************************************************************************************/
960 #ifdef CONFIG_SDMMC_RK29
961 #include "../mach-rk30/board-rk3168-tb-sdmmc-conifg.c"
962 #include "../plat-rk/rk-sdmmc-ops.c"
963 #include "../plat-rk/rk-sdmmc-wifi.c"
964 #endif //endif ---#ifdef CONFIG_SDMMC_RK29
965
966 #ifdef CONFIG_SDMMC0_RK29
967 static int rk29_sdmmc0_cfg_gpio(void)
968 {
969 #ifdef CONFIG_SDMMC_RK29_OLD
970         iomux_set(MMC0_CMD);
971         iomux_set(MMC0_CLKOUT);
972         iomux_set(MMC0_D0);
973         iomux_set(MMC0_D1);
974         iomux_set(MMC0_D2);
975         iomux_set(MMC0_D3);
976
977         iomux_set_gpio_mode(iomux_mode_to_gpio(MMC0_DETN));
978
979         gpio_request(RK30_PIN3_PA7, "sdmmc-power");
980         gpio_direction_output(RK30_PIN3_PA7, GPIO_LOW);
981
982 #else
983         rk29_sdmmc_set_iomux(0, 0xFFFF);
984
985     #if defined(CONFIG_SDMMC0_RK29_SDCARD_DET_FROM_GPIO)
986         #if SDMMC_USE_NEW_IOMUX_API
987         iomux_set_gpio_mode(iomux_gpio_to_mode(RK29SDK_SD_CARD_DETECT_N));
988         #else
989         rk30_mux_api_set(RK29SDK_SD_CARD_DETECT_PIN_NAME, RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO);
990         #endif
991     #else
992         #if SDMMC_USE_NEW_IOMUX_API       
993         iomux_set(MMC0_DETN);
994         #else
995         rk30_mux_api_set(RK29SDK_SD_CARD_DETECT_PIN_NAME, RK29SDK_SD_CARD_DETECT_IOMUX_FMUX);
996         #endif
997     #endif      
998
999 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
1000         gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
1001         gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
1002 #endif
1003
1004 #endif
1005
1006         return 0;
1007 }
1008
1009 #define CONFIG_SDMMC0_USE_DMA
1010 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
1011         .host_ocr_avail =
1012             (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
1013              MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
1014              MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
1015         .host_caps =
1016             (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
1017         .io_init = rk29_sdmmc0_cfg_gpio,
1018
1019 #if !defined(CONFIG_SDMMC_RK29_OLD)
1020         .set_iomux = rk29_sdmmc_set_iomux,
1021 #endif
1022
1023         .dma_name = "sd_mmc",
1024 #ifdef CONFIG_SDMMC0_USE_DMA
1025         .use_dma = 1,
1026 #else
1027         .use_dma = 0,
1028 #endif
1029
1030 #if defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC) && defined(CONFIG_USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD)
1031     .status = rk29sdk_wifi_mmc0_status,
1032     .register_status_notify = rk29sdk_wifi_mmc0_status_register,
1033 #endif
1034
1035 #if defined(RK29SDK_SD_CARD_PWR_EN) || (INVALID_GPIO != RK29SDK_SD_CARD_PWR_EN)
1036     .power_en = RK29SDK_SD_CARD_PWR_EN,
1037     .power_en_level = RK29SDK_SD_CARD_PWR_EN_LEVEL,
1038 #else
1039     .power_en = INVALID_GPIO,
1040     .power_en_level = GPIO_LOW,
1041 #endif    
1042         .enable_sd_wakeup = 0,
1043
1044 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
1045         .write_prt = SDMMC0_WRITE_PROTECT_PIN,
1046         .write_prt_enalbe_level = SDMMC0_WRITE_PROTECT_ENABLE_VALUE;
1047 #else
1048         .write_prt = INVALID_GPIO,
1049 #endif
1050
1051     .det_pin_info = {    
1052     #if defined(RK29SDK_SD_CARD_DETECT_N) || (INVALID_GPIO != RK29SDK_SD_CARD_DETECT_N)  
1053         .io             = RK29SDK_SD_CARD_DETECT_N, //INVALID_GPIO,
1054         .enable         = RK29SDK_SD_CARD_INSERT_LEVEL,
1055         #ifdef RK29SDK_SD_CARD_DETECT_PIN_NAME
1056         .iomux          = {
1057             .name       = RK29SDK_SD_CARD_DETECT_PIN_NAME,
1058             #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO
1059             .fgpio      = RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO,
1060             #endif
1061             #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FMUX
1062             .fmux       = RK29SDK_SD_CARD_DETECT_IOMUX_FMUX,
1063             #endif
1064         },
1065         #endif
1066     #else
1067         .io             = INVALID_GPIO,
1068         .enable         = GPIO_LOW,
1069     #endif    
1070     }, 
1071
1072 };
1073 #endif // CONFIG_SDMMC0_RK29
1074
1075 #ifdef CONFIG_SDMMC1_RK29
1076 #define CONFIG_SDMMC1_USE_DMA
1077 static int rk29_sdmmc1_cfg_gpio(void)
1078 {
1079 #if defined(CONFIG_SDMMC_RK29_OLD)
1080         iomux_set(MMC1_CMD);
1081         iomux_set(MMC1_CLKOUT);
1082         iomux_set(MMC1_D0);
1083         iomux_set(MMC1_D1);
1084         iomux_set(MMC1_D2);
1085         iomux_set(MMC1_D3);
1086 #else
1087
1088 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
1089         gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp");
1090         gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN);
1091 #endif
1092
1093 #endif
1094
1095         return 0;
1096 }
1097
1098 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
1099         .host_ocr_avail =
1100             (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
1101              MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
1102              MMC_VDD_33_34),
1103
1104 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
1105         .host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |
1106                       MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
1107 #else
1108         .host_caps =
1109             (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
1110 #endif
1111
1112         .io_init = rk29_sdmmc1_cfg_gpio,
1113
1114 #if !defined(CONFIG_SDMMC_RK29_OLD)
1115         .set_iomux = rk29_sdmmc_set_iomux,
1116 #endif
1117
1118         .dma_name = "sdio",
1119 #ifdef CONFIG_SDMMC1_USE_DMA
1120         .use_dma = 1,
1121 #else
1122         .use_dma = 0,
1123 #endif
1124
1125 #if defined(CONFIG_WIFI_CONTROL_FUNC) || defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC)
1126     .status = rk29sdk_wifi_status,
1127     .register_status_notify = rk29sdk_wifi_status_register,
1128 #endif
1129
1130 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
1131         .write_prt = SDMMC1_WRITE_PROTECT_PIN,
1132             .write_prt_enalbe_level = SDMMC1_WRITE_PROTECT_ENABLE_VALUE;
1133 #else
1134         .write_prt = INVALID_GPIO,
1135 #endif
1136
1137     #if defined(CONFIG_RK29_SDIO_IRQ_FROM_GPIO)
1138         .sdio_INT_gpio = RK29SDK_WIFI_SDIO_CARD_INT,
1139     #endif
1140
1141     .det_pin_info = {    
1142 #if defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
1143      #if defined(RK29SDK_SD_CARD_DETECT_N) || (INVALID_GPIO != RK29SDK_SD_CARD_DETECT_N)  
1144         .io             = RK29SDK_SD_CARD_DETECT_N,
1145      #else
1146          .io             = INVALID_GPIO,
1147      #endif   
1148
1149         .enable         = RK29SDK_SD_CARD_INSERT_LEVEL,
1150         #ifdef RK29SDK_SD_CARD_DETECT_PIN_NAME
1151         .iomux          = {
1152             .name       = RK29SDK_SD_CARD_DETECT_PIN_NAME,
1153             #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO
1154             .fgpio      = RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO,
1155             #endif
1156             #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FMUX
1157             .fmux       = RK29SDK_SD_CARD_DETECT_IOMUX_FMUX,
1158             #endif
1159         },
1160         #endif
1161  #else
1162         .io             = INVALID_GPIO,
1163         .enable         = GPIO_LOW,
1164 #endif
1165     },
1166    
1167         .enable_sd_wakeup = 0,
1168 };
1169 #endif //endif--#ifdef CONFIG_SDMMC1_RK29
1170
1171 /**************************************************************************************************
1172  * the end of setting for SDMMC devices
1173 **************************************************************************************************/
1174
1175 #ifdef CONFIG_BATTERY_RK30_ADC
1176 static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
1177         .dc_det_pin      = RK30_PIN0_PB2,
1178         .batt_low_pin    = RK30_PIN0_PB1, 
1179         .charge_set_pin  = INVALID_GPIO,
1180         .charge_ok_pin   = RK30_PIN0_PA6,
1181         .dc_det_level    = GPIO_LOW,
1182         .charge_ok_level = GPIO_HIGH,
1183 };
1184
1185 static struct platform_device rk30_device_adc_battery = {
1186         .name   = "rk30-battery",
1187         .id     = -1,
1188         .dev = {
1189                 .platform_data = &rk30_adc_battery_platdata,
1190         },
1191 };
1192 #endif
1193 #ifdef CONFIG_CW2015_BATTERY
1194 /*
1195    note the follow array must set depend on the battery that you use
1196    you must send the battery to cellwise-semi the contact information:
1197    name: chen gan; tel:13416876079; E-mail: ben.chen@cellwise-semi.com
1198  */
1199 static u8 config_info[SIZE_BATINFO] = {
1200         0x15, 0x42, 0x60, 0x59, 0x52,
1201         0x58, 0x4D, 0x48, 0x48, 0x44,
1202         0x44, 0x46, 0x49, 0x48, 0x32,
1203         0x24, 0x20, 0x17, 0x13, 0x0F,
1204         0x19, 0x3E, 0x51, 0x45, 0x08,
1205         0x76, 0x0B, 0x85, 0x0E, 0x1C,
1206         0x2E, 0x3E, 0x4D, 0x52, 0x52,
1207         0x57, 0x3D, 0x1B, 0x6A, 0x2D,
1208         0x25, 0x43, 0x52, 0x87, 0x8F,
1209         0x91, 0x94, 0x52, 0x82, 0x8C,
1210         0x92, 0x96, 0xFF, 0x7B, 0xBB,
1211         0xCB, 0x2F, 0x7D, 0x72, 0xA5,
1212         0xB5, 0xC1, 0x46, 0xAE
1213 };
1214
1215 static struct cw_bat_platform_data cw_bat_platdata = {
1216         .dc_det_pin      = RK30_PIN0_PB2,
1217         .bat_low_pin    = RK30_PIN0_PB1,
1218         .chg_ok_pin   = RK30_PIN0_PA6,
1219         .dc_det_level    = GPIO_LOW,
1220         .bat_low_level  = GPIO_LOW,   
1221         .chg_ok_level = GPIO_HIGH,
1222
1223         .cw_bat_config_info     = config_info,
1224
1225 };
1226
1227 #endif
1228 #ifdef CONFIG_RK30_PWM_REGULATOR
1229 static int pwm_voltage_map[] = {
1230         800000,825000,850000, 875000,900000, 925000 ,950000, 975000,1000000, 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, 1300000, 1325000, 1350000,1375000
1231 };
1232 static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
1233         {
1234                 .supply = "vdd_cpu",
1235         }
1236 };
1237
1238 struct regulator_init_data pwm_regulator_init_dcdc[1] =
1239 {
1240         {
1241                 .constraints = {
1242                         .name = "PWM_DCDC1",
1243                         .min_uV = 600000,
1244                         .max_uV = 1800000,      //0.6-1.8V
1245                         .apply_uV = true,
1246                         .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1247                 },
1248                 .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
1249                 .consumer_supplies = pwm_dcdc1_consumers,
1250         },
1251 };
1252
1253 static struct pwm_platform_data pwm_regulator_info[1] = {
1254         {
1255                 .pwm_id = 1,
1256                 .pwm_gpio = RK30_PIN3_PD4,
1257                 .pwm_iomux_pwm = PWM1,
1258                 .pwm_iomux_gpio = GPIO3_D4,
1259                 .pwm_voltage = 1100000,
1260                 .suspend_voltage = 1000000,
1261                 .min_uV = 800000,
1262                 .max_uV = 1375000,
1263                 .coefficient = 575,     //57.5%
1264                 .pwm_voltage_map = pwm_voltage_map,
1265                 .init_data      = &pwm_regulator_init_dcdc[0],
1266         },
1267 };
1268
1269 struct platform_device pwm_regulator_device[1] = {
1270         {
1271                 .name = "pwm-voltage-regulator",
1272                 .id = 0,
1273                 .dev            = {
1274                         .platform_data = &pwm_regulator_info[0],
1275                 }
1276         },
1277 };
1278 #endif
1279
1280 #ifdef CONFIG_RK29_VMAC
1281 #define PHY_PWR_EN_GPIO RK30_PIN1_PD6
1282 #include "board-rk30-sdk-vmac.c"
1283 #endif
1284
1285 #ifdef CONFIG_RFKILL_RK
1286 // bluetooth rfkill device, its driver in net/rfkill/rfkill-rk.c
1287 static struct rfkill_rk_platform_data rfkill_rk_platdata = {
1288     .type               = RFKILL_TYPE_BLUETOOTH,
1289
1290     .poweron_gpio       = { // BT_REG_ON
1291         .io             = INVALID_GPIO, //RK30_PIN3_PC7,
1292         .enable         = GPIO_HIGH,
1293         .iomux          = {
1294             .name       = "bt_poweron",
1295             .fgpio      = GPIO3_C7,
1296         },
1297     },
1298
1299     .reset_gpio         = { // BT_RST
1300         .io             = RK30_PIN3_PC7, // set io to INVALID_GPIO for disable it
1301         .enable         = GPIO_LOW,
1302         .iomux          = {
1303             .name       = "bt_reset",
1304             .fgpio      = GPIO3_C7,
1305        },
1306    }, 
1307
1308     .wake_gpio          = { // BT_WAKE, use to control bt's sleep and wakeup
1309         .io             = RK30_PIN3_PC6, // set io to INVALID_GPIO for disable it
1310         .enable         = GPIO_HIGH,
1311         .iomux          = {
1312             .name       = "bt_wake",
1313             .fgpio      = GPIO3_C6,
1314         },
1315     },
1316
1317     .wake_host_irq      = { // BT_HOST_WAKE, for bt wakeup host when it is in deep sleep
1318         .gpio           = {
1319             .io         = RK30_PIN0_PA5, // set io to INVALID_GPIO for disable it
1320             .enable     = GPIO_LOW,      // set GPIO_LOW for falling, set 0 for rising
1321             .iomux      = {
1322                 .name   = NULL,
1323             },
1324         },
1325     },
1326
1327     .rts_gpio           = { // UART_RTS, enable or disable BT's data coming
1328         .io             = RK30_PIN1_PA3, // set io to INVALID_GPIO for disable it
1329         .enable         = GPIO_LOW,
1330         .iomux          = {
1331             .name       = "bt_rts",
1332             .fgpio      = GPIO1_A3,
1333             .fmux       = UART0_RTSN,
1334         },
1335     },
1336 };
1337
1338 static struct platform_device device_rfkill_rk = {
1339     .name   = "rfkill_rk",
1340     .id     = -1,
1341     .dev    = {
1342         .platform_data = &rfkill_rk_platdata,
1343     },
1344 };
1345 #endif
1346
1347 #if defined(CONFIG_GPS_RK)
1348 int rk_gps_io_init(void)
1349 {
1350         printk("%s \n", __FUNCTION__);
1351         
1352         gpio_request(RK30_PIN1_PB5, NULL);
1353         gpio_direction_output(RK30_PIN1_PB5, GPIO_LOW);
1354
1355         iomux_set(GPS_RFCLK);//GPS_CLK
1356         iomux_set(GPS_MAG);//GPS_MAG
1357         iomux_set(GPS_SIG);//GPS_SIGN
1358
1359         gpio_request(RK30_PIN1_PA6, NULL);
1360         gpio_direction_output(RK30_PIN1_PA6, GPIO_LOW);
1361
1362         gpio_request(RK30_PIN1_PA5, NULL);
1363         gpio_direction_output(RK30_PIN1_PA5, GPIO_LOW); 
1364
1365         gpio_request(RK30_PIN1_PA7, NULL);
1366         gpio_direction_output(RK30_PIN1_PA7, GPIO_LOW);         
1367         return 0;
1368 }
1369 int rk_gps_power_up(void)
1370 {
1371         printk("%s \n", __FUNCTION__);
1372
1373         return 0;
1374 }
1375
1376 int rk_gps_power_down(void)
1377 {
1378         printk("%s \n", __FUNCTION__);
1379
1380         return 0;
1381 }
1382
1383 int rk_gps_reset_set(int level)
1384 {
1385         return 0;
1386 }
1387 int rk_enable_hclk_gps(void)
1388 {
1389         struct clk *gps_aclk = NULL;
1390         gps_aclk = clk_get(NULL, "aclk_gps");
1391         if(gps_aclk) {
1392                 clk_enable(gps_aclk);
1393                 clk_put(gps_aclk);
1394                 printk("%s \n", __FUNCTION__);
1395         }
1396         else
1397                 printk("get gps aclk fail\n");
1398         return 0;
1399 }
1400 int rk_disable_hclk_gps(void)
1401 {
1402         struct clk *gps_aclk = NULL;
1403         gps_aclk = clk_get(NULL, "aclk_gps");
1404         if(gps_aclk) {
1405                 //TO wait long enough until GPS ISR is finished.
1406                 msleep(5);
1407                 clk_disable(gps_aclk);
1408                 clk_put(gps_aclk);
1409                 printk("%s \n", __FUNCTION__);
1410         }       
1411         else
1412                 printk("get gps aclk fail\n");
1413         return 0;
1414 }
1415 struct rk_gps_data rk_gps_info = {
1416         .io_init = rk_gps_io_init,
1417         .power_up = rk_gps_power_up,
1418         .power_down = rk_gps_power_down,
1419         .reset = rk_gps_reset_set,
1420         .enable_hclk_gps = rk_enable_hclk_gps,
1421         .disable_hclk_gps = rk_disable_hclk_gps,
1422         .GpsSign = RK30_PIN1_PB3,
1423         .GpsMag = RK30_PIN1_PB2,        //GPIO index
1424         .GpsClk = RK30_PIN1_PB4,        //GPIO index
1425         .GpsVCCEn = RK30_PIN1_PB5,     //GPIO index
1426         .GpsSpi_CSO = RK30_PIN1_PA4,    //GPIO index
1427         .GpsSpiClk = RK30_PIN1_PA5,     //GPIO index
1428         .GpsSpiMOSI = RK30_PIN1_PA7,      //GPIO index
1429         .GpsIrq = IRQ_GPS,
1430         .GpsSpiEn = 0,
1431         .GpsAdcCh = 2,
1432         .u32GpsPhyAddr = RK30_GPS_PHYS,
1433         .u32GpsPhySize = RK30_GPS_SIZE,
1434 };
1435
1436 struct platform_device rk_device_gps = {
1437         .name = "gps_hv5820b",
1438         .id = -1,
1439         .dev            = {
1440         .platform_data = &rk_gps_info,
1441                 }
1442         };
1443 #endif
1444
1445 #if defined(CONFIG_MT5931_MT6622)
1446 static struct mt6622_platform_data mt6622_platdata = {
1447                     .power_gpio         = { // BT_REG_ON
1448                         .io             = RK30_PIN3_PD5, // set io to INVALID_GPIO for disable it
1449                             .enable         = GPIO_HIGH,
1450                             .iomux          = {
1451                                     .name       = NULL,
1452                                 },
1453                     },
1454
1455                     .reset_gpio         = { // BT_RST
1456                         .io             = RK30_PIN0_PD7,
1457                         .enable         = GPIO_HIGH,
1458                         .iomux          = {
1459                             .name       = NULL,
1460                         },
1461                     },
1462
1463                     .irq_gpio           = {
1464                             .io             = RK30_PIN3_PD2,
1465                             .enable         = GPIO_HIGH,
1466                             .iomux          = {
1467                                     .name       = NULL,
1468                                 },
1469                     }
1470 };
1471
1472 static struct platform_device device_mt6622 = {
1473                     .name   = "mt6622",
1474                         .id     = -1,
1475                         .dev    = {
1476                                .platform_data = &mt6622_platdata,
1477                         },
1478 };      
1479 #endif
1480
1481 static struct platform_device *devices[] __initdata = {
1482 #ifdef CONFIG_ION
1483         &device_ion,
1484 #endif
1485 #ifdef CONFIG_ANDROID_TIMED_GPIO
1486         &rk29_device_vibrator,
1487 #endif
1488 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1489         &rk29_device_gpio_leds,
1490 #endif
1491 #ifdef CONFIG_RK_IRDA
1492         &irda_device,
1493 #endif
1494 #if defined(CONFIG_WIFI_CONTROL_FUNC)||defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC)
1495         &rk29sdk_wifi_device,
1496 #endif
1497
1498 #if defined(CONFIG_MT6620)
1499     &mt3326_device_gps,
1500 #endif   
1501
1502 #ifdef CONFIG_RK29_SUPPORT_MODEM
1503         &rk30_device_modem,
1504 #endif
1505 #if defined(CONFIG_MU509)
1506         &rk29_device_mu509,
1507 #endif
1508 #if defined(CONFIG_MW100)
1509         &rk29_device_mw100,
1510 #endif
1511 #if defined(CONFIG_MT6229)
1512         &rk29_device_mt6229,
1513 #endif
1514 #ifdef CONFIG_BATTERY_RK30_ADC
1515         &rk30_device_adc_battery,
1516 #endif
1517 #ifdef CONFIG_RFKILL_RK
1518         &device_rfkill_rk,
1519 #endif
1520 #ifdef CONFIG_GPS_RK
1521         &rk_device_gps,
1522 #endif
1523 #if defined(CONFIG_ARCH_RK3188)
1524         &device_mali,
1525 #endif
1526 #ifdef CONFIG_MT5931_MT6622
1527         &device_mt6622,
1528 #endif
1529 };
1530
1531 static int rk_platform_add_display_devices(void)
1532 {
1533         struct platform_device *fb = NULL;  //fb
1534         struct platform_device *lcdc0 = NULL; //lcdc0
1535         struct platform_device *lcdc1 = NULL; //lcdc1
1536         struct platform_device *bl = NULL; //backlight
1537 #ifdef CONFIG_FB_ROCKCHIP
1538         fb = &device_fb;
1539 #endif
1540
1541 #if defined(CONFIG_LCDC0_RK3066B) || defined(CONFIG_LCDC0_RK3188)
1542         lcdc0 = &device_lcdc0,
1543 #endif
1544
1545 #if defined(CONFIG_LCDC1_RK3066B) || defined(CONFIG_LCDC1_RK3188)
1546         lcdc1 = &device_lcdc1,
1547 #endif
1548
1549 #ifdef CONFIG_BACKLIGHT_RK29_BL
1550         bl = &rk29_device_backlight,
1551 #endif
1552         __rk_platform_add_display_devices(fb,lcdc0,lcdc1,bl);
1553
1554         return 0;
1555         
1556 }
1557
1558 // i2c
1559 #ifdef CONFIG_I2C0_RK30
1560 static struct i2c_board_info __initdata i2c0_info[] = {
1561 #if defined (CONFIG_GS_MMA8452)
1562         {
1563                 .type           = "gs_mma8452",
1564                 .addr           = 0x1d,
1565                 .flags          = 0,
1566                 .irq            = MMA8452_INT_PIN,
1567                 .platform_data = &mma8452_info,
1568         },
1569 #endif
1570 #if defined (CONFIG_GS_LIS3DH)
1571         {
1572                 .type           = "gs_lis3dh",
1573                 .addr           = 0x19,   //0x19(SA0-->VCC), 0x18(SA0-->GND)
1574                 .flags          = 0,
1575                 .irq            = LIS3DH_INT_PIN,
1576                 .platform_data = &lis3dh_info,
1577         },
1578 #endif
1579 #if defined (CONFIG_COMPASS_AK8975)
1580         {
1581                 .type          = "ak8975",
1582                 .addr          = 0x0d,
1583                 .flags         = 0,
1584                 .irq           = RK30_PIN3_PD7, 
1585                 .platform_data = &akm8975_info,
1586         },
1587 #endif
1588 #if defined (CONFIG_GYRO_L3G4200D)
1589         {
1590                 .type          = "l3g4200d_gryo",
1591                 .addr          = 0x69,
1592                 .flags         = 0,
1593                 .irq           = L3G4200D_INT_PIN,
1594                 .platform_data = &l3g4200d_info,
1595         },
1596 #endif
1597 #if defined (CONFIG_SND_SOC_RK1000)
1598         {
1599                 .type          = "rk1000_i2c_codec",
1600                 .addr          = 0x60,
1601                 .flags         = 0,
1602         },
1603         {
1604                 .type          = "rk1000_control",
1605                 .addr          = 0x40,
1606                 .flags         = 0,
1607         },
1608 #endif
1609 #if defined (CONFIG_SND_SOC_RT5631)
1610         {
1611                 .type                   = "rt5631",
1612                 .addr                   = 0x1a,
1613                 .flags                  = 0,
1614         },
1615 #endif
1616
1617 #if defined (CONFIG_SND_SOC_RT5640) 
1618             {
1619                         .type                   = "rt5640",
1620                         .addr                   = 0x1c,
1621                         .flags                  = 0,
1622                 },
1623 #endif
1624
1625 #ifdef CONFIG_MFD_RK610
1626                 {
1627                         .type                   = "rk610_ctl",
1628                         .addr                   = 0x40,
1629                         .flags                  = 0,
1630                         .platform_data          = &rk610_ctl_pdata,
1631                 },
1632 #ifdef CONFIG_RK610_TVOUT
1633                 {
1634                         .type                   = "rk610_tvout",
1635                         .addr                   = 0x42,
1636                         .flags                  = 0,
1637                 },
1638 #endif
1639 #ifdef CONFIG_HDMI_RK610
1640                 {
1641                         .type                   = "rk610_hdmi",
1642                         .addr                   = 0x46,
1643                         .flags                  = 0,
1644                         .irq                    = INVALID_GPIO,
1645                 },
1646 #endif
1647 #ifdef CONFIG_SND_SOC_RK610
1648                 {//RK610_CODEC addr  from 0x60 to 0x80 (0x60~0x80)
1649                         .type                   = "rk610_i2c_codec",
1650                         .addr                   = 0x60,
1651                         .flags                  = 0,
1652                         .platform_data          = &rk610_codec_pdata,                                   
1653                 },
1654 #endif
1655 #endif
1656
1657 };
1658 #endif
1659
1660 int __sramdata g_pmic_type =  0;
1661 #ifdef CONFIG_I2C1_RK30
1662 #ifdef CONFIG_MFD_WM831X_I2C
1663 #define PMU_POWER_SLEEP                 RK30_PIN0_PA1 
1664
1665 static struct pmu_info  wm8326_dcdc_info[] = {
1666         {
1667                 .name          = "vdd_core",   //logic
1668                 .min_uv          = 1000000,
1669                 .max_uv         = 1000000,
1670                 .suspend_vol  =  950000,
1671         },
1672         {
1673                 .name          = "vdd_cpu",    //arm
1674                 .min_uv          = 1000000,
1675                 .max_uv         = 1000000,
1676                 .suspend_vol  =  950000,
1677         },
1678         {
1679                 .name          = "dcdc3",   //ddr
1680                 .min_uv          = 1150000,
1681                 .max_uv         = 1150000,
1682                 .suspend_vol  =  1150000,
1683         },
1684         #ifdef CONFIG_MACH_RK3066_SDK
1685         {
1686                 .name          = "dcdc4",   //vcc_io
1687                 .min_uv          = 3300000,
1688                 .max_uv         = 3300000,
1689                 .suspend_vol  =  3000000,
1690         },
1691         #else
1692         {
1693                 .name          = "dcdc4",   //vcc_io
1694                 .min_uv          = 3000000,
1695                 .max_uv         = 3000000,
1696                 .suspend_vol  =  2800000,
1697         },
1698         #endif
1699 };
1700
1701 static struct pmu_info  wm8326_ldo_info[] = {
1702         {
1703                 .name          = "ldo1",   //vcc18_cif
1704                 .min_uv          = 1800000,
1705                 .max_uv         = 1800000,
1706                 .suspend_vol  =  1800000,
1707         },
1708         {
1709                 .name          = "ldo2",    //vccio_wl
1710                 .min_uv          = 1800000,
1711                 .max_uv         = 1800000,
1712                 .suspend_vol  =  1800000,
1713         },
1714         {
1715                 .name          = "ldo3",   //
1716                 .min_uv          = 1100000,
1717                 .max_uv         = 1100000,
1718                 .suspend_vol  =  1100000,
1719         },
1720         {
1721                 .name          = "ldo4",   //vdd11
1722                 .min_uv          = 1000000,
1723                 .max_uv         = 1000000,
1724                 .suspend_vol  =  1000000,
1725         },
1726         {
1727                 .name          = "ldo5",   //vcc25
1728                 .min_uv          = 1800000,
1729                 .max_uv         = 1800000,
1730                 .suspend_vol  =  1800000,
1731         },
1732         {
1733                 .name          = "ldo6",   //vcc33
1734                 .min_uv          = 3300000,
1735                 .max_uv         = 3300000,
1736                 .suspend_vol  =  3300000,
1737         },
1738         {
1739                 .name          = "ldo7",   //vcc28_cif
1740                 .min_uv          = 2800000,
1741                 .max_uv         = 2800000,
1742                 .suspend_vol  =  2800000,
1743         },
1744         {
1745                 .name          = "ldo8",   //vcca33
1746                 .min_uv          = 3300000,
1747                 .max_uv         = 3300000,
1748                 .suspend_vol  =  3300000,
1749         },
1750         {
1751                 .name          = "ldo9",   //vcc_tp
1752                 .min_uv          = 3300000,
1753                 .max_uv         = 3300000,
1754                 .suspend_vol  =  3300000,
1755         },
1756         {
1757                 .name          = "ldo10",   //flash_io
1758                 .min_uv          = 1800000,
1759                 .max_uv         = 1800000,
1760                 .suspend_vol  =  1800000,
1761         },
1762 };
1763
1764 #include "../mach-rk30/board-pmu-wm8326.c"
1765 #endif
1766
1767 #ifdef CONFIG_MFD_TPS65910
1768 #define TPS65910_HOST_IRQ        RK30_PIN0_PB3
1769
1770 #define PMU_POWER_SLEEP RK30_PIN0_PA1
1771
1772 static struct pmu_info  tps65910_dcdc_info[] = {
1773         {
1774                 .name          = "vdd_core",   //logic
1775                 .min_uv          = 1100000,
1776                 .max_uv         = 1100000,
1777         },
1778         {
1779                 .name          = "vdd2",    //ddr
1780                 .min_uv          = 1200000,
1781                 .max_uv         = 1200000,
1782         },
1783         {
1784                 .name          = "vio",   //vcc_io
1785                 .min_uv          = 2500000,
1786                 .max_uv         = 2500000,
1787         },
1788         
1789 };
1790 static  struct pmu_info  tps65910_ldo_info[] = {
1791         {
1792                 .name          = "vpll",   //vdd10
1793                 .min_uv          = 1000000,
1794                 .max_uv         = 1000000,
1795         },
1796         {
1797                 .name          = "vdig1",    //vcc18_cif
1798                 .min_uv          = 1800000,
1799                 .max_uv         = 1800000,
1800         },
1801         {
1802                 .name          = "vdig2",   //vdd_jetta
1803                 .min_uv          = 1200000,
1804                 .max_uv         = 1200000,
1805         },
1806         {
1807                 .name          = "vaux1",   //vcc28_cif
1808                 .min_uv          = 2800000,
1809                 .max_uv         = 2800000,
1810         },
1811         {
1812                 .name          = "vaux2",   //vcca33
1813                 .min_uv          = 3300000,
1814                 .max_uv         = 3300000,
1815         },
1816         {
1817                 .name          = "vaux33",   //vcc_tp
1818                 .min_uv          = 3300000,
1819                 .max_uv         = 3300000,
1820         },
1821         {
1822                 .name          = "vmmc",   //vcc30
1823                 .min_uv          = 3000000,
1824                 .max_uv         = 3000000,
1825         },
1826         {
1827                 .name          = "vdac",   //vcc18
1828                 .min_uv          = 1800000,
1829                 .max_uv         = 1800000,
1830         },
1831  };
1832
1833 #include "../mach-rk30/board-pmu-tps65910.c"
1834 #endif
1835
1836 #ifdef CONFIG_REGULATOR_ACT8846
1837 #define PMU_POWER_SLEEP RK30_PIN0_PA1
1838 #define PMU_VSEL RK30_PIN3_PD3
1839 static struct pmu_info  act8846_dcdc_info[] = {
1840         {
1841                 .name          = "act_dcdc1",   //ddr
1842                 .min_uv          = 1200000,
1843                 .max_uv         = 1200000,
1844                 .suspend_vol  =  1200000,
1845         },
1846         {
1847                 .name          = "vdd_core",    //logic
1848                 .min_uv          = 1000000,
1849                 .max_uv         = 1000000,
1850                 #ifdef CONFIG_ACT8846_SUPPORT_RESET
1851                 .suspend_vol  =  1200000,
1852                 #else
1853                 .suspend_vol  =  900000,
1854                 #endif
1855
1856         },
1857         {
1858                 .name          = "vdd_cpu",   //arm
1859                 .min_uv          = 1000000,
1860                 .max_uv         = 1000000,
1861                 #ifdef CONFIG_ACT8846_SUPPORT_RESET
1862                 .suspend_vol  =  1200000,
1863                 #else
1864                 .suspend_vol  =  900000,
1865                 #endif
1866
1867         },
1868         {
1869                 .name          = "act_dcdc4",   //vccio
1870                 .min_uv          = 3000000,
1871                 .max_uv         = 3000000,
1872                 #ifdef CONFIG_ACT8846_SUPPORT_RESET
1873                 .suspend_vol  =  3000000,
1874                 #else
1875                 .suspend_vol  =  2800000,
1876                 #endif
1877
1878         },
1879         
1880 };
1881 static  struct pmu_info  act8846_ldo_info[] = {
1882         {
1883                 .name          = "act_ldo1",   //vdd11
1884                 .min_uv          = 1000000,
1885                 .max_uv         = 1000000,
1886         },
1887         {
1888                 .name          = "act_ldo2",    //vdd12
1889                 .min_uv          = 1200000,
1890                 .max_uv         = 1200000,
1891         },
1892         {
1893                 .name          = "act_ldo3",   //vcc18_cif
1894                 .min_uv          = 1800000,
1895                 .max_uv         = 1800000,
1896         },
1897         {
1898                 .name          = "act_ldo4",   //vcca33
1899                 .min_uv          = 3300000,
1900                 .max_uv         = 3300000,
1901         },
1902         {
1903                 .name          = "act_ldo5",   //vcctp
1904                 .min_uv          = 3300000,
1905                 .max_uv         = 3300000,
1906         },
1907         {
1908                 .name          = "act_ldo6",   //vcc33
1909                 .min_uv          = 3300000,
1910                 .max_uv         = 3300000,
1911         },
1912         {
1913                 .name          = "act_ldo7",   //vccio_wl
1914                 .min_uv          = 1800000,
1915                 .max_uv         = 1800000,
1916         },
1917         {
1918                 .name          = "act_ldo8",   //vcc28_cif
1919                 .min_uv          = 2800000,
1920                 .max_uv         = 2800000,
1921         },
1922  };
1923
1924 #include "../mach-rk30/board-pmu-act8846.c"
1925 #endif
1926
1927 #ifdef CONFIG_MFD_RK808
1928 #define PMU_POWER_SLEEP RK30_PIN0_PA1
1929 #define RK808_HOST_IRQ        RK30_PIN0_PB3
1930
1931 static struct pmu_info  rk808_dcdc_info[] = {
1932         {
1933                 .name          = "vdd_cpu",   //arm
1934                 .min_uv          = 1000000,
1935                 .max_uv         = 1000000,
1936                 .suspend_vol  =  900000,
1937         },
1938         {
1939                 .name          = "vdd_core",    //logic
1940                 .min_uv          = 1000000,
1941                 .max_uv         = 1000000,
1942                 .suspend_vol  =  900000,
1943         },
1944         {
1945                 .name          = "rk_dcdc3",   //ddr
1946                 .min_uv          = 1200000,
1947                 .max_uv         = 1200000,
1948                 .suspend_vol  =  1200000,
1949         },
1950         {
1951                 .name          = "rk_dcdc4",   //vccio
1952                 .min_uv          = 3300000,
1953                 .max_uv         = 3300000,
1954                 .suspend_vol  =  3000000,
1955         },
1956         
1957 };
1958 static  struct pmu_info  rk808_ldo_info[] = {
1959         {
1960                 .name          = "rk_ldo1",   //vcc33
1961                 .min_uv          = 3300000,
1962                 .max_uv         = 3300000,
1963                 .suspend_vol   = 3300000,
1964         },
1965         {
1966                 .name          = "rk_ldo2",    //vcctp
1967                 .min_uv          = 3300000,
1968                 .max_uv         = 3300000,
1969                  .suspend_vol   = 3300000,
1970
1971         },
1972         {
1973                 .name          = "rk_ldo3",   //vdd10
1974                 .min_uv          = 1000000,
1975                 .max_uv         = 1000000,
1976                  .suspend_vol   = 1000000,
1977         },
1978         {
1979                 .name          = "rk_ldo4",   //vcc18
1980                 .min_uv          = 1800000,
1981                 .max_uv         = 1800000,
1982                  .suspend_vol   = 1800000,
1983         },
1984         {
1985                 .name          = "rk_ldo5",   //vcc28_cif
1986                 .min_uv          = 2800000,
1987                 .max_uv         = 2800000,
1988                  .suspend_vol   = 2800000,
1989         },
1990         {
1991                 .name          = "rk_ldo6",   //vdd12
1992                 .min_uv          = 1200000,
1993                 .max_uv         = 1200000,
1994                  .suspend_vol   = 1200000,
1995         },
1996         {
1997                 .name          = "rk_ldo7",   //vcc18_cif
1998                 .min_uv          = 1800000,
1999                 .max_uv         = 1800000,
2000                  .suspend_vol   = 1800000,
2001         },
2002         {
2003                 .name          = "rk_ldo8",   //vcca_33
2004                 .min_uv          = 3300000,
2005                 .max_uv         = 3300000,
2006                  .suspend_vol   = 3300000,
2007         },
2008  };
2009
2010 #include "board-pmu-rk808.c"
2011 #endif
2012
2013
2014 static struct i2c_board_info __initdata i2c1_info[] = {
2015 #if defined (CONFIG_MFD_WM831X_I2C)
2016         {
2017                 .type          = "wm8326",
2018                 .addr          = 0x34,
2019                 .flags         = 0,
2020                 .irq           = RK30_PIN0_PB3,
2021                 .platform_data = &wm831x_platdata,
2022         },
2023 #endif
2024 #if defined (CONFIG_MFD_TPS65910)
2025         {
2026         .type           = "tps65910",
2027         .addr           = TPS65910_I2C_ID0,
2028         .flags          = 0,
2029         .irq            = TPS65910_HOST_IRQ,
2030         .platform_data = &tps65910_data,
2031         },
2032 #endif
2033
2034 #if defined (CONFIG_REGULATOR_ACT8846)
2035         {
2036                 .type                   = "act8846",
2037                 .addr           = 0x5a, 
2038                 .flags                  = 0,
2039         //      .irq            = ACT8846_HOST_IRQ,
2040                 .platform_data=&act8846_data,
2041         },
2042 #endif
2043 #if defined (CONFIG_MFD_RK808)
2044         {
2045                 .type                   = "rk808",
2046                 .addr           = 0x1b, 
2047                 .flags                  = 0,
2048         //      .irq            = ACT8846_HOST_IRQ,
2049                 .platform_data=&rk808_data,
2050         },
2051 #endif
2052
2053 #if defined (CONFIG_RTC_HYM8563)
2054         {
2055                 .type                   = "rtc_hym8563",
2056                 .addr           = 0x51,
2057                 .flags                  = 0,
2058                 .irq            = RK30_PIN1_PA4,
2059         },
2060 #if defined (CONFIG_CW2015_BATTERY)
2061         {
2062                 .type           = "cw201x",
2063                 .addr           = 0x62,
2064                 .flags          = 0,
2065                 .platform_data  = &cw_bat_platdata,
2066         },
2067 #endif
2068 #endif
2069
2070 };
2071 #endif
2072
2073 void __sramfunc board_pmu_suspend(void)
2074 {      
2075         #if defined (CONFIG_MFD_WM831X_I2C)
2076        if(pmic_is_wm8326())
2077        board_pmu_wm8326_suspend();
2078         #endif
2079         #if defined (CONFIG_MFD_TPS65910)
2080        if(pmic_is_tps65910())
2081        board_pmu_tps65910_suspend(); 
2082     #endif   
2083         #if defined (CONFIG_REGULATOR_ACT8846)
2084        if(pmic_is_act8846())
2085        board_pmu_act8846_suspend(); 
2086        #endif   
2087         #if defined (CONFIG_MFD_RK808)
2088        if(pmic_is_rk808())
2089        board_pmu_rk808_suspend();
2090        #endif
2091
2092 }
2093
2094 void __sramfunc board_pmu_resume(void)
2095 {      
2096         #if defined (CONFIG_MFD_WM831X_I2C)
2097        if(pmic_is_wm8326())
2098        board_pmu_wm8326_resume();
2099         #endif
2100         #if defined (CONFIG_MFD_TPS65910)
2101        if(pmic_is_tps65910())
2102        board_pmu_tps65910_resume(); 
2103         #endif
2104         #if defined (CONFIG_REGULATOR_ACT8846)
2105        if(pmic_is_act8846())
2106        board_pmu_act8846_resume(); 
2107        #endif 
2108          #if defined (CONFIG_MFD_RK808)
2109        if(pmic_is_rk808())
2110        board_pmu_rk808_resume();
2111        #endif
2112   
2113 }
2114
2115  int __sramdata gpio3d6_iomux,gpio3d6_do,gpio3d6_dir,gpio3d6_en;
2116
2117 #define grf_readl(offset)       readl_relaxed(RK30_GRF_BASE + offset)
2118 #define grf_writel(v, offset)   do { writel_relaxed(v, RK30_GRF_BASE + offset); dsb(); } while (0)
2119  
2120 void __sramfunc rk30_pwm_logic_suspend_voltage(void)
2121 {
2122 #ifdef CONFIG_RK30_PWM_REGULATOR
2123
2124 //      int gpio0d7_iomux,gpio0d7_do,gpio0d7_dir,gpio0d7_en;
2125         sram_udelay(10000);
2126         gpio3d6_iomux = grf_readl(GRF_GPIO3D_IOMUX);
2127         gpio3d6_do = grf_readl(GRF_GPIO3H_DO);
2128         gpio3d6_dir = grf_readl(GRF_GPIO3H_DIR);
2129         gpio3d6_en = grf_readl(GRF_GPIO3H_EN);
2130
2131         grf_writel((1<<28), GRF_GPIO3D_IOMUX);
2132         grf_writel((1<<30)|(1<<14), GRF_GPIO3H_DIR);
2133         grf_writel((1<<30)|(1<<14), GRF_GPIO3H_DO);
2134         grf_writel((1<<30)|(1<<14), GRF_GPIO3H_EN);
2135 #endif 
2136 }
2137 void __sramfunc rk30_pwm_logic_resume_voltage(void)
2138 {
2139 #ifdef CONFIG_RK30_PWM_REGULATOR
2140         grf_writel((1<<28)|gpio3d6_iomux, GRF_GPIO3D_IOMUX);
2141         grf_writel((1<<30)|gpio3d6_en, GRF_GPIO3H_EN);
2142         grf_writel((1<<30)|gpio3d6_dir, GRF_GPIO3H_DIR);
2143         grf_writel((1<<30)|gpio3d6_do, GRF_GPIO3H_DO);
2144         sram_udelay(10000);
2145
2146 #endif
2147
2148 }
2149 extern void pwm_suspend_voltage(void);
2150 extern void pwm_resume_voltage(void);
2151 void  rk30_pwm_suspend_voltage_set(void)
2152 {
2153 #ifdef CONFIG_RK30_PWM_REGULATOR
2154         pwm_suspend_voltage();
2155 #endif
2156 }
2157 void  rk30_pwm_resume_voltage_set(void)
2158 {
2159 #ifdef CONFIG_RK30_PWM_REGULATOR
2160         pwm_resume_voltage();
2161 #endif
2162 }
2163
2164
2165 #ifdef CONFIG_I2C2_RK30
2166 static struct i2c_board_info __initdata i2c2_info[] = {
2167 #if defined (CONFIG_TOUCHSCREEN_GT8XX)
2168         {
2169                 .type          = "Goodix-TS",
2170                 .addr          = 0x55,
2171                 .flags         = 0,
2172                 .irq           = RK30_PIN1_PB7,
2173                 .platform_data = &goodix_info,
2174         },
2175 #endif
2176 #if defined (CONFIG_LS_CM3217)
2177         {
2178                 .type          = "lightsensor",
2179                 .addr          = 0x10,
2180                 .flags         = 0,
2181                 .platform_data = &cm3217_info,
2182         },
2183 #endif
2184 };
2185 #endif
2186
2187 #ifdef CONFIG_I2C3_RK30
2188 static struct i2c_board_info __initdata i2c3_info[] = {
2189 };
2190 #endif
2191
2192 #ifdef CONFIG_I2C4_RK30
2193 static struct i2c_board_info __initdata i2c4_info[] = {
2194 #if defined (CONFIG_MFD_RK616)
2195                 {
2196                         .type          = "rk616",
2197                         .addr          = 0x50,
2198                         .flags         = 0,
2199                         .platform_data = &rk616_pdata,
2200                 },
2201 #endif
2202
2203 };
2204 #endif
2205
2206 #ifdef CONFIG_I2C_GPIO_RK30
2207 #define I2C_SDA_PIN     INVALID_GPIO// RK30_PIN2_PD6   //set sda_pin here
2208 #define I2C_SCL_PIN     INVALID_GPIO//RK30_PIN2_PD7   //set scl_pin here
2209 static int rk30_i2c_io_init(void)
2210 {
2211         //set iomux (gpio) here
2212         //rk30_mux_api_set(GPIO2D7_I2C1SCL_NAME, GPIO2D_GPIO2D7);
2213         //rk30_mux_api_set(GPIO2D6_I2C1SDA_NAME, GPIO2D_GPIO2D6);
2214
2215         return 0;
2216 }
2217 struct i2c_gpio_platform_data default_i2c_gpio_data = {
2218        .sda_pin = I2C_SDA_PIN,
2219        .scl_pin = I2C_SCL_PIN,
2220        .udelay = 5, // clk = 500/udelay = 100Khz
2221        .timeout = 100,//msecs_to_jiffies(100),
2222        .bus_num    = 5,
2223        .io_init = rk30_i2c_io_init,
2224 };
2225 static struct i2c_board_info __initdata i2c_gpio_info[] = {
2226 };
2227 #endif
2228
2229 static void __init rk30_i2c_register_board_info(void)
2230 {
2231 #ifdef CONFIG_I2C0_RK30
2232         i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
2233 #endif
2234 #ifdef CONFIG_I2C1_RK30
2235         i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
2236 #endif
2237 #ifdef CONFIG_I2C2_RK30
2238         i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
2239 #endif
2240 #ifdef CONFIG_I2C3_RK30
2241         i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
2242 #endif
2243 #ifdef CONFIG_I2C4_RK30
2244         i2c_register_board_info(4, i2c4_info, ARRAY_SIZE(i2c4_info));
2245 #endif
2246 #ifdef CONFIG_I2C_GPIO_RK30
2247         i2c_register_board_info(5, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
2248 #endif
2249 }
2250 //end of i2c
2251
2252 // ========== Begin of rk3168 top board keypad defination ============
2253
2254 #include <plat/key.h>
2255
2256
2257 #if defined(CONFIG_MACH_RK3188_RK618)
2258 static struct rk29_keys_button key_button[] = {
2259         {
2260                 .desc   = "play",
2261                 .code   = KEY_POWER,
2262                 .gpio   = RK30_PIN0_PA4,
2263                 .active_low = PRESS_LEV_LOW,
2264                 .wakeup = 1,
2265         },
2266         {
2267                 .desc   = "vol+",
2268                 .code   = KEY_VOLUMEUP,
2269                 .adc_value      = 1,
2270                 .gpio = INVALID_GPIO,
2271                 .active_low = PRESS_LEV_LOW,
2272         },
2273         {
2274                 .desc   = "vol-",
2275                 .code   = KEY_VOLUMEDOWN,
2276                 .adc_value      = 133,
2277                 .gpio = INVALID_GPIO,
2278                 .active_low = PRESS_LEV_LOW,
2279         },
2280         {
2281                 .desc   = "esc",
2282                 .code   = KEY_BACK,
2283                 .adc_value      = 550,
2284                 .gpio = INVALID_GPIO,
2285                 .active_low = PRESS_LEV_LOW,
2286         },
2287         {
2288                 .desc   = "menu",
2289                 .code   = EV_MENU,
2290                 .adc_value      = 354,
2291                 .gpio = INVALID_GPIO,
2292                 .active_low = PRESS_LEV_LOW,
2293         },
2294         {
2295                 .desc   = "home",
2296                 .code   = KEY_HOME,
2297                 .adc_value      = 742,
2298                 .gpio = INVALID_GPIO,
2299                 .active_low = PRESS_LEV_LOW,
2300         },
2301 };
2302
2303 #else
2304 static struct rk29_keys_button key_button[] = {
2305         {
2306                 .desc   = "vol-",
2307                 .code   = KEY_VOLUMEDOWN,
2308                 .adc_value      = 900,
2309                 .gpio   = INVALID_GPIO,
2310                 .active_low = PRESS_LEV_LOW,
2311         },
2312         {
2313                 .desc   = "play",
2314                 .code   = KEY_POWER,
2315                 .gpio   = RK30_PIN0_PA4,
2316                 .active_low = PRESS_LEV_LOW,
2317                 .wakeup = 1,
2318         },
2319         {
2320                 .desc   = "vol+",
2321                 .code   = KEY_VOLUMEUP,
2322                 .adc_value      = 1,
2323                 .gpio = INVALID_GPIO,
2324                 .active_low = PRESS_LEV_LOW,
2325         },
2326         {
2327                 .desc   = "menu",
2328                 .code   = EV_MENU,
2329                 .adc_value      = 133,
2330                 .gpio = INVALID_GPIO,
2331                 .active_low = PRESS_LEV_LOW,
2332         },
2333         {
2334                 .desc   = "home",
2335                 .code   = KEY_HOME,
2336                 .adc_value      = 550,
2337                 .gpio = INVALID_GPIO,
2338                 .active_low = PRESS_LEV_LOW,
2339         },
2340         {
2341                 .desc   = "esc",
2342                 .code   = KEY_BACK,
2343                 .adc_value      = 333,
2344                 .gpio = INVALID_GPIO,
2345                 .active_low = PRESS_LEV_LOW,
2346         },
2347         {
2348                 .desc   = "camera",
2349                 .code   = KEY_CAMERA,
2350                 .adc_value      = 742,
2351                 .gpio = INVALID_GPIO,
2352                 .active_low = PRESS_LEV_LOW,
2353         },
2354 };
2355 #endif
2356 struct rk29_keys_platform_data rk29_keys_pdata = {
2357         .buttons        = key_button,
2358         .nbuttons       = ARRAY_SIZE(key_button),
2359         .chn    = 1,  //chn: 0-7, if do not use ADC,set 'chn' -1
2360 };
2361
2362 // =========== End of rk3168 top board keypad defination  =============
2363
2364
2365 #define POWER_ON_PIN RK30_PIN0_PA0   //power_hold
2366 static void rk30_pm_power_off(void)
2367 {
2368         printk(KERN_ERR "rk30_pm_power_off start...\n");
2369         #if defined(CONFIG_MFD_WM831X)
2370         if(pmic_is_wm8326()){
2371                 wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000);  //set sys_pwr 0
2372                 wm831x_device_shutdown(Wm831x);//wm8326 shutdown
2373          }
2374         #endif
2375
2376         #if defined(CONFIG_REGULATOR_ACT8846)
2377         if(pmic_is_act8846())
2378         {
2379                act8846_device_shutdown();
2380         }
2381         #endif
2382         
2383         #if defined(CONFIG_MFD_TPS65910)        
2384         if(pmic_is_tps65910())
2385         {
2386                 tps65910_device_shutdown();//tps65910 shutdown
2387         }
2388         #endif
2389         
2390          #if defined(CONFIG_MFD_RK808)        
2391         if(pmic_is_rk808())
2392        {
2393                 rk808_device_shutdown();//rk808 shutdown
2394         }
2395         #endif
2396
2397         gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
2398         while (1);
2399 }
2400
2401 static void __init machine_rk30_board_init(void)
2402 {
2403         //avs_init();
2404         gpio_request(POWER_ON_PIN, "poweronpin");
2405         gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
2406         
2407         pm_power_off = rk30_pm_power_off;
2408         
2409         gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
2410
2411
2412         rk30_i2c_register_board_info();
2413         spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
2414         platform_add_devices(devices, ARRAY_SIZE(devices));
2415         rk_platform_add_display_devices();
2416         board_usb_detect_init(RK30_PIN0_PA7);
2417
2418 #if defined(CONFIG_WIFI_CONTROL_FUNC)
2419         rk29sdk_wifi_bt_gpio_control_init();
2420 #elif defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC)
2421     rk29sdk_wifi_combo_module_gpio_init();
2422 #endif
2423
2424 #if defined(CONFIG_MT6620)
2425     clk_set_rate(clk_get_sys("rk_serial.0", "uart"), 48*1000000);
2426 #endif
2427
2428 #if defined(CONFIG_MT5931_MT6622)
2429                 clk_set_rate(clk_get_sys("rk_serial.0", "uart"), 24*1000000);
2430 #endif          
2431 }
2432 #define HD_SCREEN_SIZE 1920UL*1200UL*4*3
2433 static void __init rk30_reserve(void)
2434 {
2435 #if defined(CONFIG_ARCH_RK3188)
2436         /*if lcd resolution great than or equal to 1920*1200,reserve the ump memory */
2437         if(!(get_fb_size() < ALIGN(HD_SCREEN_SIZE,SZ_1M)))
2438         {
2439                 int ump_mem_phy_size=512UL*1024UL*1024UL; 
2440                 resource_mali[0].start = board_mem_reserve_add("ump buf", ump_mem_phy_size); 
2441                 resource_mali[0].end = resource_mali[0].start + ump_mem_phy_size -1;
2442         }
2443 #endif
2444 #ifdef CONFIG_ION
2445         rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
2446 #endif
2447 #ifdef CONFIG_FB_ROCKCHIP
2448         resource_fb[0].start = board_mem_reserve_add("fb0 buf", get_fb_size());
2449         resource_fb[0].end = resource_fb[0].start + get_fb_size()- 1;
2450 #if 0
2451         resource_fb[1].start = board_mem_reserve_add("ipp buf", RK30_FB0_MEM_SIZE);
2452         resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1;
2453 #endif
2454
2455 #if defined(CONFIG_FB_ROTATE) || !defined(CONFIG_THREE_FB_BUFFER)
2456         resource_fb[2].start = board_mem_reserve_add("fb2 buf",get_fb_size());
2457         resource_fb[2].end = resource_fb[2].start + get_fb_size() - 1;
2458 #endif
2459 #endif
2460
2461 #ifdef CONFIG_VIDEO_RK29
2462         rk30_camera_request_reserve_mem();
2463 #endif
2464         
2465 #ifdef CONFIG_GPS_RK
2466         //it must be more than 8MB
2467         rk_gps_info.u32MemoryPhyAddr = board_mem_reserve_add("gps", SZ_8M);
2468 #endif
2469         board_mem_reserved();
2470 }
2471 /******************************** arm dvfs frequency volt table **********************************/
2472 /**
2473  * dvfs_cpu_logic_table: table for arm and logic dvfs 
2474  * @frequency   : arm frequency
2475  * @cpu_volt    : arm voltage depend on frequency
2476  */
2477
2478 #if defined(CONFIG_ARCH_RK3188)
2479 //sdk
2480 static struct cpufreq_frequency_table dvfs_arm_table_volt_level0[] = {
2481         {.frequency = 312 * 1000,       .index = 850 * 1000},
2482         {.frequency = 504 * 1000,       .index = 900 * 1000},
2483         {.frequency = 816 * 1000,       .index = 950 * 1000},
2484         {.frequency = 1008 * 1000,      .index = 1025 * 1000},
2485         {.frequency = 1200 * 1000,      .index = 1100 * 1000},
2486         {.frequency = 1416 * 1000,      .index = 1200 * 1000},
2487         {.frequency = 1608 * 1000,      .index = 1300 * 1000},
2488         {.frequency = CPUFREQ_TABLE_END},
2489 };
2490 //default
2491 static struct cpufreq_frequency_table dvfs_arm_table_volt_level1[] = {
2492         {.frequency = 312 * 1000,       .index = 875 * 1000},
2493         {.frequency = 504 * 1000,       .index = 925 * 1000},
2494         {.frequency = 816 * 1000,       .index = 975 * 1000},
2495         {.frequency = 1008 * 1000,      .index = 1075 * 1000},
2496         {.frequency = 1200 * 1000,      .index = 1150 * 1000},
2497         {.frequency = 1416 * 1000,      .index = 1250 * 1000},
2498         {.frequency = 1608 * 1000,      .index = 1350 * 1000},
2499         {.frequency = CPUFREQ_TABLE_END},
2500 };
2501 // cube 10'
2502 static struct cpufreq_frequency_table dvfs_arm_table_volt_level2[] = {
2503         {.frequency = 312 * 1000,       .index = 900 * 1000},
2504         {.frequency = 504 * 1000,       .index = 925 * 1000},
2505         {.frequency = 816 * 1000,       .index = 1000 * 1000},
2506         {.frequency = 1008 * 1000,      .index = 1075 * 1000},
2507         {.frequency = 1200 * 1000,      .index = 1200 * 1000},
2508         {.frequency = 1416 * 1000,      .index = 1250 * 1000},
2509         {.frequency = 1608 * 1000,      .index = 1350 * 1000},
2510         {.frequency = CPUFREQ_TABLE_END},
2511 };
2512
2513 /******************************** gpu dvfs frequency volt table **********************************/
2514 //sdk
2515 static struct cpufreq_frequency_table dvfs_gpu_table_volt_level0[] = {  
2516         {.frequency = 133 * 1000,       .index = 975 * 1000},//the mininum rate is limited 133M for rk3188
2517         {.frequency = 200 * 1000,       .index = 975 * 1000},
2518         {.frequency = 266 * 1000,       .index = 1000 * 1000},
2519         {.frequency = 300 * 1000,       .index = 1050 * 1000},
2520         {.frequency = 400 * 1000,       .index = 1100 * 1000},
2521         {.frequency = 600 * 1000,       .index = 1200 * 1000},
2522         {.frequency = CPUFREQ_TABLE_END},
2523 };
2524 //cube 10'
2525 static struct cpufreq_frequency_table dvfs_gpu_table_volt_level1[] = {  
2526         {.frequency = 133 * 1000,       .index = 975 * 1000},//the mininum rate is limited 133M for rk3188
2527         {.frequency = 200 * 1000,       .index = 1000 * 1000},
2528         {.frequency = 266 * 1000,       .index = 1025 * 1000},
2529         {.frequency = 300 * 1000,       .index = 1050 * 1000},
2530         {.frequency = 400 * 1000,       .index = 1100 * 1000},
2531         {.frequency = 600 * 1000,       .index = 1250 * 1000},
2532         {.frequency = CPUFREQ_TABLE_END},
2533 };
2534
2535 /******************************** ddr dvfs frequency volt table **********************************/
2536 static struct cpufreq_frequency_table dvfs_ddr_table_volt_level0[] = {
2537         {.frequency = 200 * 1000 + DDR_FREQ_SUSPEND,    .index = 950 * 1000},
2538         {.frequency = 300 * 1000 + DDR_FREQ_VIDEO,      .index = 1000 * 1000},
2539         {.frequency = 396 * 1000 + DDR_FREQ_NORMAL,     .index = 1100 * 1000},
2540         {.frequency = 460 * 1000 + DDR_FREQ_DUALVIEW,     .index = 1150 * 1000},
2541         {.frequency = CPUFREQ_TABLE_END},
2542 };
2543
2544 //if you board is good for volt quality,select dvfs_arm_table_volt_level0
2545 #define dvfs_arm_table dvfs_arm_table_volt_level1
2546 #define dvfs_gpu_table dvfs_gpu_table_volt_level1
2547 #define dvfs_ddr_table dvfs_ddr_table_volt_level0
2548
2549 #else
2550 //for RK3168 && RK3066B
2551 static struct cpufreq_frequency_table dvfs_arm_table[] = {
2552         {.frequency = 312 * 1000,       .index = 950 * 1000},
2553         {.frequency = 504 * 1000,       .index = 1000 * 1000},
2554         {.frequency = 816 * 1000,       .index = 1050 * 1000},
2555         {.frequency = 1008 * 1000,      .index = 1125 * 1000},
2556         {.frequency = 1200 * 1000,      .index = 1200 * 1000},
2557         //{.frequency = 1416 * 1000,      .index = 1250 * 1000},
2558         //{.frequency = 1608 * 1000,      .index = 1300 * 1000},
2559         {.frequency = CPUFREQ_TABLE_END},
2560 };
2561
2562 static struct cpufreq_frequency_table dvfs_gpu_table[] = {
2563         {.frequency = 100 * 1000,       .index = 1000 * 1000},
2564         {.frequency = 200 * 1000,       .index = 1000 * 1000},
2565         {.frequency = 266 * 1000,       .index = 1050 * 1000},
2566         //{.frequency = 300 * 1000,       .index = 1050 * 1000},
2567         {.frequency = 400 * 1000,       .index = 1125 * 1000},
2568         {.frequency = CPUFREQ_TABLE_END},
2569 };
2570
2571 static struct cpufreq_frequency_table dvfs_ddr_table[] = {
2572         {.frequency = 200 * 1000 + DDR_FREQ_SUSPEND,    .index = 1000 * 1000},
2573         {.frequency = 300 * 1000 + DDR_FREQ_VIDEO,      .index = 1050 * 1000},
2574         {.frequency = 400 * 1000 + DDR_FREQ_NORMAL,     .index = 1100 * 1000},
2575         {.frequency = CPUFREQ_TABLE_END},
2576 };
2577 #endif
2578 /******************************** arm dvfs frequency volt table end **********************************/
2579 //#define DVFS_CPU_TABLE_SIZE   (ARRAY_SIZE(dvfs_cpu_logic_table))
2580 //static struct cpufreq_frequency_table cpu_dvfs_table[DVFS_CPU_TABLE_SIZE];
2581 //static struct cpufreq_frequency_table dep_cpu2core_table[DVFS_CPU_TABLE_SIZE];
2582
2583 void __init board_clock_init(void)
2584 {
2585         rk30_clock_data_init(periph_pll_default, codec_pll_default, RK30_CLOCKS_DEFAULT_FLAGS);
2586         //dvfs_set_arm_logic_volt(dvfs_cpu_logic_table, cpu_dvfs_table, dep_cpu2core_table);    
2587         dvfs_set_freq_volt_table(clk_get(NULL, "cpu"), dvfs_arm_table);
2588         dvfs_set_freq_volt_table(clk_get(NULL, "gpu"), dvfs_gpu_table);
2589         dvfs_set_freq_volt_table(clk_get(NULL, "ddr"), dvfs_ddr_table);
2590 }
2591
2592 MACHINE_START(RK30, "RK30board")
2593         .boot_params    = PLAT_PHYS_OFFSET + 0x800,
2594         .fixup          = rk30_fixup,
2595         .reserve        = &rk30_reserve,
2596         .map_io         = rk30_map_io,
2597         .init_irq       = rk30_init_irq,
2598         .timer          = &rk30_timer,
2599         .init_machine   = machine_rk30_board_init,
2600 MACHINE_END