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_RK_HDMI)
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_RK_HDMI)
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)
636 #define RK610_RST_PIN_MUX_NAME GPIO2C5_LCDC1DATA21_SMCADDR5_NAME
637 #define RK610_RST_PIN_MUX_MODE GPIO2C_GPIO2C5
638 #define RK610_RST_PIN RK30_PIN2_PC5
640 #define RK610_RST_PIN_MUX_NAME GPIO2D6_SMCCSN1_NAME
641 #define RK610_RST_PIN_MUX_MODE GPIO2D_GPIO2D6
642 #define RK610_RST_PIN RK30_PIN2_PD6
645 static int rk610_power_on_init(void)
648 if(RK610_RST_PIN != INVALID_GPIO)
650 rk30_mux_api_set(RK610_RST_PIN_MUX_NAME,RK610_RST_PIN_MUX_MODE);
651 ret = gpio_request(RK610_RST_PIN, "rk610 reset");
654 printk(KERN_ERR "rk610_control_probe request gpio fail\n");
658 gpio_direction_output(RK610_RST_PIN, GPIO_HIGH);
660 gpio_direction_output(RK610_RST_PIN, GPIO_LOW);
662 gpio_set_value(RK610_RST_PIN, GPIO_HIGH);
671 static struct rk610_ctl_platform_data rk610_ctl_pdata = {
672 .rk610_power_on_init = rk610_power_on_init,
676 #ifdef CONFIG_ANDROID_TIMED_GPIO
677 static struct timed_gpio timed_gpios[] = {
680 .gpio = RK30_PIN3_PD3,
683 .adjust_time =20, //adjust for diff product
687 static struct timed_gpio_platform_data rk29_vibrator_info = {
689 .gpios = timed_gpios,
692 static struct platform_device rk29_device_vibrator = {
693 .name = "timed-gpio",
696 .platform_data = &rk29_vibrator_info,
702 #ifdef CONFIG_LEDS_GPIO_PLATFORM
703 static struct gpio_led rk29_leds[] = {
705 .name = "button-backlight",
706 .gpio = RK30_PIN2_PB3,
707 .default_trigger = "timer",
709 .retain_state_suspended = 0,
710 .default_state = LEDS_GPIO_DEFSTATE_OFF,
714 static struct gpio_led_platform_data rk29_leds_pdata = {
716 .num_leds = ARRAY_SIZE(rk29_leds),
719 static struct platform_device rk29_device_gpio_leds = {
723 .platform_data = &rk29_leds_pdata,
728 #ifdef CONFIG_RK_IRDA
729 #define IRDA_IRQ_PIN RK30_PIN0_PA3
731 static int irda_iomux_init(void)
736 ret = gpio_request(IRDA_IRQ_PIN, NULL);
738 gpio_free(IRDA_IRQ_PIN);
739 printk(">>>>>> IRDA_IRQ_PIN gpio_request err \n ");
741 gpio_pull_updown(IRDA_IRQ_PIN, PullDisable);
742 gpio_direction_input(IRDA_IRQ_PIN);
747 static int irda_iomux_deinit(void)
749 gpio_free(IRDA_IRQ_PIN);
753 static struct irda_info rk29_irda_info = {
754 .intr_pin = IRDA_IRQ_PIN,
755 .iomux_init = irda_iomux_init,
756 .iomux_deinit = irda_iomux_deinit,
757 //.irda_pwr_ctl = bu92747guw_power_ctl,
760 static struct platform_device irda_device = {
761 #ifdef CONFIG_RK_IRDA_NET
764 .name = "bu92747_irda",
768 .platform_data = &rk29_irda_info,
774 #define ION_RESERVE_SIZE (80 * SZ_1M)
775 static struct ion_platform_data rk30_ion_pdata = {
779 .type = ION_HEAP_TYPE_CARVEOUT,
780 .id = ION_NOR_HEAP_ID,
782 .size = ION_RESERVE_SIZE,
787 static struct platform_device device_ion = {
788 .name = "ion-rockchip",
791 .platform_data = &rk30_ion_pdata,
796 /**************************************************************************************************
797 * SDMMC devices, include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
798 **************************************************************************************************/
799 #ifdef CONFIG_SDMMC_RK29
800 #include "board-rk3066b-sdk-sdmmc.c"
802 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
803 #define SDMMC0_WRITE_PROTECT_PIN RK30_PIN3_PB7 //According to your own project to set the value of write-protect-pin.
806 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
807 #define SDMMC1_WRITE_PROTECT_PIN RK30_PIN3_PC7 //According to your own project to set the value of write-protect-pin.
810 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK30_PIN6_PB2
812 #endif //endif ---#ifdef CONFIG_SDMMC_RK29
814 #ifdef CONFIG_SDMMC0_RK29
815 static int rk29_sdmmc0_cfg_gpio(void)
817 #ifdef CONFIG_SDMMC_RK29_OLD
818 rk30_mux_api_set(GPIO3B1_SDMMC0CMD_NAME, GPIO3B_SDMMC0_CMD);
819 rk30_mux_api_set(GPIO3B0_SDMMC0CLKOUT_NAME, GPIO3B_SDMMC0_CLKOUT);
820 rk30_mux_api_set(GPIO3B2_SDMMC0DATA0_NAME, GPIO3B_SDMMC0_DATA0);
821 rk30_mux_api_set(GPIO3B3_SDMMC0DATA1_NAME, GPIO3B_SDMMC0_DATA1);
822 rk30_mux_api_set(GPIO3B4_SDMMC0DATA2_NAME, GPIO3B_SDMMC0_DATA2);
823 rk30_mux_api_set(GPIO3B5_SDMMC0DATA3_NAME, GPIO3B_SDMMC0_DATA3);
825 rk30_mux_api_set(GPIO3B6_SDMMC0DETECTN_NAME, GPIO3B_GPIO3B6);
827 rk30_mux_api_set(GPIO3A7_SDMMC0PWREN_NAME, GPIO3A_GPIO3A7);
828 gpio_request(RK30_PIN3_PA7, "sdmmc-power");
829 gpio_direction_output(RK30_PIN3_PA7, GPIO_LOW);
832 rk29_sdmmc_set_iomux(0, 0xFFFF);
834 rk30_mux_api_set(GPIO3B0_SDMMC0DETECTN_NAME, GPIO3B_SDMMC0DETECTN);
836 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
837 gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
838 gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
846 #define CONFIG_SDMMC0_USE_DMA
847 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
849 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
850 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
851 MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
853 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
854 .io_init = rk29_sdmmc0_cfg_gpio,
856 #if !defined(CONFIG_SDMMC_RK29_OLD)
857 .set_iomux = rk29_sdmmc_set_iomux,
860 .dma_name = "sd_mmc",
861 #ifdef CONFIG_SDMMC0_USE_DMA
866 .detect_irq = RK30_PIN3_PB6, // INVALID_GPIO
867 .enable_sd_wakeup = 0,
869 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
870 .write_prt = SDMMC0_WRITE_PROTECT_PIN,
872 .write_prt = INVALID_GPIO,
875 #endif // CONFIG_SDMMC0_RK29
877 #ifdef CONFIG_SDMMC1_RK29
878 #define CONFIG_SDMMC1_USE_DMA
879 static int rk29_sdmmc1_cfg_gpio(void)
881 #if defined(CONFIG_SDMMC_RK29_OLD)
882 rk30_mux_api_set(GPIO3C0_SMMC1CMD_NAME, GPIO3C_SMMC1_CMD);
883 rk30_mux_api_set(GPIO3C5_SDMMC1CLKOUT_NAME, GPIO3C_SDMMC1_CLKOUT);
884 rk30_mux_api_set(GPIO3C1_SDMMC1DATA0_NAME, GPIO3C_SDMMC1_DATA0);
885 rk30_mux_api_set(GPIO3C2_SDMMC1DATA1_NAME, GPIO3C_SDMMC1_DATA1);
886 rk30_mux_api_set(GPIO3C3_SDMMC1DATA2_NAME, GPIO3C_SDMMC1_DATA2);
887 rk30_mux_api_set(GPIO3C4_SDMMC1DATA3_NAME, GPIO3C_SDMMC1_DATA3);
888 //rk30_mux_api_set(GPIO3C6_SDMMC1DETECTN_NAME, GPIO3C_SDMMC1_DETECT_N);
892 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
893 gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp");
894 gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN);
902 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
904 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
905 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
908 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
909 .host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |
910 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
913 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
916 .io_init = rk29_sdmmc1_cfg_gpio,
918 #if !defined(CONFIG_SDMMC_RK29_OLD)
919 .set_iomux = rk29_sdmmc_set_iomux,
923 #ifdef CONFIG_SDMMC1_USE_DMA
929 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
930 #ifdef CONFIG_WIFI_CONTROL_FUNC
931 .status = rk29sdk_wifi_status,
932 .register_status_notify = rk29sdk_wifi_status_register,
935 .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
938 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
939 .write_prt = SDMMC1_WRITE_PROTECT_PIN,
941 .write_prt = INVALID_GPIO,
945 .detect_irq = INVALID_GPIO,
946 .enable_sd_wakeup = 0,
950 #endif //endif--#ifdef CONFIG_SDMMC1_RK29
952 /**************************************************************************************************
953 * the end of setting for SDMMC devices
954 **************************************************************************************************/
956 #ifdef CONFIG_BATTERY_RK30_ADC
957 static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
958 .dc_det_pin = RK30_PIN0_PB2,
959 .batt_low_pin = RK30_PIN0_PB1,
960 .charge_set_pin = INVALID_GPIO,
961 .charge_ok_pin = RK30_PIN0_PA6,
962 .dc_det_level = GPIO_LOW,
963 .charge_ok_level = GPIO_HIGH,
966 static struct platform_device rk30_device_adc_battery = {
967 .name = "rk30-battery",
970 .platform_data = &rk30_adc_battery_platdata,
974 #ifdef CONFIG_RK30_PWM_REGULATOR
975 const static int pwm_voltage_map[] = {
976 1000000, 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000
979 static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
981 .supply = "vdd_core",
985 struct regulator_init_data pwm_regulator_init_dcdc[1] =
991 .max_uV = 1800000, //0.6-1.8V
993 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
995 .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
996 .consumer_supplies = pwm_dcdc1_consumers,
1000 static struct pwm_platform_data pwm_regulator_info[1] = {
1003 .pwm_gpio = RK30_PIN3_PD6,
1004 .pwm_iomux_name = GPIO3D6_PWM3_JTAGTMS_HOSTDRVVBUS_NAME,
1005 .pwm_iomux_pwm = GPIO3D_PWM3,
1006 .pwm_iomux_gpio = GPIO3D_GPIO3D6,
1007 .pwm_voltage = 1100000,
1008 .suspend_voltage = 1050000,
1011 .coefficient = 455, //45.5%
1012 .pwm_voltage_map = pwm_voltage_map,
1013 .init_data = &pwm_regulator_init_dcdc[0],
1017 struct platform_device pwm_regulator_device[1] = {
1019 .name = "pwm-voltage-regulator",
1022 .platform_data = &pwm_regulator_info[0],
1028 #ifdef CONFIG_RK29_VMAC
1029 #define PHY_PWR_EN_GPIO RK30_PIN1_PD6
1030 #include "board-rk30-sdk-vmac.c"
1033 #ifdef CONFIG_RFKILL_RK
1034 // bluetooth rfkill device, its driver in net/rfkill/rfkill-rk.c
1035 static struct rfkill_rk_platform_data rfkill_rk_platdata = {
1036 .type = RFKILL_TYPE_BLUETOOTH,
1038 .poweron_gpio = { // BT_REG_ON
1039 .io = INVALID_GPIO, //RK30_PIN3_PC7,
1040 .enable = GPIO_HIGH,
1042 .name = GPIO3C7_SDMMC1WRITEPRT_RMIICRS_NAME,
1043 .fgpio = GPIO3C_GPIO3C7,
1047 .reset_gpio = { // BT_RST
1048 .io = RK30_PIN3_PD1, // set io to INVALID_GPIO for disable it
1051 .name = GPIO3D1_SDMMC1BACKENDPWR_MIIMDCLK_NAME,
1052 .fgpio = GPIO3D_GPIO3D1,
1056 .wake_gpio = { // BT_WAKE, use to control bt's sleep and wakeup
1057 .io = RK30_PIN3_PC6, // set io to INVALID_GPIO for disable it
1058 .enable = GPIO_HIGH,
1060 .name = GPIO3C6_SDMMC1DETECTN_RMIIRXERR_NAME,
1061 .fgpio = GPIO3C_GPIO3C6,
1065 .wake_host_irq = { // BT_HOST_WAKE, for bt wakeup host when it is in deep sleep
1067 .io = RK30_PIN0_PA5, // set io to INVALID_GPIO for disable it
1068 .enable = GPIO_LOW, // set GPIO_LOW for falling, set 0 for rising
1075 .rts_gpio = { // UART_RTS, enable or disable BT's data coming
1076 .io = RK30_PIN1_PA3, // set io to INVALID_GPIO for disable it
1079 .name = GPIO1A3_UART0RTSN_NAME,
1080 .fgpio = GPIO1A_GPIO1A3,
1081 .fmux = GPIO1A_UART0RTSN,
1086 static struct platform_device device_rfkill_rk = {
1087 .name = "rfkill_rk",
1090 .platform_data = &rfkill_rk_platdata,
1095 #if defined(CONFIG_GPS_RK)
1096 int rk_gps_io_init(void)
1098 printk("%s \n", __FUNCTION__);
1100 rk30_mux_api_set(GPIO1B5_UART3RTSN_NAME, GPIO1B_GPIO1B5);//VCC_EN
1101 gpio_request(RK30_PIN1_PB5, NULL);
1102 gpio_direction_output(RK30_PIN1_PB5, GPIO_LOW);
1104 rk30_mux_api_set(GPIO1B4_UART3CTSN_GPSRFCLK_NAME, GPIO1B_GPSRFCLK);//GPS_CLK
1105 rk30_mux_api_set(GPIO1B2_UART3SIN_GPSMAG_NAME, GPIO1B_GPSMAG);//GPS_MAG
1106 rk30_mux_api_set(GPIO1B3_UART3SOUT_GPSSIG_NAME, GPIO1B_GPSSIG);//GPS_SIGN
1108 rk30_mux_api_set(GPIO1A6_UART1CTSN_SPI0CLK_NAME, GPIO1A_GPIO1A6);//SPI_CLK
1109 gpio_request(RK30_PIN1_PA6, NULL);
1110 gpio_direction_output(RK30_PIN1_PA6, GPIO_LOW);
1112 rk30_mux_api_set(GPIO1A5_UART1SOUT_SPI0TXD_NAME, GPIO1A_GPIO1A5);//SPI_MOSI
1113 gpio_request(RK30_PIN1_PA5, NULL);
1114 gpio_direction_output(RK30_PIN1_PA5, GPIO_LOW);
1116 rk30_mux_api_set(GPIO1A7_UART1RTSN_SPI0CSN0_NAME, GPIO1A_GPIO1A7);//SPI_CS
1117 gpio_request(RK30_PIN1_PA7, NULL);
1118 gpio_direction_output(RK30_PIN1_PA7, GPIO_LOW);
1121 int rk_gps_power_up(void)
1123 printk("%s \n", __FUNCTION__);
1128 int rk_gps_power_down(void)
1130 printk("%s \n", __FUNCTION__);
1135 int rk_gps_reset_set(int level)
1139 int rk_enable_hclk_gps(void)
1141 printk("%s \n", __FUNCTION__);
1142 clk_enable(clk_get(NULL, "hclk_gps"));
1145 int rk_disable_hclk_gps(void)
1147 printk("%s \n", __FUNCTION__);
1148 clk_disable(clk_get(NULL, "hclk_gps"));
1151 struct rk_gps_data rk_gps_info = {
1152 .io_init = rk_gps_io_init,
1153 .power_up = rk_gps_power_up,
1154 .power_down = rk_gps_power_down,
1155 .reset = rk_gps_reset_set,
1156 .enable_hclk_gps = rk_enable_hclk_gps,
1157 .disable_hclk_gps = rk_disable_hclk_gps,
1158 .GpsSign = RK30_PIN1_PB3,
1159 .GpsMag = RK30_PIN1_PB2, //GPIO index
1160 .GpsClk = RK30_PIN1_PB4, //GPIO index
1161 .GpsVCCEn = RK30_PIN1_PB5, //GPIO index
1162 .GpsSpi_CSO = RK30_PIN1_PA4, //GPIO index
1163 .GpsSpiClk = RK30_PIN1_PA5, //GPIO index
1164 .GpsSpiMOSI = RK30_PIN1_PA7, //GPIO index
1168 .u32GpsPhyAddr = RK30_GPS_PHYS,
1169 .u32GpsPhySize = RK30_GPS_SIZE,
1172 struct platform_device rk_device_gps = {
1173 .name = "gps_hv5820b",
1176 .platform_data = &rk_gps_info,
1182 static struct platform_device *devices[] __initdata = {
1183 #ifdef CONFIG_FB_ROCKCHIP
1186 #if defined(CONFIG_LCDC0_RK3066B)
1189 #if defined(CONFIG_LCDC1_RK3066B)
1193 #ifdef CONFIG_BACKLIGHT_RK29_BL
1194 &rk29_device_backlight,
1200 #ifdef CONFIG_ANDROID_TIMED_GPIO
1201 &rk29_device_vibrator,
1203 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1204 &rk29_device_gpio_leds,
1206 #ifdef CONFIG_RK_IRDA
1209 #ifdef CONFIG_WIFI_CONTROL_FUNC
1210 &rk29sdk_wifi_device,
1212 #ifdef CONFIG_RK29_SUPPORT_MODEM
1215 #if defined(CONFIG_MU509)
1218 #if defined(CONFIG_MW100)
1221 #if defined(CONFIG_MT6229)
1222 &rk29_device_mt6229,
1224 #ifdef CONFIG_BATTERY_RK30_ADC
1225 &rk30_device_adc_battery,
1227 #ifdef CONFIG_RFKILL_RK
1230 #ifdef CONFIG_GPS_RK
1237 #ifdef CONFIG_I2C0_RK30
1238 static struct i2c_board_info __initdata i2c0_info[] = {
1239 #if defined (CONFIG_GS_MMA8452)
1241 .type = "gs_mma8452",
1244 .irq = MMA8452_INT_PIN,
1245 .platform_data = &mma8452_info,
1248 #if defined (CONFIG_GS_LIS3DH)
1250 .type = "gs_lis3dh",
1251 .addr = 0x19, //0x19(SA0-->VCC), 0x18(SA0-->GND)
1253 .irq = LIS3DH_INT_PIN,
1254 .platform_data = &lis3dh_info,
1257 #if defined (CONFIG_COMPASS_AK8975)
1262 .irq = RK30_PIN0_PD5,
1263 .platform_data = &akm8975_info,
1266 #if defined (CONFIG_GYRO_L3G4200D)
1268 .type = "l3g4200d_gryo",
1271 .irq = L3G4200D_INT_PIN,
1272 .platform_data = &l3g4200d_info,
1275 #if defined (CONFIG_SND_SOC_RK1000)
1277 .type = "rk1000_i2c_codec",
1282 .type = "rk1000_control",
1287 #if defined (CONFIG_SND_SOC_RT5631)
1295 #ifdef CONFIG_MFD_RK610
1297 .type = "rk610_ctl",
1300 .platform_data = &rk610_ctl_pdata,
1302 #ifdef CONFIG_RK610_TVOUT
1304 .type = "rk610_tvout",
1309 #ifdef CONFIG_HDMI_RK610
1311 .type = "rk610_hdmi",
1314 .irq = INVALID_GPIO,
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 #ifdef CONFIG_ARCH_RK3066B
1338 #define TPS65910_HOST_IRQ RK30_PIN0_PB3
1340 #define TPS65910_HOST_IRQ RK30_PIN6_PA4
1342 #include "board-rk3066b-sdk-tps65910.c"
1345 static struct i2c_board_info __initdata i2c1_info[] = {
1346 #if defined (CONFIG_MFD_WM831X_I2C)
1351 .irq = RK30_PIN0_PB3,
1352 .platform_data = &wm831x_platdata,
1355 #if defined (CONFIG_MFD_TPS65910)
1358 .addr = TPS65910_I2C_ID0,
1360 .irq = TPS65910_HOST_IRQ,
1361 .platform_data = &tps65910_data,
1367 void __sramfunc board_pmu_suspend(void)
1369 #if defined (CONFIG_MFD_WM831X_I2C)
1370 if(g_pmic_type == PMIC_TYPE_WM8326)
1371 board_pmu_wm8326_suspend();
1373 #if defined (CONFIG_MFD_TPS65910)
1374 if(g_pmic_type == PMIC_TYPE_TPS65910)
1375 board_pmu_tps65910_suspend();
1379 void __sramfunc board_pmu_resume(void)
1381 #if defined (CONFIG_MFD_WM831X_I2C)
1382 if(g_pmic_type == PMIC_TYPE_WM8326)
1383 board_pmu_wm8326_resume();
1385 #if defined (CONFIG_MFD_TPS65910)
1386 if(g_pmic_type == PMIC_TYPE_TPS65910)
1387 board_pmu_tps65910_resume();
1391 int __sramdata gpio0d7_iomux,gpio0d7_do,gpio0d7_dir,gpio0d7_en;
1393 void __sramfunc rk30_pwm_logic_suspend_voltage(void)
1395 #ifdef CONFIG_RK30_PWM_REGULATOR
1397 // int gpio0d7_iomux,gpio0d7_do,gpio0d7_dir,gpio0d7_en;
1399 gpio0d7_iomux = readl_relaxed(GRF_GPIO0D_IOMUX);
1400 gpio0d7_do = grf_readl(GRF_GPIO0H_DO);
1401 gpio0d7_dir = grf_readl(GRF_GPIO0H_DIR);
1402 gpio0d7_en = grf_readl(GRF_GPIO0H_EN);
1404 writel_relaxed((1<<30), GRF_GPIO0D_IOMUX);
1405 grf_writel((1<<31)|(1<<15), GRF_GPIO0H_DIR);
1406 grf_writel((1<<31)|(1<<15), GRF_GPIO0H_DO);
1407 grf_writel((1<<31)|(1<<15), GRF_GPIO0H_EN);
1410 void __sramfunc rk30_pwm_logic_resume_voltage(void)
1412 #ifdef CONFIG_RK30_PWM_REGULATOR
1413 writel_relaxed((1<<30)|gpio0d7_iomux, GRF_GPIO0D_IOMUX);
1414 grf_writel((1<<31)|gpio0d7_en, GRF_GPIO0H_EN);
1415 grf_writel((1<<31)|gpio0d7_dir, GRF_GPIO0H_DIR);
1416 grf_writel((1<<31)|gpio0d7_do, GRF_GPIO0H_DO);
1422 extern void pwm_suspend_voltage(void);
1423 extern void pwm_resume_voltage(void);
1424 void rk30_pwm_suspend_voltage_set(void)
1426 #ifdef CONFIG_RK30_PWM_REGULATOR
1427 pwm_suspend_voltage();
1430 void rk30_pwm_resume_voltage_set(void)
1432 #ifdef CONFIG_RK30_PWM_REGULATOR
1433 pwm_resume_voltage();
1438 #ifdef CONFIG_I2C2_RK30
1439 static struct i2c_board_info __initdata i2c2_info[] = {
1440 #if defined (CONFIG_TOUCHSCREEN_GT8XX)
1442 .type = "Goodix-TS",
1445 .irq = RK30_PIN0_PD4,
1446 .platform_data = &goodix_info,
1449 #if defined (CONFIG_LS_CM3217)
1451 .type = "lightsensor",
1454 .platform_data = &cm3217_info,
1460 #ifdef CONFIG_I2C3_RK30
1461 static struct i2c_board_info __initdata i2c3_info[] = {
1465 #ifdef CONFIG_I2C4_RK30
1466 static struct i2c_board_info __initdata i2c4_info[] = {
1470 #ifdef CONFIG_I2C_GPIO_RK30
1471 #define I2C_SDA_PIN INVALID_GPIO// RK30_PIN2_PD6 //set sda_pin here
1472 #define I2C_SCL_PIN INVALID_GPIO//RK30_PIN2_PD7 //set scl_pin here
1473 static int rk30_i2c_io_init(void)
1475 //set iomux (gpio) here
1476 //rk30_mux_api_set(GPIO2D7_I2C1SCL_NAME, GPIO2D_GPIO2D7);
1477 //rk30_mux_api_set(GPIO2D6_I2C1SDA_NAME, GPIO2D_GPIO2D6);
1481 struct i2c_gpio_platform_data default_i2c_gpio_data = {
1482 .sda_pin = I2C_SDA_PIN,
1483 .scl_pin = I2C_SCL_PIN,
1484 .udelay = 5, // clk = 500/udelay = 100Khz
1485 .timeout = 100,//msecs_to_jiffies(100),
1487 .io_init = rk30_i2c_io_init,
1489 static struct i2c_board_info __initdata i2c_gpio_info[] = {
1493 static void __init rk30_i2c_register_board_info(void)
1495 #ifdef CONFIG_I2C0_RK30
1496 i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
1498 #ifdef CONFIG_I2C1_RK30
1499 i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
1501 #ifdef CONFIG_I2C2_RK30
1502 i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
1504 #ifdef CONFIG_I2C3_RK30
1505 i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
1507 #ifdef CONFIG_I2C4_RK30
1508 i2c_register_board_info(4, i2c4_info, ARRAY_SIZE(i2c4_info));
1510 #ifdef CONFIG_I2C_GPIO_RK30
1511 i2c_register_board_info(5, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
1516 #define POWER_ON_PIN RK30_PIN0_PA0 //power_hold
1517 static void rk30_pm_power_off(void)
1519 printk(KERN_ERR "rk30_pm_power_off start...\n");
1520 gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
1521 #if defined(CONFIG_MFD_WM831X)
1522 wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000); //set sys_pwr 0
1523 wm831x_device_shutdown(Wm831x);//wm8326 shutdown
1528 static void __init machine_rk30_board_init(void)
1531 gpio_request(POWER_ON_PIN, "poweronpin");
1532 gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
1534 pm_power_off = rk30_pm_power_off;
1536 rk30_i2c_register_board_info();
1537 spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
1538 platform_add_devices(devices, ARRAY_SIZE(devices));
1539 board_usb_detect_init(RK30_PIN0_PA7);
1541 #ifdef CONFIG_WIFI_CONTROL_FUNC
1542 rk29sdk_wifi_bt_gpio_control_init();
1546 static void __init rk30_reserve(void)
1549 rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
1551 #ifdef CONFIG_FB_ROCKCHIP
1552 resource_fb[0].start = board_mem_reserve_add("fb0", RK30_FB0_MEM_SIZE);
1553 resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1;
1555 resource_fb[1].start = board_mem_reserve_add("ipp buf", RK30_FB0_MEM_SIZE);
1556 resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1;
1557 resource_fb[2].start = board_mem_reserve_add("fb2", RK30_FB0_MEM_SIZE);
1558 resource_fb[2].end = resource_fb[2].start + RK30_FB0_MEM_SIZE - 1;
1561 #ifdef CONFIG_VIDEO_RK29
1562 rk30_camera_request_reserve_mem();
1565 #ifdef CONFIG_GPS_RK
1566 //it must be more than 8MB
1567 rk_gps_info.u32MemoryPhyAddr = board_mem_reserve_add("gps", SZ_8M);
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[] = {
1580 {.frequency = 252 * 1000, .cpu_volt = 1000 * 1000, .logic_volt = 1000 * 1000},
1581 {.frequency = 504 * 1000, .cpu_volt = 1000 * 1000, .logic_volt = 1000 * 1000},
1582 {.frequency = 816 * 1000, .cpu_volt = 1000 * 1000, .logic_volt = 1000 * 1000},
1583 {.frequency = 1008 * 1000, .cpu_volt = 1000 * 1000, .logic_volt = 1000 * 1000},
1584 {.frequency = 1200 * 1000, .cpu_volt = 1000 * 1000, .logic_volt = 1000 * 1000},
1586 {.frequency = 1272 * 1000, .cpu_volt = 1225 * 1000, .logic_volt = 1200 * 1000},
1587 {.frequency = 1416 * 1000, .cpu_volt = 1300 * 1000, .logic_volt = 1200 * 1000},
1588 {.frequency = 1512 * 1000, .cpu_volt = 1350 * 1000, .logic_volt = 1250 * 1000},
1589 {.frequency = 1608 * 1000, .cpu_volt = 1425 * 1000, .logic_volt = 1300 * 1000},
1591 {.frequency = CPUFREQ_TABLE_END},
1594 static struct cpufreq_frequency_table dvfs_gpu_table[] = {
1595 {.frequency = 266 * 1000, .index = 1000 * 1000},
1596 {.frequency = 400 * 1000, .index = 1000 * 1000},
1597 {.frequency = 600 * 1000, .index = 1200 * 1000},
1598 {.frequency = CPUFREQ_TABLE_END},
1601 static struct cpufreq_frequency_table dvfs_ddr_table[] = {
1602 {.frequency = 300 * 1000, .index = 1000 * 1000},
1603 {.frequency = 400 * 1000, .index = 1000 * 1000},
1604 {.frequency = CPUFREQ_TABLE_END},
1607 #define DVFS_CPU_TABLE_SIZE (ARRAY_SIZE(dvfs_cpu_logic_table))
1608 static struct cpufreq_frequency_table cpu_dvfs_table[DVFS_CPU_TABLE_SIZE];
1609 static struct cpufreq_frequency_table dep_cpu2core_table[DVFS_CPU_TABLE_SIZE];
1611 void __init board_clock_init(void)
1613 rk30_clock_data_init(periph_pll_default, codec_pll_default, RK30_CLOCKS_DEFAULT_FLAGS);
1614 dvfs_set_arm_logic_volt(dvfs_cpu_logic_table, cpu_dvfs_table, dep_cpu2core_table);
1615 dvfs_set_freq_volt_table(clk_get(NULL, "gpu"), dvfs_gpu_table);
1616 dvfs_set_freq_volt_table(clk_get(NULL, "ddr"), dvfs_ddr_table);
1619 MACHINE_START(RK30, "RK30board")
1620 .boot_params = PLAT_PHYS_OFFSET + 0x800,
1621 .fixup = rk30_fixup,
1622 .reserve = &rk30_reserve,
1623 .map_io = rk30_map_io,
1624 .init_irq = rk30_init_irq,
1625 .timer = &rk30_timer,
1626 .init_machine = machine_rk30_board_init,