1 /* arch/arm/mach-rk30/board-rk30-sdk.c
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/regulator/rk29-pwm-regulator.h>
49 #if defined(CONFIG_MFD_RK610)
50 #include <linux/mfd/rk610_core.h>
53 #if defined(CONFIG_HDMI_RK30)
54 #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
57 #if defined(CONFIG_SPIM_RK29)
58 #include "../../../drivers/spi/rk29_spim.h"
60 #if defined(CONFIG_MU509)
61 #include <linux/mu509.h>
63 #if defined(CONFIG_MW100)
64 #include <linux/mw100.h>
66 #if defined(CONFIG_MT6229)
67 #include <linux/mt6229.h>
69 #if defined(CONFIG_SEW868)
70 #include <linux/sew868.h>
72 #if defined(CONFIG_ANDROID_TIMED_GPIO)
73 #include "../../../drivers/staging/android/timed_gpio.h"
76 #if defined(CONFIG_MT6620)
77 #include <linux/gps.h>
80 #ifdef CONFIG_THREE_FB_BUFFER
81 #define RK30_FB0_MEM_SIZE 12*SZ_1M
83 #define RK30_FB0_MEM_SIZE 8*SZ_1M
86 #include "board-rk30-sdk-camera.c"
87 #include "board-rk30-sdk-key.c"
89 #if defined(CONFIG_TOUCHSCREEN_GT8XX)
90 #define TOUCH_RESET_PIN RK30_PIN4_PD0
91 #define TOUCH_PWR_PIN INVALID_GPIO
92 int goodix_init_platform_hw(void)
96 rk30_mux_api_set(GPIO4D0_SMCDATA8_TRACEDATA8_NAME, GPIO4D_GPIO4D0);
97 rk30_mux_api_set(GPIO4C2_SMCDATA2_TRACEDATA2_NAME, GPIO4C_GPIO4C2);
98 printk("%s:0x%x,0x%x\n",__func__,rk30_mux_api_get(GPIO4D0_SMCDATA8_TRACEDATA8_NAME),rk30_mux_api_get(GPIO4C2_SMCDATA2_TRACEDATA2_NAME));
100 if (TOUCH_PWR_PIN != INVALID_GPIO) {
101 ret = gpio_request(TOUCH_PWR_PIN, "goodix power pin");
103 gpio_free(TOUCH_PWR_PIN);
104 printk("goodix power error\n");
107 gpio_direction_output(TOUCH_PWR_PIN, 0);
108 gpio_set_value(TOUCH_PWR_PIN, GPIO_LOW);
112 if (TOUCH_RESET_PIN != INVALID_GPIO) {
113 ret = gpio_request(TOUCH_RESET_PIN, "goodix reset pin");
115 gpio_free(TOUCH_RESET_PIN);
116 printk("goodix gpio_request error\n");
119 gpio_direction_output(TOUCH_RESET_PIN, 1);
121 //gpio_set_value(TOUCH_RESET_PIN, GPIO_LOW);
123 //gpio_set_value(TOUCH_RESET_PIN, GPIO_HIGH);
129 struct goodix_platform_data goodix_info = {
131 .irq_pin = RK30_PIN4_PC2,
132 .rest_pin = TOUCH_RESET_PIN,
133 .init_platform_hw = goodix_init_platform_hw,
137 static struct spi_board_info board_spi_devices[] = {
140 /***********************************************************
142 ************************************************************/
143 #ifdef CONFIG_BACKLIGHT_RK29_BL
145 #define PWM_MUX_NAME GPIO0A3_PWM0_NAME
146 #define PWM_MUX_MODE GPIO0A_PWM0
147 #define PWM_MUX_MODE_GPIO GPIO0A_GPIO0A3
148 #define PWM_GPIO RK30_PIN0_PA3
149 #define PWM_EFFECT_VALUE 1
151 #define LCD_DISP_ON_PIN
153 #ifdef LCD_DISP_ON_PIN
154 //#define BL_EN_MUX_NAME GPIOF34_UART3_SEL_NAME
155 //#define BL_EN_MUX_MODE IOMUXB_GPIO1_B34
157 #define BL_EN_PIN RK30_PIN6_PB3
158 #define BL_EN_VALUE GPIO_HIGH
160 static int rk29_backlight_io_init(void)
163 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
164 #ifdef LCD_DISP_ON_PIN
165 // rk30_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
167 ret = gpio_request(BL_EN_PIN, NULL);
169 gpio_free(BL_EN_PIN);
172 gpio_direction_output(BL_EN_PIN, 0);
173 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
178 static int rk29_backlight_io_deinit(void)
181 #ifdef LCD_DISP_ON_PIN
182 gpio_free(BL_EN_PIN);
184 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
188 static int rk29_backlight_pwm_suspend(void)
191 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
192 if (gpio_request(PWM_GPIO, NULL)) {
193 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
196 gpio_direction_output(PWM_GPIO, GPIO_LOW);
197 #ifdef LCD_DISP_ON_PIN
198 gpio_direction_output(BL_EN_PIN, 0);
199 gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
204 static int rk29_backlight_pwm_resume(void)
207 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
208 #ifdef LCD_DISP_ON_PIN
210 gpio_direction_output(BL_EN_PIN, 1);
211 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
216 static struct rk29_bl_info rk29_bl_info = {
218 .bl_ref = PWM_EFFECT_VALUE,
219 .io_init = rk29_backlight_io_init,
220 .io_deinit = rk29_backlight_io_deinit,
221 .pwm_suspend = rk29_backlight_pwm_suspend,
222 .pwm_resume = rk29_backlight_pwm_resume,
225 static struct platform_device rk29_device_backlight = {
226 .name = "rk29_backlight",
229 .platform_data = &rk29_bl_info,
235 #ifdef CONFIG_RK29_SUPPORT_MODEM
237 #define RK30_MODEM_POWER RK30_PIN4_PD1
238 #define RK30_MODEM_POWER_IOMUX rk29_mux_api_set(GPIO4D1_SMCDATA9_TRACEDATA9_NAME, GPIO4D_GPIO4D1)
240 static int rk30_modem_io_init(void)
242 printk("%s\n", __FUNCTION__);
243 RK30_MODEM_POWER_IOMUX;
248 static struct rk29_io_t rk30_modem_io = {
249 .io_addr = RK30_MODEM_POWER,
252 .io_init = rk30_modem_io_init,
255 static struct platform_device rk30_device_modem = {
256 .name = "rk30_modem",
259 .platform_data = &rk30_modem_io,
263 #if defined(CONFIG_MU509)
264 static int mu509_io_init(void)
267 rk30_mux_api_set(GPIO2B6_LCDC1DATA14_SMCADDR18_TSSYNC_NAME, GPIO2B_GPIO2B6);
268 rk30_mux_api_set(GPIO4D2_SMCDATA10_TRACEDATA10_NAME, GPIO4D_GPIO4D2);
269 rk30_mux_api_set(GPIO2B7_LCDC1DATA15_SMCADDR19_HSADCDATA7_NAME, GPIO2B_GPIO2B7);
270 rk30_mux_api_set(GPIO2C0_LCDCDATA16_GPSCLK_HSADCCLKOUT_NAME, GPIO2C_GPIO2C0);
274 static int mu509_io_deinit(void)
280 struct rk29_mu509_data rk29_mu509_info = {
281 .io_init = mu509_io_init,
282 .io_deinit = mu509_io_deinit,
283 .modem_power_en = RK30_PIN6_PB2,//RK30_PIN4_PD1,
284 .bp_power = RK30_PIN2_PB6,//RK30_PIN4_PD1,
285 .bp_reset = RK30_PIN4_PD2,
286 .ap_wakeup_bp = RK30_PIN2_PB7,
287 .bp_wakeup_ap = RK30_PIN6_PA0,
289 struct platform_device rk29_device_mu509 = {
293 .platform_data = &rk29_mu509_info,
297 #if defined(CONFIG_MW100)
298 static int mw100_io_init(void)
300 rk30_mux_api_set(GPIO2B6_LCDC1DATA14_SMCADDR18_TSSYNC_NAME, GPIO2B_GPIO2B6);
301 rk30_mux_api_set(GPIO4D2_SMCDATA10_TRACEDATA10_NAME, GPIO4D_GPIO4D2);
302 rk30_mux_api_set(GPIO2B7_LCDC1DATA15_SMCADDR19_HSADCDATA7_NAME, GPIO2B_GPIO2B7);
303 rk30_mux_api_set(GPIO2C0_LCDCDATA16_GPSCLK_HSADCCLKOUT_NAME, GPIO2C_GPIO2C0);
307 static int mw100_io_deinit(void)
313 struct rk29_mw100_data rk29_mw100_info = {
314 .io_init = mw100_io_init,
315 .io_deinit = mw100_io_deinit,
316 .modem_power_en = RK30_PIN6_PB2,
317 .bp_power = RK30_PIN2_PB6,
318 .bp_reset = RK30_PIN4_PD2,
319 .ap_wakeup_bp = RK30_PIN2_PB7,
320 .bp_wakeup_ap = RK30_PIN6_PA0,
322 struct platform_device rk29_device_mw100 = {
326 .platform_data = &rk29_mw100_info,
330 #if defined(CONFIG_MT6229)
331 static int mt6229_io_init(void)
333 rk30_mux_api_set(GPIO2B6_LCDC1DATA14_SMCADDR18_TSSYNC_NAME, GPIO2B_GPIO2B6);
334 rk30_mux_api_set(GPIO4D2_SMCDATA10_TRACEDATA10_NAME, GPIO4D_GPIO4D2);
335 rk30_mux_api_set(GPIO2B7_LCDC1DATA15_SMCADDR19_HSADCDATA7_NAME, GPIO2B_GPIO2B7);
336 rk30_mux_api_set(GPIO2C0_LCDCDATA16_GPSCLK_HSADCCLKOUT_NAME, GPIO2C_GPIO2C0);
337 rk30_mux_api_set(GPIO2C1_LCDC1DATA17_SMCBLSN0_HSADCDATA6_NAME, GPIO2C_GPIO2C1);
338 rk30_mux_api_set(GPIO2C1_LCDC1DATA17_SMCBLSN0_HSADCDATA6_NAME, GPIO2C_GPIO2C1);
344 static int mt6229_io_deinit(void)
350 struct rk29_mt6229_data rk29_mt6229_info = {
351 .io_init = mt6229_io_init,
352 .io_deinit = mt6229_io_deinit,
353 .modem_power_en = RK30_PIN6_PB2,
354 .bp_power = RK30_PIN2_PB6,
355 .modem_usb_en = RK30_PIN2_PC0,
356 .modem_uart_en = RK30_PIN2_PC1,
357 .bp_wakeup_ap = RK30_PIN6_PA1,
358 .ap_ready = RK30_PIN2_PB7,
361 struct platform_device rk29_device_mt6229 = {
365 .platform_data = &rk29_mt6229_info,
369 #if defined(CONFIG_SEW868)
370 static int sew868_io_init(void)
372 rk30_mux_api_set(GPIO2B6_LCDC1DATA14_SMCADDR18_TSSYNC_NAME, GPIO2B_GPIO2B6);
373 rk30_mux_api_set(GPIO4D2_SMCDATA10_TRACEDATA10_NAME, GPIO4D_GPIO4D2);
374 rk30_mux_api_set(GPIO4D4_SMCDATA12_TRACEDATA12_NAME, GPIO4D_GPIO4D4);
377 static int sew868_io_deinit(void)
381 struct rk30_sew868_data rk30_sew868_info = {
382 .io_init = sew868_io_init,
383 .io_deinit = sew868_io_deinit,
384 .bp_power = RK30_PIN6_PB2,
385 .bp_power_active_low = 1,
386 .bp_sys = RK30_PIN2_PB6,
387 .bp_reset = RK30_PIN4_PD2,
388 .bp_reset_active_low = 1,
389 .bp_wakeup_ap = RK30_PIN4_PD4,
390 .ap_wakeup_bp = NULL,
393 struct platform_device rk30_device_sew868 = {
397 .platform_data = &rk30_sew868_info,
403 #if defined (CONFIG_GS_MMA8452)
404 #define MMA8452_INT_PIN RK30_PIN4_PC0
406 static int mma8452_init_platform_hw(void)
408 rk30_mux_api_set(GPIO4C0_SMCDATA0_TRACEDATA0_NAME, GPIO4C_GPIO4C0);
413 static struct sensor_platform_data mma8452_info = {
414 .type = SENSOR_TYPE_ACCEL,
417 .init_platform_hw = mma8452_init_platform_hw,
418 .orientation = {-1, 0, 0, 0, 0, 1, 0, -1, 0},
421 #if defined (CONFIG_GS_LIS3DH)
422 #define LIS3DH_INT_PIN RK30_PIN4_PC0
424 static int lis3dh_init_platform_hw(void)
426 rk30_mux_api_set(GPIO4C0_SMCDATA0_TRACEDATA0_NAME, GPIO4C_GPIO4C0);
431 static struct sensor_platform_data lis3dh_info = {
432 .type = SENSOR_TYPE_ACCEL,
435 .init_platform_hw = lis3dh_init_platform_hw,
436 .orientation = {-1, 0, 0, 0, 0, 1, 0, -1, 0},
439 #if defined (CONFIG_GS_KXTIK)
440 #define KXTIK_INT_PIN RK30_PIN4_PC0
442 static int kxtik_init_platform_hw(void)
444 rk30_mux_api_set(GPIO4C0_SMCDATA0_TRACEDATA0_NAME, GPIO4C_GPIO4C0);
449 static struct sensor_platform_data kxtik_info = {
450 .type = SENSOR_TYPE_ACCEL,
453 .init_platform_hw = kxtik_init_platform_hw,
454 .orientation = {0, 1, 0, 0, 0, -1, 1, 0, 0},
458 #if defined (CONFIG_COMPASS_AK8975)
459 static struct sensor_platform_data akm8975_info =
461 .type = SENSOR_TYPE_COMPASS,
494 #if defined(CONFIG_GYRO_L3G4200D)
496 #include <linux/l3g4200d.h>
497 #define L3G4200D_INT_PIN RK30_PIN4_PC3
499 static int l3g4200d_init_platform_hw(void)
501 rk30_mux_api_set(GPIO4C3_SMCDATA3_TRACEDATA3_NAME, GPIO4C_GPIO4C3);
506 static struct sensor_platform_data l3g4200d_info = {
507 .type = SENSOR_TYPE_GYROSCOPE,
510 .orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1},
511 .init_platform_hw = l3g4200d_init_platform_hw,
512 .x_min = 40,//x_min,y_min,z_min = (0-100) according to hardware
519 #ifdef CONFIG_LS_CM3217
520 static struct sensor_platform_data cm3217_info = {
521 .type = SENSOR_TYPE_LIGHT,
523 .poll_delay_ms = 500,
528 #if defined(CONFIG_PS_AL3006)
529 static struct sensor_platform_data proximity_al3006_info = {
530 .type = SENSOR_TYPE_PROXIMITY,
532 .poll_delay_ms = 200,
536 #if defined(CONFIG_PS_STK3171)
537 static struct sensor_platform_data proximity_stk3171_info = {
538 .type = SENSOR_TYPE_PROXIMITY,
540 .poll_delay_ms = 200,
545 #if defined(CONFIG_LS_AL3006)
546 static struct sensor_platform_data light_al3006_info = {
547 .type = SENSOR_TYPE_LIGHT,
549 .poll_delay_ms = 200,
553 #if defined(CONFIG_LS_STK3171)
554 static struct sensor_platform_data light_stk3171_info = {
555 .type = SENSOR_TYPE_LIGHT,
557 .poll_delay_ms = 200,
560 #ifdef CONFIG_FB_ROCKCHIP
562 #define LCD_CS_MUX_NAME GPIO4C7_SMCDATA7_TRACEDATA7_NAME
563 #define LCD_CS_PIN RK30_PIN4_PC7
564 #define LCD_CS_VALUE GPIO_HIGH
566 #define LCD_EN_MUX_NAME GPIO4C7_SMCDATA7_TRACEDATA7_NAME
567 #define LCD_EN_PIN RK30_PIN6_PB4
568 #define LCD_EN_VALUE GPIO_LOW
570 static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
573 rk30_mux_api_set(LCD_CS_MUX_NAME, GPIO4C_GPIO4C7);
574 ret = gpio_request(LCD_CS_PIN, NULL);
577 gpio_free(LCD_CS_PIN);
578 printk(KERN_ERR "request lcd cs pin fail!\n");
583 gpio_direction_output(LCD_CS_PIN, LCD_CS_VALUE);
585 ret = gpio_request(LCD_EN_PIN, NULL);
588 gpio_free(LCD_EN_PIN);
589 printk(KERN_ERR "request lcd en pin fail!\n");
594 gpio_direction_output(LCD_EN_PIN, LCD_EN_VALUE);
598 static int rk_fb_io_disable(void)
600 gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE? 0:1);
601 gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE? 0:1);
604 static int rk_fb_io_enable(void)
606 gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE);
607 gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE);
611 #if defined(CONFIG_LCDC0_RK30)
612 struct rk29fb_info lcdc0_screen_info = {
613 .prop = PRMRY, //primary display device
614 .io_init = rk_fb_io_init,
615 .io_disable = rk_fb_io_disable,
616 .io_enable = rk_fb_io_enable,
617 .set_screen_info = set_lcd_info,
621 #if defined(CONFIG_LCDC1_RK30)
622 struct rk29fb_info lcdc1_screen_info = {
623 #if defined(CONFIG_HDMI_RK30)
624 .prop = EXTEND, //extend display device
626 .set_screen_info = hdmi_init_lcdc,
631 static struct resource resource_fb[] = {
635 .end = 0,//RK30_FB0_MEM_SIZE - 1,
636 .flags = IORESOURCE_MEM,
639 .name = "ipp buf", //for rotate
641 .end = 0,//RK30_FB0_MEM_SIZE - 1,
642 .flags = IORESOURCE_MEM,
647 .end = 0,//RK30_FB0_MEM_SIZE - 1,
648 .flags = IORESOURCE_MEM,
652 static struct platform_device device_fb = {
655 .num_resources = ARRAY_SIZE(resource_fb),
656 .resource = resource_fb,
660 #if defined(CONFIG_LCDC0_RK30)
661 static struct resource resource_lcdc0[] = {
664 .start = RK30_LCDC0_PHYS,
665 .end = RK30_LCDC0_PHYS + RK30_LCDC0_SIZE - 1,
666 .flags = IORESOURCE_MEM,
673 .flags = IORESOURCE_IRQ,
677 static struct platform_device device_lcdc0 = {
680 .num_resources = ARRAY_SIZE(resource_lcdc0),
681 .resource = resource_lcdc0,
683 .platform_data = &lcdc0_screen_info,
687 #if defined(CONFIG_LCDC1_RK30)
688 extern struct rk29fb_info lcdc1_screen_info;
689 static struct resource resource_lcdc1[] = {
692 .start = RK30_LCDC1_PHYS,
693 .end = RK30_LCDC1_PHYS + RK30_LCDC1_SIZE - 1,
694 .flags = IORESOURCE_MEM,
700 .flags = IORESOURCE_IRQ,
704 static struct platform_device device_lcdc1 = {
707 .num_resources = ARRAY_SIZE(resource_lcdc1),
708 .resource = resource_lcdc1,
710 .platform_data = &lcdc1_screen_info,
715 #if defined(CONFIG_MFD_RK610)
716 #define RK610_RST_PIN_MUX_NAME GPIO0C6_TRACECLK_SMCADDR2_NAME
717 #define RK610_RST_PIN_MUX_MODE GPIO0C_GPIO0C6
718 #define RK610_RST_PIN RK30_PIN0_PC6
719 static int rk610_power_on_init(void)
722 if(RK610_RST_PIN != INVALID_GPIO)
724 rk30_mux_api_set(RK610_RST_PIN_MUX_NAME,RK610_RST_PIN_MUX_MODE);
725 ret = gpio_request(RK610_RST_PIN, "rk610 reset");
728 printk(KERN_ERR "rk610_control_probe request gpio fail\n");
732 gpio_direction_output(RK610_RST_PIN, GPIO_HIGH);
734 gpio_direction_output(RK610_RST_PIN, GPIO_LOW);
736 gpio_set_value(RK610_RST_PIN, GPIO_HIGH);
745 static struct rk610_ctl_platform_data rk610_ctl_pdata = {
746 .rk610_power_on_init = rk610_power_on_init,
750 #ifdef CONFIG_ANDROID_TIMED_GPIO
751 static struct timed_gpio timed_gpios[] = {
754 .gpio = RK30_PIN0_PA4,
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_PIN4_PD7,
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_PIN6_PA1
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-rk30-sdk-sdmmc.c"
876 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
877 #define SDMMC0_WRITE_PROTECT_PIN RK30_PIN3_PB2 //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_PB3 //According to your own project to set the value of write-protect-pin.
884 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK30_PIN6_PB2
885 #define RK29SDK_WIFI_SDIO_CARD_INT RK30_PIN3_PD2
887 #endif //endif ---#ifdef CONFIG_SDMMC_RK29
889 #ifdef CONFIG_SDMMC0_RK29
890 static int rk29_sdmmc0_cfg_gpio(void)
892 #ifdef CONFIG_SDMMC_RK29_OLD
893 rk30_mux_api_set(GPIO3B1_SDMMC0CMD_NAME, GPIO3B_SDMMC0_CMD);
894 rk30_mux_api_set(GPIO3B0_SDMMC0CLKOUT_NAME, GPIO3B_SDMMC0_CLKOUT);
895 rk30_mux_api_set(GPIO3B2_SDMMC0DATA0_NAME, GPIO3B_SDMMC0_DATA0);
896 rk30_mux_api_set(GPIO3B3_SDMMC0DATA1_NAME, GPIO3B_SDMMC0_DATA1);
897 rk30_mux_api_set(GPIO3B4_SDMMC0DATA2_NAME, GPIO3B_SDMMC0_DATA2);
898 rk30_mux_api_set(GPIO3B5_SDMMC0DATA3_NAME, GPIO3B_SDMMC0_DATA3);
900 rk30_mux_api_set(GPIO3B6_SDMMC0DETECTN_NAME, GPIO3B_GPIO3B6);
902 rk30_mux_api_set(GPIO3A7_SDMMC0PWREN_NAME, GPIO3A_GPIO3A7);
903 gpio_request(RK30_PIN3_PA7, "sdmmc-power");
904 gpio_direction_output(RK30_PIN3_PA7, GPIO_LOW);
907 rk29_sdmmc_set_iomux(0, 0xFFFF);
909 rk30_mux_api_set(GPIO3B6_SDMMC0DETECTN_NAME, GPIO3B_SDMMC0_DETECT_N);
911 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
912 gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
913 gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
921 #define CONFIG_SDMMC0_USE_DMA
922 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
924 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
925 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
926 MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
928 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
929 .io_init = rk29_sdmmc0_cfg_gpio,
931 #if !defined(CONFIG_SDMMC_RK29_OLD)
932 .set_iomux = rk29_sdmmc_set_iomux,
935 .dma_name = "sd_mmc",
936 #ifdef CONFIG_SDMMC0_USE_DMA
942 #if defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC)
943 .status = rk29sdk_wifi_mmc0_status,
944 .register_status_notify = rk29sdk_wifi_mmc0_status_register,
947 .detect_irq = RK30_PIN3_PB6, // INVALID_GPIO
948 .enable_sd_wakeup = 0,
950 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
951 .write_prt = SDMMC0_WRITE_PROTECT_PIN,
953 .write_prt = INVALID_GPIO,
956 #endif // CONFIG_SDMMC0_RK29
958 #ifdef CONFIG_SDMMC1_RK29
959 #define CONFIG_SDMMC1_USE_DMA
960 static int rk29_sdmmc1_cfg_gpio(void)
962 #if defined(CONFIG_SDMMC_RK29_OLD)
963 rk30_mux_api_set(GPIO3C0_SMMC1CMD_NAME, GPIO3C_SMMC1_CMD);
964 rk30_mux_api_set(GPIO3C5_SDMMC1CLKOUT_NAME, GPIO3C_SDMMC1_CLKOUT);
965 rk30_mux_api_set(GPIO3C1_SDMMC1DATA0_NAME, GPIO3C_SDMMC1_DATA0);
966 rk30_mux_api_set(GPIO3C2_SDMMC1DATA1_NAME, GPIO3C_SDMMC1_DATA1);
967 rk30_mux_api_set(GPIO3C3_SDMMC1DATA2_NAME, GPIO3C_SDMMC1_DATA2);
968 rk30_mux_api_set(GPIO3C4_SDMMC1DATA3_NAME, GPIO3C_SDMMC1_DATA3);
969 //rk30_mux_api_set(GPIO3C6_SDMMC1DETECTN_NAME, GPIO3C_SDMMC1_DETECT_N);
973 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
974 gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp");
975 gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN);
983 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
985 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
986 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
989 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
990 .host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |
991 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
994 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
997 .io_init = rk29_sdmmc1_cfg_gpio,
999 #if !defined(CONFIG_SDMMC_RK29_OLD)
1000 .set_iomux = rk29_sdmmc_set_iomux,
1004 #ifdef CONFIG_SDMMC1_USE_DMA
1010 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
1011 #if defined(CONFIG_WIFI_CONTROL_FUNC) || defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC)
1012 .status = rk29sdk_wifi_status,
1013 .register_status_notify = rk29sdk_wifi_status_register,
1016 .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
1019 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
1020 .write_prt = SDMMC1_WRITE_PROTECT_PIN,
1022 .write_prt = INVALID_GPIO,
1025 #if defined(CONFIG_RK29_SDIO_IRQ_FROM_GPIO)
1026 .sdio_INT_gpio = RK29SDK_WIFI_SDIO_CARD_INT,
1030 .detect_irq = INVALID_GPIO,
1031 .enable_sd_wakeup = 0,
1035 #endif //endif--#ifdef CONFIG_SDMMC1_RK29
1037 /**************************************************************************************************
1038 * the end of setting for SDMMC devices
1039 **************************************************************************************************/
1041 #if defined(CONFIG_BATTERY_RK30_ADC)||defined(CONFIG_BATTERY_RK30_ADC_FAC)
1042 static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
1043 .dc_det_pin = RK30_PIN6_PA5,
1044 .batt_low_pin = RK30_PIN6_PA0,
1045 .charge_set_pin = INVALID_GPIO,
1046 .charge_ok_pin = RK30_PIN6_PA6,
1047 .dc_det_level = GPIO_LOW,
1048 .charge_ok_level = GPIO_HIGH,
1051 static struct platform_device rk30_device_adc_battery = {
1052 .name = "rk30-battery",
1055 .platform_data = &rk30_adc_battery_platdata,
1060 #ifdef CONFIG_RK30_PWM_REGULATOR
1061 const static int pwm_voltage_map[] = {
1062 1000000, 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000
1065 static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
1067 .supply = "vdd_core",
1071 struct regulator_init_data pwm_regulator_init_dcdc[1] =
1075 .name = "PWM_DCDC1",
1077 .max_uV = 1800000, //0.6-1.8V
1079 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1081 .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
1082 .consumer_supplies = pwm_dcdc1_consumers,
1086 static struct pwm_platform_data pwm_regulator_info[1] = {
1089 .pwm_gpio = RK30_PIN0_PD7,
1090 .pwm_iomux_name = GPIO0D7_PWM3_NAME,
1091 .pwm_iomux_pwm = GPIO0D_PWM3,
1092 .pwm_iomux_gpio = GPIO0D_GPIO0D6,
1093 .pwm_voltage = 1100000,
1094 .suspend_voltage = 1050000,
1097 .coefficient = 455, //45.5%
1098 .pwm_voltage_map = pwm_voltage_map,
1099 .init_data = &pwm_regulator_init_dcdc[0],
1103 struct platform_device pwm_regulator_device[1] = {
1105 .name = "pwm-voltage-regulator",
1108 .platform_data = &pwm_regulator_info[0],
1114 #ifdef CONFIG_RK29_VMAC
1115 #define PHY_PWR_EN_GPIO RK30_PIN1_PD6
1116 #include "board-rk30-sdk-vmac.c"
1119 #ifdef CONFIG_RFKILL_RK
1120 // bluetooth rfkill device, its driver in net/rfkill/rfkill-rk.c
1121 static struct rfkill_rk_platform_data rfkill_rk_platdata = {
1122 .type = RFKILL_TYPE_BLUETOOTH,
1124 .poweron_gpio = { // BT_REG_ON
1125 .io = RK30_PIN3_PC7,
1126 .enable = GPIO_HIGH,
1128 .name = GPIO3C7_SDMMC1WRITEPRT_NAME,
1129 .fgpio = GPIO3C_GPIO3C7,
1133 .reset_gpio = { // BT_RST
1134 .io = RK30_PIN3_PD1, // set io to INVALID_GPIO for disable it
1137 .name = GPIO3D1_SDMMC1BACKENDPWR_NAME,
1138 .fgpio = GPIO3D_GPIO3D1,
1142 .wake_gpio = { // BT_WAKE, use to control bt's sleep and wakeup
1143 .io = RK30_PIN3_PC6, // set io to INVALID_GPIO for disable it
1144 .enable = GPIO_HIGH,
1146 .name = GPIO3C6_SDMMC1DETECTN_NAME,
1147 .fgpio = GPIO3C_GPIO3C6,
1151 .wake_host_irq = { // BT_HOST_WAKE, for bt wakeup host when it is in deep sleep
1153 .io = RK30_PIN6_PA7, // set io to INVALID_GPIO for disable it
1154 .enable = GPIO_LOW, // set GPIO_LOW for falling, set 0 for rising
1161 .rts_gpio = { // UART_RTS, enable or disable BT's data coming
1162 .io = RK30_PIN1_PA3, // set io to INVALID_GPIO for disable it
1165 .name = GPIO1A3_UART0RTSN_NAME,
1166 .fgpio = GPIO1A_GPIO1A3,
1167 .fmux = GPIO1A_UART0_RTS_N,
1172 static struct platform_device device_rfkill_rk = {
1173 .name = "rfkill_rk",
1176 .platform_data = &rfkill_rk_platdata,
1181 static struct platform_device *devices[] __initdata = {
1182 #ifdef CONFIG_FB_ROCKCHIP
1185 #if defined(CONFIG_LCDC0_RK30)
1188 #if defined(CONFIG_LCDC1_RK30)
1192 #ifdef CONFIG_BACKLIGHT_RK29_BL
1193 &rk29_device_backlight,
1199 #ifdef CONFIG_ANDROID_TIMED_GPIO
1200 &rk29_device_vibrator,
1202 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1203 &rk29_device_gpio_leds,
1205 #ifdef CONFIG_RK_IRDA
1208 #if defined(CONFIG_WIFI_CONTROL_FUNC)||defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC)
1209 &rk29sdk_wifi_device,
1212 #if defined(CONFIG_MT6620)
1216 #ifdef CONFIG_RK29_SUPPORT_MODEM
1219 #if defined(CONFIG_MU509)
1222 #if defined(CONFIG_MW100)
1225 #if defined(CONFIG_MT6229)
1226 &rk29_device_mt6229,
1228 #if defined(CONFIG_SEW868)
1229 &rk30_device_sew868,
1231 #if defined(CONFIG_BATTERY_RK30_ADC)||defined(CONFIG_BATTERY_RK30_ADC_FAC)
1232 &rk30_device_adc_battery,
1234 #ifdef CONFIG_RFKILL_RK
1240 #ifdef CONFIG_I2C0_RK30
1241 static struct i2c_board_info __initdata i2c0_info[] = {
1242 #if defined (CONFIG_GS_MMA8452)
1244 .type = "gs_mma8452",
1247 .irq = MMA8452_INT_PIN,
1248 .platform_data = &mma8452_info,
1251 #if defined (CONFIG_GS_LIS3DH)
1253 .type = "gs_lis3dh",
1254 .addr = 0x19, //0x19(SA0-->VCC), 0x18(SA0-->GND)
1256 .irq = LIS3DH_INT_PIN,
1257 .platform_data = &lis3dh_info,
1260 #if defined (CONFIG_GS_KXTIK)
1265 .irq = KXTIK_INT_PIN,
1266 .platform_data = &kxtik_info,
1269 #if defined (CONFIG_COMPASS_AK8975)
1274 .irq = RK30_PIN4_PC1,
1275 .platform_data = &akm8975_info,
1278 #if defined (CONFIG_GYRO_L3G4200D)
1280 .type = "l3g4200d_gryo",
1283 .irq = L3G4200D_INT_PIN,
1284 .platform_data = &l3g4200d_info,
1287 #if defined (CONFIG_LS_AL3006)
1289 .type = "light_al3006",
1290 .addr = 0x1c, //sel = 0; if sel =1, then addr = 0x1D
1292 .irq = RK30_PIN6_PA2,
1293 .platform_data = &light_al3006_info,
1296 #if defined (CONFIG_LS_STK3171)
1298 .type = "ls_stk3171",
1301 .irq = RK30_PIN6_PA2,
1302 .platform_data = &light_stk3171_info,
1307 #if defined (CONFIG_PS_AL3006)
1309 .type = "proximity_al3006",
1310 .addr = 0x1c, //sel = 0; if sel =1, then addr = 0x1D
1312 .irq = RK30_PIN6_PA2,
1313 .platform_data = &proximity_al3006_info,
1317 #if defined (CONFIG_PS_STK3171)
1319 .type = "ps_stk3171",
1322 .irq = RK30_PIN6_PA2,
1323 .platform_data = &proximity_stk3171_info,
1326 #if defined (CONFIG_SND_SOC_RK1000)
1328 .type = "rk1000_i2c_codec",
1333 .type = "rk1000_control",
1338 #if defined (CONFIG_SND_SOC_RT5631)
1346 #ifdef CONFIG_MFD_RK610
1348 .type = "rk610_ctl",
1351 .platform_data = &rk610_power_on_init,
1353 #ifdef CONFIG_RK610_TVOUT
1355 .type = "rk610_tvout",
1360 #ifdef CONFIG_RK610_HDMI
1362 .type = "rk610_hdmi",
1365 .irq = RK29_PIN5_PA2,
1368 #ifdef CONFIG_SND_SOC_RK610
1369 {//RK610_CODEC addr from 0x60 to 0x80 (0x60~0x80)
1370 .type = "rk610_i2c_codec",
1379 #define PMIC_TYPE_WM8326 1
1380 #define PMIC_TYPE_TPS65910 2
1381 int __sramdata g_pmic_type = 0;
1382 #ifdef CONFIG_I2C1_RK30
1383 #ifdef CONFIG_MFD_WM831X_I2C
1384 #include "board-rk30-sdk-wm8326.c"
1386 #ifdef CONFIG_MFD_TPS65910
1387 #define TPS65910_HOST_IRQ RK30_PIN6_PA4
1388 #include "board-rk30-sdk-tps65910.c"
1391 static struct i2c_board_info __initdata i2c1_info[] = {
1392 #if defined (CONFIG_MFD_WM831X_I2C)
1397 .irq = RK30_PIN6_PA4,
1398 .platform_data = &wm831x_platdata,
1401 #if defined (CONFIG_MFD_TPS65910)
1404 .addr = TPS65910_I2C_ID0,
1406 .irq = TPS65910_HOST_IRQ,
1407 .platform_data = &tps65910_data,
1413 void __sramfunc board_pmu_suspend(void)
1415 #if defined (CONFIG_MFD_WM831X_I2C)
1416 if(g_pmic_type == PMIC_TYPE_WM8326)
1417 board_pmu_wm8326_suspend();
1419 #if defined (CONFIG_MFD_TPS65910)
1420 if(g_pmic_type == PMIC_TYPE_TPS65910)
1421 board_pmu_tps65910_suspend();
1425 void __sramfunc board_pmu_resume(void)
1427 #if defined (CONFIG_MFD_WM831X_I2C)
1428 if(g_pmic_type == PMIC_TYPE_WM8326)
1429 board_pmu_wm8326_resume();
1431 #if defined (CONFIG_MFD_TPS65910)
1432 if(g_pmic_type == PMIC_TYPE_TPS65910)
1433 board_pmu_tps65910_resume();
1437 #ifdef CONFIG_I2C2_RK30
1438 static struct i2c_board_info __initdata i2c2_info[] = {
1439 #if defined (CONFIG_TOUCHSCREEN_GT8XX)
1441 .type = "Goodix-TS",
1444 .irq = RK30_PIN4_PC2,
1445 .platform_data = &goodix_info,
1448 #if defined (CONFIG_LS_CM3217)
1450 .type = "light_cm3217",
1453 .platform_data = &cm3217_info,
1459 #ifdef CONFIG_I2C3_RK30
1460 static struct i2c_board_info __initdata i2c3_info[] = {
1464 #ifdef CONFIG_I2C4_RK30
1465 static struct i2c_board_info __initdata i2c4_info[] = {
1469 #ifdef CONFIG_I2C_GPIO_RK30
1470 #define I2C_SDA_PIN INVALID_GPIO// RK30_PIN2_PD6 //set sda_pin here
1471 #define I2C_SCL_PIN INVALID_GPIO//RK30_PIN2_PD7 //set scl_pin here
1472 static int rk30_i2c_io_init(void)
1474 //set iomux (gpio) here
1475 //rk30_mux_api_set(GPIO2D7_I2C1SCL_NAME, GPIO2D_GPIO2D7);
1476 //rk30_mux_api_set(GPIO2D6_I2C1SDA_NAME, GPIO2D_GPIO2D6);
1480 struct i2c_gpio_platform_data default_i2c_gpio_data = {
1481 .sda_pin = I2C_SDA_PIN,
1482 .scl_pin = I2C_SCL_PIN,
1483 .udelay = 5, // clk = 500/udelay = 100Khz
1484 .timeout = 100,//msecs_to_jiffies(100),
1486 .io_init = rk30_i2c_io_init,
1488 static struct i2c_board_info __initdata i2c_gpio_info[] = {
1492 static void __init rk30_i2c_register_board_info(void)
1494 #ifdef CONFIG_I2C0_RK30
1495 i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
1497 #ifdef CONFIG_I2C1_RK30
1498 i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
1500 #ifdef CONFIG_I2C2_RK30
1501 i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
1503 #ifdef CONFIG_I2C3_RK30
1504 i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
1506 #ifdef CONFIG_I2C4_RK30
1507 i2c_register_board_info(4, i2c4_info, ARRAY_SIZE(i2c4_info));
1509 #ifdef CONFIG_I2C_GPIO_RK30
1510 i2c_register_board_info(5, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
1515 #define POWER_ON_PIN RK30_PIN6_PB0 //power_hold
1516 static void rk30_pm_power_off(void)
1518 printk(KERN_ERR "rk30_pm_power_off start...\n");
1519 gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
1520 #if defined(CONFIG_MFD_WM831X)
1521 if(g_pmic_type == PMIC_TYPE_WM8326)
1523 wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000); //set sys_pwr 0
1524 wm831x_device_shutdown(Wm831x);//wm8326 shutdown
1527 #if defined(CONFIG_MFD_TPS65910)
1528 if(g_pmic_type == PMIC_TYPE_TPS65910)
1530 tps65910_device_shutdown();//tps65910 shutdown
1537 static void __init machine_rk30_board_init(void)
1540 gpio_request(POWER_ON_PIN, "poweronpin");
1541 gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
1543 pm_power_off = rk30_pm_power_off;
1545 rk30_i2c_register_board_info();
1546 spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
1547 platform_add_devices(devices, ARRAY_SIZE(devices));
1548 board_usb_detect_init(RK30_PIN6_PA3);
1550 #ifdef CONFIG_WIFI_CONTROL_FUNC
1551 rk29sdk_wifi_bt_gpio_control_init();
1554 #if defined(CONFIG_MT6620)
1555 clk_set_rate(clk_get_sys("rk_serial.0", "uart"), 16*1000000);
1559 static void __init rk30_reserve(void)
1562 rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
1564 #ifdef CONFIG_FB_ROCKCHIP
1565 resource_fb[0].start = board_mem_reserve_add("fb0", RK30_FB0_MEM_SIZE);
1566 resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1;
1568 resource_fb[1].start = board_mem_reserve_add("ipp buf", RK30_FB0_MEM_SIZE);
1569 resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1;
1570 resource_fb[2].start = board_mem_reserve_add("fb2", RK30_FB0_MEM_SIZE);
1571 resource_fb[2].end = resource_fb[2].start + RK30_FB0_MEM_SIZE - 1;
1574 #ifdef CONFIG_VIDEO_RK29
1575 rk30_camera_request_reserve_mem();
1577 board_mem_reserved();
1581 * dvfs_cpu_logic_table: table for arm and logic dvfs
1582 * @frequency : arm frequency
1583 * @cpu_volt : arm voltage depend on frequency
1584 * @logic_volt : logic voltage arm requests depend on frequency
1585 * comments : min arm/logic voltage
1587 static struct dvfs_arm_table dvfs_cpu_logic_table[] = {
1588 {.frequency = 252 * 1000, .cpu_volt = 1075 * 1000, .logic_volt = 1125 * 1000},//0.975V/1.000V
1589 {.frequency = 504 * 1000, .cpu_volt = 1100 * 1000, .logic_volt = 1125 * 1000},//0.975V/1.000V
1590 {.frequency = 816 * 1000, .cpu_volt = 1125 * 1000, .logic_volt = 1150 * 1000},//1.000V/1.025V
1591 {.frequency = 1008 * 1000, .cpu_volt = 1125 * 1000, .logic_volt = 1150 * 1000},//1.025V/1.050V
1592 {.frequency = 1200 * 1000, .cpu_volt = 1175 * 1000, .logic_volt = 1200 * 1000},//1.100V/1.050V
1593 {.frequency = 1272 * 1000, .cpu_volt = 1225 * 1000, .logic_volt = 1200 * 1000},//1.150V/1.100V
1594 {.frequency = 1416 * 1000, .cpu_volt = 1300 * 1000, .logic_volt = 1200 * 1000},//1.225V/1.100V
1595 {.frequency = 1512 * 1000, .cpu_volt = 1350 * 1000, .logic_volt = 1250 * 1000},//1.300V/1.150V
1596 {.frequency = 1608 * 1000, .cpu_volt = 1425 * 1000, .logic_volt = 1300 * 1000},//1.325V/1.175V
1597 {.frequency = CPUFREQ_TABLE_END},
1600 static struct cpufreq_frequency_table dvfs_gpu_table[] = {
1601 {.frequency = 266 * 1000, .index = 1050 * 1000},
1602 {.frequency = 400 * 1000, .index = 1275 * 1000},
1603 {.frequency = CPUFREQ_TABLE_END},
1606 static struct cpufreq_frequency_table dvfs_ddr_table[] = {
1607 {.frequency = 300 * 1000, .index = 1050 * 1000},
1608 {.frequency = 400 * 1000, .index = 1125 * 1000},
1609 {.frequency = CPUFREQ_TABLE_END},
1612 #define DVFS_CPU_TABLE_SIZE (ARRAY_SIZE(dvfs_cpu_logic_table))
1613 static struct cpufreq_frequency_table cpu_dvfs_table[DVFS_CPU_TABLE_SIZE];
1614 static struct cpufreq_frequency_table dep_cpu2core_table[DVFS_CPU_TABLE_SIZE];
1616 void __init board_clock_init(void)
1618 rk30_clock_data_init(periph_pll_default, codec_pll_default, RK30_CLOCKS_DEFAULT_FLAGS);
1619 dvfs_set_arm_logic_volt(dvfs_cpu_logic_table, cpu_dvfs_table, dep_cpu2core_table);
1620 dvfs_set_freq_volt_table(clk_get(NULL, "gpu"), dvfs_gpu_table);
1621 dvfs_set_freq_volt_table(clk_get(NULL, "ddr"), dvfs_ddr_table);
1624 MACHINE_START(RK30, "RK30board")
1625 .boot_params = PLAT_PHYS_OFFSET + 0x800,
1626 .fixup = rk30_fixup,
1627 .reserve = &rk30_reserve,
1628 .map_io = rk30_map_io,
1629 .init_irq = rk30_init_irq,
1630 .timer = &rk30_timer,
1631 .init_machine = machine_rk30_board_init,