2 * Copyright (C) 2013 ROCKCHIP, Inc.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
15 #include <linux/kernel.h>
16 #include <linux/init.h>
17 #include <linux/platform_device.h>
18 #include <linux/input.h>
20 #include <linux/delay.h>
21 #include <linux/i2c.h>
22 #include <linux/skbuff.h>
23 #include <linux/spi/spi.h>
24 #include <linux/mmc/host.h>
25 #include <linux/ion.h>
26 #include <linux/cpufreq.h>
27 #include <linux/clk.h>
28 #include <linux/rk_fb.h>
29 #include <linux/regulator/machine.h>
30 #include <linux/rfkill-rk.h>
31 #include <linux/sensor-dev.h>
32 #include <linux/mfd/tps65910.h>
33 #include <linux/regulator/act8846.h>
34 #include <linux/regulator/rk29-pwm-regulator.h>
36 #include <asm/setup.h>
37 #include <asm/mach-types.h>
38 #include <asm/mach/arch.h>
39 #include <asm/mach/map.h>
40 #include <asm/mach/flash.h>
41 #include <asm/hardware/gic.h>
43 #include <mach/dvfs.h>
44 #include <mach/board.h>
45 #include <mach/hardware.h>
47 #include <mach/gpio.h>
48 #include <mach/iomux.h>
50 #if defined(CONFIG_SPIM_RK29)
51 #include "../../../drivers/spi/rk29_spim.h"
54 #ifdef CONFIG_SND_SOC_RK3026
55 #include "../../../sound/soc/codecs/rk3026_codec.h"
58 #if defined(CONFIG_RK_HDMI)
59 #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
62 #if defined(CONFIG_GPS_RK)
63 #include "../../../drivers/misc/gps/rk_gps/rk_gps.h"
65 #include "board-rk3028a-86v-camera.c"
66 #include <plat/config.h>
67 #include <plat/board.h>
68 #include "../plat-rk/rk-fac-config.c"
70 #define INIT_ERR(name) do { printk("%s: %s init Failed: \n", __func__, (name)); } while(0)
72 #define INIT_ERR(name)
75 /***********************************************************
77 ************************************************************/
80 #define REG_PWM 1 // (0 ~ 2)
82 #define PMU_INT_PIN RK30_PIN3_PC6
83 #define PMU_SLEEP_PIN RK30_PIN3_PC4
85 #define ION_RESERVE_SIZE (80 * SZ_1M)
87 static int pwm_mode[] = {PWM0, PWM1, PWM2};
88 static inline int rk_gpio_request(int gpio, int direction, int value, const char *label)
91 unsigned long flags = 0;
93 if(!gpio_is_valid(gpio))
96 if(direction == GPIOF_DIR_IN)
98 else if(value == GPIO_LOW)
99 flags = GPIOF_OUT_INIT_LOW;
101 flags = GPIOF_OUT_INIT_HIGH;
103 ret = gpio_request_one(gpio, flags, label);
105 pr_err("Failed to request '%s'\n", label);
109 ////////////////////////////////////////////////////////////////////////////////////////
111 ////////////////////////////////////////////////////////////////////////////////////////
112 #include <plat/key.h>
113 static struct rk29_keys_button key_button[] = {
121 .code = KEY_VOLUMEDOWN,
125 .code = KEY_VOLUMEUP,
140 struct rk29_keys_platform_data rk29_keys_pdata = {
141 .buttons = key_button,
142 .chn = -1, //chn: 0-7, if do not use ADC,set 'chn' -1
144 ////////////////////////////////////////////////////////////////////////////////////////
146 ////////////////////////////////////////////////////////////////////////////////////////
147 #ifdef CONFIG_BACKLIGHT_RK29_BL
148 static int rk29_backlight_io_init(void)
151 printk("rk29_backlight_io_init %d\n",bl_pwm_mode);
152 iomux_set(bl_pwm_mode);
156 ret = port_output_init(bl_en, 1, "bl_en");
158 printk("%s: port output init faild\n", __func__);
161 port_output_on(bl_en);
167 static int rk29_backlight_io_deinit(void)
169 int ret = 0, pwm_gpio;
174 pwm_gpio = iomux_mode_to_gpio(bl_pwm_mode);
175 gpio_request(pwm_gpio, NULL);
176 gpio_direction_output(pwm_gpio, GPIO_LOW);
180 static int rk29_backlight_pwm_suspend(void)
182 int ret = 0, pwm_gpio;
184 pwm_gpio = iomux_mode_to_gpio(bl_pwm_mode);
185 if (gpio_request(pwm_gpio, NULL)) {
186 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
189 gpio_direction_output(pwm_gpio, GPIO_LOW);
190 port_output_off(bl_en);
194 static int rk29_backlight_pwm_resume(void)
196 int pwm_gpio = iomux_mode_to_gpio(bl_pwm_mode);
199 iomux_set(bl_pwm_mode);
201 port_output_on(bl_en);
205 static struct rk29_bl_info rk29_bl_info = {
206 .io_init = rk29_backlight_io_init,
207 .io_deinit = rk29_backlight_io_deinit,
208 .pwm_suspend = rk29_backlight_pwm_suspend,
209 .pwm_resume = rk29_backlight_pwm_resume,
212 static struct platform_device rk29_device_backlight = {
213 .name = "rk29_backlight",
216 .platform_data = &rk29_bl_info,
220 ////////////////////////////////////////////////////////////////////////////////////////
222 ////////////////////////////////////////////////////////////////////////////////////////
223 #ifdef CONFIG_FB_ROCKCHIP
224 static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
227 //printk("rk_fb_io_init %x,%x,%x\n",lcd_cs,lcd_en,lcd_std);
229 ret = port_output_init(lcd_cs, 1, "lcd_cs");
231 printk("%s: port output init faild\n", __func__);
232 port_output_on(lcd_cs);
236 ret = port_output_init(lcd_en, 1, "lcd_en");
238 printk("%s: port output init faild\n", __func__);
239 port_output_on(lcd_en);
244 static int rk_fb_io_disable(void)
247 port_output_off(lcd_cs);
249 port_output_on(lcd_en);
252 static int rk_fb_io_enable(void)
255 port_output_on(lcd_en);
257 port_output_on(lcd_cs);
261 #if defined(CONFIG_LCDC0_RK3066B) || defined(CONFIG_LCDC0_RK3188)
262 struct rk29fb_info lcdc0_screen_info = {
263 #if defined(CONFIG_RK_HDMI) && defined(CONFIG_HDMI_SOURCE_LCDC0) && defined(CONFIG_DUAL_LCDC_DUAL_DISP_IN_KERNEL)
264 .prop = EXTEND, //extend display device
268 .set_screen_info = hdmi_init_lcdc,
270 .prop = PRMRY, //primary display device
271 .io_init = rk_fb_io_init,
272 .io_disable = rk_fb_io_disable,
273 .io_enable = rk_fb_io_enable,
274 .set_screen_info = set_lcd_info,
279 #if defined(CONFIG_LCDC1_RK3066B) || defined(CONFIG_LCDC1_RK3188)
280 struct rk29fb_info lcdc1_screen_info = {
281 #if defined(CONFIG_RK_HDMI) && defined(CONFIG_HDMI_SOURCE_LCDC1) && defined(CONFIG_DUAL_LCDC_DUAL_DISP_IN_KERNEL)
282 .prop = EXTEND, //extend display device
286 .set_screen_info = hdmi_init_lcdc,
288 .prop = PRMRY, //primary display device
289 .io_init = rk_fb_io_init,
290 .io_disable = rk_fb_io_disable,
291 .io_enable = rk_fb_io_enable,
292 .set_screen_info = set_lcd_info,
297 static struct resource resource_fb[] = {
301 .end = 0,//RK30_FB0_MEM_SIZE - 1,
302 .flags = IORESOURCE_MEM,
305 .name = "ipp buf", //for rotate
307 .end = 0,//RK30_FB0_MEM_SIZE - 1,
308 .flags = IORESOURCE_MEM,
313 .end = 0,//RK30_FB0_MEM_SIZE - 1,
314 .flags = IORESOURCE_MEM,
318 static struct platform_device device_fb = {
321 .num_resources = ARRAY_SIZE(resource_fb),
322 .resource = resource_fb,
326 #if defined(CONFIG_LCDC0_RK3066B) || defined(CONFIG_LCDC0_RK3188)
327 static struct resource resource_lcdc0[] = {
330 .start = RK3026_LCDC0_PHYS,
331 .end = RK3026_LCDC0_PHYS + RK3026_LCDC0_SIZE - 1,
332 .flags = IORESOURCE_MEM,
339 .flags = IORESOURCE_IRQ,
343 static struct platform_device device_lcdc0 = {
346 .num_resources = ARRAY_SIZE(resource_lcdc0),
347 .resource = resource_lcdc0,
349 .platform_data = &lcdc0_screen_info,
354 #if defined(CONFIG_LCDC1_RK3066B) || defined(CONFIG_LCDC1_RK3188)
355 static struct resource resource_lcdc1[] = {
358 .start = RK3026_LCDC1_PHYS,
359 .end = RK3026_LCDC1_PHYS + RK3026_LCDC1_SIZE - 1,
360 .flags = IORESOURCE_MEM,
366 .flags = IORESOURCE_IRQ,
370 static struct platform_device device_lcdc1 = {
373 .num_resources = ARRAY_SIZE(resource_lcdc1),
374 .resource = resource_lcdc1,
376 .platform_data = &lcdc1_screen_info,
381 static int rk_platform_add_display_devices(void)
383 struct platform_device *fb = NULL; //fb
384 struct platform_device *lcdc0 = NULL; //lcdc0
385 struct platform_device *lcdc1 = NULL; //lcdc1
386 struct platform_device *bl = NULL; //backlight
387 #ifdef CONFIG_FB_ROCKCHIP
391 #if defined(CONFIG_LCDC0_RK3066B) || defined(CONFIG_LCDC0_RK3188)
392 lcdc0 = &device_lcdc0,
395 #if defined(CONFIG_LCDC1_RK3066B) || defined(CONFIG_LCDC1_RK3188)
396 lcdc1 = &device_lcdc1,
399 #ifdef CONFIG_BACKLIGHT_RK29_BL
400 bl = &rk29_device_backlight,
402 __rk_platform_add_display_devices(fb,lcdc0,lcdc1,bl);
407 ////////////////////////////////////////////////////////////////////////////////////////
409 ////////////////////////////////////////////////////////////////////////////////////////
410 #if (defined(CONFIG_TOUCHSCREEN_GSLX680_RK3168)||defined (CONFIG_TOUCHSCREEN_GSLX680_RK3028))
411 static int gslx680_init_platform_hw()
415 ret = port_output_init(tp_rst, 1, "tp_rst");
417 printk("%s: port output init faild\n", __func__);
420 port_output_on(tp_rst);
422 port_output_off(tp_rst);
424 port_output_on(tp_rst);
429 static struct tp_platform_data gslx680_data = {
431 .init_platform_hw = gslx680_init_platform_hw,
433 struct i2c_board_info __initdata gslx680_info = {
436 .platform_data = &gslx680_data,
441 #if defined (CONFIG_TOUCHSCREEN_86V_GT811_IIC)
442 int gt811_init_platform_hw(int irq,int reset)
446 ret = port_output_init(tp_rst, 1, "tp_rst");
448 printk("%s: port output init faild\n", __func__);
451 port_output_off(tp_rst);
453 port_output_off(tp_rst);
455 port_output_on(tp_rst);
461 static struct tp_platform_data gt811_data = {
463 .init_platform_hw= gt811_init_platform_hw,
466 struct i2c_board_info __initdata gt811_info = {
469 .platform_data = >811_data,
472 #if defined(CONFIG_TOUCHSCREEN_GT8XX)
473 #define TOUCH_PWR_PIN RK30_PIN0_PC5 // need to fly line by hardware engineer
474 static int goodix_init_platform_hw(void)
478 if (TOUCH_PWR_PIN != INVALID_GPIO) {
479 ret = gpio_request(TOUCH_PWR_PIN, "goodix power pin");
481 gpio_free(TOUCH_PWR_PIN);
482 printk("goodix power error\n");
485 gpio_direction_output(TOUCH_PWR_PIN, 0);
486 gpio_set_value(TOUCH_PWR_PIN, GPIO_LOW);
491 ret = port_output_init(tp_rst, 1, "tp_rst");
493 printk("%s: port output init faild\n", __func__);
495 port_output_on(tp_rst);
500 struct tp_platform_data goodix_data = {
502 .init_platform_hw = goodix_init_platform_hw,
505 struct i2c_board_info __initdata goodix_info = {
508 .platform_data = &goodix_data,
512 ////////////////////////////////////////////////////////////////////////////////////////
514 ////////////////////////////////////////////////////////////////////////////////////////
515 #if defined (CONFIG_GS_LSM303D)
516 static int lms303d_init_platform_hw(void)
520 static struct sensor_platform_data lms303d_data = {
521 .type = SENSOR_TYPE_ACCEL,
524 .init_platform_hw = lms303d_init_platform_hw,
526 struct i2c_board_info __initdata lms303d_info = {
527 .type = "gs_lsm303d",
529 .platform_data =&lms303d_data,
533 #if defined (CONFIG_GS_MMA8452)
534 static int mma8452_init_platform_hw(void)
539 static struct sensor_platform_data mma8452_data = {
540 .type = SENSOR_TYPE_ACCEL,
543 .init_platform_hw = mma8452_init_platform_hw,
545 struct i2c_board_info __initdata mma8452_info = {
546 .type = "gs_mma8452",
548 .platform_data =&mma8452_data,
553 #if defined (CONFIG_GS_MMA7660)
554 static int mma7660_init_platform_hw(void)
556 //rk30_mux_api_set(GPIO1B2_SPI_RXD_UART1_SIN_NAME, GPIO1B_GPIO1B2);
561 static struct sensor_platform_data mma7660_data = {
562 .type = SENSOR_TYPE_ACCEL,
565 .init_platform_hw = mma7660_init_platform_hw,
567 struct i2c_board_info __initdata mma7660_info = {
568 .type = "gs_mma7660",
570 .platform_data =&mma7660_data,
574 #if defined (CONFIG_GS_MXC6225)
575 static int mxc6225_init_platform_hw(void)
577 // rk30_mux_api_set(GPIO1B1_SPI_TXD_UART1_SOUT_NAME, GPIO1B_GPIO1B1);
581 static struct sensor_platform_data mxc6225_data = {
582 .type = SENSOR_TYPE_ACCEL,
585 .init_platform_hw = mxc6225_init_platform_hw,
587 struct i2c_board_info __initdata mxc6225_info = {
588 .type = "gs_mxc6225",
590 .platform_data =&mxc6225_data,
594 #if defined (CONFIG_GS_DMT10)
595 static int dmt10_init_platform_hw(void)
600 static struct sensor_platform_data dmt10_data = {
601 .type = SENSOR_TYPE_ACCEL,
604 .init_platform_hw = dmt10_init_platform_hw,
606 struct i2c_board_info __initdata dmt10_info = {
607 .type = "gs_dmard10",
609 .platform_data =&dmt10_data,
614 #if defined (CONFIG_GS_LIS3DH)
615 static int lis3dh_init_platform_hw(void)
619 static struct sensor_platform_data lis3dh_data = {
620 .type = SENSOR_TYPE_ACCEL,
623 .init_platform_hw = lis3dh_init_platform_hw,
625 struct i2c_board_info __initdata lis3dh_info = {
628 .platform_data =&lis3dh_data,
632 ////////////////////////////////////////////////////////////////////////////////////////
634 ////////////////////////////////////////////////////////////////////////////////////////
635 #ifdef CONFIG_BATTERY_RK30_ADC_FAC
636 static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
641 static struct platform_device rk30_device_adc_battery = {
642 .name = "rk30-battery",
645 .platform_data = &rk30_adc_battery_platdata,
650 ////////////////////////////////////////////////////////////////////////////////////////
652 ////////////////////////////////////////////////////////////////////////////////////////
653 #ifdef CONFIG_SND_SOC_RK3026
654 struct rk3026_codec_pdata rk3026_codec_pdata_info={
655 .spk_ctl_gpio = RK2928_PIN3_PD4,
656 .hp_ctl_gpio = RK2928_PIN3_PD4,
659 static struct resource resources_acodec[] = {
661 .start = RK2928_ACODEC_PHYS,
662 .end = RK2928_ACODEC_PHYS + RK2928_ACODEC_SIZE - 1,
663 .flags = IORESOURCE_MEM,
667 static struct platform_device rk3026_codec = {
668 .name = "rk3026-codec",
670 .resource = resources_acodec,
672 .platform_data = &rk3026_codec_pdata_info,
677 #if defined (CONFIG_SND_RK29_SOC_RT5631)
678 static struct codec_platform_data rt5631_data = {
680 struct i2c_board_info __initdata rt5631_info = {
683 .platform_data =&rt5631_data,
687 #if defined (CONFIG_SND_RK29_SOC_ES8323)
688 static struct codec_platform_data es8323_data = {
690 struct i2c_board_info __initdata es8323_info = {
693 .platform_data =&es8323_data,
697 #if defined(CONFIG_MFD_RK616)
698 #define RK616_SCL_RATE (100*1000) //i2c scl rate
699 static int rk616_power_on_init(void)
705 ret = port_output_init(codec_power, 1, "codec_power");
707 printk("%s: port output init faild\n", __func__);
708 port_output_on(codec_power);
713 ret = port_output_init(codec_rst, 1, "codec_rst");
715 printk("%s: port output init faild\n", __func__);
716 port_output_on(codec_rst);
718 port_output_off(codec_rst);
720 port_output_on(codec_rst);
727 static int rk616_power_deinit(void)
731 port_output_off(codec_power);
732 port_deinit(codec_power);
736 port_output_off(codec_rst);
737 port_deinit(codec_rst);
742 static struct rk616_platform_data rk616_pdata = {
743 .power_init = rk616_power_on_init,
744 .power_deinit = rk616_power_deinit,
745 .scl_rate = RK616_SCL_RATE,
746 .lcd0_func = INPUT, //port lcd0 as input
747 .lcd1_func = INPUT, //port lcd1 as input
748 .lvds_ch_nr = 1, //the number of used lvds channel
749 //.hdmi_irq = RK30_PIN2_PD6,
750 //.spk_ctl_gpio = RK30_PIN2_PD7,
751 .hp_ctl_gpio = RK30_PIN2_PD7,
754 struct i2c_board_info __initdata rk616_info = {
757 .platform_data = &rk616_pdata,
762 ////////////////////////////////////////////////////////////////////////////////////////
764 ////////////////////////////////////////////////////////////////////////////////////////
765 static struct spi_board_info board_spi_devices[] = {
769 ////////////////////////////////////////////////////////////////////////////////////////
771 ////////////////////////////////////////////////////////////////////////////////////////
772 #if defined (CONFIG_COMPASS_AK8975)
773 static struct sensor_platform_data akm8975_info =
775 .type = SENSOR_TYPE_COMPASS,
808 #if defined (CONFIG_COMPASS_AK8963)
809 static struct sensor_platform_data akm8963_info =
811 .type = SENSOR_TYPE_COMPASS,
845 #if defined(CONFIG_GYRO_L3G4200D)
847 #include <linux/l3g4200d.h>
848 #define L3G4200D_INT_PIN RK30_PIN0_PB4
850 static int l3g4200d_init_platform_hw(void)
855 static struct sensor_platform_data l3g4200d_info = {
856 .type = SENSOR_TYPE_GYROSCOPE,
859 .orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1},
860 .init_platform_hw = l3g4200d_init_platform_hw,
861 .x_min = 40,//x_min,y_min,z_min = (0-100) according to hardware
868 #ifdef CONFIG_LS_CM3217
869 static struct sensor_platform_data cm3217_info = {
870 .type = SENSOR_TYPE_LIGHT,
872 .poll_delay_ms = 500,
878 /***********************************************************
880 ************************************************************/
881 #ifdef CONFIG_SDMMC_RK29
882 #include "board-rk3028a-86v-sdmmc-config.c"
883 #include "../plat-rk/rk-sdmmc-ops.c"
884 #include "../plat-rk/rk-sdmmc-wifi.c"
885 #endif //endif ---#ifdef CONFIG_SDMMC_RK29
887 #ifdef CONFIG_SDMMC0_RK29
888 #define CONFIG_SDMMC0_USE_DMA
889 static int rk29_sdmmc0_cfg_gpio(void)
891 rk29_sdmmc_set_iomux(0, 0xFFFF);
892 #if defined(CONFIG_SDMMC0_RK29_SDCARD_DET_FROM_GPIO)
893 iomux_set_gpio_mode(iomux_gpio_to_mode(RK29SDK_SD_CARD_DETECT_N));
895 iomux_set(MMC0_DETN);
898 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
899 gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
900 gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
905 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
907 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
908 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
909 MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
911 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
912 .io_init = rk29_sdmmc0_cfg_gpio,
914 .set_iomux = rk29_sdmmc_set_iomux,
916 .dma_name = "sd_mmc",
917 #ifdef CONFIG_SDMMC0_USE_DMA
923 #if defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC) && defined(CONFIG_USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD)
924 .status = rk29sdk_wifi_mmc0_status,
925 .register_status_notify = rk29sdk_wifi_mmc0_status_register,
928 #if defined(RK29SDK_SD_CARD_PWR_EN) || (INVALID_GPIO != RK29SDK_SD_CARD_PWR_EN)
929 .power_en = RK29SDK_SD_CARD_PWR_EN,
930 .power_en_level = RK29SDK_SD_CARD_PWR_EN_LEVEL,
932 .power_en = INVALID_GPIO,
933 .power_en_level = GPIO_LOW,
935 .enable_sd_wakeup = 0,
937 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
938 .write_prt = SDMMC0_WRITE_PROTECT_PIN,
939 .write_prt_enalbe_level = SDMMC0_WRITE_PROTECT_ENABLE_VALUE;
941 .write_prt = INVALID_GPIO,
945 #if defined(RK29SDK_SD_CARD_DETECT_N) || (INVALID_GPIO != RK29SDK_SD_CARD_DETECT_N)
946 .io = RK29SDK_SD_CARD_DETECT_N, //INVALID_GPIO,
947 .enable = RK29SDK_SD_CARD_INSERT_LEVEL,
955 #endif // CONFIG_SDMMC0_RK29
957 #ifdef CONFIG_SDMMC1_RK29
958 #define CONFIG_SDMMC1_USE_DMA
959 static int rk29_sdmmc1_cfg_gpio(void)
961 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
962 gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp");
963 gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN);
968 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
970 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
971 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
974 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
975 .host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |
976 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
979 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
982 .io_init = rk29_sdmmc1_cfg_gpio,
984 .set_iomux = rk29_sdmmc_set_iomux,
987 #ifdef CONFIG_SDMMC1_USE_DMA
993 #if defined(CONFIG_WIFI_CONTROL_FUNC) || defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC)
994 .status = rk29sdk_wifi_status,
995 .register_status_notify = rk29sdk_wifi_status_register,
998 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
999 .write_prt = SDMMC1_WRITE_PROTECT_PIN,
1000 .write_prt_enalbe_level = SDMMC1_WRITE_PROTECT_ENABLE_VALUE;
1002 .write_prt = INVALID_GPIO,
1005 #if defined(CONFIG_RK29_SDIO_IRQ_FROM_GPIO)
1006 .sdio_INT_gpio = RK29SDK_WIFI_SDIO_CARD_INT,
1010 #if defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
1011 #if defined(RK29SDK_SD_CARD_DETECT_N) || (INVALID_GPIO != RK29SDK_SD_CARD_DETECT_N)
1012 .io = RK29SDK_SD_CARD_DETECT_N,
1017 .enable = RK29SDK_SD_CARD_INSERT_LEVEL,
1023 .enable_sd_wakeup = 0,
1025 #endif //endif--#ifdef CONFIG_SDMMC1_RK29
1027 /***********************************************************
1029 ************************************************************/
1030 #ifdef CONFIG_RFKILL_RK
1031 // bluetooth rfkill device, its driver in net/rfkill/rfkill-rk.c
1032 static struct rfkill_rk_platform_data rfkill_rk_platdata = {
1033 .type = RFKILL_TYPE_BLUETOOTH,
1035 .poweron_gpio = { // BT_REG_ON
1036 .io = INVALID_GPIO, //RK30_PIN3_PC7,
1037 .enable = GPIO_HIGH,
1039 .name = "bt_poweron",
1040 //.fgpio = GPIO3_C7,
1044 .reset_gpio = { // BT_RST
1045 .io = RK30_PIN1_PB3, // set io to INVALID_GPIO for disable it
1053 .wake_gpio = { // BT_WAKE, use to control bt's sleep and wakeup
1054 .io = RK30_PIN1_PB2, // set io to INVALID_GPIO for disable it
1055 .enable = GPIO_HIGH,
1062 .wake_host_irq = { // BT_HOST_WAKE, for bt wakeup host when it is in deep sleep
1064 .io = RK30_PIN0_PA4, // set io to INVALID_GPIO for disable it
1065 .enable = GPIO_LOW, // set GPIO_LOW for falling, set 0 for rising
1067 .name = "bt_wake_host",
1068 //.fgpio = GPIO0_A4,
1073 .rts_gpio = { // UART_RTS, enable or disable BT's data coming
1074 .io = RK30_PIN1_PA3, // set io to INVALID_GPIO for disable it
1084 static struct platform_device device_rfkill_rk = {
1085 .name = "rfkill_rk",
1088 .platform_data = &rfkill_rk_platdata,
1093 /***********************************************************
1095 ************************************************************/
1097 static struct ion_platform_data rk30_ion_pdata = {
1101 .type = ION_HEAP_TYPE_CARVEOUT,
1102 .id = ION_NOR_HEAP_ID,
1104 .size = ION_RESERVE_SIZE,
1109 static struct platform_device device_ion = {
1110 .name = "ion-rockchip",
1113 .platform_data = &rk30_ion_pdata,
1118 /***********************************************************
1120 ************************************************************/
1121 #ifdef CONFIG_RK30_PWM_REGULATOR
1122 static int pwm_voltage_map[] = {
1123 800000, 825000, 850000, 875000, 900000, 925000 ,
1124 950000, 975000, 1000000, 1025000, 1050000, 1075000,
1125 1100000, 1125000, 1150000, 1175000, 1200000, 1225000,
1126 1250000, 1275000, 1300000, 1325000, 1350000, 1375000
1129 static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
1131 .supply = "vdd_core",
1135 struct regulator_init_data pwm_regulator_init_dcdc[1] = {
1138 .name = "PWM_DCDC1",
1140 .max_uV = 1800000, //0.6-1.8V
1142 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1144 .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
1145 .consumer_supplies = pwm_dcdc1_consumers,
1149 static struct pwm_platform_data pwm_regulator_info[1] = {
1152 .pwm_voltage = 1200000,
1153 .suspend_voltage = 1050000,
1156 .coefficient = 504, //50.4%
1157 .pwm_voltage_map = pwm_voltage_map,
1158 .init_data = &pwm_regulator_init_dcdc[0],
1161 struct platform_device pwm_regulator_device[1] = {
1163 .name = "pwm-voltage-regulator",
1166 .platform_data = &pwm_regulator_info[0],
1171 static void pwm_regulator_init(void)
1173 pwm_regulator_info[0].pwm_gpio = iomux_mode_to_gpio(pwm_mode[REG_PWM]);
1174 pwm_regulator_info[0].pwm_iomux_pwm = pwm_mode[REG_PWM];
1175 pwm_regulator_info[0].pwm_iomux_gpio = iomux_switch_gpio_mode(pwm_mode[REG_PWM]);
1179 int __sramdata pwm_iomux, pwm_do, pwm_dir, pwm_en;
1180 #define grf_readl(offset) readl_relaxed(RK30_GRF_BASE + offset)
1181 #define grf_writel(v, offset) do { writel_relaxed(v, RK30_GRF_BASE + offset); dsb(); } while (0)
1183 #define GPIO0_D2_OFFSET 10
1184 void __sramfunc rk30_pwm_logic_suspend_voltage(void)
1186 #ifdef CONFIG_RK30_PWM_REGULATOR
1188 /* pwm0: GPIO0_D2, pwm1: GPIO0_D3, pwm2: GPIO0_D4 */
1189 int off = GPIO0_D2_OFFSET + REG_PWM;
1192 pwm_iomux = grf_readl(GRF_GPIO0D_IOMUX);
1193 pwm_dir = grf_readl(GRF_GPIO0H_DIR);
1194 pwm_do = grf_readl(GRF_GPIO0H_DO);
1195 pwm__en = grf_readl(GRF_GPIO0H_EN);
1197 grf_writel((1<<(2 * off), GRF_GPIO0D_IOMUX);
1198 grf_writel((1<<(16 + off))|(1<<off), GRF_GPIO0H_DIR);
1199 grf_writel((1<<(16 + off))|(1<<off), GRF_GPIO0H_DO);
1204 void __sramfunc rk30_pwm_logic_resume_voltage(void)
1206 #ifdef CONFIG_RK30_PWM_REGULATOR
1208 /* pwm0: GPIO0_D2, pwm1: GPIO0_D3, pwm2: GPIO0_D4 */
1209 int off = GPIO0_D2_OFFSET + REG_PWM;
1211 grf_writel((1<<(2 * off))|pwm_iomux, GRF_GPIO0D_IOMUX);
1212 grf_writel(((1<<(16 + off))|pwm_dir), GRF_GPIO0L_DIR);
1213 grf_writel(((1<<(16 + off))|pwm_do), GRF_GPIO0L_DO);
1214 grf_writel(((1<<(16 + off))|pwm_en), GRF_GPIO0L_EN);
1219 extern void pwm_suspend_voltage(void);
1220 extern void pwm_resume_voltage(void);
1222 void rk30_pwm_suspend_voltage_set(void)
1224 #ifdef CONFIG_RK30_PWM_REGULATOR
1225 pwm_suspend_voltage();
1229 void rk30_pwm_resume_voltage_set(void)
1231 #ifdef CONFIG_RK30_PWM_REGULATOR
1232 pwm_resume_voltage();
1236 /***********************************************************
1238 ************************************************************/
1239 int __sramdata g_pmic_type = 0;
1241 #ifdef CONFIG_MFD_TPS65910
1242 #define TPS65910_HOST_IRQ PMU_INT_PIN
1243 #define PMU_POWER_SLEEP PMU_SLEEP_PIN
1244 static struct pmu_info tps65910_dcdc_info[] = {
1246 .name = "vdd_core", //logic
1251 .name = "vdd_cpu", //arm
1256 .name = "vio", //vcc_io
1262 static struct pmu_info tps65910_ldo_info[] = {
1264 .name = "vpll", //vdd10
1269 .name = "vdig1", //vcc18_cif
1270 .min_uv = 2800000,//1800000,
1271 .max_uv = 2800000,//1800000,
1274 .name = "vdig2", //vdd11
1279 .name = "vaux1", //vcc28_cif
1284 .name = "vaux2", //vcc33
1289 .name = "vaux33", //vcc_tp
1294 .name = "vmmc", //vcca30
1304 #include "../mach-rk30/board-pmu-tps65910.c"
1307 void __sramfunc board_pmu_suspend(void)
1309 #if defined (CONFIG_MFD_TPS65910)
1310 if(pmic_is_tps65910())
1311 board_pmu_tps65910_suspend();
1315 void __sramfunc board_pmu_resume(void)
1317 #if defined (CONFIG_MFD_TPS65910)
1318 if(pmic_is_tps65910())
1319 board_pmu_tps65910_resume();
1323 #if defined(CONFIG_GPS_RK)
1324 #define GPS_OSCEN_PIN RK2928_PIN1_PB0
1325 #define GPS_RXEN_PIN RK2928_PIN1_PB0
1327 static int rk_gps_io_init(void)
1329 printk("%s \n", __FUNCTION__);
1331 gpio_request(GPS_OSCEN_PIN, NULL);
1332 gpio_direction_output(GPS_OSCEN_PIN, GPIO_LOW);
1334 iomux_set(GPS_CLK);//GPS_CLK
1335 iomux_set(GPS_MAG);//GPS_MAG
1336 iomux_set(GPS_SIGN);//GPS_SIGN
1338 gpio_request(RK30_PIN1_PA6, NULL);
1339 gpio_direction_output(RK30_PIN1_PA6, GPIO_LOW);
1341 gpio_request(RK30_PIN1_PA5, NULL);
1342 gpio_direction_output(RK30_PIN1_PA5, GPIO_LOW);
1344 gpio_request(RK30_PIN1_PA7, NULL);
1345 gpio_direction_output(RK30_PIN1_PA7, GPIO_LOW);
1349 static int rk_gps_power_up(void)
1351 printk("%s \n", __FUNCTION__);
1356 static int rk_gps_power_down(void)
1358 printk("%s \n", __FUNCTION__);
1363 static int rk_gps_reset_set(int level)
1367 static int rk_enable_hclk_gps(void)
1369 struct clk *gps_aclk = NULL;
1370 gps_aclk = clk_get(NULL, "aclk_gps");
1372 clk_enable(gps_aclk);
1374 printk("%s \n", __FUNCTION__);
1377 printk("get gps aclk fail\n");
1380 static int rk_disable_hclk_gps(void)
1382 struct clk *gps_aclk = NULL;
1383 gps_aclk = clk_get(NULL, "aclk_gps");
1385 //TO wait long enough until GPS ISR is finished.
1387 clk_disable(gps_aclk);
1389 printk("%s \n", __FUNCTION__);
1392 printk("get gps aclk fail\n");
1395 static struct rk_gps_data rk_gps_info = {
1396 .io_init = rk_gps_io_init,
1397 .power_up = rk_gps_power_up,
1398 .power_down = rk_gps_power_down,
1399 .reset = rk_gps_reset_set,
1400 .enable_hclk_gps = rk_enable_hclk_gps,
1401 .disable_hclk_gps = rk_disable_hclk_gps,
1402 .GpsSign = RK2928_PIN1_PA5,
1403 .GpsMag = RK2928_PIN1_PA4, //GPIO index
1404 .GpsClk = RK2928_PIN1_PA2, //GPIO index
1405 .GpsVCCEn = GPS_OSCEN_PIN, //GPIO index
1407 .GpsSpi_CSO = RK30_PIN1_PA4, //GPIO index
1408 .GpsSpiClk = RK30_PIN1_PA5, //GPIO index
1409 .GpsSpiMOSI = RK30_PIN1_PA7, //GPIO index
1414 .u32GpsPhyAddr = RK2928_GPS_PHYS,
1415 .u32GpsPhySize = RK2928_GPS_SIZE,
1418 static struct platform_device rk_device_gps = {
1419 .name = "gps_hv5820b",
1422 .platform_data = &rk_gps_info,
1428 /***********************************************************
1430 ************************************************************/
1431 #ifdef CONFIG_I2C0_RK30
1432 static struct i2c_board_info __initdata i2c0_info[] = {
1433 #if defined (CONFIG_MFD_TPS65910)
1436 .addr = TPS65910_I2C_ID0,
1438 .irq = TPS65910_HOST_IRQ,
1439 .platform_data = &tps65910_data,
1446 #ifdef CONFIG_I2C1_RK30
1447 static struct i2c_board_info __initdata i2c1_info[] = {
1448 #if defined (CONFIG_COMPASS_AK8975)
1453 .irq = RK30_PIN3_PD7,
1454 .platform_data = &akm8975_info,
1455 .irq = RK30_PIN3_PD7,
1456 .platform_data = &akm8975_info,
1459 #if defined (CONFIG_COMPASS_AK8963)
1464 .irq = RK30_PIN3_PD7,
1465 .platform_data = &akm8963_info,
1468 #if defined (CONFIG_GYRO_L3G4200D)
1470 .type = "l3g4200d_gryo",
1473 .irq = L3G4200D_INT_PIN,
1474 .platform_data = &l3g4200d_info,
1481 #ifdef CONFIG_I2C2_RK30
1482 static struct i2c_board_info __initdata i2c2_info[] = {
1486 #ifdef CONFIG_I2C3_RK30
1487 static struct i2c_board_info __initdata i2c3_info[] = {
1491 #ifdef CONFIG_I2C_GPIO_RK30
1492 #define I2C_SDA_PIN INVALID_GPIO// RK30_PIN2_PD6 //set sda_pin here
1493 #define I2C_SCL_PIN INVALID_GPIO//RK30_PIN2_PD7 //set scl_pin here
1494 static int rk30_i2c_io_init(void)
1499 struct i2c_gpio_platform_data default_i2c_gpio_data = {
1500 .sda_pin = I2C_SDA_PIN,
1501 .scl_pin = I2C_SCL_PIN,
1502 .udelay = 5, // clk = 500/udelay = 100Khz
1503 .timeout = 100,//msecs_to_jiffies(100),
1505 .io_init = rk30_i2c_io_init,
1508 static struct i2c_board_info __initdata i2c_gpio_info[] = {
1513 static void __init rk30_i2c_register_board_info(void)
1515 #ifdef CONFIG_I2C0_RK30
1516 i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
1518 #ifdef CONFIG_I2C1_RK30
1519 i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
1521 #ifdef CONFIG_I2C2_RK30
1522 i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
1524 #ifdef CONFIG_I2C3_RK30
1525 i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
1527 #ifdef CONFIG_I2C_GPIO_RK30
1528 i2c_register_board_info(4, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
1532 /***********************************************************
1534 ************************************************************/
1535 static struct platform_device *devices[] __initdata = {
1539 #ifdef CONFIG_WIFI_CONTROL_FUNC
1540 &rk29sdk_wifi_device,
1542 #ifdef CONFIG_RFKILL_RK
1545 #ifdef CONFIG_BATTERY_RK30_ADC_FAC
1546 &rk30_device_adc_battery,
1548 #ifdef CONFIG_SND_SOC_RK3026
1551 #ifdef CONFIG_GPS_RK
1556 static void rk30_pm_power_off(void)
1558 #if defined(CONFIG_MFD_TPS65910)
1559 tps65910_device_shutdown();//tps65910 shutdown
1561 port_output_off(pwr_on);
1564 static int __init tp_board_init(void)
1567 struct port_config irq_port;
1568 struct port_config rst_port;
1569 int ret = check_tp_param();
1574 irq_port = get_port_config(tp_irq);
1575 rst_port = get_port_config(tp_rst);
1576 #if (defined (CONFIG_TOUCHSCREEN_GSLX680_RK3168)||defined (CONFIG_TOUCHSCREEN_GSLX680_RK3028))
1577 if(tp_type == TP_TYPE_GSLX680){
1578 gslx680_data.irq_pin = irq_port.gpio;
1579 gslx680_info.addr = tp_addr;
1580 gslx680_data.reset_pin= rst_port.gpio;
1581 gslx680_data.x_max=tp_xmax;
1582 gslx680_data.y_max=tp_ymax;
1583 gslx680_data.firmVer=tp_firmVer;
1584 i2c_register_board_info(tp_i2c, &gslx680_info, 1);
1588 #if defined (CONFIG_TOUCHSCREEN_86V_GT811_IIC)
1589 if(tp_type == TP_TYPE_GT811_86V){
1590 gt811_data.irq_pin = irq_port.gpio;
1591 gt811_info.addr = tp_addr;
1592 gt811_data.reset_pin= rst_port.gpio;
1593 gt811_data.x_max=tp_xmax;
1594 gt811_data.y_max=tp_ymax;
1595 i2c_register_board_info(tp_i2c, >811_info, 1);
1599 #if defined(CONFIG_TOUCHSCREEN_GT8XX)
1600 if(tp_type == TP_TYPE_GT8XX){
1601 goodix_data.irq_pin = irq_port.gpio;
1602 goodix_info.addr = tp_addr;
1603 goodix_data.reset_pin= rst_port.gpio;
1604 goodix_data.x_max=tp_xmax;
1605 goodix_data.y_max=tp_ymax;
1606 i2c_register_board_info(tp_i2c, &goodix_info, 1);
1613 static int __init codec_board_init(void)
1615 struct port_config spk_port;
1616 struct port_config hp_port;
1617 struct port_config hdmi_irq_port;
1618 int ret = check_codec_param();
1623 spk_port = get_port_config(spk_ctl);
1624 hp_port = get_port_config(hp_det);
1626 #if defined (CONFIG_SND_RK29_SOC_RT5631)
1627 if(codec_type == CODEC_TYPE_RT5631){
1628 rt5631_data.spk_pin = spk_port.gpio;
1629 rt5631_info.addr = codec_addr;
1630 rt5631_data.hp_pin= hp_port.gpio;
1631 i2c_register_board_info(codec_i2c, &rt5631_info, 1);
1635 #if defined (CONFIG_SND_RK29_SOC_ES8323)
1636 if(codec_type == CODEC_TYPE_ES8323){
1637 es8323_data.spk_pin = spk_port.gpio;
1638 es8323_info.addr = codec_addr;
1639 es8323_data.hp_pin= hp_port.gpio;
1640 i2c_register_board_info(codec_i2c, &es8323_info, 1);
1644 #if defined (CONFIG_MFD_RK616)
1645 if(codec_type == CODEC_TYPE_RK616){
1646 rk616_pdata.spk_ctl_gpio = spk_port.gpio;
1647 rk616_info.addr = codec_addr;
1648 rk616_pdata.hdmi_irq= get_port_config(codec_hdmi_irq).gpio;
1649 i2c_register_board_info(codec_i2c, &rk616_info, 1);
1655 static int __init chg_board_init(void)
1658 int ret = check_chg_param();
1661 #ifdef CONFIG_BATTERY_RK30_ADC_FAC
1662 //rk30_adc_battery_platdata.adc_channel = chg_adc;
1664 rk30_adc_battery_platdata.dc_det_pin = get_port_config(dc_det).gpio;
1665 printk("rk30_adc_battery_platdata.dc_det_pin %d %d",rk30_adc_battery_platdata.dc_det_pin,RK30_PIN0_PB2);
1666 rk30_adc_battery_platdata.dc_det_level = !get_port_config(dc_det).io.active_low;
1669 rk30_adc_battery_platdata.dc_det_pin=INVALID_GPIO;
1672 rk30_adc_battery_platdata.batt_low_pin = get_port_config(bat_low).gpio;
1673 rk30_adc_battery_platdata.batt_low_level = !get_port_config(bat_low).io.active_low;
1676 rk30_adc_battery_platdata.batt_low_pin=INVALID_GPIO;
1679 rk30_adc_battery_platdata.charge_ok_pin = get_port_config(chg_ok).gpio;
1680 rk30_adc_battery_platdata.charge_ok_level = !get_port_config(chg_ok).io.active_low;
1683 rk30_adc_battery_platdata.charge_ok_pin=INVALID_GPIO;
1686 rk30_adc_battery_platdata.charge_set_pin = get_port_config(chg_set).gpio;
1687 rk30_adc_battery_platdata.charge_set_level = !get_port_config(chg_set).io.active_low;
1690 rk30_adc_battery_platdata.charge_set_pin=INVALID_GPIO;
1693 rk30_adc_battery_platdata.usb_det_pin = get_port_config(chg_set).gpio;
1694 rk30_adc_battery_platdata.usb_det_level = !get_port_config(chg_set).io.active_low;
1697 rk30_adc_battery_platdata.usb_det_pin=INVALID_GPIO;
1701 rk30_adc_battery_platdata.reference_voltage=ref_vol;
1705 rk30_adc_battery_platdata.pull_up_res=up_res;
1708 rk30_adc_battery_platdata.pull_down_res=down_res;
1711 rk30_adc_battery_platdata.is_reboot_charging=root_chg;
1714 rk30_adc_battery_platdata.save_capacity=save_cap;
1717 rk30_adc_battery_platdata.low_voltage_protection=low_vol;
1722 rk30_adc_battery_platdata.chargeArray[i]=bat_charge[i];
1723 rk30_adc_battery_platdata.dischargeArray[i]=bat_discharge[i];
1729 static int __init gs_board_init(void)
1732 struct port_config port;
1733 int ret = check_gs_param();
1736 port = get_port_config(gs_irq);
1738 #if defined (CONFIG_GS_MMA7660)
1739 if(gs_type == GS_TYPE_MMA7660){
1741 mma7660_info.irq = port.gpio;
1742 mma7660_info.addr = gs_addr;
1743 for(i = 0; i < 9; i++)
1744 mma7660_data.orientation[i] = gs_orig[i];
1745 i2c_register_board_info(gs_i2c, &mma7660_info, 1);
1749 #if defined (CONFIG_GS_LIS3DH)
1750 if(gs_type == GS_TYPE_LIS3DH){
1751 lis3dh_info.irq = port.gpio;
1752 lis3dh_info.addr = gs_addr;
1753 for(i = 0; i < 9; i++)
1754 lis3dh_data.orientation[i] = gs_orig[i];
1755 i2c_register_board_info(gs_i2c, &lis3dh_info, 1);
1759 #if defined (CONFIG_GS_MXC6225)
1760 if(gs_type == GS_TYPE_MXC6225){
1761 mxc6225_info.irq = port.gpio;
1762 mxc6225_info.addr = gs_addr;
1763 for(i = 0; i < 9; i++)
1764 mxc6225_data.orientation[i] = gs_orig[i];
1765 i2c_register_board_info(gs_i2c, &mxc6225_info, 1);
1769 #if defined (CONFIG_GS_DMT10)
1770 if(gs_type == GS_TYPE_DMARAD10){
1771 dmt10_info.irq = port.gpio;
1772 dmt10_info.addr = gs_addr;
1773 for(i = 0; i < 9; i++)
1774 dmt10_data.orientation[i] = gs_orig[i];
1775 i2c_register_board_info(gs_i2c, &dmt10_info, 1);
1779 #if defined (CONFIG_GS_MMA8452)
1780 if(gs_type == GS_TYPE_MMA8452){
1781 mma8452_info.irq = port.gpio;
1782 mma8452_info.addr = gs_addr;
1783 for(i = 0; i < 9; i++)
1784 mma8452_data.orientation[i] = gs_orig[i];
1785 i2c_register_board_info(gs_i2c, &mma8452_info, 1);
1789 #if defined (CONFIG_GS_LSM303D)
1790 if(gs_type == GS_TYPE_LSM303D){
1791 lms303d_info.irq = port.gpio;
1792 lms303d_info.addr = gs_addr;
1793 for(i = 0; i < 9; i++)
1794 lms303d_data.orientation[i] = gs_orig[i];
1795 i2c_register_board_info(gs_i2c, &lms303d_info, 1);
1801 static int __init bl_board_init(void){
1802 int ret = check_bl_param();
1819 rk29_bl_info.pwm_id = bl_pwmid;
1820 rk29_bl_info.brightness_mode=bl_mode;
1821 rk29_bl_info.pre_div=bl_div;
1822 rk29_bl_info.bl_ref = bl_ref;
1823 rk29_bl_info.min_brightness=bl_min;
1824 rk29_bl_info.max_brightness=bl_max;
1830 static int __init lcd_board_init(void)
1832 return check_lcd_param();
1835 static int __init key_board_init(void){
1837 struct port_config port;
1838 for(i = 0; i < key_val_size; i++){
1839 if(key_val[i] & (1<<31)){
1840 key_button[i].adc_value = key_val[i] & 0xffff;
1841 key_button[i].gpio = INVALID_GPIO;
1843 port = get_port_config(key_val[i]);
1844 key_button[i].gpio = port.gpio;
1845 key_button[i].active_low = port.io.active_low;
1848 rk29_keys_pdata.nbuttons = key_val_size;
1849 rk29_keys_pdata.chn = key_adc;
1853 static int __init wifi_board_init(void)
1855 return check_wifi_param();
1859 static int __init rk_config_init(void)
1862 ret = lcd_board_init();
1866 ret = bl_board_init();
1868 INIT_ERR("backlight");
1870 ret = tp_board_init();
1874 ret = gs_board_init();
1876 INIT_ERR("gsensor");
1878 ret = codec_board_init();
1882 ret = key_board_init();
1886 ret = chg_board_init();
1890 ret = wifi_board_init();
1897 static void __init machine_rk30_board_init(void)
1899 #ifdef CONFIG_RK30_PWM_REGULATOR
1900 pwm_regulator_init();
1903 pm_power_off = rk30_pm_power_off;
1906 rk30_i2c_register_board_info();
1907 spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
1908 platform_add_devices(devices, ARRAY_SIZE(devices));
1909 rk_platform_add_display_devices();
1910 #if defined(CONFIG_WIFI_CONTROL_FUNC)
1911 rk29sdk_wifi_bt_gpio_control_init();
1912 #elif defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC)
1913 rk29sdk_wifi_combo_module_gpio_init();
1917 static void __init rk30_reserve(void)
1920 #ifdef CONFIG_FB_ROCKCHIP
1921 resource_fb[0].start = board_mem_reserve_add("fb0 buf", get_fb_size());
1922 resource_fb[0].end = resource_fb[0].start + get_fb_size()- 1;
1924 resource_fb[1].start = board_mem_reserve_add("ipp buf", RK30_FB0_MEM_SIZE);
1925 resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1;
1928 #if defined(CONFIG_FB_ROTATE) || !defined(CONFIG_THREE_FB_BUFFER)
1929 resource_fb[2].start = board_mem_reserve_add("fb2 buf",get_fb_size());
1930 resource_fb[2].end = resource_fb[2].start + get_fb_size() - 1;
1935 rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
1938 #ifdef CONFIG_VIDEO_RK29
1939 rk30_camera_request_reserve_mem();
1941 #ifdef CONFIG_GPS_RK
1942 //it must be more than 8MB
1943 rk_gps_info.u32MemoryPhyAddr = board_mem_reserve_add("gps", SZ_8M);
1945 board_mem_reserved();
1948 /***********************************************************
1950 ************************************************************/
1951 static struct cpufreq_frequency_table dvfs_arm_table[] = {
1952 {.frequency = 312 * 1000, .index = 1100 * 1000},
1953 {.frequency = 504 * 1000, .index = 1100 * 1000},
1954 {.frequency = 816 * 1000, .index = 1150 * 1000},
1955 {.frequency = 1008 * 1000, .index = 1200 * 1000},
1956 //{.frequency = 1200 * 1000, .index = 1300 * 1000},
1957 //{.frequency = 1416 * 1000, .index = 1200 * 1000},
1958 //{.frequency = 1608 * 1000, .index = 1200 * 1000},
1959 {.frequency = CPUFREQ_TABLE_END},
1962 static struct cpufreq_frequency_table dvfs_gpu_table[] = {
1963 //{.frequency = 100 * 1000, .index = 1200 * 1000},
1964 {.frequency = 200 * 1000, .index = 1200 * 1000},
1965 //{.frequency = 266 * 1000, .index = 1200 * 1000},
1966 //{.frequency = 300 * 1000, .index = 1200 * 1000},
1967 //{.frequency = 400 * 1000, .index = 1200 * 1000},
1968 {.frequency = CPUFREQ_TABLE_END},
1971 static struct cpufreq_frequency_table dvfs_ddr_table[] = {
1972 //{.frequency = 200 * 1000 + DDR_FREQ_SUSPEND, .index = 1200 * 1000},
1973 //{.frequency = 300 * 1000 + DDR_FREQ_VIDEO, .index = 1200 * 1000},
1974 {.frequency = 360 * 1000 + DDR_FREQ_NORMAL, .index = 1200 * 1000},
1975 {.frequency = CPUFREQ_TABLE_END},
1978 void __init board_clock_init(void)
1980 rk2928_clock_data_init(periph_pll_default, codec_pll_default, RK30_CLOCKS_DEFAULT_FLAGS);
1981 //dvfs_set_arm_logic_volt(dvfs_cpu_logic_table, cpu_dvfs_table, dep_cpu2core_table);
1982 dvfs_set_freq_volt_table(clk_get(NULL, "cpu"), dvfs_arm_table);
1983 dvfs_set_freq_volt_table(clk_get(NULL, "gpu"), dvfs_gpu_table);
1984 dvfs_set_freq_volt_table(clk_get(NULL, "ddr"), dvfs_ddr_table);
1987 /************************ end *****************************/
1988 MACHINE_START(RK30, "RK30board")
1989 .boot_params = PLAT_PHYS_OFFSET + 0x800,
1990 .fixup = rk2928_fixup,
1991 .reserve = &rk30_reserve,
1992 .map_io = rk2928_map_io,
1993 .init_irq = rk2928_init_irq,
1994 .timer = &rk2928_timer,
1995 .init_machine = machine_rk30_board_init,