3 * Copyright (C) 2012 ROCKCHIP, Inc.
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.
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.
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/platform_device.h>
19 #include <linux/input.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>
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>
38 #include <mach/board.h>
39 #include <mach/hardware.h>
41 #include <mach/gpio.h>
42 #include <mach/iomux.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"
53 #if defined(CONFIG_SPIM_RK29)
54 #include "../../../drivers/spi/rk29_spim.h"
56 #if defined(CONFIG_MU509)
57 #include <linux/mu509.h>
59 #if defined(CONFIG_MW100)
60 #include <linux/mw100.h>
62 #if defined(CONFIG_MT6229)
63 #include <linux/mt6229.h>
65 #if defined(CONFIG_SEW868)
66 #include <linux/sew868.h>
68 #if defined(CONFIG_ANDROID_TIMED_GPIO)
69 #include "../../../drivers/staging/android/timed_gpio.h"
72 #ifdef CONFIG_THREE_FB_BUFFER
73 #define RK30_FB0_MEM_SIZE 12*SZ_1M
75 #define RK30_FB0_MEM_SIZE 8*SZ_1M
78 #include "board-rk3066b-sdk-camera.c"
79 #include "board-rk3066b-m701-key.c"
81 #if defined(CONFIG_TOUCHSCREEN_GT8XX)
82 #define TOUCH_RESET_PIN RK30_PIN2_PC0
83 #define TOUCH_PWR_PIN RK30_PIN2_PB4
84 static int goodix_init_platform_hw(void)
88 rk30_mux_api_set(GPIO2C0_LCDC1DATA16_SMCADDR0_TRACECLK_NAME, GPIO2C_GPIO2C0);
89 rk30_mux_api_set(GPIO2B4_LCDC1DATA12_SMCDATA12_TRACEDATA12_NAME, GPIO2B_GPIO2B4);
90 printk("%s:0x%x,0x%x\n",__func__,rk30_mux_api_get(GPIO2C0_LCDC1DATA16_SMCADDR0_TRACECLK_NAME),rk30_mux_api_get(GPIO2B4_LCDC1DATA12_SMCDATA12_TRACEDATA12_NAME));
92 if (TOUCH_PWR_PIN != INVALID_GPIO) {
93 ret = gpio_request(TOUCH_PWR_PIN, "goodix power pin");
95 gpio_free(TOUCH_PWR_PIN);
96 printk("goodix power error\n");
99 gpio_direction_output(TOUCH_PWR_PIN, 0);
100 gpio_set_value(TOUCH_PWR_PIN, GPIO_LOW);
104 if (TOUCH_RESET_PIN != INVALID_GPIO) {
105 ret = gpio_request(TOUCH_RESET_PIN, "goodix reset pin");
107 gpio_free(TOUCH_RESET_PIN);
108 printk("goodix gpio_request error\n");
111 gpio_direction_output(TOUCH_RESET_PIN, 1);
113 //gpio_set_value(TOUCH_RESET_PIN, GPIO_LOW);
115 //gpio_set_value(TOUCH_RESET_PIN, GPIO_HIGH);
121 struct goodix_platform_data goodix_info = {
123 .irq_pin = RK30_PIN0_PD4,
124 .rest_pin = TOUCH_RESET_PIN,
125 .init_platform_hw = goodix_init_platform_hw,
129 #if defined (CONFIG_TOUCHSCREEN_FT5306)
131 #define TOUCH_RESET_PIN RK30_PIN2_PC0
132 #define TOUCH_INT_PIN RK30_PIN0_PD4
133 #define TOUCH_PWR_PIN RK30_PIN2_PB4
135 static int ft5x0x_init_platform_hw(void)
138 rk30_mux_api_set(GPIO2C0_LCDC1DATA16_SMCADDR0_TRACECLK_NAME, GPIO2C_GPIO2C0);
139 rk30_mux_api_set(GPIO2B4_LCDC1DATA12_SMCDATA12_TRACEDATA12_NAME, GPIO2B_GPIO2B4);
140 //printk("%s:0x%x,0x%x\n",__func__,rk30_mux_api_get(GPIO2C0_LCDC1DATA16_SMCADDR0_TRACECLK_NAME),rk30_mux_api_get(GPIO2B4_LCDC1DATA12_SMCDATA12_TRACEDATA12_NAME));
142 printk("==ft5x0x_init_platform_hw =\n");
143 if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
144 gpio_free(TOUCH_RESET_PIN);
145 printk("ft5606_init_platform_hw gpio_request error\n");
149 if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
150 gpio_free(TOUCH_INT_PIN);
151 printk("ift5606_init_platform_hw gpio_request error\n");
155 gpio_direction_output(TOUCH_RESET_PIN, 0);
156 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
158 gpio_direction_input(TOUCH_INT_PIN);
160 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
165 void ft5x0x_exit_platform_hw(void)
167 printk("ft5606_exit_platform_hw\n");
168 gpio_free(TOUCH_RESET_PIN);
169 gpio_free(TOUCH_INT_PIN);
172 int ft5x0x_platform_sleep(void)
174 printk("ft5606_platform_sleep\n");
175 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
179 int ft5x0x_platform_wakeup(void)
181 printk("ft5606_platform_wakeup\n");
182 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
187 static struct ft5606_platform_data ft5x0x_info = {
188 .init_platform_hw= ft5x0x_init_platform_hw,
189 .exit_platform_hw= ft5x0x_exit_platform_hw,
190 .platform_sleep = ft5x0x_platform_sleep,
191 .platform_wakeup = ft5x0x_platform_wakeup,
196 static struct spi_board_info board_spi_devices[] = {
199 /***********************************************************
201 ************************************************************/
202 #ifdef CONFIG_BACKLIGHT_RK29_BL
204 #define PWM_MUX_NAME GPIO3D5_PWM2_JTAGTCK_OTGDRVVBUS_NAME
205 #define PWM_MUX_MODE GPIO3D_PWM2
206 #define PWM_MUX_MODE_GPIO GPIO3D_GPIO3D5
207 #define PWM_GPIO RK30_PIN3_PD5
208 #define PWM_EFFECT_VALUE 0
210 #define LCD_DISP_ON_PIN
212 #ifdef LCD_DISP_ON_PIN
213 #define BL_EN_PIN RK30_PIN0_PA2
214 #define BL_EN_VALUE GPIO_HIGH
216 static int rk29_backlight_io_init(void)
219 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
220 #ifdef LCD_DISP_ON_PIN
221 // rk30_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
223 ret = gpio_request(BL_EN_PIN, NULL);
225 gpio_free(BL_EN_PIN);
228 gpio_direction_output(BL_EN_PIN, 0);
229 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
234 static int rk29_backlight_io_deinit(void)
237 #ifdef LCD_DISP_ON_PIN
238 gpio_free(BL_EN_PIN);
240 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
244 static int rk29_backlight_pwm_suspend(void)
247 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
248 if (gpio_request(PWM_GPIO, NULL)) {
249 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
252 gpio_direction_output(PWM_GPIO, GPIO_LOW);
253 #ifdef LCD_DISP_ON_PIN
254 gpio_direction_output(BL_EN_PIN, 0);
255 gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
260 static int rk29_backlight_pwm_resume(void)
263 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
264 #ifdef LCD_DISP_ON_PIN
266 gpio_direction_output(BL_EN_PIN, 1);
267 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
272 static struct rk29_bl_info rk29_bl_info = {
274 .bl_ref = PWM_EFFECT_VALUE,
275 .io_init = rk29_backlight_io_init,
276 .io_deinit = rk29_backlight_io_deinit,
277 .pwm_suspend = rk29_backlight_pwm_suspend,
278 .pwm_resume = rk29_backlight_pwm_resume,
281 static struct platform_device rk29_device_backlight = {
282 .name = "rk29_backlight",
285 .platform_data = &rk29_bl_info,
291 #ifdef CONFIG_RK29_SUPPORT_MODEM
293 #define RK30_MODEM_POWER RK30_PIN2_PB0
294 #define RK30_MODEM_POWER_IOMUX rk29_mux_api_set(GPIO2B0_LCDC1DATA8_SMCDATA8_TRACEDATA8_NAME, GPIO2B_GPIO2B0)
296 static int rk30_modem_io_init(void)
298 printk("%s\n", __FUNCTION__);
299 RK30_MODEM_POWER_IOMUX;
304 static struct rk29_io_t rk30_modem_io = {
305 .io_addr = RK30_MODEM_POWER,
308 .io_init = rk30_modem_io_init,
311 static struct platform_device rk30_device_modem = {
312 .name = "rk30_modem",
315 .platform_data = &rk30_modem_io,
319 #if defined(CONFIG_MU509)
320 static int mu509_io_init(void)
323 rk30_mux_api_set(GPIO2B0_LCDC1DATA8_SMCDATA8_TRACEDATA8_NAME, GPIO2B_GPIO2B0);
324 rk30_mux_api_set(GPIO2D1_LCDC1DEN_SMCWEN_NAME, GPIO2D_GPIO2D1);
325 rk30_mux_api_set(GPIO2B7_LCDC1DATA15_SMCADDR19_HSADCDATA7_NAME, GPIO2B_GPIO2B7);
326 rk30_mux_api_set(GPIO2C0_LCDCDATA16_GPSCLK_HSADCCLKOUT_NAME, GPIO2C_GPIO2C0);
330 static int mu509_io_deinit(void)
336 struct rk29_mu509_data rk29_mu509_info = {
337 .io_init = mu509_io_init,
338 .io_deinit = mu509_io_deinit,
339 .modem_power_en = RK30_PIN2_PB0,
340 .bp_power = RK30_PIN2_PB0,
341 .bp_reset = RK30_PIN2_PD1,
342 .ap_wakeup_bp = RK30_PIN2_PB7,
343 .bp_wakeup_ap = RK30_PIN6_PA0,
345 struct platform_device rk29_device_mu509 = {
349 .platform_data = &rk29_mu509_info,
353 #if defined(CONFIG_MW100)
354 static int mw100_io_init(void)
356 rk30_mux_api_set(GPIO2B0_LCDC1DATA8_SMCDATA8_TRACEDATA8_NAME, GPIO2B_GPIO2B0);
357 rk30_mux_api_set(GPIO2D1_LCDC1DEN_SMCWEN_NAME, GPIO2D_GPIO2D1);
358 rk30_mux_api_set(GPIO2B7_LCDC1DATA15_SMCADDR19_HSADCDATA7_NAME, GPIO2B_GPIO2B7);
359 rk30_mux_api_set(GPIO2C0_LCDCDATA16_GPSCLK_HSADCCLKOUT_NAME, GPIO2C_GPIO2C0);
363 static int mw100_io_deinit(void)
369 struct rk29_mw100_data rk29_mw100_info = {
370 .io_init = mw100_io_init,
371 .io_deinit = mw100_io_deinit,
372 .modem_power_en = RK30_PIN6_PB0,
373 .bp_power = RK30_PIN2_PB0,
374 .bp_reset = RK30_PIN2_PD1,
375 .ap_wakeup_bp = RK30_PIN2_PB7,
376 .bp_wakeup_ap = RK30_PIN6_PA0,
378 struct platform_device rk29_device_mw100 = {
382 .platform_data = &rk29_mw100_info,
386 #if defined(CONFIG_MT6229)
387 static int mt6229_io_init(void)
389 rk30_mux_api_set(GPIO2B0_LCDC1DATA8_SMCDATA8_TRACEDATA8_NAME, GPIO2B_GPIO2B0);
390 rk30_mux_api_set(GPIO2D1_LCDC1DEN_SMCWEN_NAME, GPIO2D_GPIO2D1);
391 rk30_mux_api_set(GPIO2B7_LCDC1DATA15_SMCADDR19_HSADCDATA7_NAME, GPIO2B_GPIO2B7);
392 rk30_mux_api_set(GPIO2C0_LCDCDATA16_GPSCLK_HSADCCLKOUT_NAME, GPIO2C_GPIO2C0);
396 static int mt6229_io_deinit(void)
402 struct rk29_mt6229_data rk29_mt6229_info = {
403 .io_init = mt6229_io_init,
404 .io_deinit = mt6229_io_deinit,
405 .modem_power_en = RK30_PIN2_PB0,
406 .bp_power = RK30_PIN2_PB0,//RK30_PIN2_PB6,
407 .bp_reset = RK30_PIN2_PD1,
408 .ap_wakeup_bp = RK30_PIN2_PC0,
409 .bp_wakeup_ap = RK30_PIN6_PA0,
411 struct platform_device rk29_device_mt6229 = {
415 .platform_data = &rk29_mt6229_info,
419 #if defined(CONFIG_SEW868)
420 static int sew868_io_init(void)
422 rk30_mux_api_set(GPIO2B6_LCDC1DATA14_SMCADDR18_TSSYNC_NAME, GPIO2B_GPIO2B6);
423 rk30_mux_api_set(GPIO4D2_SMCDATA10_TRACEDATA10_NAME, GPIO4D_GPIO4D2);
424 rk30_mux_api_set(GPIO4D4_SMCDATA12_TRACEDATA12_NAME, GPIO4D_GPIO4D4);
427 static int sew868_io_deinit(void)
431 struct rk30_sew868_data rk30_sew868_info = {
432 .io_init = sew868_io_init,
433 .io_deinit = sew868_io_deinit,
434 .bp_power = RK30_PIN6_PB2,
435 .bp_power_active_low = 1,
436 .bp_sys = RK30_PIN2_PB6,
437 .bp_reset = RK30_PIN4_PD2,
438 .bp_reset_active_low = 1,
439 .bp_wakeup_ap = RK30_PIN4_PD4,
440 .ap_wakeup_bp = NULL,
443 struct platform_device rk30_device_sew868 = {
447 .platform_data = &rk30_sew868_info,
453 #if defined (CONFIG_GS_MMA7660)
454 #define MMA7660_INT_PIN RK30_PIN4_PC0
455 static int gs_init_platform_hw(void)
457 rk30_mux_api_set(GPIO4C0_SMCDATA0_TRACEDATA0_NAME, GPIO4C_GPIO4C0);
458 if(gpio_request(MMA7660_INT_PIN, NULL) != 0){
459 gpio_free(MMA7660_INT_PIN);
460 printk("gsensor gpio_request error\n");
463 //gpio_direction_input(MMA7660_INT_PIN);
464 gpio_pull_updown(MMA7660_INT_PIN, 1);
469 static struct gs_platform_data mma7660_info = {
472 .init_platform_hw= gs_init_platform_hw,
478 #if defined (CONFIG_GS_MMA8452)
479 #define MMA8452_INT_PIN RK30_PIN3_PD7
481 static int mma8452_init_platform_hw(void)
486 static struct sensor_platform_data mma8452_info = {
487 .type = SENSOR_TYPE_ACCEL,
490 .init_platform_hw = mma8452_init_platform_hw,
491 .orientation = {-1, 0, 0, 0, 0, 1, 0, -1, 0},
494 #if defined (CONFIG_GS_LIS3DH)
495 #define LIS3DH_INT_PIN RK30_PIN3_PD7
497 static int lis3dh_init_platform_hw(void)
503 static struct sensor_platform_data lis3dh_info = {
504 .type = SENSOR_TYPE_ACCEL,
507 .init_platform_hw = lis3dh_init_platform_hw,
508 .orientation = {-1, 0, 0, 0, 0, 1, 0, -1, 0},
511 #if defined (CONFIG_COMPASS_AK8975)
512 static struct sensor_platform_data akm8975_info =
514 .type = SENSOR_TYPE_COMPASS,
547 #if defined(CONFIG_GYRO_L3G4200D)
549 #include <linux/l3g4200d.h>
550 #define L3G4200D_INT_PIN RK30_PIN0_PB4
552 static int l3g4200d_init_platform_hw(void)
557 static struct sensor_platform_data l3g4200d_info = {
558 .type = SENSOR_TYPE_GYROSCOPE,
561 .orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1},
562 .init_platform_hw = l3g4200d_init_platform_hw,
563 .x_min = 40,//x_min,y_min,z_min = (0-100) according to hardware
570 #ifdef CONFIG_LS_CM3217
571 static struct sensor_platform_data cm3217_info = {
572 .type = SENSOR_TYPE_LIGHT,
574 .poll_delay_ms = 500,
579 #ifdef CONFIG_FB_ROCKCHIP
581 #define LCD_CS_PIN INVALID_GPIO
582 #define LCD_CS_VALUE GPIO_HIGH
584 #define LCD_EN_PIN RK30_PIN0_PB0
585 #define LCD_EN_VALUE GPIO_HIGH
587 static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
591 if(LCD_CS_PIN !=INVALID_GPIO)
593 ret = gpio_request(LCD_CS_PIN, NULL);
596 gpio_free(LCD_CS_PIN);
597 printk(KERN_ERR "request lcd cs pin fail!\n");
602 gpio_direction_output(LCD_CS_PIN, LCD_CS_VALUE);
606 if(LCD_EN_PIN !=INVALID_GPIO)
608 ret = gpio_request(LCD_EN_PIN, NULL);
611 gpio_free(LCD_EN_PIN);
612 printk(KERN_ERR "request lcd en pin fail!\n");
617 gpio_direction_output(LCD_EN_PIN, LCD_EN_VALUE);
622 static int rk_fb_io_disable(void)
624 if(LCD_CS_PIN !=INVALID_GPIO)
626 gpio_set_value(LCD_CS_PIN, !LCD_CS_VALUE);
628 if(LCD_EN_PIN !=INVALID_GPIO)
630 gpio_set_value(LCD_EN_PIN, !LCD_EN_VALUE);
634 static int rk_fb_io_enable(void)
636 if(LCD_CS_PIN !=INVALID_GPIO)
638 gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE);
640 if(LCD_EN_PIN !=INVALID_GPIO)
642 gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE);
647 #if defined(CONFIG_LCDC0_RK3066B)
648 struct rk29fb_info lcdc0_screen_info = {
649 .prop = PRMRY, //primary display device
650 .io_init = rk_fb_io_init,
651 .io_disable = rk_fb_io_disable,
652 .io_enable = rk_fb_io_enable,
653 .set_screen_info = set_lcd_info,
657 #if defined(CONFIG_LCDC1_RK3066B)
658 struct rk29fb_info lcdc1_screen_info = {
659 #if defined(CONFIG_HDMI_RK30)
660 .prop = EXTEND, //extend display device
662 .set_screen_info = hdmi_init_lcdc,
667 static struct resource resource_fb[] = {
671 .end = 0,//RK30_FB0_MEM_SIZE - 1,
672 .flags = IORESOURCE_MEM,
675 .name = "ipp buf", //for rotate
677 .end = 0,//RK30_FB0_MEM_SIZE - 1,
678 .flags = IORESOURCE_MEM,
683 .end = 0,//RK30_FB0_MEM_SIZE - 1,
684 .flags = IORESOURCE_MEM,
688 static struct platform_device device_fb = {
691 .num_resources = ARRAY_SIZE(resource_fb),
692 .resource = resource_fb,
696 #if defined(CONFIG_LCDC0_RK3066B)
697 static struct resource resource_lcdc0[] = {
700 .start = RK30_LCDC0_PHYS,
701 .end = RK30_LCDC0_PHYS + RK30_LCDC0_SIZE - 1,
702 .flags = IORESOURCE_MEM,
709 .flags = IORESOURCE_IRQ,
713 static struct platform_device device_lcdc0 = {
716 .num_resources = ARRAY_SIZE(resource_lcdc0),
717 .resource = resource_lcdc0,
719 .platform_data = &lcdc0_screen_info,
723 #if defined(CONFIG_LCDC1_RK3066B)
724 static struct resource resource_lcdc1[] = {
727 .start = RK30_LCDC1_PHYS,
728 .end = RK30_LCDC1_PHYS + RK30_LCDC1_SIZE - 1,
729 .flags = IORESOURCE_MEM,
735 .flags = IORESOURCE_IRQ,
739 static struct platform_device device_lcdc1 = {
742 .num_resources = ARRAY_SIZE(resource_lcdc1),
743 .resource = resource_lcdc1,
745 .platform_data = &lcdc1_screen_info,
750 #ifdef CONFIG_ANDROID_TIMED_GPIO
751 static struct timed_gpio timed_gpios[] = {
754 .gpio = RK30_PIN3_PD3,
757 .adjust_time =20, //adjust for diff product
761 static struct timed_gpio_platform_data rk29_vibrator_info = {
763 .gpios = timed_gpios,
766 static struct platform_device rk29_device_vibrator = {
767 .name = "timed-gpio",
770 .platform_data = &rk29_vibrator_info,
776 #ifdef CONFIG_LEDS_GPIO_PLATFORM
777 static struct gpio_led rk29_leds[] = {
779 .name = "button-backlight",
780 .gpio = RK30_PIN2_PB3,
781 .default_trigger = "timer",
783 .retain_state_suspended = 0,
784 .default_state = LEDS_GPIO_DEFSTATE_OFF,
788 static struct gpio_led_platform_data rk29_leds_pdata = {
790 .num_leds = ARRAY_SIZE(rk29_leds),
793 static struct platform_device rk29_device_gpio_leds = {
797 .platform_data = &rk29_leds_pdata,
802 #ifdef CONFIG_RK_IRDA
803 #define IRDA_IRQ_PIN RK30_PIN0_PA3
805 static int irda_iomux_init(void)
810 ret = gpio_request(IRDA_IRQ_PIN, NULL);
812 gpio_free(IRDA_IRQ_PIN);
813 printk(">>>>>> IRDA_IRQ_PIN gpio_request err \n ");
815 gpio_pull_updown(IRDA_IRQ_PIN, PullDisable);
816 gpio_direction_input(IRDA_IRQ_PIN);
821 static int irda_iomux_deinit(void)
823 gpio_free(IRDA_IRQ_PIN);
827 static struct irda_info rk29_irda_info = {
828 .intr_pin = IRDA_IRQ_PIN,
829 .iomux_init = irda_iomux_init,
830 .iomux_deinit = irda_iomux_deinit,
831 //.irda_pwr_ctl = bu92747guw_power_ctl,
834 static struct platform_device irda_device = {
835 #ifdef CONFIG_RK_IRDA_NET
838 .name = "bu92747_irda",
842 .platform_data = &rk29_irda_info,
848 #define ION_RESERVE_SIZE (80 * SZ_1M)
849 static struct ion_platform_data rk30_ion_pdata = {
853 .type = ION_HEAP_TYPE_CARVEOUT,
854 .id = ION_NOR_HEAP_ID,
856 .size = ION_RESERVE_SIZE,
861 static struct platform_device device_ion = {
862 .name = "ion-rockchip",
865 .platform_data = &rk30_ion_pdata,
870 /**************************************************************************************************
871 * SDMMC devices, include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
872 **************************************************************************************************/
873 #ifdef CONFIG_SDMMC_RK29
874 #include "board-rk3066b-sdk-sdmmc.c"
876 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
877 #define SDMMC0_WRITE_PROTECT_PIN RK30_PIN3_PB7 //According to your own project to set the value of write-protect-pin.
880 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
881 #define SDMMC1_WRITE_PROTECT_PIN RK30_PIN3_PC7 //According to your own project to set the value of write-protect-pin.
884 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK30_PIN6_PB2
886 #endif //endif ---#ifdef CONFIG_SDMMC_RK29
888 #ifdef CONFIG_SDMMC0_RK29
889 static int rk29_sdmmc0_cfg_gpio(void)
891 #ifdef CONFIG_SDMMC_RK29_OLD
892 rk30_mux_api_set(GPIO3B1_SDMMC0CMD_NAME, GPIO3B_SDMMC0_CMD);
893 rk30_mux_api_set(GPIO3B0_SDMMC0CLKOUT_NAME, GPIO3B_SDMMC0_CLKOUT);
894 rk30_mux_api_set(GPIO3B2_SDMMC0DATA0_NAME, GPIO3B_SDMMC0_DATA0);
895 rk30_mux_api_set(GPIO3B3_SDMMC0DATA1_NAME, GPIO3B_SDMMC0_DATA1);
896 rk30_mux_api_set(GPIO3B4_SDMMC0DATA2_NAME, GPIO3B_SDMMC0_DATA2);
897 rk30_mux_api_set(GPIO3B5_SDMMC0DATA3_NAME, GPIO3B_SDMMC0_DATA3);
899 rk30_mux_api_set(GPIO3B6_SDMMC0DETECTN_NAME, GPIO3B_GPIO3B6);
901 rk30_mux_api_set(GPIO3A7_SDMMC0PWREN_NAME, GPIO3A_GPIO3A7);
902 gpio_request(RK30_PIN3_PA7, "sdmmc-power");
903 gpio_direction_output(RK30_PIN3_PA7, GPIO_LOW);
906 rk29_sdmmc_set_iomux(0, 0xFFFF);
908 rk30_mux_api_set(GPIO3B0_SDMMC0DETECTN_NAME, GPIO3B_SDMMC0DETECTN);
910 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
911 gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
912 gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
920 #define CONFIG_SDMMC0_USE_DMA
921 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
923 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
924 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
925 MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
927 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
928 .io_init = rk29_sdmmc0_cfg_gpio,
930 #if !defined(CONFIG_SDMMC_RK29_OLD)
931 .set_iomux = rk29_sdmmc_set_iomux,
934 .dma_name = "sd_mmc",
935 #ifdef CONFIG_SDMMC0_USE_DMA
940 .detect_irq = RK30_PIN3_PB6, // INVALID_GPIO
941 .enable_sd_wakeup = 0,
943 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
944 .write_prt = SDMMC0_WRITE_PROTECT_PIN,
946 .write_prt = INVALID_GPIO,
949 #endif // CONFIG_SDMMC0_RK29
951 #ifdef CONFIG_SDMMC1_RK29
952 #define CONFIG_SDMMC1_USE_DMA
953 static int rk29_sdmmc1_cfg_gpio(void)
955 #if defined(CONFIG_SDMMC_RK29_OLD)
956 rk30_mux_api_set(GPIO3C0_SMMC1CMD_NAME, GPIO3C_SMMC1_CMD);
957 rk30_mux_api_set(GPIO3C5_SDMMC1CLKOUT_NAME, GPIO3C_SDMMC1_CLKOUT);
958 rk30_mux_api_set(GPIO3C1_SDMMC1DATA0_NAME, GPIO3C_SDMMC1_DATA0);
959 rk30_mux_api_set(GPIO3C2_SDMMC1DATA1_NAME, GPIO3C_SDMMC1_DATA1);
960 rk30_mux_api_set(GPIO3C3_SDMMC1DATA2_NAME, GPIO3C_SDMMC1_DATA2);
961 rk30_mux_api_set(GPIO3C4_SDMMC1DATA3_NAME, GPIO3C_SDMMC1_DATA3);
962 //rk30_mux_api_set(GPIO3C6_SDMMC1DETECTN_NAME, GPIO3C_SDMMC1_DETECT_N);
966 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
967 gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp");
968 gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN);
976 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
978 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
979 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
982 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
983 .host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |
984 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
987 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
990 .io_init = rk29_sdmmc1_cfg_gpio,
992 #if !defined(CONFIG_SDMMC_RK29_OLD)
993 .set_iomux = rk29_sdmmc_set_iomux,
997 #ifdef CONFIG_SDMMC1_USE_DMA
1003 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
1004 #ifdef CONFIG_WIFI_CONTROL_FUNC
1005 .status = rk29sdk_wifi_status,
1006 .register_status_notify = rk29sdk_wifi_status_register,
1009 .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
1012 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
1013 .write_prt = SDMMC1_WRITE_PROTECT_PIN,
1015 .write_prt = INVALID_GPIO,
1019 .detect_irq = INVALID_GPIO,
1020 .enable_sd_wakeup = 0,
1024 #endif //endif--#ifdef CONFIG_SDMMC1_RK29
1026 /**************************************************************************************************
1027 * the end of setting for SDMMC devices
1028 **************************************************************************************************/
1030 #ifdef CONFIG_BATTERY_RK30_ADC
1031 static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
1032 .dc_det_pin = RK30_PIN0_PB2,
1033 .batt_low_pin = RK30_PIN0_PB1,
1034 .charge_set_pin = INVALID_GPIO,
1035 .charge_ok_pin = RK30_PIN0_PA6,
1036 .dc_det_level = GPIO_LOW,
1037 .charge_ok_level = GPIO_HIGH,
1040 static struct platform_device rk30_device_adc_battery = {
1041 .name = "rk30-battery",
1044 .platform_data = &rk30_adc_battery_platdata,
1048 #ifdef CONFIG_RK30_PWM_REGULATOR
1049 const static int pwm_voltage_map[] = {
1050 1000000, 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000
1053 static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
1055 .supply = "vdd_core",
1059 struct regulator_init_data pwm_regulator_init_dcdc[1] =
1063 .name = "PWM_DCDC1",
1065 .max_uV = 1800000, //0.6-1.8V
1067 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1069 .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
1070 .consumer_supplies = pwm_dcdc1_consumers,
1074 static struct pwm_platform_data pwm_regulator_info[1] = {
1077 .pwm_gpio = RK30_PIN3_PD6,
1078 .pwm_iomux_name = GPIO3D6_PWM3_JTAGTMS_HOSTDRVVBUS_NAME,
1079 .pwm_iomux_pwm = GPIO3D_PWM3,
1080 .pwm_iomux_gpio = GPIO3D_GPIO3D6,
1081 .pwm_voltage = 1000000,
1082 .suspend_voltage = 1050000,
1085 .coefficient = 455, //45.5%
1086 .pwm_voltage_map = pwm_voltage_map,
1087 .init_data = &pwm_regulator_init_dcdc[0],
1091 struct platform_device pwm_regulator_device[1] = {
1093 .name = "pwm-voltage-regulator",
1096 .platform_data = &pwm_regulator_info[0],
1102 #ifdef CONFIG_RK29_VMAC
1103 #define PHY_PWR_EN_GPIO RK30_PIN1_PD6
1104 #include "board-rk30-sdk-vmac.c"
1107 #ifdef CONFIG_RFKILL_RK
1108 // bluetooth rfkill device, its driver in net/rfkill/rfkill-rk.c
1109 static struct rfkill_rk_platform_data rfkill_rk_platdata = {
1110 .type = RFKILL_TYPE_BLUETOOTH,
1112 .poweron_gpio = { // BT_REG_ON
1113 .io = RK30_PIN3_PC7,
1114 .enable = GPIO_HIGH,
1116 .name = GPIO3C7_SDMMC1WRITEPRT_RMIICRS_NAME,
1117 .fgpio = GPIO3C_GPIO3C7,
1121 .reset_gpio = { // BT_RST
1122 .io = RK30_PIN3_PD1, // set io to INVALID_GPIO for disable it
1125 .name = GPIO3D1_SDMMC1BACKENDPWR_MIIMDCLK_NAME,
1126 .fgpio = GPIO3D_GPIO3D1,
1130 .wake_gpio = { // BT_WAKE, use to control bt's sleep and wakeup
1131 .io = RK30_PIN3_PC6, // set io to INVALID_GPIO for disable it
1132 .enable = GPIO_HIGH,
1134 .name = GPIO3C6_SDMMC1DETECTN_RMIIRXERR_NAME,
1135 .fgpio = GPIO3C_GPIO3C6,
1139 .wake_host_irq = { // BT_HOST_WAKE, for bt wakeup host when it is in deep sleep
1141 .io = RK30_PIN0_PA5, // set io to INVALID_GPIO for disable it
1142 .enable = GPIO_LOW, // set GPIO_LOW for falling, set 0 for rising
1149 .rts_gpio = { // UART_RTS, enable or disable BT's data coming
1150 .io = RK30_PIN1_PA3, // set io to INVALID_GPIO for disable it
1153 .name = GPIO1A3_UART0RTSN_NAME,
1154 .fgpio = GPIO1A_GPIO1A3,
1155 .fmux = GPIO1A_UART0RTSN,
1160 static struct platform_device device_rfkill_rk = {
1161 .name = "rfkill_rk",
1164 .platform_data = &rfkill_rk_platdata,
1169 static struct platform_device *devices[] __initdata = {
1170 #ifdef CONFIG_FB_ROCKCHIP
1173 #if defined(CONFIG_LCDC0_RK3066B)
1176 #if defined(CONFIG_LCDC1_RK3066B)
1180 #ifdef CONFIG_BACKLIGHT_RK29_BL
1181 &rk29_device_backlight,
1187 #ifdef CONFIG_ANDROID_TIMED_GPIO
1188 &rk29_device_vibrator,
1190 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1191 &rk29_device_gpio_leds,
1193 #ifdef CONFIG_RK_IRDA
1196 #ifdef CONFIG_WIFI_CONTROL_FUNC
1197 &rk29sdk_wifi_device,
1199 #ifdef CONFIG_RK29_SUPPORT_MODEM
1202 #if defined(CONFIG_MU509)
1205 #if defined(CONFIG_MW100)
1208 #if defined(CONFIG_MT6229)
1209 &rk29_device_mt6229,
1211 #if defined(CONFIG_SEW868)
1212 &rk30_device_sew868,
1214 #ifdef CONFIG_BATTERY_RK30_ADC
1215 &rk30_device_adc_battery,
1217 #ifdef CONFIG_RFKILL_RK
1223 #ifdef CONFIG_I2C0_RK30
1224 static struct i2c_board_info __initdata i2c0_info[] = {
1225 #if defined (CONFIG_GS_MMA7660)
1227 .type = "gs_mma7660",
1230 .irq = MMA7660_INT_PIN,
1231 .platform_data = &mma7660_info,
1234 #if defined (CONFIG_GS_MMA8452)
1236 .type = "gs_mma8452",
1239 .irq = MMA8452_INT_PIN,
1240 .platform_data = &mma8452_info,
1243 #if defined (CONFIG_GS_LIS3DH)
1245 .type = "gs_lis3dh",
1246 .addr = 0x19, //0x19(SA0-->VCC), 0x18(SA0-->GND)
1248 .irq = LIS3DH_INT_PIN,
1249 .platform_data = &lis3dh_info,
1252 #if defined (CONFIG_COMPASS_AK8975)
1257 .irq = RK30_PIN0_PD5,
1258 .platform_data = &akm8975_info,
1261 #if defined (CONFIG_GYRO_L3G4200D)
1263 .type = "l3g4200d_gryo",
1266 .irq = L3G4200D_INT_PIN,
1267 .platform_data = &l3g4200d_info,
1270 #if defined (CONFIG_SND_SOC_RK1000)
1272 .type = "rk1000_i2c_codec",
1277 .type = "rk1000_control",
1282 #if defined (CONFIG_SND_SOC_RT5631)
1289 #if defined (CONFIG_SND_SOC_ES8323)
1296 #ifdef CONFIG_MFD_RK610
1298 .type = "rk610_ctl",
1302 #ifdef CONFIG_RK610_TVOUT
1304 .type = "rk610_tvout",
1309 #ifdef CONFIG_HDMI_RK610
1311 .type = "rk610_hdmi",
1314 .irq = RK30_PIN0_PB6,
1317 #ifdef CONFIG_SND_SOC_RK610
1318 {//RK610_CODEC addr from 0x60 to 0x80 (0x60~0x80)
1319 .type = "rk610_i2c_codec",
1329 #define PMIC_TYPE_WM8326 1
1330 #define PMIC_TYPE_TPS65910 2
1331 int __sramdata g_pmic_type = 0;
1332 #ifdef CONFIG_I2C1_RK30
1333 #ifdef CONFIG_MFD_WM831X_I2C
1334 #include "board-rk3066b-sdk-wm8326.c"
1336 #ifdef CONFIG_MFD_TPS65910
1337 #define TPS65910_HOST_IRQ RK30_PIN0_PB3
1338 #include "board-rk3066b-sdk-tps65910.c"
1341 static struct i2c_board_info __initdata i2c1_info[] = {
1342 #if defined (CONFIG_MFD_WM831X_I2C)
1347 .irq = RK30_PIN0_PB3,
1348 .platform_data = &wm831x_platdata,
1351 #if defined (CONFIG_MFD_TPS65910)
1354 .addr = TPS65910_I2C_ID0,
1356 .irq = TPS65910_HOST_IRQ,
1357 .platform_data = &tps65910_data,
1363 void __sramfunc board_pmu_suspend(void)
1365 #if defined (CONFIG_MFD_WM831X_I2C)
1366 if(g_pmic_type == PMIC_TYPE_WM8326)
1367 board_pmu_wm8326_suspend();
1369 #if defined (CONFIG_MFD_TPS65910)
1370 if(g_pmic_type == PMIC_TYPE_TPS65910)
1371 board_pmu_tps65910_suspend();
1375 void __sramfunc board_pmu_resume(void)
1377 #if defined (CONFIG_MFD_WM831X_I2C)
1378 if(g_pmic_type == PMIC_TYPE_WM8326)
1379 board_pmu_wm8326_resume();
1381 #if defined (CONFIG_MFD_TPS65910)
1382 if(g_pmic_type == PMIC_TYPE_TPS65910)
1383 board_pmu_tps65910_resume();
1387 int __sramdata gpio0d7_iomux,gpio0d7_do,gpio0d7_dir,gpio0d7_en;
1389 void __sramfunc rk30_pwm_logic_suspend_voltage(void)
1391 #ifdef CONFIG_RK30_PWM_REGULATOR
1393 // int gpio0d7_iomux,gpio0d7_do,gpio0d7_dir,gpio0d7_en;
1395 gpio0d7_iomux = readl_relaxed(GRF_GPIO0D_IOMUX);
1396 gpio0d7_do = grf_readl(GRF_GPIO0H_DO);
1397 gpio0d7_dir = grf_readl(GRF_GPIO0H_DIR);
1398 gpio0d7_en = grf_readl(GRF_GPIO0H_EN);
1400 writel_relaxed((1<<30), GRF_GPIO0D_IOMUX);
1401 grf_writel((1<<31)|(1<<15), GRF_GPIO0H_DIR);
1402 grf_writel((1<<31)|(1<<15), GRF_GPIO0H_DO);
1403 grf_writel((1<<31)|(1<<15), GRF_GPIO0H_EN);
1406 void __sramfunc rk30_pwm_logic_resume_voltage(void)
1408 #ifdef CONFIG_RK30_PWM_REGULATOR
1409 writel_relaxed((1<<30)|gpio0d7_iomux, GRF_GPIO0D_IOMUX);
1410 grf_writel((1<<31)|gpio0d7_en, GRF_GPIO0H_EN);
1411 grf_writel((1<<31)|gpio0d7_dir, GRF_GPIO0H_DIR);
1412 grf_writel((1<<31)|gpio0d7_do, GRF_GPIO0H_DO);
1418 extern void pwm_suspend_voltage(void);
1419 extern void pwm_resume_voltage(void);
1420 void rk30_pwm_suspend_voltage_set(void)
1422 #ifdef CONFIG_RK30_PWM_REGULATOR
1423 pwm_suspend_voltage();
1426 void rk30_pwm_resume_voltage_set(void)
1428 #ifdef CONFIG_RK30_PWM_REGULATOR
1429 pwm_resume_voltage();
1434 #ifdef CONFIG_I2C2_RK30
1435 static struct i2c_board_info __initdata i2c2_info[] = {
1436 #if defined (CONFIG_TOUCHSCREEN_GT8XX)
1438 .type = "Goodix-TS",
1441 .irq = RK30_PIN0_PD4,
1442 .platform_data = &goodix_info,
1445 #if defined (CONFIG_TOUCHSCREEN_FT5306)
1447 .type = "ft5x0x_ts",
1450 .irq = RK30_PIN0_PD4,
1451 .platform_data = &ft5x0x_info,
1454 #if defined (CONFIG_LS_CM3217)
1456 .type = "lightsensor",
1459 .platform_data = &cm3217_info,
1465 #ifdef CONFIG_I2C3_RK30
1466 static struct i2c_board_info __initdata i2c3_info[] = {
1470 #ifdef CONFIG_I2C4_RK30
1471 static struct i2c_board_info __initdata i2c4_info[] = {
1475 #ifdef CONFIG_I2C_GPIO_RK30
1476 #define I2C_SDA_PIN INVALID_GPIO// RK30_PIN2_PD6 //set sda_pin here
1477 #define I2C_SCL_PIN INVALID_GPIO//RK30_PIN2_PD7 //set scl_pin here
1478 static int rk30_i2c_io_init(void)
1480 //set iomux (gpio) here
1481 //rk30_mux_api_set(GPIO2D7_I2C1SCL_NAME, GPIO2D_GPIO2D7);
1482 //rk30_mux_api_set(GPIO2D6_I2C1SDA_NAME, GPIO2D_GPIO2D6);
1486 struct i2c_gpio_platform_data default_i2c_gpio_data = {
1487 .sda_pin = I2C_SDA_PIN,
1488 .scl_pin = I2C_SCL_PIN,
1489 .udelay = 5, // clk = 500/udelay = 100Khz
1490 .timeout = 100,//msecs_to_jiffies(100),
1492 .io_init = rk30_i2c_io_init,
1494 static struct i2c_board_info __initdata i2c_gpio_info[] = {
1498 static void __init rk30_i2c_register_board_info(void)
1500 #ifdef CONFIG_I2C0_RK30
1501 i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
1503 #ifdef CONFIG_I2C1_RK30
1504 i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
1506 #ifdef CONFIG_I2C2_RK30
1507 i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
1509 #ifdef CONFIG_I2C3_RK30
1510 i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
1512 #ifdef CONFIG_I2C4_RK30
1513 i2c_register_board_info(4, i2c4_info, ARRAY_SIZE(i2c4_info));
1515 #ifdef CONFIG_I2C_GPIO_RK30
1516 i2c_register_board_info(5, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
1521 #define POWER_ON_PIN RK30_PIN0_PA0 //power_hold
1522 static void rk30_pm_power_off(void)
1524 printk(KERN_ERR "rk30_pm_power_off start...\n");
1525 gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
1526 #if defined(CONFIG_MFD_WM831X)
1527 wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000); //set sys_pwr 0
1528 wm831x_device_shutdown(Wm831x);//wm8326 shutdown
1533 static void __init machine_rk30_board_init(void)
1536 gpio_request(POWER_ON_PIN, "poweronpin");
1537 gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
1539 pm_power_off = rk30_pm_power_off;
1541 rk30_i2c_register_board_info();
1542 spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
1543 platform_add_devices(devices, ARRAY_SIZE(devices));
1544 board_usb_detect_init(RK30_PIN0_PA7);
1546 #ifdef CONFIG_WIFI_CONTROL_FUNC
1547 rk29sdk_wifi_bt_gpio_control_init();
1551 static void __init rk30_reserve(void)
1554 rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
1556 #ifdef CONFIG_FB_ROCKCHIP
1557 resource_fb[0].start = board_mem_reserve_add("fb0", RK30_FB0_MEM_SIZE);
1558 resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1;
1560 resource_fb[1].start = board_mem_reserve_add("ipp buf", RK30_FB0_MEM_SIZE);
1561 resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1;
1562 resource_fb[2].start = board_mem_reserve_add("fb2", RK30_FB0_MEM_SIZE);
1563 resource_fb[2].end = resource_fb[2].start + RK30_FB0_MEM_SIZE - 1;
1566 #ifdef CONFIG_VIDEO_RK29
1567 rk30_camera_request_reserve_mem();
1569 board_mem_reserved();
1573 * dvfs_cpu_logic_table: table for arm and logic dvfs
1574 * @frequency : arm frequency
1575 * @cpu_volt : arm voltage depend on frequency
1576 * @logic_volt : logic voltage arm requests depend on frequency
1577 * comments : min arm/logic voltage
1579 static struct dvfs_arm_table dvfs_cpu_logic_table[] = {
1581 {.frequency = 252 * 1000, .cpu_volt = 1075 * 1000, .logic_volt = 1125 * 1000},//0.975V/1.000V
1583 {.frequency = 504 * 1000, .cpu_volt = 975 * 1000, .logic_volt = 1000 * 1000},//0.975V/1.000V
1584 {.frequency = 816 * 1000, .cpu_volt = 1000 * 1000, .logic_volt = 1000 * 1000},//1.000V/1.025V
1585 {.frequency = 1200 * 1000, .cpu_volt = 1025 * 1000, .logic_volt = 1000 * 1000},//1.100V/1.050V
1587 {.frequency = 1008 * 1000, .cpu_volt = 1125 * 1000, .logic_volt = 1150 * 1000},//1.025V/1.050V
1588 {.frequency = 1272 * 1000, .cpu_volt = 1225 * 1000, .logic_volt = 1200 * 1000},//1.150V/1.100V
1589 {.frequency = 1416 * 1000, .cpu_volt = 1300 * 1000, .logic_volt = 1200 * 1000},//1.225V/1.100V
1590 {.frequency = 1512 * 1000, .cpu_volt = 1350 * 1000, .logic_volt = 1250 * 1000},//1.300V/1.150V
1591 {.frequency = 1608 * 1000, .cpu_volt = 1425 * 1000, .logic_volt = 1300 * 1000},//1.325V/1.175V
1593 {.frequency = CPUFREQ_TABLE_END},
1596 static struct cpufreq_frequency_table dvfs_gpu_table[] = {
1597 {.frequency = 266 * 1000, .index = 1000 * 1000},
1598 {.frequency = 400 * 1000, .index = 1000 * 1000},
1599 {.frequency = CPUFREQ_TABLE_END},
1602 static struct cpufreq_frequency_table dvfs_ddr_table[] = {
1603 {.frequency = 300 * 1000, .index = 1000 * 1000},
1604 {.frequency = 400 * 1000, .index = 1000 * 1000},
1605 {.frequency = CPUFREQ_TABLE_END},
1608 #define DVFS_CPU_TABLE_SIZE (ARRAY_SIZE(dvfs_cpu_logic_table))
1609 static struct cpufreq_frequency_table cpu_dvfs_table[DVFS_CPU_TABLE_SIZE];
1610 static struct cpufreq_frequency_table dep_cpu2core_table[DVFS_CPU_TABLE_SIZE];
1612 void __init board_clock_init(void)
1614 rk30_clock_data_init(periph_pll_default, codec_pll_default, RK30_CLOCKS_DEFAULT_FLAGS);
1615 dvfs_set_arm_logic_volt(dvfs_cpu_logic_table, cpu_dvfs_table, dep_cpu2core_table);
1616 dvfs_set_freq_volt_table(clk_get(NULL, "gpu"), dvfs_gpu_table);
1617 dvfs_set_freq_volt_table(clk_get(NULL, "ddr"), dvfs_ddr_table);
1620 MACHINE_START(RK30, "RK30board")
1621 .boot_params = PLAT_PHYS_OFFSET + 0x800,
1622 .fixup = rk30_fixup,
1623 .reserve = &rk30_reserve,
1624 .map_io = rk30_map_io,
1625 .init_irq = rk30_init_irq,
1626 .timer = &rk30_timer,
1627 .init_machine = machine_rk30_board_init,