04b777ffb3c8da4c3d8fc7d72c84fd8a0b2f2149
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rk2928 / board-rk2926-sdk.c
1 /* arch/arm/mach-rk2928/board-rk2928-fpga.c
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
30 #include <asm/setup.h>
31 #include <asm/mach-types.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach/map.h>
34 #include <asm/mach/flash.h>
35 #include <asm/hardware/gic.h>
36 #include <mach/dvfs.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/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/act8931.h>
49 #include <linux/regulator/rk29-pwm-regulator.h>
50 #if defined(CONFIG_HDMI_RK30)
51         #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
52 #endif
53
54 #if defined(CONFIG_SPIM_RK29)
55 #include "../../../drivers/spi/rk29_spim.h"
56 #endif
57
58 #include "board-rk2928-sdk-camera.c" 
59 #include "board-rk2928-sdk-key.c"
60
61 #ifdef  CONFIG_THREE_FB_BUFFER
62 #define RK30_FB0_MEM_SIZE 12*SZ_1M
63 #else
64 #define RK30_FB0_MEM_SIZE 8*SZ_1M
65 #endif
66
67 int __sramdata g_pmic_type =  0;
68
69 #if defined(CONFIG_REGULATOR_ACT8931)
70 extern  int act8931_charge_det ;
71 extern  int act8931_charge_ok  ;
72 #endif
73
74 #if defined(CONFIG_MACH_RK2926_V86)
75 //#define V86_VERSION_1_0
76 #define V86_VERSION_1_1
77 #endif
78
79 #if defined(V86_VERSION_1_1)
80 #if defined(CONFIG_MFD_TPS65910)
81 extern int tps65910_charge_ok ;
82 #endif
83 #endif
84
85
86 static struct spi_board_info board_spi_devices[] = {
87 };
88
89 /***********************************************************
90 *       rk30  backlight
91 ************************************************************/
92 #ifdef CONFIG_BACKLIGHT_RK29_BL
93 #define PWM_ID            0
94 #define PWM_MUX_NAME      GPIO0D2_PWM_0_NAME
95 #define PWM_MUX_MODE      GPIO0D_PWM_0
96 #define PWM_MUX_MODE_GPIO GPIO0D_GPIO0D2
97 #define PWM_GPIO          RK2928_PIN0_PD2
98 #define PWM_EFFECT_VALUE  0
99
100 #if defined(V86_VERSION_1_1)
101 #define LCD_DISP_ON_PIN
102 #endif
103
104 #ifdef  LCD_DISP_ON_PIN
105 #if defined(V86_VERSION_1_1)
106 #define BL_EN_PIN         RK2928_PIN3_PC1
107 #define BL_EN_VALUE       GPIO_HIGH
108 #define BL_EN_MUX_NAME   GPIO3C1_OTG_DRVVBUS_NAME
109 #define BL_EN_MUX_MODE   GPIO3C_GPIO3C1
110 #else
111 #define BL_EN_PIN         RK2928_PIN1_PB0
112 #define BL_EN_VALUE       GPIO_HIGH
113 #endif
114 #endif
115 static int rk29_backlight_io_init(void)
116 {
117         int ret = 0;
118         rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
119 #ifdef  LCD_DISP_ON_PIN
120         #if defined(V86_VERSION_1_1)
121        rk30_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
122        #endif
123
124         ret = gpio_request(BL_EN_PIN, NULL);
125         if (ret != 0) {
126                 gpio_free(BL_EN_PIN);
127         }
128
129         gpio_direction_output(BL_EN_PIN, 0);
130         gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
131 #endif
132         return ret;
133 }
134
135 static int rk29_backlight_io_deinit(void)
136 {
137         int ret = 0;
138 #ifdef  LCD_DISP_ON_PIN
139         gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
140         gpio_free(BL_EN_PIN);
141 #endif
142         rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
143
144         #if defined(V86_VERSION_1_0) || defined(V86_VERSION_1_1)
145         #if defined(CONFIG_MFD_TPS65910)        
146         if(g_pmic_type == PMIC_TYPE_TPS65910)
147         {
148                 gpio_direction_output(PWM_GPIO, GPIO_HIGH);
149         }
150         #endif
151         #endif
152         
153         return ret;
154 }
155
156 static int rk29_backlight_pwm_suspend(void)
157 {
158         int ret = 0;
159         rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
160         if (gpio_request(PWM_GPIO, NULL)) {
161                 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
162                 return -1;
163         }
164         #if defined(CONFIG_MFD_TPS65910)        
165          if (pmic_is_tps65910() )
166          #if defined(V86_VERSION_1_0) || defined(V86_VERSION_1_1)
167            gpio_direction_output(PWM_GPIO, GPIO_HIGH);
168          #else
169            gpio_direction_output(PWM_GPIO, GPIO_LOW);
170          #endif
171         #endif
172         #if defined(CONFIG_REGULATOR_ACT8931)
173          if (pmic_is_act8931() )
174            gpio_direction_output(PWM_GPIO, GPIO_HIGH);
175         #endif
176 #ifdef  LCD_DISP_ON_PIN
177         gpio_direction_output(BL_EN_PIN, 0);
178         gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
179 #endif
180
181         return ret;
182 }
183
184 static int rk29_backlight_pwm_resume(void)
185 {
186         gpio_free(PWM_GPIO);
187         rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
188 #ifdef  LCD_DISP_ON_PIN
189         msleep(30);
190         gpio_direction_output(BL_EN_PIN, 1);
191         gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
192 #endif
193         return 0;
194 }
195
196 static struct rk29_bl_info rk29_bl_info = {
197         .pwm_id = PWM_ID,
198         .min_brightness = 80,
199         .bl_ref = PWM_EFFECT_VALUE,
200         .io_init = rk29_backlight_io_init,
201         .io_deinit = rk29_backlight_io_deinit,
202         .pwm_suspend = rk29_backlight_pwm_suspend,
203         .pwm_resume = rk29_backlight_pwm_resume,
204 };
205
206 static struct platform_device rk29_device_backlight = {
207         .name   = "rk29_backlight",
208         .id     = -1,
209         .dev    = {
210                 .platform_data  = &rk29_bl_info,
211         }
212 };
213
214 #if defined(V86_VERSION_1_0) || defined(V86_VERSION_1_1) //for v86 to modify flash lcd when startup
215 static int __init set_pwm_gpio_high(void)
216 {  
217         printk("%s, xhc", __func__);
218         rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
219         if (gpio_request(PWM_GPIO, NULL)) {
220                 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
221                 return -1;
222         }
223         gpio_direction_output(PWM_GPIO, GPIO_HIGH);
224         gpio_free(PWM_GPIO);
225         return 0;
226 }
227 core_initcall(set_pwm_gpio_high);
228 #endif
229
230 #endif
231
232 #ifdef CONFIG_FB_ROCKCHIP
233
234 #define LCD_MUX_NAME  GPIO0C2_UART0_RTSN_NAME
235 #define LCD_GPIO_MODE GPIO0C_GPIO0C2
236
237 #define LCD_EN        RK2928_PIN1_PB3
238 #define LCD_EN_VALUE  GPIO_LOW
239
240 static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
241 {
242         int ret = 0;
243
244         rk30_mux_api_set(LCD_MUX_NAME, LCD_GPIO_MODE);
245
246         ret = gpio_request(LCD_EN, NULL);
247         if (ret != 0)
248         {
249                 gpio_free(LCD_EN);
250                 printk(KERN_ERR "request lcd en pin fail!\n");
251                 return -1;
252         }
253         else
254         {
255                 gpio_direction_output(LCD_EN, LCD_EN_VALUE); //disable
256         }
257         return 0;
258 }
259 static int rk_fb_io_disable(void)
260 {
261
262         #if 0//defined(CONFIG_REGULATOR_ACT8931)
263         if (pmic_is_act8931() ){
264                 struct regulator *ldo;
265                 ldo = regulator_get(NULL, "act_ldo4");   //vcc_lcd
266                 regulator_disable(ldo);
267                 regulator_put(ldo);
268                 udelay(100);
269         }
270         #endif
271         
272         //#if defined(V86_VERSION_1_0)
273         msleep(30);
274         //#endif
275
276         gpio_set_value(LCD_EN, !LCD_EN_VALUE);
277         return 0;
278 }
279 static int rk_fb_io_enable(void)
280 {
281         #if 0//defined(CONFIG_REGULATOR_ACT8931)
282         if (pmic_is_act8931() ){
283                 struct regulator *ldo;
284                 ldo = regulator_get(NULL, "act_ldo4");   //vcc_lcd
285                 regulator_enable(ldo);
286                 regulator_put(ldo);
287                 udelay(100);
288                 msleep(300);    // wait for powering on LED circuit
289         }
290         #endif
291
292       //#if defined(V86_VERSION_1_0)
293       msleep(100);
294       //#endif
295
296         gpio_set_value(LCD_EN, LCD_EN_VALUE);
297         return 0;
298 }
299
300 #if defined(CONFIG_LCDC_RK2928)
301 struct rk29fb_info lcdc_screen_info = {
302         .prop      = PRMRY,             //primary display device
303         .io_init   = rk_fb_io_init,
304         .io_disable = rk_fb_io_disable,
305         .io_enable = rk_fb_io_enable,
306         .set_screen_info = set_lcd_info,
307 };
308 #endif
309
310 static struct resource resource_fb[] = {
311         [0] = {
312                 .name  = "fb0 buf",
313                 .start = 0,
314                 .end   = 0,//RK30_FB0_MEM_SIZE - 1,
315                 .flags = IORESOURCE_MEM,
316         },
317         [1] = {
318                 .name  = "ipp buf",  //for rotate
319                 .start = 0,
320                 .end   = 0,//RK30_FB0_MEM_SIZE - 1,
321                 .flags = IORESOURCE_MEM,
322         },
323         [2] = {
324                 .name  = "fb2 buf",
325                 .start = 0,
326                 .end   = 0,//RK30_FB0_MEM_SIZE - 1,
327                 .flags = IORESOURCE_MEM,
328         },
329 };
330
331 static struct platform_device device_fb = {
332         .name           = "rk-fb",
333         .id             = -1,
334         .num_resources  = ARRAY_SIZE(resource_fb),
335         .resource       = resource_fb,
336 };
337 #endif
338
339 //LCDC
340 #ifdef CONFIG_LCDC_RK2928
341 static struct resource resource_lcdc[] = {
342         [0] = {
343                 .name  = "lcdc reg",
344                 .start = RK2928_LCDC_PHYS,
345                 .end   = RK2928_LCDC_PHYS + RK2928_LCDC_SIZE - 1,
346                 .flags = IORESOURCE_MEM,
347         },
348         
349         [1] = {
350                 .name  = "lcdc irq",
351                 .start = IRQ_LCDC,
352                 .end   = IRQ_LCDC,
353                 .flags = IORESOURCE_IRQ,
354         },
355 };
356
357 static struct platform_device device_lcdc = {
358         .name             = "rk2928-lcdc",
359         .id               = 0,
360         .num_resources    = ARRAY_SIZE(resource_lcdc),
361         .resource         = resource_lcdc,
362         .dev            = {
363                 .platform_data = &lcdc_screen_info,
364         },
365 };
366 #endif
367
368 #ifdef CONFIG_ION
369 #define ION_RESERVE_SIZE        (80 * SZ_1M)
370 static struct ion_platform_data rk30_ion_pdata = {
371         .nr = 1,
372         .heaps = {
373                 {
374                         .type = ION_HEAP_TYPE_CARVEOUT,
375                         .id = ION_NOR_HEAP_ID,
376                         .name = "norheap",
377                         .size = ION_RESERVE_SIZE,
378                 }
379         },
380 };
381
382 static struct platform_device device_ion = {
383         .name = "ion-rockchip",
384         .id = 0,
385         .dev = {
386                 .platform_data = &rk30_ion_pdata,
387         },
388 };
389 #endif
390
391 /*ft5x0x touchpad*/
392 #if defined (CONFIG_TOUCHSCREEN_FT5X0X)
393
394 #define TOUCH_RESET_PIN RK2928_PIN0_PD3
395 #define TOUCH_EN_PIN NULL
396 #define TOUCH_INT_PIN RK2928_PIN1_PB0
397
398 static struct ts_hw_data ts_hw_info = {
399         .reset_gpio = TOUCH_RESET_PIN,
400 };
401 #endif
402
403 #if defined(CONFIG_TOUCHSCREEN_GT811_IIC)
404 #define TOUCH_RESET_PIN  INVALID_GPIO//RK2928_PIN0_PD3//RK2928_PIN1_PA3
405 #define TOUCH_INT_PIN    RK2928_PIN1_PB0
406 int goodix_init_platform_hw(void)
407 {
408
409         //printk("ft5306_init_platform_hw\n");
410         if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
411                 gpio_free(TOUCH_RESET_PIN);
412                 printk("ft5306_init_platform_hw gpio_request error\n");
413                 return -EIO;
414         }
415
416         if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
417                 gpio_free(TOUCH_INT_PIN);
418                 printk("ift5306_init_platform_hw gpio_request error\n");
419                 return -EIO;
420         }
421         gpio_direction_output(TOUCH_RESET_PIN, GPIO_HIGH);
422         mdelay(10);
423         gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
424         mdelay(10);
425         gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
426         msleep(300);
427         return 0;
428
429 }
430
431 struct goodix_platform_data goodix_info = {
432         .model = 8105,
433         //.irq_pin = RK2928_PIN1_PB0,
434         .rest_pin = TOUCH_RESET_PIN,
435         .init_platform_hw = goodix_init_platform_hw,
436 };
437 #endif
438
439
440 #if defined(CONFIG_TOUCHSCREEN_SITRONIX_A720)
441
442 #if defined(V86_VERSION_1_1)
443 #define TOUCH_RESET_PIN         NULL
444 #else
445 #define TOUCH_RESET_PIN         RK2928_PIN1_PA3
446 #endif
447 #define TOUCH_INT_PIN    RK2928_PIN1_PB0
448
449 int ft5306_init_platform_hw(void)
450 {
451
452         //printk("ft5306_init_platform_hw\n");
453         if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
454                 gpio_free(TOUCH_RESET_PIN);
455                 printk("ft5306_init_platform_hw gpio_request error\n");
456                 return -EIO;
457         }
458
459         if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
460                 gpio_free(TOUCH_INT_PIN);
461                 printk("ift5306_init_platform_hw gpio_request error\n");
462                 return -EIO;
463         }
464         gpio_direction_output(TOUCH_RESET_PIN, GPIO_HIGH);
465         mdelay(10);
466         gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
467         mdelay(10);
468         gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
469         msleep(300);
470         return 0;
471
472 }
473 #if defined(V86_VERSION_1_1)
474 int  sitronix_direction_otation( int *x,int *y )
475 {
476        *x = *x ;
477        *y = 480 - *y ;
478         return 1 ;      
479 }
480 #endif
481 struct ft5x0x_platform_data sitronix_info = {
482         .model = 5007,
483         .init_platform_hw= ft5306_init_platform_hw,
484          #if defined(V86_VERSION_1_1)
485          .direction_otation = sitronix_direction_otation ,
486          #endif
487 };
488 #endif
489
490 /*MMA7660 gsensor*/
491 #if defined (CONFIG_GS_MMA7660)
492 #define MMA7660_INT_PIN   RK2928_PIN1_PB2
493
494 static int mma7660_init_platform_hw(void)
495 {
496         rk30_mux_api_set(GPIO1B2_SPI_RXD_UART1_SIN_NAME, GPIO1B_GPIO1B2);
497
498         return 0;
499 }
500
501 static struct sensor_platform_data mma7660_info = {
502         .type = SENSOR_TYPE_ACCEL,
503         .irq_enable = 1,
504         .poll_delay_ms = 30,
505         .init_platform_hw = mma7660_init_platform_hw,
506         #if defined(V86_VERSION_1_0) || defined(V86_VERSION_1_1)
507            #if defined(V86_VERSION_1_0)
508            .orientation = {1, 0, 0, 0, 0, -1, 0, -1, 0},
509             #else if defined(V86_VERSION_1_1)
510             .orientation = {0, 1, 0, 0, 0, -1, 1, 0, 0},
511             #endif
512         #else 
513         .orientation = {-1, 0, 0, 0, 0, -1, 0, 1, 0},
514         #endif
515 };
516 #endif
517
518
519 #if CONFIG_RK30_PWM_REGULATOR
520 static int pwm_voltage_map[] = {
521         950000,975000,1000000, 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000
522 };
523
524 static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
525         {
526                 .supply = "vdd_core",
527         }
528 };
529
530 struct regulator_init_data pwm_regulator_init_dcdc[1] =
531 {
532         {
533                 .constraints = {
534                         .name = "PWM_DCDC1",
535                         .min_uV = 600000,
536                         .max_uV = 1800000,      //0.6-1.8V
537                         .apply_uV = true,
538                         .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
539                 },
540                 .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
541                 .consumer_supplies = pwm_dcdc1_consumers,
542         },
543 };
544
545 static struct pwm_platform_data pwm_regulator_info[1] = {
546         {
547                 .pwm_id = 1,
548                 #if defined(V86_VERSION_1_1)
549              #else
550                 .pwm_gpio = RK2928_PIN0_PD3,
551                 #endif
552                 .pwm_iomux_name = GPIO0D3_PWM_1_NAME,
553                 .pwm_iomux_pwm = GPIO0D_PWM_1, 
554                 .pwm_iomux_gpio = GPIO0D_GPIO0D3,
555                 .pwm_voltage = 1200000,
556                 .suspend_voltage = 1050000,
557                 .min_uV = 950000,
558                 .max_uV = 1400000,
559                 .coefficient = 455,     //45.5%
560                 .pwm_voltage_map = pwm_voltage_map,
561                 .init_data      = &pwm_regulator_init_dcdc[0],
562         },
563 };
564
565 struct platform_device pwm_regulator_device[1] = {
566         {
567                 .name = "pwm-voltage-regulator",
568                 .id = 0,
569                 .dev            = {
570                         .platform_data = &pwm_regulator_info[0],
571                 }
572         },
573 };
574 #endif
575
576 /***********************************************************
577 *       usb wifi
578 ************************************************************/
579 #if defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) 
580
581 static void rkusb_wifi_power(int on) {
582         struct regulator *ldo = NULL;
583         
584 #if defined(CONFIG_MFD_TPS65910)        
585         if (pmic_is_tps65910() )
586                 ldo = regulator_get(NULL, "vmmc");  //vccio_wl
587 #endif
588 #if defined(CONFIG_REGULATOR_ACT8931)
589         if(pmic_is_act8931() )
590                 ldo = regulator_get(NULL, "act_ldo4");  //vccio_wl
591 #endif  
592         
593         if(on) {
594                 regulator_enable(ldo);
595                 printk("%s: vccio_wl enable\n", __func__);
596         } else {
597                 printk("%s: vccio_wl disable\n", __func__);
598                 regulator_disable(ldo);
599         }
600         
601         regulator_put(ldo);
602         udelay(100);
603 }
604
605 #endif
606
607 /**************************************************************************************************
608  * SDMMC devices,  include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
609 **************************************************************************************************/
610 #ifdef CONFIG_SDMMC_RK29
611 #include "board-rk2928-sdk-sdmmc.c"
612
613 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
614 #define SDMMC0_WRITE_PROTECT_PIN        RK2928_PIN1_PA7 //According to your own project to set the value of write-protect-pin.
615 #endif
616
617 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
618 #define SDMMC1_WRITE_PROTECT_PIN        RK2928_PIN0_PD5 //According to your own project to set the value of write-protect-pin.
619 #endif
620
621 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N    RK2928_PIN0_PB2
622
623 #define RK29SDK_SD_CARD_DETECT_N        RK2928_PIN2_PA7  //According to your own project to set the value of card-detect-pin.
624 #define RK29SDK_SD_CARD_INSERT_LEVEL    GPIO_LOW         // set the voltage of insert-card. Please pay attention to the default setting.
625
626
627 #endif //endif ---#ifdef CONFIG_SDMMC_RK29
628
629 #ifdef CONFIG_SDMMC0_RK29
630 static int rk29_sdmmc0_cfg_gpio(void)
631 {
632         rk29_sdmmc_set_iomux(0, 0xFFFF);
633
634 #if defined(CONFIG_SDMMC0_RK29_SDCARD_DET_FROM_GPIO)
635     rk30_mux_api_set(GPIO1C1_MMC0_DETN_NAME, GPIO1C_GPIO1C1);
636    // gpio_request(RK29SDK_SD_CARD_DETECT_N, "sd-detect");
637    // gpio_direction_output(RK29SDK_SD_CARD_DETECT_N,GPIO_HIGH);//set mmc0-data1 to high.
638 #else
639         rk30_mux_api_set(GPIO1C1_MMC0_DETN_NAME, GPIO1C_MMC0_DETN);
640 #endif  
641
642 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
643         gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
644         gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
645 #endif
646
647         return 0;
648 }
649
650 #define CONFIG_SDMMC0_USE_DMA
651 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
652         .host_ocr_avail =
653             (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
654              MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
655              MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
656         .host_caps =
657             (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
658         .io_init = rk29_sdmmc0_cfg_gpio,
659
660 #if !defined(CONFIG_SDMMC_RK29_OLD)
661         .set_iomux = rk29_sdmmc_set_iomux,
662 #endif
663
664         .dma_name = "sd_mmc",
665 #ifdef CONFIG_SDMMC0_USE_DMA
666         .use_dma = 1,
667 #else
668         .use_dma = 0,
669 #endif
670
671 #if defined(CONFIG_SDMMC0_RK29_SDCARD_DET_FROM_GPIO)
672     .detect_irq = RK29SDK_SD_CARD_DETECT_N,
673     .insert_card_level = RK29SDK_SD_CARD_INSERT_LEVEL,
674 #else
675         .detect_irq = INVALID_GPIO,
676 #endif
677
678         .enable_sd_wakeup = 0,
679
680 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
681         .write_prt = SDMMC0_WRITE_PROTECT_PIN,
682 #else
683         .write_prt = INVALID_GPIO,
684 #endif
685 };
686 #endif // CONFIG_SDMMC0_RK29
687
688 #ifdef CONFIG_SND_SOC_RK2928
689 static struct resource resources_acodec[] = {
690         {
691                 .start  = RK2928_ACODEC_PHYS,
692                 .end    = RK2928_ACODEC_PHYS + RK2928_ACODEC_SIZE - 1,
693                 .flags  = IORESOURCE_MEM,
694         },
695         {
696                 .start  = RK2928_PIN1_PA0,
697                 .end    = RK2928_PIN1_PA0,
698                 .flags  = IORESOURCE_IO,
699         },
700 };
701
702 static struct platform_device device_acodec = {
703         .name   = "rk2928-codec",
704         .id             = -1,
705         .num_resources  = ARRAY_SIZE(resources_acodec),
706         .resource       = resources_acodec,
707 };
708 #endif
709
710 #ifdef CONFIG_BATTERY_RK30_ADC_FAC
711 #if  defined(V86_VERSION_1_0) || defined(V86_VERSION_1_1)
712 #define   DC_DET_PIN  RK2928_PIN1_PA5
713 int rk30_battery_adc_io_init(void){
714         int ret = 0;
715                 
716         //dc charge detect pin
717         ret = gpio_request(DC_DET_PIN, NULL);
718         if (ret) {
719                 printk("failed to request dc_det gpio\n");
720                 return ret ;
721         }
722
723         gpio_pull_updown(DC_DET_PIN, 0);//important
724         ret = gpio_direction_input(DC_DET_PIN);
725         if (ret) {
726                 printk("failed to set gpio dc_det input\n");
727                 return ret ;
728         }
729         
730         return 0;
731
732 }
733 #if defined(V86_VERSION_1_1)
734 extern int tps65910_charge_ok;
735 #if defined(CONFIG_MFD_TPS65910)
736 int rk30_battery_adc_charging_ok( ){
737
738        if( gpio_get_value(DC_DET_PIN) == GPIO_LOW){
739        //printk(">>>>>>>>>> DC_DET_OK\n");
740            if( tps65910_charge_ok ){
741                 //printk(">>>>>>>>>>return tps65910_charge_ok = %d \n",tps65910_charge_ok);
742                 return 1 ;
743             }
744             //printk(">>>>>>>>>> tps65910_charge_ok = %d \n",tps65910_charge_ok);
745        }
746
747        return 0 ;
748 }
749 #endif
750 #endif
751 static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
752         .dc_det_pin      = DC_DET_PIN,//INVALID_GPIO,
753         .batt_low_pin    = INVALID_GPIO,
754         .charge_set_pin  = INVALID_GPIO,
755         .charge_ok_pin   = INVALID_GPIO,//RK2928_PIN1_PA5,
756         .dc_det_level    = GPIO_LOW,
757         .charge_ok_level = GPIO_HIGH,
758
759         .io_init = rk30_battery_adc_io_init,
760         #if defined(V86_VERSION_1_1)
761          .charging_ok     = rk30_battery_adc_charging_ok ,
762         #endif
763
764         .reference_voltage=3200,
765         .pull_up_res = 200 ,
766         .pull_down_res = 200 ,
767
768         .charging_sleep   = 0 ,        
769         .save_capacity   = 1 ,
770         .adc_channel     =0 ,
771         
772 };
773
774 static struct platform_device rk30_device_adc_battery = {
775         .name   = "rk30-battery",
776         .id     = -1,
777         .dev = {
778                 .platform_data = &rk30_adc_battery_platdata,
779         },
780 };
781
782 #else
783 #define   DC_DET_PIN  RK2928_PIN1_PA5
784 int rk30_battery_adc_io_init(void){
785         int ret = 0;
786                 
787         //dc charge detect pin
788         ret = gpio_request(DC_DET_PIN, NULL);
789         if (ret) {
790                 printk("failed to request dc_det gpio\n");
791                 return ret ;
792         }
793
794         gpio_pull_updown(DC_DET_PIN, 0);//important
795         ret = gpio_direction_input(DC_DET_PIN);
796         if (ret) {
797                 printk("failed to set gpio dc_det input\n");
798                 return ret ;
799         }
800         
801         return 0;
802
803 }
804 #if defined(CONFIG_REGULATOR_ACT8931)
805 int rk30_battery_adc_is_dc_charging( ){
806         return  act8931_charge_det  ;  
807 }
808 int rk30_battery_adc_charging_ok( ){
809        return act8931_charge_ok ;
810 }
811 #endif  
812  static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
813          .dc_det_pin      = INVALID_GPIO,
814          .batt_low_pin    = INVALID_GPIO,
815          .charge_set_pin  = INVALID_GPIO,
816          .charge_ok_pin   = INVALID_GPIO,
817
818         //.io_init = rk30_battery_adc_io_init,
819         #if defined(CONFIG_REGULATOR_ACT8931)
820         .is_dc_charging  = rk30_battery_adc_is_dc_charging,
821           .charging_ok     = rk30_battery_adc_charging_ok ,
822         #endif
823         
824         .charging_sleep   = 0 ,
825         .save_capacity   = 1 ,
826         .adc_channel      =0 ,
827  };
828 static struct platform_device rk30_device_adc_battery = {
829         .name   = "rk30-battery",
830         .id     = -1,
831         .dev = {
832                 .platform_data = &rk30_adc_battery_platdata,
833         },
834 };
835 #endif
836 #endif
837
838 static struct platform_device *devices[] __initdata = {
839 #ifdef CONFIG_FB_ROCKCHIP
840         &device_fb,
841 #endif
842 #ifdef CONFIG_LCDC_RK2928
843         &device_lcdc,
844 #endif
845 #ifdef CONFIG_BACKLIGHT_RK29_BL
846         &rk29_device_backlight,
847 #endif
848 #ifdef CONFIG_ION
849         &device_ion,
850 #endif
851 #ifdef CONFIG_SND_SOC_RK2928
852         &device_acodec,
853 #endif
854 #ifdef CONFIG_BATTERY_RK30_ADC_FAC
855         &rk30_device_adc_battery,
856 #endif
857 };
858 //i2c
859 #ifdef CONFIG_I2C0_RK30
860 #ifdef CONFIG_MFD_TPS65910
861 #if defined(V86_VERSION_1_0) || defined(V86_VERSION_1_1)
862 #define TPS65910_HOST_IRQ        RK2928_PIN1_PB1
863 #else
864 #define TPS65910_HOST_IRQ        RK2928_PIN1_PB2
865 #endif
866 #define PMU_POWER_SLEEP RK2928_PIN1_PA1
867
868 static struct pmu_info  tps65910_dcdc_info[] = {
869         {
870                 .name          = "vdd_cpu",   //arm
871                 .min_uv          = 1200000,
872                 .max_uv         = 1200000,
873         },
874         {
875              #if defined(V86_VERSION_1_1)
876              .name          = "vdd_core",    //ddr
877               #else
878                 .name          = "vdd2",    //ddr
879                 #endif
880                 .min_uv          = 1200000,
881                 .max_uv         = 1200000,
882         },
883         {
884                 .name          = "vio",   //vcc_io
885                 .min_uv          = 3300000,
886                 .max_uv         = 3300000,
887         },
888         
889 };
890 static  struct pmu_info  tps65910_ldo_info[] = {
891         #if defined(CONFIG_MACH_RK2928_TB) || defined(CONFIG_MACH_RK2926_TB)
892         {
893                 .name          = "vpll",   //vcc25
894                 .min_uv          = 2500000,
895                 .max_uv         = 2500000,
896         },
897         {
898                 .name          = "vdig1",    //vcc18_cif
899                 .min_uv          = 1800000,
900                 .max_uv         = 1800000,
901         },
902         {
903                 .name          = "vdac",   //vccio_wl
904                 .min_uv          = 1800000,
905                 .max_uv         = 1800000,
906         },
907         #else
908         {
909                 .name          = "vdig1",    //vcc18_cif
910                 .min_uv          = 1500000,
911                 .max_uv         = 1500000,
912         },
913
914         {
915                 .name          = "vdig2",   //vdd11
916                 .min_uv          = 1200000,
917                 .max_uv         = 1200000,
918         },
919         {
920                 .name          = "vaux1",   //vcc28_cif
921                 .min_uv          = 2800000,
922                 .max_uv         = 2800000,
923         },
924         {
925                 .name          = "vaux2",   //vcca33
926                 .min_uv          = 3300000,
927                 .max_uv         = 3300000,
928         },
929         {
930                 .name          = "vaux33",   //vcc_tp
931                 .min_uv          = 3300000,
932                 .max_uv         = 3300000,
933         },
934         {
935                 .name          = "vmmc",   //
936                 .min_uv          = 3300000,
937                 .max_uv         = 3300000,
938         },
939         #endif
940  };
941
942 #include "board-rk2928-sdk-tps65910.c"
943 #endif
944
945 #ifdef CONFIG_REGULATOR_ACT8931
946 #define ACT8931_HOST_IRQ                RK2928_PIN1_PB1
947 #if defined(CONFIG_MACH_RK2928_SDK)
948 #define ACT8931_CHGSEL_PIN RK2928_PIN0_PD0
949 #else
950 #define ACT8931_CHGSEL_PIN RK2928_PIN1_PA1
951 #endif
952
953 static struct pmu_info  act8931_dcdc_info[] = {
954         {
955                 .name          = "act_dcdc1",   //vcc_io
956                 .min_uv          = 3300000,
957                 .max_uv         = 3300000,
958         },
959         {
960                 .name          = "act_dcdc2",    //ddr
961                 .min_uv          = 1500000,
962                 .max_uv         = 1500000,
963         },
964         {
965                 .name          = "vdd_cpu",   //vdd_arm
966                 .min_uv          = 1200000,
967                 .max_uv         = 1200000,
968         },
969         
970 };
971 static  struct pmu_info  act8931_ldo_info[] = {
972         {
973                 .name          = "act_ldo1",   //vcc28_cif
974                 .min_uv          = 2800000,
975                 .max_uv         = 2800000,
976         },
977         {
978                 .name          = "act_ldo2",    //vcc18_cif
979                 .min_uv          = 1800000,
980                 .max_uv         = 1800000,
981         },
982         {
983                 .name          = "act_ldo3",    //vcca30
984                 .min_uv          = 3000000,
985                 .max_uv         = 3000000,
986         },
987         {
988                 .name          = "act_ldo4",    //vcc_wl
989                 .min_uv          = 3300000,
990                 .max_uv         = 3300000,
991         },
992 };
993 #include "board-rk2928-sdk-act8931.c"
994 #endif
995
996 static struct i2c_board_info __initdata i2c0_info[] = {
997 #if defined (CONFIG_MFD_TPS65910)
998         {
999         .type           = "tps65910",
1000         .addr           = TPS65910_I2C_ID0,
1001         .flags          = 0,
1002         .irq            = TPS65910_HOST_IRQ,
1003         .platform_data = &tps65910_data,
1004         },
1005 #endif
1006 #if defined (CONFIG_REGULATOR_ACT8931)
1007         {
1008                 .type                   = "act8931",
1009                 .addr           = 0x5b, 
1010                 .flags                  = 0,
1011                 .irq            = ACT8931_HOST_IRQ,
1012                 .platform_data=&act8931_data,
1013         },
1014 #endif
1015 #if defined (CONFIG_RTC_HYM8563)
1016         {
1017                 .type                   = "rtc_hym8563",
1018                 .addr           = 0x51,
1019                 .flags                  = 0,
1020                 .irq            = RK2928_PIN1_PA5,
1021         },
1022 #endif
1023 };
1024 #endif
1025
1026 int __sramdata gpio0d3_iomux,gpio0d3_do,gpio0d3_dir;
1027
1028 #define gpio0_readl(offset)     readl_relaxed(RK2928_GPIO0_BASE + offset)
1029 #define gpio0_writel(v, offset) do { writel_relaxed(v, RK2928_GPIO0_BASE + offset); dsb(); } while (0)
1030
1031 void __sramfunc rk30_pwm_logic_suspend_voltage(void)
1032 {
1033 #ifdef CONFIG_RK30_PWM_REGULATOR
1034
1035         sram_udelay(10000);
1036         gpio0d3_iomux = readl_relaxed(GRF_GPIO0D_IOMUX);
1037         gpio0d3_do = gpio0_readl(GPIO_SWPORTA_DR);
1038         gpio0d3_dir = gpio0_readl(GPIO_SWPORTA_DDR);
1039
1040         writel_relaxed((gpio0d3_iomux |(1<<22)) & (~(1<<6)), GRF_GPIO0D_IOMUX);
1041         gpio0_writel(gpio0d3_dir |(1<<27), GPIO_SWPORTA_DDR);
1042         gpio0_writel(gpio0d3_do |(1<<27), GPIO_SWPORTA_DR);
1043 #endif 
1044 }
1045 void __sramfunc rk30_pwm_logic_resume_voltage(void)
1046 {
1047 #ifdef CONFIG_RK30_PWM_REGULATOR
1048         writel_relaxed((1<<22)|gpio0d3_iomux, GRF_GPIO0D_IOMUX);
1049         gpio0_writel(gpio0d3_dir, GPIO_SWPORTA_DDR);
1050         gpio0_writel(gpio0d3_do, GPIO_SWPORTA_DR);
1051         sram_udelay(10000);
1052
1053 #endif
1054
1055 }
1056 extern void pwm_suspend_voltage(void);
1057 extern void pwm_resume_voltage(void);
1058 void  rk30_pwm_suspend_voltage_set(void)
1059 {
1060 #ifdef CONFIG_RK30_PWM_REGULATOR
1061         pwm_suspend_voltage();
1062 #endif
1063 }
1064 void  rk30_pwm_resume_voltage_set(void)
1065 {
1066 #ifdef CONFIG_RK30_PWM_REGULATOR
1067         pwm_resume_voltage();
1068 #endif
1069 }
1070
1071 void __sramfunc board_pmu_suspend(void)
1072 {      
1073         #if defined (CONFIG_MFD_TPS65910)
1074         if(pmic_is_tps65910() )
1075         board_pmu_tps65910_suspend(); 
1076         #endif   
1077 }
1078 void __sramfunc board_pmu_resume(void)
1079 {      
1080         #if defined (CONFIG_MFD_TPS65910)
1081         if(pmic_is_tps65910() )
1082         board_pmu_tps65910_resume(); 
1083         #endif
1084 }
1085
1086 #ifdef CONFIG_I2C1_RK30
1087 static struct i2c_board_info __initdata i2c1_info[] = {
1088 #if defined (CONFIG_GS_MMA7660)
1089                 {
1090                         .type           = "gs_mma7660",
1091                         .addr           = 0x4c,
1092                         .flags          = 0,
1093                         .irq            = MMA7660_INT_PIN,
1094                         .platform_data = &mma7660_info,
1095                 },
1096 #endif
1097
1098 };
1099 #endif
1100 #ifdef CONFIG_I2C2_RK30
1101 static struct i2c_board_info __initdata i2c2_info[] = {
1102 #if defined (CONFIG_TOUCHSCREEN_SITRONIX_A720)
1103 {
1104         .type           ="sitronix",
1105         .addr           = 0x60,
1106         .flags          = 0,
1107         .irq            = TOUCH_INT_PIN,
1108         .platform_data = &sitronix_info,
1109 },
1110 #endif
1111 #if defined (CONFIG_TOUCHSCREEN_GT811_IIC)
1112         {
1113                 .type          = "gt811_ts",
1114                 .addr          = 0x5d,
1115                 .flags         = 0,
1116                 .irq           = TOUCH_INT_PIN,
1117                 .platform_data = &goodix_info,
1118         },
1119 #endif
1120 #if defined (CONFIG_TOUCHSCREEN_FT5X0X)
1121         {
1122             .type           = "ft5x0x_ts",
1123             .addr           = 0x38,
1124             .flags          = 0,
1125             .irq            = TOUCH_INT_PIN,
1126             //.platform_data  = &ft5x0x_info,
1127             .platform_data = &ts_hw_info,
1128         },
1129 #endif
1130 };
1131 #endif
1132 #ifdef CONFIG_I2C3_RK30
1133 static struct i2c_board_info __initdata i2c3_info[] = {
1134 };
1135 #endif
1136 #ifdef CONFIG_I2C_GPIO_RK30
1137 #define I2C_SDA_PIN     INVALID_GPIO   //set sda_pin here
1138 #define I2C_SCL_PIN     INVALID_GPIO   //set scl_pin here
1139 static int rk30_i2c_io_init(void)
1140 {
1141         //set iomux (gpio) here
1142
1143         return 0;
1144 }
1145 struct i2c_gpio_platform_data default_i2c_gpio_data = {
1146        .sda_pin = I2C_SDA_PIN,
1147        .scl_pin = I2C_SCL_PIN,
1148        .udelay = 5, // clk = 500/udelay = 100Khz
1149        .timeout = 100,//msecs_to_jiffies(100),
1150        .bus_num    = 5,
1151        .io_init = rk30_i2c_io_init,
1152 };
1153 static struct i2c_board_info __initdata i2c_gpio_info[] = {
1154 };
1155 #endif
1156 static void __init rk30_i2c_register_board_info(void)
1157 {
1158 #ifdef CONFIG_I2C0_RK30
1159         i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
1160 #endif
1161 #ifdef CONFIG_I2C1_RK30
1162         i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
1163 #endif
1164 #ifdef CONFIG_I2C2_RK30
1165         i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
1166 #endif
1167 #ifdef CONFIG_I2C3_RK30
1168         i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
1169 #endif
1170 #ifdef CONFIG_I2C_GPIO_RK30
1171         i2c_register_board_info(4, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
1172 #endif
1173 }
1174 //end of i2c
1175
1176 #define POWER_ON_PIN RK2928_PIN1_PA2   //power_hold
1177 static void rk2928_pm_power_off(void)
1178 {
1179         printk(KERN_ERR "rk2928_pm_power_off start...\n");
1180         
1181         #if defined(CONFIG_REGULATOR_ACT8931)
1182          if (pmic_is_act8931() ){
1183               if(act8931_charge_det)
1184                    arm_pm_restart(0, NULL);
1185                 act8931_device_shutdown();
1186          }
1187         #endif
1188         
1189         #if defined(CONFIG_MFD_TPS65910)        
1190          if(pmic_is_tps65910() )
1191                 tps65910_device_shutdown();//tps65910 shutdown
1192         #endif
1193         gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
1194         
1195 };
1196
1197 static void __init rk2928_board_init(void)
1198 {
1199         gpio_request(POWER_ON_PIN, "poweronpin");
1200         gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
1201  
1202         pm_power_off = rk2928_pm_power_off;
1203         
1204         rk30_i2c_register_board_info();
1205         spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
1206         platform_add_devices(devices, ARRAY_SIZE(devices));
1207
1208 #ifdef CONFIG_WIFI_CONTROL_FUNC
1209         rk29sdk_wifi_bt_gpio_control_init();
1210 #endif
1211 }
1212
1213 static void __init rk2928_reserve(void)
1214 {
1215 #ifdef CONFIG_ION
1216         rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
1217 #endif
1218 #ifdef CONFIG_FB_ROCKCHIP
1219         resource_fb[0].start = board_mem_reserve_add("fb0", RK30_FB0_MEM_SIZE);
1220         resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1;
1221 #endif
1222 #ifdef CONFIG_VIDEO_RK29
1223         rk30_camera_request_reserve_mem();
1224 #endif
1225         board_mem_reserved();
1226 }
1227 /**
1228  * dvfs_cpu_logic_table: table for arm and logic dvfs 
1229  * @frequency   : arm frequency
1230  * @cpu_volt    : arm voltage depend on frequency
1231  * @logic_volt  : logic voltage arm requests depend on frequency
1232  * comments     : min arm/logic voltage
1233  */
1234 static struct dvfs_arm_table dvfs_cpu_logic_table[] = {
1235 #if 1
1236         {.frequency = 216 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},
1237         {.frequency = 312 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},
1238         {.frequency = 408 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},
1239         {.frequency = 504 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},
1240         {.frequency = 600 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},
1241         {.frequency = 696 * 1000,       .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
1242         {.frequency = 816 * 1000,       .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
1243         {.frequency = 912 * 1000,       .cpu_volt = 1450 * 1000,        .logic_volt = 1200 * 1000},
1244         {.frequency = 1008 * 1000,      .cpu_volt = 1500 * 1000,        .logic_volt = 1200 * 1000},
1245 #else
1246         {.frequency = 216 * 1000,       .cpu_volt =  850 * 1000,        .logic_volt = 1200 * 1000},
1247         {.frequency = 312 * 1000,       .cpu_volt =  900 * 1000,        .logic_volt = 1200 * 1000},
1248         {.frequency = 408 * 1000,       .cpu_volt =  950 * 1000,        .logic_volt = 1200 * 1000},
1249         {.frequency = 504 * 1000,       .cpu_volt = 1000 * 1000,        .logic_volt = 1200 * 1000},
1250         {.frequency = 600 * 1000,       .cpu_volt = 1100 * 1000,        .logic_volt = 1200 * 1000},
1251         {.frequency = 696 * 1000,       .cpu_volt = 1175 * 1000,        .logic_volt = 1200 * 1000},
1252         {.frequency = 816 * 1000,       .cpu_volt = 1250 * 1000,        .logic_volt = 1200 * 1000},
1253         {.frequency = 912 * 1000,       .cpu_volt = 1350 * 1000,        .logic_volt = 1200 * 1000},
1254         {.frequency = 1008 * 1000,      .cpu_volt = 1450 * 1000,        .logic_volt = 1200 * 1000},
1255 #endif
1256 #if 0
1257         {.frequency = 1104 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
1258         {.frequency = 1200 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
1259         {.frequency = 1104 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
1260         {.frequency = 1248 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
1261 #endif
1262         {.frequency = CPUFREQ_TABLE_END},
1263 };
1264
1265 static struct cpufreq_frequency_table dvfs_gpu_table[] = {
1266         {.frequency = 266 * 1000,       .index = 1050 * 1000},
1267         {.frequency = 400 * 1000,       .index = 1275 * 1000},
1268         {.frequency = CPUFREQ_TABLE_END},
1269 };
1270
1271 static struct cpufreq_frequency_table dvfs_ddr_table[] = {
1272         {.frequency = 300 * 1000,       .index = 1050 * 1000},
1273         {.frequency = 400 * 1000,       .index = 1125 * 1000},
1274         {.frequency = CPUFREQ_TABLE_END},
1275 };
1276
1277 #define DVFS_CPU_TABLE_SIZE     (ARRAY_SIZE(dvfs_cpu_logic_table))
1278 static struct cpufreq_frequency_table cpu_dvfs_table[DVFS_CPU_TABLE_SIZE];
1279 static struct cpufreq_frequency_table dep_cpu2core_table[DVFS_CPU_TABLE_SIZE];
1280
1281 void __init board_clock_init(void)
1282 {
1283         rk2928_clock_data_init(periph_pll_default, codec_pll_default, RK30_CLOCKS_DEFAULT_FLAGS);
1284         dvfs_set_arm_logic_volt(dvfs_cpu_logic_table, cpu_dvfs_table, dep_cpu2core_table);
1285         dvfs_set_freq_volt_table(clk_get(NULL, "gpu"), dvfs_gpu_table);
1286         //dvfs_set_freq_volt_table(clk_get(NULL, "ddr"), dvfs_ddr_table);
1287         printk("%s end\n", __func__);
1288 }
1289
1290
1291 MACHINE_START(RK2928, "RK2928board")
1292 .boot_params    = PLAT_PHYS_OFFSET + 0x800,
1293         .fixup          = rk2928_fixup,
1294         .reserve        = &rk2928_reserve,
1295         .map_io         = rk2928_map_io,
1296         .init_irq       = rk2928_init_irq,
1297         .timer          = &rk2928_timer,
1298         .init_machine   = rk2928_board_init,
1299         MACHINE_END