rk2928: a720: set min_brightness 80
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rk2928 / board-rk2928-a720.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/rk29-pwm-regulator.h>
49 #if defined(CONFIG_HDMI_RK30)
50         #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
51 #endif
52
53 #if defined(CONFIG_SPIM_RK29)
54 #include "../../../drivers/spi/rk29_spim.h"
55 #endif
56
57 #include "board-rk2928-a720-camera.c" 
58 #include "board-rk2928-a720-key.c"
59
60 #ifdef  CONFIG_THREE_FB_BUFFER
61 #define RK30_FB0_MEM_SIZE 12*SZ_1M
62 #else
63 #define RK30_FB0_MEM_SIZE 8*SZ_1M
64 #endif
65
66 static struct spi_board_info board_spi_devices[] = {
67 };
68
69 /***********************************************************
70 *       rk30  backlight
71 ************************************************************/
72 #ifdef CONFIG_BACKLIGHT_RK29_BL
73 #define PWM_ID            0
74 #define PWM_MUX_NAME      GPIO0D2_PWM_0_NAME
75 #define PWM_MUX_MODE      GPIO0D_PWM_0
76 #define PWM_MUX_MODE_GPIO GPIO0D_GPIO0D2
77 #define PWM_GPIO          RK2928_PIN0_PD2
78 #define PWM_EFFECT_VALUE  0
79
80 #define LCD_DISP_ON_PIN
81
82 #ifdef  LCD_DISP_ON_PIN
83
84 #define BL_EN_PIN         RK2928_PIN1_PB0
85 #define BL_EN_VALUE       GPIO_HIGH
86 #endif
87 static int rk29_backlight_io_init(void)
88 {
89         int ret = 0;
90         rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
91 #ifdef  LCD_DISP_ON_PIN
92         // rk30_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
93
94         ret = gpio_request(BL_EN_PIN, NULL);
95         if (ret != 0) {
96                 gpio_free(BL_EN_PIN);
97         }
98
99         gpio_direction_output(BL_EN_PIN, 0);
100         gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
101 #endif
102         return ret;
103 }
104
105 static int rk29_backlight_io_deinit(void)
106 {
107         int ret = 0;
108 #ifdef  LCD_DISP_ON_PIN
109         gpio_free(BL_EN_PIN);
110 #endif
111         rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
112         return ret;
113 }
114
115 static int rk29_backlight_pwm_suspend(void)
116 {
117         int ret = 0;
118         rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
119         if (gpio_request(PWM_GPIO, NULL)) {
120                 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
121                 return -1;
122         }
123         gpio_direction_output(PWM_GPIO, GPIO_LOW);
124 #ifdef  LCD_DISP_ON_PIN
125         gpio_direction_output(BL_EN_PIN, 0);
126         gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
127 #endif
128
129         return ret;
130 }
131
132 static int rk29_backlight_pwm_resume(void)
133 {
134         gpio_free(PWM_GPIO);
135         rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
136 #ifdef  LCD_DISP_ON_PIN
137         msleep(30);
138         gpio_direction_output(BL_EN_PIN, 1);
139         gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
140 #endif
141         return 0;
142 }
143
144 static struct rk29_bl_info rk29_bl_info = {
145         .pwm_id = PWM_ID,
146         .min_brightness = 80,
147         .bl_ref = PWM_EFFECT_VALUE,
148         .io_init = rk29_backlight_io_init,
149         .io_deinit = rk29_backlight_io_deinit,
150         .pwm_suspend = rk29_backlight_pwm_suspend,
151         .pwm_resume = rk29_backlight_pwm_resume,
152 };
153
154 static struct platform_device rk29_device_backlight = {
155         .name   = "rk29_backlight",
156         .id     = -1,
157         .dev    = {
158                 .platform_data  = &rk29_bl_info,
159         }
160 };
161
162 #endif
163
164 #ifdef CONFIG_FB_ROCKCHIP
165
166 #define LCD_MUX_NAME  GPIO0C2_UART0_RTSN_NAME
167 #define LCD_GPIO_MODE GPIO0C_GPIO0C2
168
169 #define LCD_EN        RK2928_PIN0_PC2
170 #define LCD_EN_VALUE  GPIO_LOW
171
172 static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
173 {
174         int ret = 0;
175
176         rk30_mux_api_set(LCD_MUX_NAME, LCD_GPIO_MODE);
177
178         ret = gpio_request(LCD_EN, NULL);
179         if (ret != 0)
180         {
181                 gpio_free(LCD_EN);
182                 printk(KERN_ERR "request lcd en pin fail!\n");
183                 return -1;
184         }
185         else
186         {
187                 gpio_direction_output(LCD_EN, LCD_EN_VALUE); //disable
188         }
189         return 0;
190 }
191 static int rk_fb_io_disable(void)
192 {
193         gpio_set_value(LCD_EN, !LCD_EN_VALUE);
194         return 0;
195 }
196 static int rk_fb_io_enable(void)
197 {
198         gpio_set_value(LCD_EN, LCD_EN_VALUE);
199         return 0;
200 }
201
202 #if defined(CONFIG_LCDC_RK2928)
203 struct rk29fb_info lcdc_screen_info = {
204         .prop      = PRMRY,             //primary display device
205         .io_init   = rk_fb_io_init,
206         .io_disable = rk_fb_io_disable,
207         .io_enable = rk_fb_io_enable,
208         .set_screen_info = set_lcd_info,
209 };
210 #endif
211
212 static struct resource resource_fb[] = {
213         [0] = {
214                 .name  = "fb0 buf",
215                 .start = 0,
216                 .end   = 0,//RK30_FB0_MEM_SIZE - 1,
217                 .flags = IORESOURCE_MEM,
218         },
219         [1] = {
220                 .name  = "ipp buf",  //for rotate
221                 .start = 0,
222                 .end   = 0,//RK30_FB0_MEM_SIZE - 1,
223                 .flags = IORESOURCE_MEM,
224         },
225         [2] = {
226                 .name  = "fb2 buf",
227                 .start = 0,
228                 .end   = 0,//RK30_FB0_MEM_SIZE - 1,
229                 .flags = IORESOURCE_MEM,
230         },
231 };
232
233 static struct platform_device device_fb = {
234         .name           = "rk-fb",
235         .id             = -1,
236         .num_resources  = ARRAY_SIZE(resource_fb),
237         .resource       = resource_fb,
238 };
239 #endif
240
241 #ifdef CONFIG_ION
242 #define ION_RESERVE_SIZE        (80 * SZ_1M)
243 static struct ion_platform_data rk30_ion_pdata = {
244         .nr = 1,
245         .heaps = {
246                 {
247                         .type = ION_HEAP_TYPE_CARVEOUT,
248                         .id = ION_NOR_HEAP_ID,
249                         .name = "norheap",
250                         .size = ION_RESERVE_SIZE,
251                 }
252         },
253 };
254
255 static struct platform_device device_ion = {
256         .name = "ion-rockchip",
257         .id = 0,
258         .dev = {
259                 .platform_data = &rk30_ion_pdata,
260         },
261 };
262 #endif
263
264
265 #if defined(CONFIG_TOUCHSCREEN_SITRONIX_A720)
266
267 #define TOUCH_RESET_PIN  RK2928_PIN1_PA3
268 #define TOUCH_INT_PIN    RK2928_PIN1_PB3
269 int ft5306_init_platform_hw(void)
270 {
271
272         //printk("ft5306_init_platform_hw\n");
273         if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
274                 gpio_free(TOUCH_RESET_PIN);
275                 printk("ft5306_init_platform_hw gpio_request error\n");
276                 return -EIO;
277         }
278
279         if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
280                 gpio_free(TOUCH_INT_PIN);
281                 printk("ift5306_init_platform_hw gpio_request error\n");
282                 return -EIO;
283         }
284         gpio_direction_output(TOUCH_RESET_PIN, GPIO_HIGH);
285         mdelay(10);
286         gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
287         mdelay(10);
288         gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
289         msleep(300);
290         return 0;
291
292 }
293
294 struct ft5x0x_platform_data sitronix_info = {
295         .model = 5007,
296         .init_platform_hw= ft5306_init_platform_hw,
297 };
298
299 #endif
300
301
302 /*MMA7660 gsensor*/
303 #if defined (CONFIG_GS_MMA7660)
304 #define MMA7660_INT_PIN   RK2928_PIN1_PB1
305
306 static int mma7660_init_platform_hw(void)
307 {
308         rk30_mux_api_set(GPIO1B1_SPI_TXD_UART1_SOUT_NAME, GPIO1B_GPIO1B1);
309
310         return 0;
311 }
312
313 static struct sensor_platform_data mma7660_info = {
314         .type = SENSOR_TYPE_ACCEL,
315         .irq_enable = 1,
316         .poll_delay_ms = 30,
317         .init_platform_hw = mma7660_init_platform_hw,
318         .orientation = {-1, 0, 0, 0, 0, 1, 0, -1, 0},
319 };
320 #endif
321
322
323 #if CONFIG_RK30_PWM_REGULATOR
324 const static int pwm_voltage_map[] = {
325         1000000, 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000
326 };
327
328 static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
329         {
330                 .supply = "vdd_core",
331         }
332 };
333
334 struct regulator_init_data pwm_regulator_init_dcdc[1] =
335 {
336         {
337                 .constraints = {
338                         .name = "PWM_DCDC1",
339                         .min_uV = 600000,
340                         .max_uV = 1800000,      //0.6-1.8V
341                         .apply_uV = true,
342                         .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
343                 },
344                 .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
345                 .consumer_supplies = pwm_dcdc1_consumers,
346         },
347 };
348
349 static struct pwm_platform_data pwm_regulator_info[1] = {
350         {
351                 .pwm_id = 2,
352                 .pwm_gpio = RK2928_PIN0_PD4,
353                 .pwm_iomux_name = GPIO0D4_PWM_2_NAME,
354                 .pwm_iomux_pwm = GPIO0D_PWM_2, 
355                 .pwm_iomux_gpio = GPIO0D_GPIO0D4,
356                 .pwm_voltage = 1200000,
357                 .suspend_voltage = 1050000,
358                 .min_uV = 1000000,
359                 .max_uV = 1400000,
360                 .coefficient = 455,     //45.5%
361                 .pwm_voltage_map = pwm_voltage_map,
362                 .init_data      = &pwm_regulator_init_dcdc[0],
363         },
364 };
365
366 struct platform_device pwm_regulator_device[1] = {
367         {
368                 .name = "pwm-voltage-regulator",
369                 .id = 0,
370                 .dev            = {
371                         .platform_data = &pwm_regulator_info[0],
372                 }
373         },
374 };
375 #endif
376 /**************************************************************************************************
377  * SDMMC devices,  include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
378 **************************************************************************************************/
379 #ifdef CONFIG_SDMMC_RK29
380 #include "board-rk2928-sdk-sdmmc.c"
381
382 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
383 #define SDMMC0_WRITE_PROTECT_PIN        RK2928_PIN1_PA7 //According to your own project to set the value of write-protect-pin.
384 #endif
385
386 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
387 #define SDMMC1_WRITE_PROTECT_PIN        RK2928_PIN0_PD5 //According to your own project to set the value of write-protect-pin.
388 #endif
389
390 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N    RK2928_PIN0_PB2
391
392 #endif //endif ---#ifdef CONFIG_SDMMC_RK29
393
394 #ifdef CONFIG_SDMMC0_RK29
395 static int rk29_sdmmc0_cfg_gpio(void)
396 {
397         rk29_sdmmc_set_iomux(0, 0xFFFF);
398
399         rk30_mux_api_set(GPIO1C1_MMC0_DETN_NAME, GPIO1C_MMC0_DETN);
400
401 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
402         gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
403         gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
404 #endif
405
406         return 0;
407 }
408
409 #define CONFIG_SDMMC0_USE_DMA
410 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
411         .host_ocr_avail =
412             (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
413              MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
414              MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
415         .host_caps =
416             (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
417         .io_init = rk29_sdmmc0_cfg_gpio,
418
419 #if !defined(CONFIG_SDMMC_RK29_OLD)
420         .set_iomux = rk29_sdmmc_set_iomux,
421 #endif
422
423         .dma_name = "sd_mmc",
424 #ifdef CONFIG_SDMMC0_USE_DMA
425         .use_dma = 1,
426 #else
427         .use_dma = 0,
428 #endif
429         .detect_irq = RK2928_PIN1_PC1,  // INVALID_GPIO
430         .enable_sd_wakeup = 0,
431
432 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
433         .write_prt = SDMMC0_WRITE_PROTECT_PIN,
434 #else
435         .write_prt = INVALID_GPIO,
436 #endif
437 };
438 #endif // CONFIG_SDMMC0_RK29
439
440 #ifdef CONFIG_SND_SOC_RK2928
441 static struct resource resources_acodec[] = {
442         {
443                 .start  = RK2928_ACODEC_PHYS,
444                 .end    = RK2928_ACODEC_PHYS + RK2928_ACODEC_SIZE - 1,
445                 .flags  = IORESOURCE_MEM,
446         },
447         {
448                 .start  = RK2928_PIN1_PA0,
449                 .end    = RK2928_PIN1_PA0,
450                 .flags  = IORESOURCE_IO,
451         },
452 };
453
454 static struct platform_device device_acodec = {
455         .name   = "rk2928-codec",
456         .id             = -1,
457         .num_resources  = ARRAY_SIZE(resources_acodec),
458         .resource       = resources_acodec,
459 };
460 #endif
461
462 static struct platform_device *devices[] __initdata = {
463 #ifdef CONFIG_BACKLIGHT_RK29_BL
464         &rk29_device_backlight,
465 #endif
466 #ifdef CONFIG_FB_ROCKCHIP
467         &device_fb,
468 #endif
469 #ifdef CONFIG_ION
470         &device_ion,
471 #endif
472 #ifdef CONFIG_SND_SOC_RK2928
473         &device_acodec,
474 #endif
475 };
476 //i2c
477 #ifdef CONFIG_I2C0_RK30
478 #ifdef CONFIG_MFD_TPS65910
479 #define TPS65910_HOST_IRQ        RK2928_PIN1_PB2
480 #include "board-rk2928-a720-tps65910.c"
481 #endif
482 static struct i2c_board_info __initdata i2c0_info[] = {
483 #if defined (CONFIG_MFD_TPS65910)
484         {
485         .type           = "tps65910",
486         .addr           = TPS65910_I2C_ID0,
487         .flags          = 0,
488         .irq            = TPS65910_HOST_IRQ,
489         .platform_data = &tps65910_data,
490         },
491 #endif
492 };
493 #endif
494 #ifdef CONFIG_I2C1_RK30
495 static struct i2c_board_info __initdata i2c1_info[] = {
496 #if defined (CONFIG_GS_MMA7660)
497                 {
498                         .type           = "gs_mma7660",
499                         .addr           = 0x4c,
500                         .flags          = 0,
501                         .irq            = MMA7660_INT_PIN,
502                         .platform_data = &mma7660_info,
503                 },
504 #endif
505
506 };
507 #endif
508 #ifdef CONFIG_I2C2_RK30
509 static struct i2c_board_info __initdata i2c2_info[] = {
510 #if defined (CONFIG_TOUCHSCREEN_SITRONIX_A720)
511 {
512         .type           ="sitronix",
513         .addr           = 0x38,
514         .flags          = 0,
515         .irq            = TOUCH_INT_PIN,
516         .platform_data = &sitronix_info,
517 },
518 #endif
519 };
520 #endif
521 #ifdef CONFIG_I2C3_RK30
522 static struct i2c_board_info __initdata i2c3_info[] = {
523 };
524 #endif
525 #ifdef CONFIG_I2C_GPIO_RK30
526 #define I2C_SDA_PIN     INVALID_GPIO   //set sda_pin here
527 #define I2C_SCL_PIN     INVALID_GPIO   //set scl_pin here
528 static int rk30_i2c_io_init(void)
529 {
530         //set iomux (gpio) here
531
532         return 0;
533 }
534 struct i2c_gpio_platform_data default_i2c_gpio_data = {
535        .sda_pin = I2C_SDA_PIN,
536        .scl_pin = I2C_SCL_PIN,
537        .udelay = 5, // clk = 500/udelay = 100Khz
538        .timeout = 100,//msecs_to_jiffies(100),
539        .bus_num    = 5,
540        .io_init = rk30_i2c_io_init,
541 };
542 static struct i2c_board_info __initdata i2c_gpio_info[] = {
543 };
544 #endif
545 static void __init rk30_i2c_register_board_info(void)
546 {
547 #ifdef CONFIG_I2C0_RK30
548         i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
549 #endif
550 #ifdef CONFIG_I2C1_RK30
551         i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
552 #endif
553 #ifdef CONFIG_I2C2_RK30
554         i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
555 #endif
556 #ifdef CONFIG_I2C3_RK30
557         i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
558 #endif
559 #ifdef CONFIG_I2C_GPIO_RK30
560         i2c_register_board_info(4, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
561 #endif
562 }
563 //end of i2c
564
565 #define POWER_ON_PIN RK2928_PIN1_PA2   //power_hold
566 static void rk2928_pm_power_off(void)
567 {
568         printk(KERN_ERR "rk2928_pm_power_off start...\n");
569         
570         #if defined(CONFIG_MFD_TPS65910)
571                 tps65910_device_shutdown();//tps65910 shutdown
572         #endif
573         gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
574         
575 };
576
577 static void __init rk2928_board_init(void)
578 {
579         gpio_request(POWER_ON_PIN, "poweronpin");
580         gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
581         gpio_free(POWER_ON_PIN);
582         
583         pm_power_off = rk2928_pm_power_off;
584         
585         rk30_i2c_register_board_info();
586         spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
587         platform_add_devices(devices, ARRAY_SIZE(devices));
588
589 }
590
591 static void __init rk2928_reserve(void)
592 {
593 #ifdef CONFIG_ION
594         rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
595 #endif
596 #ifdef CONFIG_FB_ROCKCHIP
597         resource_fb[0].start = board_mem_reserve_add("fb0", RK30_FB0_MEM_SIZE);
598         resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1;
599 #endif
600 #ifdef CONFIG_VIDEO_RK29
601         rk30_camera_request_reserve_mem();
602 #endif
603         board_mem_reserved();
604 }
605 /**
606  * dvfs_cpu_logic_table: table for arm and logic dvfs 
607  * @frequency   : arm frequency
608  * @cpu_volt    : arm voltage depend on frequency
609  * @logic_volt  : logic voltage arm requests depend on frequency
610  * comments     : min arm/logic voltage
611  */
612 static struct dvfs_arm_table dvfs_cpu_logic_table[] = {
613         {.frequency = 216 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},//0.975V/1.000V
614         {.frequency = 312 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},//0.975V/1.000V
615         {.frequency = 408 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},//1.000V/1.025V
616         {.frequency = 504 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},//1.000V/1.025V
617         {.frequency = 600 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},//1.025V/1.050V
618         {.frequency = 696 * 1000,       .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},//1.000V/1.025V
619         {.frequency = 816 * 1000,       .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},//1.100V/1.050V
620         //{.frequency = 912 * 1000,     .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},//1.100V/1.050V
621         //{.frequency = 1008 * 1000,    .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},//1.100V/1.050V
622 #if 0
623         {.frequency = 1104 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},//1.100V/1.050V
624         {.frequency = 1200 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},//1.100V/1.050V
625         {.frequency = 1104 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},//1.100V/1.050V
626         {.frequency = 1248 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},//1.100V/1.050V
627 #endif
628         //{.frequency = 1000 * 1000,    .cpu_volt = 1225 * 1000,        .logic_volt = 1200 * 1000},//1.150V/1.100V
629         {.frequency = CPUFREQ_TABLE_END},
630 };
631
632 static struct cpufreq_frequency_table dvfs_gpu_table[] = {
633         {.frequency = 266 * 1000,       .index = 1050 * 1000},
634         {.frequency = 400 * 1000,       .index = 1275 * 1000},
635         {.frequency = CPUFREQ_TABLE_END},
636 };
637
638 static struct cpufreq_frequency_table dvfs_ddr_table[] = {
639         {.frequency = 300 * 1000,       .index = 1050 * 1000},
640         {.frequency = 400 * 1000,       .index = 1125 * 1000},
641         {.frequency = CPUFREQ_TABLE_END},
642 };
643
644 #define DVFS_CPU_TABLE_SIZE     (ARRAY_SIZE(dvfs_cpu_logic_table))
645 static struct cpufreq_frequency_table cpu_dvfs_table[DVFS_CPU_TABLE_SIZE];
646 static struct cpufreq_frequency_table dep_cpu2core_table[DVFS_CPU_TABLE_SIZE];
647
648 void __init board_clock_init(void)
649 {
650         rk2928_clock_data_init(periph_pll_default, codec_pll_default, RK30_CLOCKS_DEFAULT_FLAGS);
651         dvfs_set_arm_logic_volt(dvfs_cpu_logic_table, cpu_dvfs_table, dep_cpu2core_table);
652         dvfs_set_freq_volt_table(clk_get(NULL, "gpu"), dvfs_gpu_table);
653         //dvfs_set_freq_volt_table(clk_get(NULL, "ddr"), dvfs_ddr_table);
654         printk("%s end\n", __func__);
655 }
656
657
658 MACHINE_START(RK2928, "RK2928board")
659         .boot_params    = PLAT_PHYS_OFFSET + 0x800,
660         .fixup          = rk2928_fixup,
661         .reserve        = &rk2928_reserve,
662         .map_io         = rk2928_map_io,
663         .init_irq       = rk2928_init_irq,
664         .timer          = &rk2928_timer,
665         .init_machine   = rk2928_board_init,
666 MACHINE_END