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>
50 #if defined(CONFIG_MFD_RK610)
51 #include <linux/mfd/rk610_core.h>
54 #if defined(CONFIG_HDMI_RK30)
55 #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
58 #if defined(CONFIG_SPIM_RK29)
59 #include "../../../drivers/spi/rk29_spim.h"
61 #if defined(CONFIG_GPS_RK)
62 #include "../../../drivers/misc/gps/rk_gps/rk_gps.h"
65 #if defined(CONFIG_MU509)
66 #include <linux/mu509.h>
68 #if defined(CONFIG_MW100)
69 #include <linux/mw100.h>
71 #if defined(CONFIG_MT6229)
72 #include <linux/mt6229.h>
74 #if defined(CONFIG_ANDROID_TIMED_GPIO)
75 #include "../../../drivers/staging/android/timed_gpio.h"
78 #ifdef CONFIG_THREE_FB_BUFFER
79 #define RK30_FB0_MEM_SIZE 12*SZ_1M
81 #define RK30_FB0_MEM_SIZE 8*SZ_1M
84 #include "board-rk3066b-sdk-camera.c"
85 #include "board-rk3066b-sdk-key.c"
87 #if defined(CONFIG_TOUCHSCREEN_GT8XX)
88 #define TOUCH_RESET_PIN RK30_PIN2_PC0
89 #define TOUCH_PWR_PIN RK30_PIN2_PB4
90 static int goodix_init_platform_hw(void)
94 rk30_mux_api_set(GPIO2C0_LCDC1DATA16_SMCADDR0_TRACECLK_NAME, GPIO2C_GPIO2C0);
95 rk30_mux_api_set(GPIO2B4_LCDC1DATA12_SMCDATA12_TRACEDATA12_NAME, GPIO2B_GPIO2B4);
96 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));
98 if (TOUCH_PWR_PIN != INVALID_GPIO) {
99 ret = gpio_request(TOUCH_PWR_PIN, "goodix power pin");
101 gpio_free(TOUCH_PWR_PIN);
102 printk("goodix power error\n");
105 gpio_direction_output(TOUCH_PWR_PIN, 0);
106 gpio_set_value(TOUCH_PWR_PIN, GPIO_LOW);
110 if (TOUCH_RESET_PIN != INVALID_GPIO) {
111 ret = gpio_request(TOUCH_RESET_PIN, "goodix reset pin");
113 gpio_free(TOUCH_RESET_PIN);
114 printk("goodix gpio_request error\n");
117 gpio_direction_output(TOUCH_RESET_PIN, 1);
119 //gpio_set_value(TOUCH_RESET_PIN, GPIO_LOW);
121 //gpio_set_value(TOUCH_RESET_PIN, GPIO_HIGH);
127 struct goodix_platform_data goodix_info = {
129 .irq_pin = RK30_PIN0_PD4,
130 .rest_pin = TOUCH_RESET_PIN,
131 .init_platform_hw = goodix_init_platform_hw,
135 static struct spi_board_info board_spi_devices[] = {
138 /***********************************************************
140 ************************************************************/
141 #ifdef CONFIG_BACKLIGHT_RK29_BL
143 #define PWM_MUX_NAME GPIO3D5_PWM2_JTAGTCK_OTGDRVVBUS_NAME
144 #define PWM_MUX_MODE GPIO3D_PWM2
145 #define PWM_MUX_MODE_GPIO GPIO3D_GPIO3D5
146 #define PWM_GPIO RK30_PIN3_PD5
147 #define PWM_EFFECT_VALUE 1
149 #define LCD_DISP_ON_PIN
151 #ifdef LCD_DISP_ON_PIN
152 #define BL_EN_PIN RK30_PIN0_PA2
153 #define BL_EN_VALUE GPIO_HIGH
155 static int rk29_backlight_io_init(void)
158 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
159 #ifdef LCD_DISP_ON_PIN
160 // rk30_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
162 ret = gpio_request(BL_EN_PIN, NULL);
164 gpio_free(BL_EN_PIN);
167 gpio_direction_output(BL_EN_PIN, 0);
168 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
173 static int rk29_backlight_io_deinit(void)
176 #ifdef LCD_DISP_ON_PIN
177 gpio_free(BL_EN_PIN);
179 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
180 gpio_request(PWM_GPIO, NULL);
181 gpio_direction_output(PWM_GPIO, GPIO_LOW);
185 static int rk29_backlight_pwm_suspend(void)
188 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
189 if (gpio_request(PWM_GPIO, NULL)) {
190 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
193 gpio_direction_output(PWM_GPIO, GPIO_LOW);
194 #ifdef LCD_DISP_ON_PIN
195 gpio_direction_output(BL_EN_PIN, 0);
196 gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
201 static int rk29_backlight_pwm_resume(void)
204 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
205 #ifdef LCD_DISP_ON_PIN
207 gpio_direction_output(BL_EN_PIN, 1);
208 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
213 static struct rk29_bl_info rk29_bl_info = {
215 .bl_ref = PWM_EFFECT_VALUE,
216 .io_init = rk29_backlight_io_init,
217 .io_deinit = rk29_backlight_io_deinit,
218 .pwm_suspend = rk29_backlight_pwm_suspend,
219 .pwm_resume = rk29_backlight_pwm_resume,
222 static struct platform_device rk29_device_backlight = {
223 .name = "rk29_backlight",
226 .platform_data = &rk29_bl_info,
232 #ifdef CONFIG_RK29_SUPPORT_MODEM
234 #define RK30_MODEM_POWER RK30_PIN2_PB0
235 #define RK30_MODEM_POWER_IOMUX rk29_mux_api_set(GPIO2B0_LCDC1DATA8_SMCDATA8_TRACEDATA8_NAME, GPIO2B_GPIO2B0)
237 static int rk30_modem_io_init(void)
239 printk("%s\n", __FUNCTION__);
240 RK30_MODEM_POWER_IOMUX;
245 static struct rk29_io_t rk30_modem_io = {
246 .io_addr = RK30_MODEM_POWER,
249 .io_init = rk30_modem_io_init,
252 static struct platform_device rk30_device_modem = {
253 .name = "rk30_modem",
256 .platform_data = &rk30_modem_io,
260 #if defined(CONFIG_MU509)
261 static int mu509_io_init(void)
264 rk30_mux_api_set(GPIO2B0_LCDC1DATA8_SMCDATA8_TRACEDATA8_NAME, GPIO2B_GPIO2B0);
265 rk30_mux_api_set(GPIO2D1_LCDC1DEN_SMCWEN_NAME, GPIO2D_GPIO2D1);
266 rk30_mux_api_set(GPIO2B7_LCDC1DATA15_SMCADDR19_HSADCDATA7_NAME, GPIO2B_GPIO2B7);
267 rk30_mux_api_set(GPIO2C0_LCDCDATA16_GPSCLK_HSADCCLKOUT_NAME, GPIO2C_GPIO2C0);
271 static int mu509_io_deinit(void)
277 struct rk29_mu509_data rk29_mu509_info = {
278 .io_init = mu509_io_init,
279 .io_deinit = mu509_io_deinit,
280 .modem_power_en = RK30_PIN2_PB0,
281 .bp_power = RK30_PIN2_PB0,
282 .bp_reset = RK30_PIN2_PD1,
283 .ap_wakeup_bp = RK30_PIN2_PB7,
284 .bp_wakeup_ap = RK30_PIN6_PA0,
286 struct platform_device rk29_device_mu509 = {
290 .platform_data = &rk29_mu509_info,
294 #if defined(CONFIG_MW100)
295 static int mw100_io_init(void)
297 rk30_mux_api_set(GPIO2B0_LCDC1DATA8_SMCDATA8_TRACEDATA8_NAME, GPIO2B_GPIO2B0);
298 rk30_mux_api_set(GPIO2D1_LCDC1DEN_SMCWEN_NAME, GPIO2D_GPIO2D1);
299 rk30_mux_api_set(GPIO2B7_LCDC1DATA15_SMCADDR19_HSADCDATA7_NAME, GPIO2B_GPIO2B7);
300 rk30_mux_api_set(GPIO2C0_LCDCDATA16_GPSCLK_HSADCCLKOUT_NAME, GPIO2C_GPIO2C0);
304 static int mw100_io_deinit(void)
310 struct rk29_mw100_data rk29_mw100_info = {
311 .io_init = mw100_io_init,
312 .io_deinit = mw100_io_deinit,
313 .modem_power_en = RK30_PIN6_PB0,
314 .bp_power = RK30_PIN2_PB0,
315 .bp_reset = RK30_PIN2_PD1,
316 .ap_wakeup_bp = RK30_PIN2_PB7,
317 .bp_wakeup_ap = RK30_PIN6_PA0,
319 struct platform_device rk29_device_mw100 = {
323 .platform_data = &rk29_mw100_info,
327 #if defined(CONFIG_MT6229)
328 static int mt6229_io_init(void)
330 rk30_mux_api_set(GPIO2B0_LCDC1DATA8_SMCDATA8_TRACEDATA8_NAME, GPIO2B_GPIO2B0);
331 rk30_mux_api_set(GPIO2D1_LCDC1DEN_SMCWEN_NAME, GPIO2D_GPIO2D1);
332 rk30_mux_api_set(GPIO2B7_LCDC1DATA15_SMCADDR19_HSADCDATA7_NAME, GPIO2B_GPIO2B7);
333 rk30_mux_api_set(GPIO2C0_LCDCDATA16_GPSCLK_HSADCCLKOUT_NAME, GPIO2C_GPIO2C0);
337 static int mt6229_io_deinit(void)
343 struct rk29_mt6229_data rk29_mt6229_info = {
344 .io_init = mt6229_io_init,
345 .io_deinit = mt6229_io_deinit,
346 .modem_power_en = RK30_PIN2_PB0,
347 .bp_power = RK30_PIN2_PB0,//RK30_PIN2_PB6,
348 .bp_reset = RK30_PIN2_PD1,
349 .ap_wakeup_bp = RK30_PIN2_PC0,
350 .bp_wakeup_ap = RK30_PIN6_PA0,
352 struct platform_device rk29_device_mt6229 = {
356 .platform_data = &rk29_mt6229_info,
362 #if defined (CONFIG_GS_MMA8452)
363 #define MMA8452_INT_PIN RK30_PIN3_PD7
365 static int mma8452_init_platform_hw(void)
370 static struct sensor_platform_data mma8452_info = {
371 .type = SENSOR_TYPE_ACCEL,
374 .init_platform_hw = mma8452_init_platform_hw,
375 .orientation = {-1, 0, 0, 0, 0, 1, 0, -1, 0},
378 #if defined (CONFIG_GS_LIS3DH)
379 #define LIS3DH_INT_PIN RK30_PIN3_PD7
381 static int lis3dh_init_platform_hw(void)
387 static struct sensor_platform_data lis3dh_info = {
388 .type = SENSOR_TYPE_ACCEL,
391 .init_platform_hw = lis3dh_init_platform_hw,
392 .orientation = {-1, 0, 0, 0, 0, 1, 0, -1, 0},
395 #if defined (CONFIG_COMPASS_AK8975)
396 static struct sensor_platform_data akm8975_info =
398 .type = SENSOR_TYPE_COMPASS,
431 #if defined(CONFIG_GYRO_L3G4200D)
433 #include <linux/l3g4200d.h>
434 #define L3G4200D_INT_PIN RK30_PIN0_PB4
436 static int l3g4200d_init_platform_hw(void)
441 static struct sensor_platform_data l3g4200d_info = {
442 .type = SENSOR_TYPE_GYROSCOPE,
445 .orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1},
446 .init_platform_hw = l3g4200d_init_platform_hw,
447 .x_min = 40,//x_min,y_min,z_min = (0-100) according to hardware
454 #ifdef CONFIG_LS_CM3217
455 static struct sensor_platform_data cm3217_info = {
456 .type = SENSOR_TYPE_LIGHT,
458 .poll_delay_ms = 500,
463 #ifdef CONFIG_FB_ROCKCHIP
465 #define LCD_CS_PIN INVALID_GPIO
466 #define LCD_CS_VALUE GPIO_HIGH
468 #define LCD_EN_PIN RK30_PIN0_PB0
469 #define LCD_EN_VALUE GPIO_HIGH
471 static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
475 if(LCD_CS_PIN !=INVALID_GPIO)
477 ret = gpio_request(LCD_CS_PIN, NULL);
480 gpio_free(LCD_CS_PIN);
481 printk(KERN_ERR "request lcd cs pin fail!\n");
486 gpio_direction_output(LCD_CS_PIN, LCD_CS_VALUE);
490 if(LCD_EN_PIN !=INVALID_GPIO)
492 ret = gpio_request(LCD_EN_PIN, NULL);
495 gpio_free(LCD_EN_PIN);
496 printk(KERN_ERR "request lcd en pin fail!\n");
501 gpio_direction_output(LCD_EN_PIN, LCD_EN_VALUE);
506 static int rk_fb_io_disable(void)
508 if(LCD_CS_PIN !=INVALID_GPIO)
510 gpio_set_value(LCD_CS_PIN, !LCD_CS_VALUE);
512 if(LCD_EN_PIN !=INVALID_GPIO)
514 gpio_set_value(LCD_EN_PIN, !LCD_EN_VALUE);
518 static int rk_fb_io_enable(void)
520 if(LCD_CS_PIN !=INVALID_GPIO)
522 gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE);
524 if(LCD_EN_PIN !=INVALID_GPIO)
526 gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE);
531 #if defined(CONFIG_LCDC0_RK3066B)
532 struct rk29fb_info lcdc0_screen_info = {
533 .prop = PRMRY, //primary display device
534 .io_init = rk_fb_io_init,
535 .io_disable = rk_fb_io_disable,
536 .io_enable = rk_fb_io_enable,
537 .set_screen_info = set_lcd_info,
541 #if defined(CONFIG_LCDC1_RK3066B)
542 struct rk29fb_info lcdc1_screen_info = {
543 #if defined(CONFIG_HDMI_RK30)
544 .prop = EXTEND, //extend display device
546 .set_screen_info = hdmi_init_lcdc,
551 static struct resource resource_fb[] = {
555 .end = 0,//RK30_FB0_MEM_SIZE - 1,
556 .flags = IORESOURCE_MEM,
559 .name = "ipp buf", //for rotate
561 .end = 0,//RK30_FB0_MEM_SIZE - 1,
562 .flags = IORESOURCE_MEM,
567 .end = 0,//RK30_FB0_MEM_SIZE - 1,
568 .flags = IORESOURCE_MEM,
572 static struct platform_device device_fb = {
575 .num_resources = ARRAY_SIZE(resource_fb),
576 .resource = resource_fb,
580 #if defined(CONFIG_LCDC0_RK3066B)
581 static struct resource resource_lcdc0[] = {
584 .start = RK30_LCDC0_PHYS,
585 .end = RK30_LCDC0_PHYS + RK30_LCDC0_SIZE - 1,
586 .flags = IORESOURCE_MEM,
593 .flags = IORESOURCE_IRQ,
597 static struct platform_device device_lcdc0 = {
600 .num_resources = ARRAY_SIZE(resource_lcdc0),
601 .resource = resource_lcdc0,
603 .platform_data = &lcdc0_screen_info,
607 #if defined(CONFIG_LCDC1_RK3066B)
608 static struct resource resource_lcdc1[] = {
611 .start = RK30_LCDC1_PHYS,
612 .end = RK30_LCDC1_PHYS + RK30_LCDC1_SIZE - 1,
613 .flags = IORESOURCE_MEM,
619 .flags = IORESOURCE_IRQ,
623 static struct platform_device device_lcdc1 = {
626 .num_resources = ARRAY_SIZE(resource_lcdc1),
627 .resource = resource_lcdc1,
629 .platform_data = &lcdc1_screen_info,
634 #if defined(CONFIG_MFD_RK610)
635 #define RK610_RST_PIN_MUX_NAME GPIO2C5_LCDC1DATA21_SMCADDR5_NAME
636 #define RK610_RST_PIN_MUX_MODE GPIO2C_GPIO2C5
637 #define RK610_RST_PIN RK30_PIN2_PC5
638 static int rk610_power_on_init(void)
641 if(RK610_RST_PIN != INVALID_GPIO)
643 rk30_mux_api_set(RK610_RST_PIN_MUX_NAME,RK610_RST_PIN_MUX_MODE);
644 ret = gpio_request(RK610_RST_PIN, "rk610 reset");
647 printk(KERN_ERR "rk610_control_probe request gpio fail\n");
651 gpio_direction_output(RK610_RST_PIN, GPIO_HIGH);
653 gpio_direction_output(RK610_RST_PIN, GPIO_LOW);
655 gpio_set_value(RK610_RST_PIN, GPIO_HIGH);
664 static struct rk610_ctl_platform_data rk610_ctl_pdata = {
665 .rk610_power_on_init = rk610_power_on_init,
669 #ifdef CONFIG_ANDROID_TIMED_GPIO
670 static struct timed_gpio timed_gpios[] = {
673 .gpio = RK30_PIN3_PD3,
676 .adjust_time =20, //adjust for diff product
680 static struct timed_gpio_platform_data rk29_vibrator_info = {
682 .gpios = timed_gpios,
685 static struct platform_device rk29_device_vibrator = {
686 .name = "timed-gpio",
689 .platform_data = &rk29_vibrator_info,
695 #ifdef CONFIG_LEDS_GPIO_PLATFORM
696 static struct gpio_led rk29_leds[] = {
698 .name = "button-backlight",
699 .gpio = RK30_PIN2_PB3,
700 .default_trigger = "timer",
702 .retain_state_suspended = 0,
703 .default_state = LEDS_GPIO_DEFSTATE_OFF,
707 static struct gpio_led_platform_data rk29_leds_pdata = {
709 .num_leds = ARRAY_SIZE(rk29_leds),
712 static struct platform_device rk29_device_gpio_leds = {
716 .platform_data = &rk29_leds_pdata,
721 #ifdef CONFIG_RK_IRDA
722 #define IRDA_IRQ_PIN RK30_PIN0_PA3
724 static int irda_iomux_init(void)
729 ret = gpio_request(IRDA_IRQ_PIN, NULL);
731 gpio_free(IRDA_IRQ_PIN);
732 printk(">>>>>> IRDA_IRQ_PIN gpio_request err \n ");
734 gpio_pull_updown(IRDA_IRQ_PIN, PullDisable);
735 gpio_direction_input(IRDA_IRQ_PIN);
740 static int irda_iomux_deinit(void)
742 gpio_free(IRDA_IRQ_PIN);
746 static struct irda_info rk29_irda_info = {
747 .intr_pin = IRDA_IRQ_PIN,
748 .iomux_init = irda_iomux_init,
749 .iomux_deinit = irda_iomux_deinit,
750 //.irda_pwr_ctl = bu92747guw_power_ctl,
753 static struct platform_device irda_device = {
754 #ifdef CONFIG_RK_IRDA_NET
757 .name = "bu92747_irda",
761 .platform_data = &rk29_irda_info,
767 #define ION_RESERVE_SIZE (80 * SZ_1M)
768 static struct ion_platform_data rk30_ion_pdata = {
772 .type = ION_HEAP_TYPE_CARVEOUT,
773 .id = ION_NOR_HEAP_ID,
775 .size = ION_RESERVE_SIZE,
780 static struct platform_device device_ion = {
781 .name = "ion-rockchip",
784 .platform_data = &rk30_ion_pdata,
789 /**************************************************************************************************
790 * SDMMC devices, include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
791 **************************************************************************************************/
792 #ifdef CONFIG_SDMMC_RK29
793 #include "board-rk3066b-sdk-sdmmc.c"
795 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
796 #define SDMMC0_WRITE_PROTECT_PIN RK30_PIN3_PB7 //According to your own project to set the value of write-protect-pin.
799 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
800 #define SDMMC1_WRITE_PROTECT_PIN RK30_PIN3_PC7 //According to your own project to set the value of write-protect-pin.
803 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK30_PIN6_PB2
805 #endif //endif ---#ifdef CONFIG_SDMMC_RK29
807 #ifdef CONFIG_SDMMC0_RK29
808 static int rk29_sdmmc0_cfg_gpio(void)
810 #ifdef CONFIG_SDMMC_RK29_OLD
811 rk30_mux_api_set(GPIO3B1_SDMMC0CMD_NAME, GPIO3B_SDMMC0_CMD);
812 rk30_mux_api_set(GPIO3B0_SDMMC0CLKOUT_NAME, GPIO3B_SDMMC0_CLKOUT);
813 rk30_mux_api_set(GPIO3B2_SDMMC0DATA0_NAME, GPIO3B_SDMMC0_DATA0);
814 rk30_mux_api_set(GPIO3B3_SDMMC0DATA1_NAME, GPIO3B_SDMMC0_DATA1);
815 rk30_mux_api_set(GPIO3B4_SDMMC0DATA2_NAME, GPIO3B_SDMMC0_DATA2);
816 rk30_mux_api_set(GPIO3B5_SDMMC0DATA3_NAME, GPIO3B_SDMMC0_DATA3);
818 rk30_mux_api_set(GPIO3B6_SDMMC0DETECTN_NAME, GPIO3B_GPIO3B6);
820 rk30_mux_api_set(GPIO3A7_SDMMC0PWREN_NAME, GPIO3A_GPIO3A7);
821 gpio_request(RK30_PIN3_PA7, "sdmmc-power");
822 gpio_direction_output(RK30_PIN3_PA7, GPIO_LOW);
825 rk29_sdmmc_set_iomux(0, 0xFFFF);
827 rk30_mux_api_set(GPIO3B0_SDMMC0DETECTN_NAME, GPIO3B_SDMMC0DETECTN);
829 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
830 gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
831 gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
839 #define CONFIG_SDMMC0_USE_DMA
840 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
842 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
843 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
844 MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
846 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
847 .io_init = rk29_sdmmc0_cfg_gpio,
849 #if !defined(CONFIG_SDMMC_RK29_OLD)
850 .set_iomux = rk29_sdmmc_set_iomux,
853 .dma_name = "sd_mmc",
854 #ifdef CONFIG_SDMMC0_USE_DMA
859 .detect_irq = RK30_PIN3_PB6, // INVALID_GPIO
860 .enable_sd_wakeup = 0,
862 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
863 .write_prt = SDMMC0_WRITE_PROTECT_PIN,
865 .write_prt = INVALID_GPIO,
868 #endif // CONFIG_SDMMC0_RK29
870 #ifdef CONFIG_SDMMC1_RK29
871 #define CONFIG_SDMMC1_USE_DMA
872 static int rk29_sdmmc1_cfg_gpio(void)
874 #if defined(CONFIG_SDMMC_RK29_OLD)
875 rk30_mux_api_set(GPIO3C0_SMMC1CMD_NAME, GPIO3C_SMMC1_CMD);
876 rk30_mux_api_set(GPIO3C5_SDMMC1CLKOUT_NAME, GPIO3C_SDMMC1_CLKOUT);
877 rk30_mux_api_set(GPIO3C1_SDMMC1DATA0_NAME, GPIO3C_SDMMC1_DATA0);
878 rk30_mux_api_set(GPIO3C2_SDMMC1DATA1_NAME, GPIO3C_SDMMC1_DATA1);
879 rk30_mux_api_set(GPIO3C3_SDMMC1DATA2_NAME, GPIO3C_SDMMC1_DATA2);
880 rk30_mux_api_set(GPIO3C4_SDMMC1DATA3_NAME, GPIO3C_SDMMC1_DATA3);
881 //rk30_mux_api_set(GPIO3C6_SDMMC1DETECTN_NAME, GPIO3C_SDMMC1_DETECT_N);
885 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
886 gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp");
887 gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN);
895 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
897 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
898 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
901 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
902 .host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |
903 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
906 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
909 .io_init = rk29_sdmmc1_cfg_gpio,
911 #if !defined(CONFIG_SDMMC_RK29_OLD)
912 .set_iomux = rk29_sdmmc_set_iomux,
916 #ifdef CONFIG_SDMMC1_USE_DMA
922 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
923 #ifdef CONFIG_WIFI_CONTROL_FUNC
924 .status = rk29sdk_wifi_status,
925 .register_status_notify = rk29sdk_wifi_status_register,
928 .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
931 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
932 .write_prt = SDMMC1_WRITE_PROTECT_PIN,
934 .write_prt = INVALID_GPIO,
938 .detect_irq = INVALID_GPIO,
939 .enable_sd_wakeup = 0,
943 #endif //endif--#ifdef CONFIG_SDMMC1_RK29
945 /**************************************************************************************************
946 * the end of setting for SDMMC devices
947 **************************************************************************************************/
949 #ifdef CONFIG_BATTERY_RK30_ADC
950 static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
951 .dc_det_pin = RK30_PIN0_PB2,
952 .batt_low_pin = RK30_PIN0_PB1,
953 .charge_set_pin = INVALID_GPIO,
954 .charge_ok_pin = RK30_PIN0_PA6,
955 .dc_det_level = GPIO_LOW,
956 .charge_ok_level = GPIO_HIGH,
959 static struct platform_device rk30_device_adc_battery = {
960 .name = "rk30-battery",
963 .platform_data = &rk30_adc_battery_platdata,
967 #ifdef CONFIG_RK30_PWM_REGULATOR
968 const static int pwm_voltage_map[] = {
969 1000000, 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000
972 static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
974 .supply = "vdd_core",
978 struct regulator_init_data pwm_regulator_init_dcdc[1] =
984 .max_uV = 1800000, //0.6-1.8V
986 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
988 .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
989 .consumer_supplies = pwm_dcdc1_consumers,
993 static struct pwm_platform_data pwm_regulator_info[1] = {
996 .pwm_gpio = RK30_PIN3_PD6,
997 .pwm_iomux_name = GPIO3D6_PWM3_JTAGTMS_HOSTDRVVBUS_NAME,
998 .pwm_iomux_pwm = GPIO3D_PWM3,
999 .pwm_iomux_gpio = GPIO3D_GPIO3D6,
1000 .pwm_voltage = 1100000,
1001 .suspend_voltage = 1050000,
1004 .coefficient = 455, //45.5%
1005 .pwm_voltage_map = pwm_voltage_map,
1006 .init_data = &pwm_regulator_init_dcdc[0],
1010 struct platform_device pwm_regulator_device[1] = {
1012 .name = "pwm-voltage-regulator",
1015 .platform_data = &pwm_regulator_info[0],
1021 #ifdef CONFIG_RK29_VMAC
1022 #define PHY_PWR_EN_GPIO RK30_PIN1_PD6
1023 #include "board-rk30-sdk-vmac.c"
1026 #ifdef CONFIG_RFKILL_RK
1027 // bluetooth rfkill device, its driver in net/rfkill/rfkill-rk.c
1028 static struct rfkill_rk_platform_data rfkill_rk_platdata = {
1029 .type = RFKILL_TYPE_BLUETOOTH,
1031 .poweron_gpio = { // BT_REG_ON
1032 .io = INVALID_GPIO, //RK30_PIN3_PC7,
1033 .enable = GPIO_HIGH,
1035 .name = GPIO3C7_SDMMC1WRITEPRT_RMIICRS_NAME,
1036 .fgpio = GPIO3C_GPIO3C7,
1040 .reset_gpio = { // BT_RST
1041 .io = RK30_PIN3_PD1, // set io to INVALID_GPIO for disable it
1044 .name = GPIO3D1_SDMMC1BACKENDPWR_MIIMDCLK_NAME,
1045 .fgpio = GPIO3D_GPIO3D1,
1049 .wake_gpio = { // BT_WAKE, use to control bt's sleep and wakeup
1050 .io = RK30_PIN3_PC6, // set io to INVALID_GPIO for disable it
1051 .enable = GPIO_HIGH,
1053 .name = GPIO3C6_SDMMC1DETECTN_RMIIRXERR_NAME,
1054 .fgpio = GPIO3C_GPIO3C6,
1058 .wake_host_irq = { // BT_HOST_WAKE, for bt wakeup host when it is in deep sleep
1060 .io = RK30_PIN0_PA5, // set io to INVALID_GPIO for disable it
1061 .enable = GPIO_LOW, // set GPIO_LOW for falling, set 0 for rising
1068 .rts_gpio = { // UART_RTS, enable or disable BT's data coming
1069 .io = RK30_PIN1_PA3, // set io to INVALID_GPIO for disable it
1072 .name = GPIO1A3_UART0RTSN_NAME,
1073 .fgpio = GPIO1A_GPIO1A3,
1074 .fmux = GPIO1A_UART0RTSN,
1079 static struct platform_device device_rfkill_rk = {
1080 .name = "rfkill_rk",
1083 .platform_data = &rfkill_rk_platdata,
1088 #if defined(CONFIG_GPS_RK)
1089 int rk_gps_io_init(void)
1091 printk("%s \n", __FUNCTION__);
1093 rk30_mux_api_set(GPIO1B5_UART3RTSN_NAME, GPIO1B_GPIO1B5);//VCC_EN
1094 gpio_request(RK30_PIN1_PB5, NULL);
1095 gpio_direction_output(RK30_PIN1_PB5, GPIO_LOW);
1097 rk30_mux_api_set(GPIO1B4_UART3CTSN_GPSRFCLK_NAME, GPIO1B_GPSRFCLK);//GPS_CLK
1098 rk30_mux_api_set(GPIO1B2_UART3SIN_GPSMAG_NAME, GPIO1B_GPSMAG);//GPS_MAG
1099 rk30_mux_api_set(GPIO1B3_UART3SOUT_GPSSIG_NAME, GPIO1B_GPSSIG);//GPS_SIGN
1101 rk30_mux_api_set(GPIO1A6_UART1CTSN_SPI0CLK_NAME, GPIO1A_GPIO1A6);//SPI_CLK
1102 gpio_request(RK30_PIN1_PA6, NULL);
1103 gpio_direction_output(RK30_PIN1_PA6, GPIO_LOW);
1105 rk30_mux_api_set(GPIO1A5_UART1SOUT_SPI0TXD_NAME, GPIO1A_GPIO1A5);//SPI_MOSI
1106 gpio_request(RK30_PIN1_PA5, NULL);
1107 gpio_direction_output(RK30_PIN1_PA5, GPIO_LOW);
1109 rk30_mux_api_set(GPIO1A7_UART1RTSN_SPI0CSN0_NAME, GPIO1A_GPIO1A7);//SPI_CS
1110 gpio_request(RK30_PIN1_PA7, NULL);
1111 gpio_direction_output(RK30_PIN1_PA7, GPIO_LOW);
1114 int rk_gps_power_up(void)
1116 printk("%s \n", __FUNCTION__);
1121 int rk_gps_power_down(void)
1123 printk("%s \n", __FUNCTION__);
1128 int rk_gps_reset_set(int level)
1132 int rk_enable_hclk_gps(void)
1134 printk("%s \n", __FUNCTION__);
1135 clk_enable(clk_get(NULL, "hclk_gps"));
1138 int rk_disable_hclk_gps(void)
1140 printk("%s \n", __FUNCTION__);
1141 clk_disable(clk_get(NULL, "hclk_gps"));
1144 struct rk_gps_data rk_gps_info = {
1145 .io_init = rk_gps_io_init,
1146 .power_up = rk_gps_power_up,
1147 .power_down = rk_gps_power_down,
1148 .reset = rk_gps_reset_set,
1149 .enable_hclk_gps = rk_enable_hclk_gps,
1150 .disable_hclk_gps = rk_disable_hclk_gps,
1151 .GpsSign = RK30_PIN1_PB3,
1152 .GpsMag = RK30_PIN1_PB2, //GPIO index
1153 .GpsClk = RK30_PIN1_PB4, //GPIO index
1154 .GpsVCCEn = RK30_PIN1_PB5, //GPIO index
1155 .GpsSpi_CSO = RK30_PIN1_PA4, //GPIO index
1156 .GpsSpiClk = RK30_PIN1_PA5, //GPIO index
1157 .GpsSpiMOSI = RK30_PIN1_PA7, //GPIO index
1161 .u32GpsPhyAddr = RK30_GPS_PHYS,
1162 .u32GpsPhySize = RK30_GPS_SIZE,
1165 struct platform_device rk_device_gps = {
1166 .name = "gps_hv5820b",
1169 .platform_data = &rk_gps_info,
1175 static struct platform_device *devices[] __initdata = {
1176 #ifdef CONFIG_FB_ROCKCHIP
1179 #if defined(CONFIG_LCDC0_RK3066B)
1182 #if defined(CONFIG_LCDC1_RK3066B)
1186 #ifdef CONFIG_BACKLIGHT_RK29_BL
1187 &rk29_device_backlight,
1193 #ifdef CONFIG_ANDROID_TIMED_GPIO
1194 &rk29_device_vibrator,
1196 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1197 &rk29_device_gpio_leds,
1199 #ifdef CONFIG_RK_IRDA
1202 #ifdef CONFIG_WIFI_CONTROL_FUNC
1203 &rk29sdk_wifi_device,
1205 #ifdef CONFIG_RK29_SUPPORT_MODEM
1208 #if defined(CONFIG_MU509)
1211 #if defined(CONFIG_MW100)
1214 #if defined(CONFIG_MT6229)
1215 &rk29_device_mt6229,
1217 #ifdef CONFIG_BATTERY_RK30_ADC
1218 &rk30_device_adc_battery,
1220 #ifdef CONFIG_RFKILL_RK
1223 #ifdef CONFIG_GPS_RK
1230 #ifdef CONFIG_I2C0_RK30
1231 static struct i2c_board_info __initdata i2c0_info[] = {
1232 #if defined (CONFIG_GS_MMA8452)
1234 .type = "gs_mma8452",
1237 .irq = MMA8452_INT_PIN,
1238 .platform_data = &mma8452_info,
1241 #if defined (CONFIG_GS_LIS3DH)
1243 .type = "gs_lis3dh",
1244 .addr = 0x19, //0x19(SA0-->VCC), 0x18(SA0-->GND)
1246 .irq = LIS3DH_INT_PIN,
1247 .platform_data = &lis3dh_info,
1250 #if defined (CONFIG_COMPASS_AK8975)
1255 .irq = RK30_PIN0_PD5,
1256 .platform_data = &akm8975_info,
1259 #if defined (CONFIG_GYRO_L3G4200D)
1261 .type = "l3g4200d_gryo",
1264 .irq = L3G4200D_INT_PIN,
1265 .platform_data = &l3g4200d_info,
1268 #if defined (CONFIG_SND_SOC_RK1000)
1270 .type = "rk1000_i2c_codec",
1275 .type = "rk1000_control",
1280 #if defined (CONFIG_SND_SOC_RT5631)
1288 #ifdef CONFIG_MFD_RK610
1290 .type = "rk610_ctl",
1293 .platform_data = &rk610_ctl_pdata,
1295 #ifdef CONFIG_RK610_TVOUT
1297 .type = "rk610_tvout",
1302 #ifdef CONFIG_HDMI_RK610
1304 .type = "rk610_hdmi",
1307 .irq = INVALID_GPIO,
1310 #ifdef CONFIG_SND_SOC_RK610
1311 {//RK610_CODEC addr from 0x60 to 0x80 (0x60~0x80)
1312 .type = "rk610_i2c_codec",
1322 #define PMIC_TYPE_WM8326 1
1323 #define PMIC_TYPE_TPS65910 2
1324 int __sramdata g_pmic_type = 0;
1325 #ifdef CONFIG_I2C1_RK30
1326 #ifdef CONFIG_MFD_WM831X_I2C
1327 #include "board-rk3066b-sdk-wm8326.c"
1329 #ifdef CONFIG_MFD_TPS65910
1330 #ifdef CONFIG_ARCH_RK3066B
1331 #define TPS65910_HOST_IRQ RK30_PIN0_PB3
1333 #define TPS65910_HOST_IRQ RK30_PIN6_PA4
1335 #include "board-rk3066b-sdk-tps65910.c"
1338 static struct i2c_board_info __initdata i2c1_info[] = {
1339 #if defined (CONFIG_MFD_WM831X_I2C)
1344 .irq = RK30_PIN0_PB3,
1345 .platform_data = &wm831x_platdata,
1348 #if defined (CONFIG_MFD_TPS65910)
1351 .addr = TPS65910_I2C_ID0,
1353 .irq = TPS65910_HOST_IRQ,
1354 .platform_data = &tps65910_data,
1360 void __sramfunc board_pmu_suspend(void)
1362 #if defined (CONFIG_MFD_WM831X_I2C)
1363 if(g_pmic_type == PMIC_TYPE_WM8326)
1364 board_pmu_wm8326_suspend();
1366 #if defined (CONFIG_MFD_TPS65910)
1367 if(g_pmic_type == PMIC_TYPE_TPS65910)
1368 board_pmu_tps65910_suspend();
1372 void __sramfunc board_pmu_resume(void)
1374 #if defined (CONFIG_MFD_WM831X_I2C)
1375 if(g_pmic_type == PMIC_TYPE_WM8326)
1376 board_pmu_wm8326_resume();
1378 #if defined (CONFIG_MFD_TPS65910)
1379 if(g_pmic_type == PMIC_TYPE_TPS65910)
1380 board_pmu_tps65910_resume();
1384 int __sramdata gpio0d7_iomux,gpio0d7_do,gpio0d7_dir,gpio0d7_en;
1386 void __sramfunc rk30_pwm_logic_suspend_voltage(void)
1388 #ifdef CONFIG_RK30_PWM_REGULATOR
1390 // int gpio0d7_iomux,gpio0d7_do,gpio0d7_dir,gpio0d7_en;
1392 gpio0d7_iomux = readl_relaxed(GRF_GPIO0D_IOMUX);
1393 gpio0d7_do = grf_readl(GRF_GPIO0H_DO);
1394 gpio0d7_dir = grf_readl(GRF_GPIO0H_DIR);
1395 gpio0d7_en = grf_readl(GRF_GPIO0H_EN);
1397 writel_relaxed((1<<30), GRF_GPIO0D_IOMUX);
1398 grf_writel((1<<31)|(1<<15), GRF_GPIO0H_DIR);
1399 grf_writel((1<<31)|(1<<15), GRF_GPIO0H_DO);
1400 grf_writel((1<<31)|(1<<15), GRF_GPIO0H_EN);
1403 void __sramfunc rk30_pwm_logic_resume_voltage(void)
1405 #ifdef CONFIG_RK30_PWM_REGULATOR
1406 writel_relaxed((1<<30)|gpio0d7_iomux, GRF_GPIO0D_IOMUX);
1407 grf_writel((1<<31)|gpio0d7_en, GRF_GPIO0H_EN);
1408 grf_writel((1<<31)|gpio0d7_dir, GRF_GPIO0H_DIR);
1409 grf_writel((1<<31)|gpio0d7_do, GRF_GPIO0H_DO);
1415 extern void pwm_suspend_voltage(void);
1416 extern void pwm_resume_voltage(void);
1417 void rk30_pwm_suspend_voltage_set(void)
1419 #ifdef CONFIG_RK30_PWM_REGULATOR
1420 pwm_suspend_voltage();
1423 void rk30_pwm_resume_voltage_set(void)
1425 #ifdef CONFIG_RK30_PWM_REGULATOR
1426 pwm_resume_voltage();
1431 #ifdef CONFIG_I2C2_RK30
1432 static struct i2c_board_info __initdata i2c2_info[] = {
1433 #if defined (CONFIG_TOUCHSCREEN_GT8XX)
1435 .type = "Goodix-TS",
1438 .irq = RK30_PIN0_PD4,
1439 .platform_data = &goodix_info,
1442 #if defined (CONFIG_LS_CM3217)
1444 .type = "lightsensor",
1447 .platform_data = &cm3217_info,
1453 #ifdef CONFIG_I2C3_RK30
1454 static struct i2c_board_info __initdata i2c3_info[] = {
1458 #ifdef CONFIG_I2C4_RK30
1459 static struct i2c_board_info __initdata i2c4_info[] = {
1463 #ifdef CONFIG_I2C_GPIO_RK30
1464 #define I2C_SDA_PIN INVALID_GPIO// RK30_PIN2_PD6 //set sda_pin here
1465 #define I2C_SCL_PIN INVALID_GPIO//RK30_PIN2_PD7 //set scl_pin here
1466 static int rk30_i2c_io_init(void)
1468 //set iomux (gpio) here
1469 //rk30_mux_api_set(GPIO2D7_I2C1SCL_NAME, GPIO2D_GPIO2D7);
1470 //rk30_mux_api_set(GPIO2D6_I2C1SDA_NAME, GPIO2D_GPIO2D6);
1474 struct i2c_gpio_platform_data default_i2c_gpio_data = {
1475 .sda_pin = I2C_SDA_PIN,
1476 .scl_pin = I2C_SCL_PIN,
1477 .udelay = 5, // clk = 500/udelay = 100Khz
1478 .timeout = 100,//msecs_to_jiffies(100),
1480 .io_init = rk30_i2c_io_init,
1482 static struct i2c_board_info __initdata i2c_gpio_info[] = {
1486 static void __init rk30_i2c_register_board_info(void)
1488 #ifdef CONFIG_I2C0_RK30
1489 i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
1491 #ifdef CONFIG_I2C1_RK30
1492 i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
1494 #ifdef CONFIG_I2C2_RK30
1495 i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
1497 #ifdef CONFIG_I2C3_RK30
1498 i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
1500 #ifdef CONFIG_I2C4_RK30
1501 i2c_register_board_info(4, i2c4_info, ARRAY_SIZE(i2c4_info));
1503 #ifdef CONFIG_I2C_GPIO_RK30
1504 i2c_register_board_info(5, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
1509 #define POWER_ON_PIN RK30_PIN0_PA0 //power_hold
1510 static void rk30_pm_power_off(void)
1512 printk(KERN_ERR "rk30_pm_power_off start...\n");
1513 gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
1514 #if defined(CONFIG_MFD_WM831X)
1515 wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000); //set sys_pwr 0
1516 wm831x_device_shutdown(Wm831x);//wm8326 shutdown
1521 static void __init machine_rk30_board_init(void)
1524 gpio_request(POWER_ON_PIN, "poweronpin");
1525 gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
1527 pm_power_off = rk30_pm_power_off;
1529 rk30_i2c_register_board_info();
1530 spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
1531 platform_add_devices(devices, ARRAY_SIZE(devices));
1532 board_usb_detect_init(RK30_PIN0_PA7);
1534 #ifdef CONFIG_WIFI_CONTROL_FUNC
1535 rk29sdk_wifi_bt_gpio_control_init();
1539 static void __init rk30_reserve(void)
1542 rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
1544 #ifdef CONFIG_FB_ROCKCHIP
1545 resource_fb[0].start = board_mem_reserve_add("fb0", RK30_FB0_MEM_SIZE);
1546 resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1;
1548 resource_fb[1].start = board_mem_reserve_add("ipp buf", RK30_FB0_MEM_SIZE);
1549 resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1;
1550 resource_fb[2].start = board_mem_reserve_add("fb2", RK30_FB0_MEM_SIZE);
1551 resource_fb[2].end = resource_fb[2].start + RK30_FB0_MEM_SIZE - 1;
1554 #ifdef CONFIG_VIDEO_RK29
1555 rk30_camera_request_reserve_mem();
1558 #ifdef CONFIG_GPS_RK
1559 //it must be more than 8MB
1560 rk_gps_info.u32MemoryPhyAddr = board_mem_reserve_add("gps", SZ_8M);
1562 board_mem_reserved();
1566 * dvfs_cpu_logic_table: table for arm and logic dvfs
1567 * @frequency : arm frequency
1568 * @cpu_volt : arm voltage depend on frequency
1569 * @logic_volt : logic voltage arm requests depend on frequency
1570 * comments : min arm/logic voltage
1572 static struct dvfs_arm_table dvfs_cpu_logic_table[] = {
1573 {.frequency = 252 * 1000, .cpu_volt = 1000 * 1000, .logic_volt = 1000 * 1000},//0.975V/1.000V
1574 {.frequency = 504 * 1000, .cpu_volt = 1000 * 1000, .logic_volt = 1000 * 1000},//0.975V/1.000V
1575 {.frequency = 816 * 1000, .cpu_volt = 1000 * 1000, .logic_volt = 1000 * 1000},//1.000V/1.025V
1576 {.frequency = 1008 * 1000, .cpu_volt = 1000 * 1000, .logic_volt = 1000 * 1000},//1.025V/1.050V
1577 {.frequency = 1200 * 1000, .cpu_volt = 1000 * 1000, .logic_volt = 1000 * 1000},//1.100V/1.050V
1579 {.frequency = 1272 * 1000, .cpu_volt = 1225 * 1000, .logic_volt = 1200 * 1000},//1.150V/1.100V
1580 {.frequency = 1416 * 1000, .cpu_volt = 1300 * 1000, .logic_volt = 1200 * 1000},//1.225V/1.100V
1581 {.frequency = 1512 * 1000, .cpu_volt = 1350 * 1000, .logic_volt = 1250 * 1000},//1.300V/1.150V
1582 {.frequency = 1608 * 1000, .cpu_volt = 1425 * 1000, .logic_volt = 1300 * 1000},//1.325V/1.175V
1584 {.frequency = CPUFREQ_TABLE_END},
1587 static struct cpufreq_frequency_table dvfs_gpu_table[] = {
1588 {.frequency = 266 * 1000, .index = 1000 * 1000},
1589 {.frequency = 400 * 1000, .index = 1000 * 1000},
1590 {.frequency = CPUFREQ_TABLE_END},
1593 static struct cpufreq_frequency_table dvfs_ddr_table[] = {
1594 {.frequency = 300 * 1000, .index = 1000 * 1000},
1595 {.frequency = 400 * 1000, .index = 1000 * 1000},
1596 {.frequency = CPUFREQ_TABLE_END},
1599 #define DVFS_CPU_TABLE_SIZE (ARRAY_SIZE(dvfs_cpu_logic_table))
1600 static struct cpufreq_frequency_table cpu_dvfs_table[DVFS_CPU_TABLE_SIZE];
1601 static struct cpufreq_frequency_table dep_cpu2core_table[DVFS_CPU_TABLE_SIZE];
1603 void __init board_clock_init(void)
1605 rk30_clock_data_init(periph_pll_default, codec_pll_default, RK30_CLOCKS_DEFAULT_FLAGS);
1606 dvfs_set_arm_logic_volt(dvfs_cpu_logic_table, cpu_dvfs_table, dep_cpu2core_table);
1607 dvfs_set_freq_volt_table(clk_get(NULL, "gpu"), dvfs_gpu_table);
1608 dvfs_set_freq_volt_table(clk_get(NULL, "ddr"), dvfs_ddr_table);
1611 MACHINE_START(RK30, "RK30board")
1612 .boot_params = PLAT_PHYS_OFFSET + 0x800,
1613 .fixup = rk30_fixup,
1614 .reserve = &rk30_reserve,
1615 .map_io = rk30_map_io,
1616 .init_irq = rk30_init_irq,
1617 .timer = &rk30_timer,
1618 .init_machine = machine_rk30_board_init,