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>
43 #include <linux/rk_fb.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/act8846.h>
49 #include <linux/mfd/rk808.h>
50 #include <linux/regulator/rk29-pwm-regulator.h>
52 #if defined(CONFIG_MFD_RK610)
53 #include <linux/mfd/rk610_core.h>
56 #if defined(CONFIG_MFD_RK616)
57 #include <linux/mfd/rk616.h>
61 #if defined(CONFIG_RK_HDMI)
62 #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
65 #if defined(CONFIG_SPIM_RK29)
66 #include "../../../drivers/spi/rk29_spim.h"
68 #if defined(CONFIG_GPS_RK)
69 #include "../../../drivers/misc/gps/rk_gps/rk_gps.h"
71 #if defined(CONFIG_MU509)
72 #include <linux/mu509.h>
74 #if defined(CONFIG_MW100)
75 #include <linux/mw100.h>
77 #if defined(CONFIG_MT6229)
78 #include <linux/mt6229.h>
80 #if defined(CONFIG_ANDROID_TIMED_GPIO)
81 #include "../../../drivers/staging/android/timed_gpio.h"
84 #if defined(CONFIG_MT6620)
85 #include <linux/gps.h>
87 #include "../mach-rk30/board-rk3168-tb-camera.c"
89 #include <plat/config.h>
90 #include <plat/board.h>
91 #include "../plat-rk/rk-fac-config.c"
93 #define INIT_ERR(name) do { printk("%s: %s init Failed: \n", __func__, (name)); } while(0)
95 #define INIT_ERR(name)
98 ////////////////////////////////////////////////////////////////////////////////////////
100 static struct rk29_keys_button key_button[] = {
108 .code = KEY_VOLUMEDOWN,
112 .code = KEY_VOLUMEUP,
127 struct rk29_keys_platform_data rk29_keys_pdata = {
128 .buttons = key_button,
129 .chn = -1, //chn: 0-7, if do not use ADC,set 'chn' -1
131 ////////////////////////////////////////////////////////////////////////////////////////
133 ////////////////////////////////////////////////////////////////////////////////////////
134 #ifdef CONFIG_BACKLIGHT_RK29_BL
135 static int rk29_backlight_io_init(void)
138 printk("rk29_backlight_io_init %d\n",bl_pwm_mode);
139 iomux_set(bl_pwm_mode);
144 ret = port_output_init(bl_en, 1, "bl_en");
146 printk("%s: port output init faild\n", __func__);
149 port_output_on(bl_en);
153 static int rk29_backlight_io_deinit(void)
155 int ret = 0, pwm_gpio;
160 pwm_gpio = iomux_mode_to_gpio(bl_pwm_mode);
161 gpio_request(pwm_gpio, NULL);
162 gpio_direction_output(pwm_gpio, GPIO_LOW);
166 static int rk29_backlight_pwm_suspend(void)
168 int ret = 0, pwm_gpio;
170 pwm_gpio = iomux_mode_to_gpio(bl_pwm_mode);
171 if (gpio_request(pwm_gpio, NULL)) {
172 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
175 gpio_direction_output(pwm_gpio, GPIO_LOW);
176 port_output_off(bl_en);
180 static int rk29_backlight_pwm_resume(void)
182 int pwm_gpio = iomux_mode_to_gpio(bl_pwm_mode);
184 iomux_set(bl_pwm_mode);
186 port_output_on(bl_en);
190 static struct rk29_bl_info rk29_bl_info = {
191 .io_init = rk29_backlight_io_init,
192 .io_deinit = rk29_backlight_io_deinit,
193 .pwm_suspend = rk29_backlight_pwm_suspend,
194 .pwm_resume = rk29_backlight_pwm_resume,
197 static struct platform_device rk29_device_backlight = {
198 .name = "rk29_backlight",
201 .platform_data = &rk29_bl_info,
206 ////////////////////////////////////////////////////////////////////////////////////////
208 ////////////////////////////////////////////////////////////////////////////////////////
209 #ifdef CONFIG_FB_ROCKCHIP
210 static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
213 //printk("rk_fb_io_init %x,%x,%x\n",lcd_cs,lcd_en,lcd_std);
215 ret = port_output_init(lcd_cs, 1, "lcd_cs");
217 printk("%s: port output init faild\n", __func__);
218 port_output_on(lcd_cs);
222 ret = port_output_init(lcd_en, 1, "lcd_en");
224 printk("%s: port output init faild\n", __func__);
225 port_output_on(lcd_en);
230 static int rk_fb_io_disable(void)
233 port_output_off(lcd_cs);
235 port_output_on(lcd_en);
238 static int rk_fb_io_enable(void)
241 port_output_on(lcd_en);
243 port_output_on(lcd_cs);
247 #if defined(CONFIG_LCDC0_RK3066B) || defined(CONFIG_LCDC0_RK3188)
248 struct rk29fb_info lcdc0_screen_info = {
249 #if defined(CONFIG_RK_HDMI) && defined(CONFIG_HDMI_SOURCE_LCDC0) && defined(CONFIG_DUAL_LCDC_DUAL_DISP_IN_KERNEL)
250 .prop = EXTEND, //extend display device
254 .set_screen_info = hdmi_init_lcdc,
256 .prop = PRMRY, //primary display device
257 .io_init = rk_fb_io_init,
258 .io_disable = rk_fb_io_disable,
259 .io_enable = rk_fb_io_enable,
260 .set_screen_info = set_lcd_info,
265 #if defined(CONFIG_LCDC1_RK3066B) || defined(CONFIG_LCDC1_RK3188)
266 struct rk29fb_info lcdc1_screen_info = {
267 #if defined(CONFIG_RK_HDMI) && defined(CONFIG_HDMI_SOURCE_LCDC1) && defined(CONFIG_DUAL_LCDC_DUAL_DISP_IN_KERNEL)
268 .prop = EXTEND, //extend display device
272 .set_screen_info = hdmi_init_lcdc,
274 .prop = PRMRY, //primary display device
275 .io_init = rk_fb_io_init,
276 .io_disable = rk_fb_io_disable,
277 .io_enable = rk_fb_io_enable,
278 .set_screen_info = set_lcd_info,
283 static struct resource resource_fb[] = {
287 .end = 0,//RK30_FB0_MEM_SIZE - 1,
288 .flags = IORESOURCE_MEM,
291 .name = "ipp buf", //for rotate
293 .end = 0,//RK30_FB0_MEM_SIZE - 1,
294 .flags = IORESOURCE_MEM,
299 .end = 0,//RK30_FB0_MEM_SIZE - 1,
300 .flags = IORESOURCE_MEM,
304 static struct platform_device device_fb = {
307 .num_resources = ARRAY_SIZE(resource_fb),
308 .resource = resource_fb,
312 #if defined(CONFIG_LCDC0_RK3066B) || defined(CONFIG_LCDC0_RK3188)
313 static struct resource resource_lcdc0[] = {
316 .start = RK30_LCDC0_PHYS,
317 .end = RK30_LCDC0_PHYS + RK30_LCDC0_SIZE - 1,
318 .flags = IORESOURCE_MEM,
325 .flags = IORESOURCE_IRQ,
329 static struct platform_device device_lcdc0 = {
332 .num_resources = ARRAY_SIZE(resource_lcdc0),
333 .resource = resource_lcdc0,
335 .platform_data = &lcdc0_screen_info,
339 #if defined(CONFIG_LCDC1_RK3066B) || defined(CONFIG_LCDC1_RK3188)
340 static struct resource resource_lcdc1[] = {
343 .start = RK30_LCDC1_PHYS,
344 .end = RK30_LCDC1_PHYS + RK30_LCDC1_SIZE - 1,
345 .flags = IORESOURCE_MEM,
351 .flags = IORESOURCE_IRQ,
355 static struct platform_device device_lcdc1 = {
358 .num_resources = ARRAY_SIZE(resource_lcdc1),
359 .resource = resource_lcdc1,
361 .platform_data = &lcdc1_screen_info,
365 ////////////////////////////////////////////////////////////////////////////////////////
367 ////////////////////////////////////////////////////////////////////////////////////////
368 #if defined (CONFIG_TOUCHSCREEN_GSLX680_RK3168)
369 static int gslx680_init_platform_hw()
373 ret = port_output_init(tp_rst, 1, "tp_rst");
375 printk("%s: port output init faild\n", __func__);
378 port_output_on(tp_rst);
380 port_output_off(tp_rst);
382 port_output_on(tp_rst);
387 static struct tp_platform_data gslx680_data = {
389 .init_platform_hw = gslx680_init_platform_hw,
391 struct i2c_board_info __initdata gslx680_info = {
394 .platform_data = &gslx680_data,
399 #if defined (CONFIG_TOUCHSCREEN_86V_GT811_IIC)
400 int gt811_init_platform_hw(int irq,int reset)
404 ret = port_output_init(tp_rst, 1, "tp_rst");
406 printk("%s: port output init faild\n", __func__);
409 port_output_off(tp_rst);
411 port_output_off(tp_rst);
413 port_output_on(tp_rst);
419 static struct tp_platform_data gt811_data = {
421 .init_platform_hw= gt811_init_platform_hw,
424 struct i2c_board_info __initdata gt811_info = {
427 .platform_data = >811_data,
432 #if defined(CONFIG_TOUCHSCREEN_GT8XX)
433 #define TOUCH_PWR_PIN RK30_PIN0_PC5 // need to fly line by hardware engineer
434 static int goodix_init_platform_hw(void)
438 if (TOUCH_PWR_PIN != INVALID_GPIO) {
439 ret = gpio_request(TOUCH_PWR_PIN, "goodix power pin");
441 gpio_free(TOUCH_PWR_PIN);
442 printk("goodix power error\n");
445 gpio_direction_output(TOUCH_PWR_PIN, 0);
446 gpio_set_value(TOUCH_PWR_PIN, GPIO_LOW);
451 ret = port_output_init(tp_rst, 1, "tp_rst");
453 printk("%s: port output init faild\n", __func__);
455 port_output_on(tp_rst);
460 struct tp_platform_data goodix_data = {
462 .init_platform_hw = goodix_init_platform_hw,
465 struct i2c_board_info __initdata goodix_info = {
468 .platform_data = &goodix_data,
472 ////////////////////////////////////////////////////////////////////////////////////////
474 ////////////////////////////////////////////////////////////////////////////////////////
476 #if defined (CONFIG_GS_MMA7660)
477 static int mma7660_init_platform_hw(void)
479 //rk30_mux_api_set(GPIO1B2_SPI_RXD_UART1_SIN_NAME, GPIO1B_GPIO1B2);
484 static struct sensor_platform_data mma7660_data = {
485 .type = SENSOR_TYPE_ACCEL,
488 .init_platform_hw = mma7660_init_platform_hw,
490 struct i2c_board_info __initdata mma7660_info = {
491 .type = "gs_mma7660",
493 .platform_data =&mma7660_data,
497 #if defined (CONFIG_GS_MXC6225)
498 static int mxc6225_init_platform_hw(void)
500 // rk30_mux_api_set(GPIO1B1_SPI_TXD_UART1_SOUT_NAME, GPIO1B_GPIO1B1);
504 static struct sensor_platform_data mxc6225_data = {
505 .type = SENSOR_TYPE_ACCEL,
508 .init_platform_hw = mxc6225_init_platform_hw,
510 struct i2c_board_info __initdata mxc6225_info = {
511 .type = "gs_mxc6225",
513 .platform_data =&mxc6225_data,
517 #if defined (CONFIG_GS_DMT10)
518 static int dmt10_init_platform_hw(void)
523 static struct sensor_platform_data dmt10_data = {
524 .type = SENSOR_TYPE_ACCEL,
527 .init_platform_hw = dmt10_init_platform_hw,
529 struct i2c_board_info __initdata dmt10_info = {
530 .type = "gs_dmard10",
532 .platform_data =&dmt10_data,
537 #if defined (CONFIG_GS_LIS3DH)
538 static int lis3dh_init_platform_hw(void)
542 static struct sensor_platform_data lis3dh_data = {
543 .type = SENSOR_TYPE_ACCEL,
546 .init_platform_hw = lis3dh_init_platform_hw,
548 struct i2c_board_info __initdata lis3dh_info = {
551 .platform_data =&lis3dh_data,
555 #if defined (CONFIG_GS_LSM303D)
556 static int lms303d_init_platform_hw(void)
560 static struct sensor_platform_data lms303d_data = {
561 .type = SENSOR_TYPE_ACCEL,
564 .init_platform_hw = lms303d_init_platform_hw,
566 struct i2c_board_info __initdata lms303d_info = {
567 .type = "gs_lsm303d",
569 .platform_data =&lms303d_data,
573 #if defined (CONFIG_GS_MMA8452)
574 static int mma8452_init_platform_hw(void)
579 static struct sensor_platform_data mma8452_data = {
580 .type = SENSOR_TYPE_ACCEL,
583 .init_platform_hw = mma8452_init_platform_hw,
585 struct i2c_board_info __initdata mma8452_info = {
586 .type = "gs_mma8452",
588 .platform_data =&mma8452_data,
592 ////////////////////////////////////////////////////////////////////////////////////////
594 ////////////////////////////////////////////////////////////////////////////////////////
595 #ifdef CONFIG_BATTERY_RK30_ADC_FAC
596 static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
601 static struct platform_device rk30_device_adc_battery = {
602 .name = "rk30-battery",
605 .platform_data = &rk30_adc_battery_platdata,
610 ////////////////////////////////////////////////////////////////////////////////////////
612 ////////////////////////////////////////////////////////////////////////////////////////
613 #if defined (CONFIG_SND_RK29_SOC_RT5631)
614 static struct codec_platform_data rt5631_data = {
616 struct i2c_board_info __initdata rt5631_info = {
619 .platform_data =&rt5631_data,
623 #if defined (CONFIG_SND_RK29_SOC_ES8323)
624 static struct codec_platform_data es8323_data = {
626 struct i2c_board_info __initdata es8323_info = {
629 .platform_data =&es8323_data,
633 #if defined(CONFIG_MFD_RK616)
634 #define RK616_SCL_RATE (100*1000) //i2c scl rate
635 static int rk616_power_on_init(void)
641 ret = port_output_init(codec_power, 1, "codec_power");
643 printk("%s: port output init faild\n", __func__);
644 port_output_on(codec_power);
649 ret = port_output_init(codec_rst, 1, "codec_rst");
651 printk("%s: port output init faild\n", __func__);
652 port_output_on(codec_rst);
654 port_output_off(codec_rst);
656 port_output_on(codec_rst);
663 static int rk616_power_deinit(void)
667 port_output_off(codec_power);
668 port_deinit(codec_power);
672 port_output_off(codec_rst);
673 port_deinit(codec_rst);
678 static struct rk616_platform_data rk616_pdata = {
679 .power_init = rk616_power_on_init,
680 .power_deinit = rk616_power_deinit,
681 .scl_rate = RK616_SCL_RATE,
682 .lcd0_func = INPUT, //port lcd0 as input
683 .lcd1_func = INPUT, //port lcd1 as input
684 .lvds_ch_nr = 1, //the number of used lvds channel
685 //.hdmi_irq = RK30_PIN2_PD6,
686 //.spk_ctl_gpio = RK30_PIN2_PD7,
687 .hp_ctl_gpio = RK30_PIN2_PD7,
690 struct i2c_board_info __initdata rk616_info = {
693 .platform_data = &rk616_pdata,
698 ////////////////////////////////////////////////////////////////////////////////////////
700 ////////////////////////////////////////////////////////////////////////////////////////
701 static struct spi_board_info board_spi_devices[] = {
704 ////////////////////////////////////////////////////////////////////////////////////////
706 ////////////////////////////////////////////////////////////////////////////////////////
707 #ifdef CONFIG_RK29_SUPPORT_MODEM
709 #define RK30_MODEM_POWER RK30_PIN0_PC6
710 #define RK30_MODEM_POWER_IOMUX iomux_set(GPIO0_C6)
712 static int rk30_modem_io_init(void)
714 printk("%s\n", __FUNCTION__);
715 RK30_MODEM_POWER_IOMUX;
720 static struct rk29_io_t rk30_modem_io = {
721 .io_addr = RK30_MODEM_POWER,
724 .io_init = rk30_modem_io_init,
727 static struct platform_device rk30_device_modem = {
728 .name = "rk30_modem",
731 .platform_data = &rk30_modem_io,
735 #if defined(CONFIG_MU509)
736 static int mu509_io_init(void)
747 static int mu509_io_deinit(void)
753 struct rk29_mu509_data rk29_mu509_info = {
754 .io_init = mu509_io_init,
755 .io_deinit = mu509_io_deinit,
756 .modem_power_en = RK30_PIN2_PD5,
757 .bp_power = RK30_PIN0_PC6,
758 .bp_reset = RK30_PIN2_PD4,
759 .ap_wakeup_bp = RK30_PIN0_PC4,
760 .bp_wakeup_ap = RK30_PIN0_PC5,
762 struct platform_device rk29_device_mu509 = {
766 .platform_data = &rk29_mu509_info,
770 #if defined(CONFIG_MW100)
771 static int mw100_io_init(void)
781 static int mw100_io_deinit(void)
787 struct rk29_mw100_data rk29_mw100_info = {
788 .io_init = mw100_io_init,
789 .io_deinit = mw100_io_deinit,
790 .modem_power_en = RK30_PIN2_PD5,
791 .bp_power = RK30_PIN0_PC6,
792 .bp_reset = RK30_PIN2_PD4,
793 .ap_wakeup_bp = RK30_PIN0_PC4,
794 .bp_wakeup_ap = RK30_PIN0_PC5,
796 struct platform_device rk29_device_mw100 = {
800 .platform_data = &rk29_mw100_info,
804 #if defined(CONFIG_MT6229)
805 static int mt6229_io_init(void)
815 static int mt6229_io_deinit(void)
821 struct rk29_mt6229_data rk29_mt6229_info = {
822 .io_init = mt6229_io_init,
823 .io_deinit = mt6229_io_deinit,
824 .modem_power_en = RK30_PIN2_PD5,
825 .bp_power = RK30_PIN0_PC6,
826 .bp_reset = RK30_PIN2_PD4,
827 .ap_wakeup_bp = RK30_PIN0_PC4,
828 .bp_wakeup_ap = RK30_PIN0_PC5,
830 struct platform_device rk29_device_mt6229 = {
834 .platform_data = &rk29_mt6229_info,
840 ////////////////////////////////////////////////////////////////////////////////////////
842 ////////////////////////////////////////////////////////////////////////////////////////
843 #if defined (CONFIG_COMPASS_AK8975)
844 static struct sensor_platform_data akm8975_info =
846 .type = SENSOR_TYPE_COMPASS,
879 #if defined(CONFIG_GYRO_L3G4200D)
881 #include <linux/l3g4200d.h>
882 #define L3G4200D_INT_PIN RK30_PIN0_PB4
884 static int l3g4200d_init_platform_hw(void)
889 static struct sensor_platform_data l3g4200d_info = {
890 .type = SENSOR_TYPE_GYROSCOPE,
893 .orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1},
894 .init_platform_hw = l3g4200d_init_platform_hw,
895 .x_min = 40,//x_min,y_min,z_min = (0-100) according to hardware
902 #ifdef CONFIG_LS_CM3217
903 static struct sensor_platform_data cm3217_info = {
904 .type = SENSOR_TYPE_LIGHT,
906 .poll_delay_ms = 500,
913 ////////////////////////////////////////////////////////////////////////////////////////
915 ////////////////////////////////////////////////////////////////////////////////////////
916 #if defined(CONFIG_ARCH_RK3188)
917 static struct resource resource_mali[] = {
922 .flags = IORESOURCE_MEM,
927 static struct platform_device device_mali= {
928 .name = "mali400_ump",
930 .num_resources = ARRAY_SIZE(resource_mali),
931 .resource = resource_mali,
935 ////////////////////////////////////////////////////////////////////////////////////////
937 ////////////////////////////////////////////////////////////////////////////////////////
938 #ifdef CONFIG_ANDROID_TIMED_GPIO
939 static struct timed_gpio timed_gpios[] = {
942 .gpio = INVALID_GPIO,
945 .adjust_time =20, //adjust for diff product
949 static struct timed_gpio_platform_data rk29_vibrator_info = {
951 .gpios = timed_gpios,
954 static struct platform_device rk29_device_vibrator = {
955 .name = "timed-gpio",
958 .platform_data = &rk29_vibrator_info,
964 #ifdef CONFIG_LEDS_GPIO_PLATFORM
965 static struct gpio_led rk29_leds[] = {
967 .name = "button-backlight",
968 .gpio = INVALID_GPIO,
969 .default_trigger = "timer",
971 .retain_state_suspended = 0,
972 .default_state = LEDS_GPIO_DEFSTATE_OFF,
976 static struct gpio_led_platform_data rk29_leds_pdata = {
978 .num_leds = ARRAY_SIZE(rk29_leds),
981 static struct platform_device rk29_device_gpio_leds = {
985 .platform_data = &rk29_leds_pdata,
990 #ifdef CONFIG_RK_IRDA
991 #define IRDA_IRQ_PIN INVALID_GPIO //RK30_PIN0_PA3
993 static int irda_iomux_init(void)
998 ret = gpio_request(IRDA_IRQ_PIN, NULL);
1000 gpio_free(IRDA_IRQ_PIN);
1001 printk(">>>>>> IRDA_IRQ_PIN gpio_request err \n ");
1003 gpio_pull_updown(IRDA_IRQ_PIN, PullDisable);
1004 gpio_direction_input(IRDA_IRQ_PIN);
1009 static int irda_iomux_deinit(void)
1011 gpio_free(IRDA_IRQ_PIN);
1015 static struct irda_info rk29_irda_info = {
1016 .intr_pin = IRDA_IRQ_PIN,
1017 .iomux_init = irda_iomux_init,
1018 .iomux_deinit = irda_iomux_deinit,
1019 //.irda_pwr_ctl = bu92747guw_power_ctl,
1022 static struct platform_device irda_device = {
1023 #ifdef CONFIG_RK_IRDA_NET
1026 .name = "bu92747_irda",
1030 .platform_data = &rk29_irda_info,
1036 ////////////////////////////////////////////////////////////////////////////////////////
1038 ////////////////////////////////////////////////////////////////////////////////////////
1040 #define ION_RESERVE_SIZE (80 * SZ_1M)
1041 static struct ion_platform_data rk30_ion_pdata = {
1045 .type = ION_HEAP_TYPE_CARVEOUT,
1046 .id = ION_NOR_HEAP_ID,
1048 .size = ION_RESERVE_SIZE,
1053 static struct platform_device device_ion = {
1054 .name = "ion-rockchip",
1057 .platform_data = &rk30_ion_pdata,
1062 /**************************************************************************************************
1063 * SDMMC devices, include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
1064 **************************************************************************************************/
1065 #ifdef CONFIG_SDMMC_RK29
1066 #include "../mach-rk30/board-rk3168-tb-sdmmc-conifg.c"
1067 #include "../plat-rk/rk-sdmmc-ops.c"
1068 #include "../plat-rk/rk-sdmmc-wifi.c"
1069 #endif //endif ---#ifdef CONFIG_SDMMC_RK29
1071 #ifdef CONFIG_SDMMC0_RK29
1072 static int rk29_sdmmc0_cfg_gpio(void)
1074 #ifdef CONFIG_SDMMC_RK29_OLD
1075 iomux_set(MMC0_CMD);
1076 iomux_set(MMC0_CLKOUT);
1082 iomux_set_gpio_mode(iomux_mode_to_gpio(MMC0_DETN));
1084 gpio_request(RK30_PIN3_PA7, "sdmmc-power");
1085 gpio_direction_output(RK30_PIN3_PA7, GPIO_LOW);
1088 rk29_sdmmc_set_iomux(0, 0xFFFF);
1090 #if defined(CONFIG_SDMMC0_RK29_SDCARD_DET_FROM_GPIO)
1091 #if SDMMC_USE_NEW_IOMUX_API
1092 iomux_set_gpio_mode(iomux_gpio_to_mode(RK29SDK_SD_CARD_DETECT_N));
1094 rk30_mux_api_set(RK29SDK_SD_CARD_DETECT_PIN_NAME, RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO);
1097 #if SDMMC_USE_NEW_IOMUX_API
1098 iomux_set(MMC0_DETN);
1100 rk30_mux_api_set(RK29SDK_SD_CARD_DETECT_PIN_NAME, RK29SDK_SD_CARD_DETECT_IOMUX_FMUX);
1104 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
1105 gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
1106 gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
1114 #define CONFIG_SDMMC0_USE_DMA
1115 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
1117 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
1118 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
1119 MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
1121 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
1122 .io_init = rk29_sdmmc0_cfg_gpio,
1124 #if !defined(CONFIG_SDMMC_RK29_OLD)
1125 .set_iomux = rk29_sdmmc_set_iomux,
1128 .dma_name = "sd_mmc",
1129 #ifdef CONFIG_SDMMC0_USE_DMA
1135 #if defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC) && defined(CONFIG_USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD)
1136 .status = rk29sdk_wifi_mmc0_status,
1137 .register_status_notify = rk29sdk_wifi_mmc0_status_register,
1140 #if defined(RK29SDK_SD_CARD_PWR_EN) || (INVALID_GPIO != RK29SDK_SD_CARD_PWR_EN)
1141 .power_en = RK29SDK_SD_CARD_PWR_EN,
1142 .power_en_level = RK29SDK_SD_CARD_PWR_EN_LEVEL,
1144 .power_en = INVALID_GPIO,
1145 .power_en_level = GPIO_LOW,
1147 .enable_sd_wakeup = 0,
1149 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
1150 .write_prt = SDMMC0_WRITE_PROTECT_PIN,
1151 .write_prt_enalbe_level = SDMMC0_WRITE_PROTECT_ENABLE_VALUE;
1153 .write_prt = INVALID_GPIO,
1157 #if defined(RK29SDK_SD_CARD_DETECT_N) || (INVALID_GPIO != RK29SDK_SD_CARD_DETECT_N)
1158 .io = RK29SDK_SD_CARD_DETECT_N, //INVALID_GPIO,
1159 .enable = RK29SDK_SD_CARD_INSERT_LEVEL,
1160 #ifdef RK29SDK_SD_CARD_DETECT_PIN_NAME
1162 .name = RK29SDK_SD_CARD_DETECT_PIN_NAME,
1163 #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO
1164 .fgpio = RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO,
1166 #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FMUX
1167 .fmux = RK29SDK_SD_CARD_DETECT_IOMUX_FMUX,
1178 #endif // CONFIG_SDMMC0_RK29
1180 #ifdef CONFIG_SDMMC1_RK29
1181 #define CONFIG_SDMMC1_USE_DMA
1182 static int rk29_sdmmc1_cfg_gpio(void)
1184 #if defined(CONFIG_SDMMC_RK29_OLD)
1185 iomux_set(MMC1_CMD);
1186 iomux_set(MMC1_CLKOUT);
1193 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
1194 gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp");
1195 gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN);
1203 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
1205 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
1206 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
1209 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
1210 .host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |
1211 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
1214 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
1217 .io_init = rk29_sdmmc1_cfg_gpio,
1219 #if !defined(CONFIG_SDMMC_RK29_OLD)
1220 .set_iomux = rk29_sdmmc_set_iomux,
1224 #ifdef CONFIG_SDMMC1_USE_DMA
1230 #if defined(CONFIG_WIFI_CONTROL_FUNC) || defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC)
1231 .status = rk29sdk_wifi_status,
1232 .register_status_notify = rk29sdk_wifi_status_register,
1235 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
1236 .write_prt = SDMMC1_WRITE_PROTECT_PIN,
1237 .write_prt_enalbe_level = SDMMC1_WRITE_PROTECT_ENABLE_VALUE;
1239 .write_prt = INVALID_GPIO,
1242 #if defined(CONFIG_RK29_SDIO_IRQ_FROM_GPIO)
1243 .sdio_INT_gpio = RK29SDK_WIFI_SDIO_CARD_INT,
1247 #if defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
1248 #if defined(RK29SDK_SD_CARD_DETECT_N) || (INVALID_GPIO != RK29SDK_SD_CARD_DETECT_N)
1249 .io = RK29SDK_SD_CARD_DETECT_N,
1254 .enable = RK29SDK_SD_CARD_INSERT_LEVEL,
1255 #ifdef RK29SDK_SD_CARD_DETECT_PIN_NAME
1257 .name = RK29SDK_SD_CARD_DETECT_PIN_NAME,
1258 #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO
1259 .fgpio = RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO,
1261 #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FMUX
1262 .fmux = RK29SDK_SD_CARD_DETECT_IOMUX_FMUX,
1272 .enable_sd_wakeup = 0,
1274 #endif //endif--#ifdef CONFIG_SDMMC1_RK29
1276 ////////////////////////////////////////////////////////////////////////////////////////
1278 ////////////////////////////////////////////////////////////////////////////////////////
1279 #ifdef CONFIG_RK30_PWM_REGULATOR
1280 static int pwm_voltage_map[] = {
1281 800000,825000,850000, 875000,900000, 925000 ,950000, 975000,1000000, 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, 1300000, 1325000, 1350000,1375000
1283 static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
1285 .supply = "vdd_cpu",
1289 struct regulator_init_data pwm_regulator_init_dcdc[1] =
1293 .name = "PWM_DCDC1",
1295 .max_uV = 1800000, //0.6-1.8V
1297 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1299 .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
1300 .consumer_supplies = pwm_dcdc1_consumers,
1304 static struct pwm_platform_data pwm_regulator_info[1] = {
1307 .pwm_gpio = RK30_PIN3_PD4,
1308 .pwm_iomux_pwm = PWM1,
1309 .pwm_iomux_gpio = GPIO3_D4,
1310 .pwm_voltage = 1100000,
1311 .suspend_voltage = 1000000,
1314 .coefficient = 575, //57.5%
1315 .pwm_voltage_map = pwm_voltage_map,
1316 .init_data = &pwm_regulator_init_dcdc[0],
1320 struct platform_device pwm_regulator_device[1] = {
1322 .name = "pwm-voltage-regulator",
1325 .platform_data = &pwm_regulator_info[0],
1331 #ifdef CONFIG_RK29_VMAC
1332 #define PHY_PWR_EN_GPIO RK30_PIN1_PD6
1333 #include "board-rk30-sdk-vmac.c"
1336 #ifdef CONFIG_RFKILL_RK
1337 // bluetooth rfkill device, its driver in net/rfkill/rfkill-rk.c
1338 static struct rfkill_rk_platform_data rfkill_rk_platdata = {
1339 .type = RFKILL_TYPE_BLUETOOTH,
1341 .poweron_gpio = { // BT_REG_ON
1342 .io = INVALID_GPIO, //RK30_PIN3_PC7,
1343 .enable = GPIO_HIGH,
1345 .name = "bt_poweron",
1350 .reset_gpio = { // BT_RST
1351 .io = RK30_PIN3_PC7, // set io to INVALID_GPIO for disable it
1359 .wake_gpio = { // BT_WAKE, use to control bt's sleep and wakeup
1360 .io = RK30_PIN3_PC6, // set io to INVALID_GPIO for disable it
1361 .enable = GPIO_HIGH,
1368 .wake_host_irq = { // BT_HOST_WAKE, for bt wakeup host when it is in deep sleep
1370 .io = RK30_PIN0_PA5, // set io to INVALID_GPIO for disable it
1371 .enable = GPIO_LOW, // set GPIO_LOW for falling, set 0 for rising
1378 .rts_gpio = { // UART_RTS, enable or disable BT's data coming
1379 .io = RK30_PIN1_PA3, // set io to INVALID_GPIO for disable it
1389 static struct platform_device device_rfkill_rk = {
1390 .name = "rfkill_rk",
1393 .platform_data = &rfkill_rk_platdata,
1398 #if defined(CONFIG_GPS_RK)
1399 int rk_gps_io_init(void)
1401 printk("%s \n", __FUNCTION__);
1403 gpio_request(RK30_PIN1_PB5, NULL);
1404 gpio_direction_output(RK30_PIN1_PB5, GPIO_LOW);
1406 iomux_set(GPS_RFCLK);//GPS_CLK
1407 iomux_set(GPS_MAG);//GPS_MAG
1408 iomux_set(GPS_SIG);//GPS_SIGN
1410 gpio_request(RK30_PIN1_PA6, NULL);
1411 gpio_direction_output(RK30_PIN1_PA6, GPIO_LOW);
1413 gpio_request(RK30_PIN1_PA5, NULL);
1414 gpio_direction_output(RK30_PIN1_PA5, GPIO_LOW);
1416 gpio_request(RK30_PIN1_PA7, NULL);
1417 gpio_direction_output(RK30_PIN1_PA7, GPIO_LOW);
1420 int rk_gps_power_up(void)
1422 printk("%s \n", __FUNCTION__);
1427 int rk_gps_power_down(void)
1429 printk("%s \n", __FUNCTION__);
1434 int rk_gps_reset_set(int level)
1438 int rk_enable_hclk_gps(void)
1440 struct clk *gps_aclk = NULL;
1441 gps_aclk = clk_get(NULL, "aclk_gps");
1443 clk_enable(gps_aclk);
1445 printk("%s \n", __FUNCTION__);
1448 printk("get gps aclk fail\n");
1451 int rk_disable_hclk_gps(void)
1453 struct clk *gps_aclk = NULL;
1454 gps_aclk = clk_get(NULL, "aclk_gps");
1456 //TO wait long enough until GPS ISR is finished.
1458 clk_disable(gps_aclk);
1460 printk("%s \n", __FUNCTION__);
1463 printk("get gps aclk fail\n");
1466 struct rk_gps_data rk_gps_info = {
1467 .io_init = rk_gps_io_init,
1468 .power_up = rk_gps_power_up,
1469 .power_down = rk_gps_power_down,
1470 .reset = rk_gps_reset_set,
1471 .enable_hclk_gps = rk_enable_hclk_gps,
1472 .disable_hclk_gps = rk_disable_hclk_gps,
1473 .GpsSign = RK30_PIN1_PB3,
1474 .GpsMag = RK30_PIN1_PB2, //GPIO index
1475 .GpsClk = RK30_PIN1_PB4, //GPIO index
1476 .GpsVCCEn = RK30_PIN1_PB5, //GPIO index
1477 .GpsSpi_CSO = RK30_PIN1_PA4, //GPIO index
1478 .GpsSpiClk = RK30_PIN1_PA5, //GPIO index
1479 .GpsSpiMOSI = RK30_PIN1_PA7, //GPIO index
1483 .u32GpsPhyAddr = RK30_GPS_PHYS,
1484 .u32GpsPhySize = RK30_GPS_SIZE,
1487 struct platform_device rk_device_gps = {
1488 .name = "gps_hv5820b",
1491 .platform_data = &rk_gps_info,
1496 #if defined(CONFIG_MT5931_MT6622)
1497 static struct mt6622_platform_data mt6622_platdata = {
1498 .power_gpio = { // BT_REG_ON
1499 .io = RK30_PIN3_PD5, // set io to INVALID_GPIO for disable it
1500 .enable = GPIO_HIGH,
1506 .reset_gpio = { // BT_RST
1507 .io = RK30_PIN0_PD7,
1508 .enable = GPIO_HIGH,
1515 .io = RK30_PIN3_PD2,
1516 .enable = GPIO_HIGH,
1523 static struct platform_device device_mt6622 = {
1527 .platform_data = &mt6622_platdata,
1532 static struct platform_device *devices[] __initdata = {
1536 #ifdef CONFIG_ANDROID_TIMED_GPIO
1537 &rk29_device_vibrator,
1539 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1540 &rk29_device_gpio_leds,
1542 #ifdef CONFIG_RK_IRDA
1545 #if defined(CONFIG_WIFI_CONTROL_FUNC)||defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC)
1546 &rk29sdk_wifi_device,
1549 #if defined(CONFIG_MT6620)
1553 #ifdef CONFIG_RK29_SUPPORT_MODEM
1556 #if defined(CONFIG_MU509)
1559 #if defined(CONFIG_MW100)
1562 #if defined(CONFIG_MT6229)
1563 &rk29_device_mt6229,
1565 #if defined(CONFIG_BATTERY_RK30_ADC)||defined(CONFIG_BATTERY_RK30_ADC_FAC)
1566 &rk30_device_adc_battery,
1568 #ifdef CONFIG_RFKILL_RK
1571 #ifdef CONFIG_GPS_RK
1574 #if defined(CONFIG_ARCH_RK3188)
1577 #ifdef CONFIG_MT5931_MT6622
1582 static int rk_platform_add_display_devices(void)
1584 struct platform_device *fb = NULL; //fb
1585 struct platform_device *lcdc0 = NULL; //lcdc0
1586 struct platform_device *lcdc1 = NULL; //lcdc1
1587 struct platform_device *bl = NULL; //backlight
1588 #ifdef CONFIG_FB_ROCKCHIP
1592 #if defined(CONFIG_LCDC0_RK3066B) || defined(CONFIG_LCDC0_RK3188)
1593 lcdc0 = &device_lcdc0,
1596 #if defined(CONFIG_LCDC1_RK3066B) || defined(CONFIG_LCDC1_RK3188)
1597 lcdc1 = &device_lcdc1,
1600 #ifdef CONFIG_BACKLIGHT_RK29_BL
1601 bl = &rk29_device_backlight,
1603 __rk_platform_add_display_devices(fb,lcdc0,lcdc1,bl);
1610 #ifdef CONFIG_I2C0_RK30
1611 static struct i2c_board_info __initdata i2c0_info[] = {
1612 #if defined (CONFIG_COMPASS_AK8975)
1617 .irq = RK30_PIN3_PD7,
1618 .platform_data = &akm8975_info,
1621 #if defined (CONFIG_GYRO_L3G4200D)
1623 .type = "l3g4200d_gryo",
1626 .irq = L3G4200D_INT_PIN,
1627 .platform_data = &l3g4200d_info,
1630 #if defined (CONFIG_SND_SOC_RK1000)
1632 .type = "rk1000_i2c_codec",
1637 .type = "rk1000_control",
1642 #if defined (CONFIG_SND_SOC_RT5640)
1650 #ifdef CONFIG_MFD_RK610
1652 .type = "rk610_ctl",
1655 .platform_data = &rk610_ctl_pdata,
1657 #ifdef CONFIG_RK610_TVOUT
1659 .type = "rk610_tvout",
1664 #ifdef CONFIG_HDMI_RK610
1666 .type = "rk610_hdmi",
1669 .irq = INVALID_GPIO,
1672 #ifdef CONFIG_SND_SOC_RK610
1673 {//RK610_CODEC addr from 0x60 to 0x80 (0x60~0x80)
1674 .type = "rk610_i2c_codec",
1677 .platform_data = &rk610_codec_pdata,
1685 int __sramdata g_pmic_type = 0;
1686 #ifdef CONFIG_I2C1_RK30
1687 #ifdef CONFIG_MFD_WM831X_I2C
1688 #define PMU_POWER_SLEEP RK30_PIN0_PA1
1690 static struct pmu_info wm8326_dcdc_info[] = {
1692 .name = "vdd_core", //logic
1695 .suspend_vol = 950000,
1698 .name = "vdd_cpu", //arm
1701 .suspend_vol = 950000,
1704 .name = "dcdc3", //ddr
1707 .suspend_vol = 1150000,
1709 #ifdef CONFIG_MACH_RK3066_SDK
1711 .name = "dcdc4", //vcc_io
1714 .suspend_vol = 3000000,
1718 .name = "dcdc4", //vcc_io
1721 .suspend_vol = 2800000,
1726 static struct pmu_info wm8326_ldo_info[] = {
1728 .name = "ldo1", //vcc18_cif
1731 .suspend_vol = 1800000,
1734 .name = "ldo2", //vccio_wl
1737 .suspend_vol = 1800000,
1743 .suspend_vol = 1100000,
1746 .name = "ldo4", //vdd11
1749 .suspend_vol = 1000000,
1752 .name = "ldo5", //vcc25
1755 .suspend_vol = 1800000,
1758 .name = "ldo6", //vcc33
1761 .suspend_vol = 3300000,
1764 .name = "ldo7", //vcc28_cif
1767 .suspend_vol = 2800000,
1770 .name = "ldo8", //vcca33
1773 .suspend_vol = 3300000,
1776 .name = "ldo9", //vcc_tp
1779 .suspend_vol = 3300000,
1782 .name = "ldo10", //flash_io
1785 .suspend_vol = 1800000,
1789 #include "../mach-rk30/board-pmu-wm8326.c"
1792 #ifdef CONFIG_MFD_TPS65910
1793 #define TPS65910_HOST_IRQ RK30_PIN0_PB3
1795 #define PMU_POWER_SLEEP RK30_PIN0_PA1
1797 static struct pmu_info tps65910_dcdc_info[] = {
1799 .name = "vdd_core", //logic
1804 .name = "vdd2", //ddr
1809 .name = "vio", //vcc_io
1815 static struct pmu_info tps65910_ldo_info[] = {
1817 .name = "vpll", //vdd10
1822 .name = "vdig1", //vcc18_cif
1827 .name = "vdig2", //vdd_jetta
1832 .name = "vaux1", //vcc28_cif
1837 .name = "vaux2", //vcca33
1842 .name = "vaux33", //vcc_tp
1847 .name = "vmmc", //vcc30
1852 .name = "vdac", //vcc18
1858 #include "../mach-rk30/board-pmu-tps65910.c"
1861 #ifdef CONFIG_REGULATOR_ACT8846
1862 #define PMU_POWER_SLEEP RK30_PIN0_PA1
1863 #define PMU_VSEL RK30_PIN3_PD3
1864 static struct pmu_info act8846_dcdc_info[] = {
1866 .name = "act_dcdc1", //ddr
1869 .suspend_vol = 1200000,
1872 .name = "vdd_core", //logic
1875 #ifdef CONFIG_ACT8846_SUPPORT_RESET
1876 .suspend_vol = 1200000,
1878 .suspend_vol = 900000,
1883 .name = "vdd_cpu", //arm
1886 #ifdef CONFIG_ACT8846_SUPPORT_RESET
1887 .suspend_vol = 1200000,
1889 .suspend_vol = 900000,
1894 .name = "act_dcdc4", //vccio
1897 #ifdef CONFIG_ACT8846_SUPPORT_RESET
1898 .suspend_vol = 3000000,
1900 .suspend_vol = 2800000,
1906 static struct pmu_info act8846_ldo_info[] = {
1908 .name = "act_ldo1", //vdd11
1913 .name = "act_ldo2", //vdd12
1918 .name = "act_ldo3", //vcc18_cif
1923 .name = "act_ldo4", //vcca33
1928 .name = "act_ldo5", //vcctp
1933 .name = "act_ldo6", //vcc33
1938 .name = "act_ldo7", //vccio_wl
1943 .name = "act_ldo8", //vcc28_cif
1949 #include "../mach-rk30/board-pmu-act8846.c"
1952 #ifdef CONFIG_MFD_RK808
1953 #define PMU_POWER_SLEEP RK30_PIN0_PA1
1954 #define RK808_HOST_IRQ RK30_PIN0_PB3
1956 static struct pmu_info rk808_dcdc_info[] = {
1958 .name = "vdd_cpu", //arm
1961 .suspend_vol = 900000,
1964 .name = "vdd_core", //logic
1967 .suspend_vol = 900000,
1970 .name = "rk_dcdc3", //ddr
1973 .suspend_vol = 1200000,
1976 .name = "rk_dcdc4", //vccio
1979 .suspend_vol = 3000000,
1983 static struct pmu_info rk808_ldo_info[] = {
1985 .name = "rk_ldo1", //vcc33
1988 .suspend_vol = 3300000,
1991 .name = "rk_ldo2", //vcctp
1994 .suspend_vol = 3300000,
1998 .name = "rk_ldo3", //vdd10
2001 .suspend_vol = 1000000,
2004 .name = "rk_ldo4", //vcc18
2007 .suspend_vol = 1800000,
2010 .name = "rk_ldo5", //vcc28_cif
2013 .suspend_vol = 2800000,
2016 .name = "rk_ldo6", //vdd12
2019 .suspend_vol = 1200000,
2022 .name = "rk_ldo7", //vcc18_cif
2025 .suspend_vol = 1800000,
2028 .name = "rk_ldo8", //vcca_33
2031 .suspend_vol = 3300000,
2035 #include "board-pmu-rk808.c"
2039 static struct i2c_board_info __initdata i2c1_info[] = {
2040 #if defined (CONFIG_MFD_WM831X_I2C)
2045 .irq = RK30_PIN0_PB3,
2046 .platform_data = &wm831x_platdata,
2049 #if defined (CONFIG_MFD_TPS65910)
2052 .addr = TPS65910_I2C_ID0,
2054 .irq = TPS65910_HOST_IRQ,
2055 .platform_data = &tps65910_data,
2059 #if defined (CONFIG_REGULATOR_ACT8846)
2064 // .irq = ACT8846_HOST_IRQ,
2065 .platform_data=&act8846_data,
2068 #if defined (CONFIG_MFD_RK808)
2073 // .irq = ACT8846_HOST_IRQ,
2074 .platform_data=&rk808_data,
2078 #if defined (CONFIG_RTC_HYM8563)
2080 .type = "rtc_hym8563",
2083 .irq = RK30_PIN1_PA4,
2090 void __sramfunc board_pmu_suspend(void)
2092 #if defined (CONFIG_MFD_WM831X_I2C)
2093 if(pmic_is_wm8326())
2094 board_pmu_wm8326_suspend();
2096 #if defined (CONFIG_MFD_TPS65910)
2097 if(pmic_is_tps65910())
2098 board_pmu_tps65910_suspend();
2100 #if defined (CONFIG_REGULATOR_ACT8846)
2101 if(pmic_is_act8846())
2102 board_pmu_act8846_suspend();
2104 #if defined (CONFIG_MFD_RK808)
2106 board_pmu_rk808_suspend();
2111 void __sramfunc board_pmu_resume(void)
2113 #if defined (CONFIG_MFD_WM831X_I2C)
2114 if(pmic_is_wm8326())
2115 board_pmu_wm8326_resume();
2117 #if defined (CONFIG_MFD_TPS65910)
2118 if(pmic_is_tps65910())
2119 board_pmu_tps65910_resume();
2121 #if defined (CONFIG_REGULATOR_ACT8846)
2122 if(pmic_is_act8846())
2123 board_pmu_act8846_resume();
2125 #if defined (CONFIG_MFD_RK808)
2127 board_pmu_rk808_resume();
2132 int __sramdata gpio3d6_iomux,gpio3d6_do,gpio3d6_dir,gpio3d6_en;
2134 #define grf_readl(offset) readl_relaxed(RK30_GRF_BASE + offset)
2135 #define grf_writel(v, offset) do { writel_relaxed(v, RK30_GRF_BASE + offset); dsb(); } while (0)
2137 void __sramfunc rk30_pwm_logic_suspend_voltage(void)
2139 #ifdef CONFIG_RK30_PWM_REGULATOR
2141 // int gpio0d7_iomux,gpio0d7_do,gpio0d7_dir,gpio0d7_en;
2143 gpio3d6_iomux = grf_readl(GRF_GPIO3D_IOMUX);
2144 gpio3d6_do = grf_readl(GRF_GPIO3H_DO);
2145 gpio3d6_dir = grf_readl(GRF_GPIO3H_DIR);
2146 gpio3d6_en = grf_readl(GRF_GPIO3H_EN);
2148 grf_writel((1<<28), GRF_GPIO3D_IOMUX);
2149 grf_writel((1<<30)|(1<<14), GRF_GPIO3H_DIR);
2150 grf_writel((1<<30)|(1<<14), GRF_GPIO3H_DO);
2151 grf_writel((1<<30)|(1<<14), GRF_GPIO3H_EN);
2154 void __sramfunc rk30_pwm_logic_resume_voltage(void)
2156 #ifdef CONFIG_RK30_PWM_REGULATOR
2157 grf_writel((1<<28)|gpio3d6_iomux, GRF_GPIO3D_IOMUX);
2158 grf_writel((1<<30)|gpio3d6_en, GRF_GPIO3H_EN);
2159 grf_writel((1<<30)|gpio3d6_dir, GRF_GPIO3H_DIR);
2160 grf_writel((1<<30)|gpio3d6_do, GRF_GPIO3H_DO);
2166 extern void pwm_suspend_voltage(void);
2167 extern void pwm_resume_voltage(void);
2168 void rk30_pwm_suspend_voltage_set(void)
2170 #ifdef CONFIG_RK30_PWM_REGULATOR
2171 pwm_suspend_voltage();
2174 void rk30_pwm_resume_voltage_set(void)
2176 #ifdef CONFIG_RK30_PWM_REGULATOR
2177 pwm_resume_voltage();
2182 #ifdef CONFIG_I2C2_RK30
2183 static struct i2c_board_info __initdata i2c2_info[] = {
2184 #if defined (CONFIG_LS_CM3217)
2186 .type = "lightsensor",
2189 .platform_data = &cm3217_info,
2195 #ifdef CONFIG_I2C3_RK30
2196 static struct i2c_board_info __initdata i2c3_info[] = {
2200 #ifdef CONFIG_I2C4_RK30
2201 static struct i2c_board_info __initdata i2c4_info[] = {
2206 #ifdef CONFIG_I2C_GPIO_RK30
2207 #define I2C_SDA_PIN INVALID_GPIO// RK30_PIN2_PD6 //set sda_pin here
2208 #define I2C_SCL_PIN INVALID_GPIO//RK30_PIN2_PD7 //set scl_pin here
2209 static int rk30_i2c_io_init(void)
2211 //set iomux (gpio) here
2212 //rk30_mux_api_set(GPIO2D7_I2C1SCL_NAME, GPIO2D_GPIO2D7);
2213 //rk30_mux_api_set(GPIO2D6_I2C1SDA_NAME, GPIO2D_GPIO2D6);
2217 struct i2c_gpio_platform_data default_i2c_gpio_data = {
2218 .sda_pin = I2C_SDA_PIN,
2219 .scl_pin = I2C_SCL_PIN,
2220 .udelay = 5, // clk = 500/udelay = 100Khz
2221 .timeout = 100,//msecs_to_jiffies(100),
2223 .io_init = rk30_i2c_io_init,
2225 static struct i2c_board_info __initdata i2c_gpio_info[] = {
2229 static void __init rk30_i2c_register_board_info(void)
2231 #ifdef CONFIG_I2C0_RK30
2232 i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
2234 #ifdef CONFIG_I2C1_RK30
2235 i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
2237 #ifdef CONFIG_I2C2_RK30
2238 i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
2240 #ifdef CONFIG_I2C3_RK30
2241 i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
2243 #ifdef CONFIG_I2C4_RK30
2244 i2c_register_board_info(4, i2c4_info, ARRAY_SIZE(i2c4_info));
2246 #ifdef CONFIG_I2C_GPIO_RK30
2247 i2c_register_board_info(5, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
2252 //#define POWER_ON_PIN RK30_PIN0_PA0 //power_hold
2253 static void rk30_pm_power_off(void)
2255 printk(KERN_ERR "rk30_pm_power_off start...\n");
2256 #if defined(CONFIG_MFD_WM831X)
2257 if(pmic_is_wm8326()){
2258 wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000); //set sys_pwr 0
2259 wm831x_device_shutdown(Wm831x);//wm8326 shutdown
2263 #if defined(CONFIG_REGULATOR_ACT8846)
2264 if(pmic_is_act8846())
2266 act8846_device_shutdown();
2270 #if defined(CONFIG_MFD_TPS65910)
2271 if(pmic_is_tps65910())
2273 tps65910_device_shutdown();//tps65910 shutdown
2277 #if defined(CONFIG_MFD_RK808)
2280 rk808_device_shutdown();//rk808 shutdown
2284 //gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
2285 port_output_off(pwr_on);
2290 static int __init tp_board_init(void)
2292 struct port_config irq_port;
2293 struct port_config rst_port;
2294 int ret = check_tp_param();
2299 irq_port = get_port_config(tp_irq);
2300 rst_port = get_port_config(tp_rst);
2301 #if defined (CONFIG_TOUCHSCREEN_GSLX680_RK3168)
2302 if(tp_type == TP_TYPE_GSLX680){
2303 gslx680_data.irq_pin = irq_port.gpio;
2304 gslx680_info.addr = tp_addr;
2305 gslx680_data.reset_pin= rst_port.gpio;
2306 gslx680_data.x_max=tp_xmax;
2307 gslx680_data.y_max=tp_ymax;
2308 gslx680_data.firmVer=tp_firmVer;
2309 i2c_register_board_info(tp_i2c, &gslx680_info, 1);
2313 #if defined (CONFIG_TOUCHSCREEN_86V_GT811_IIC)
2314 if(tp_type == TP_TYPE_GT811_86V){
2315 gt811_data.irq_pin = irq_port.gpio;
2316 gt811_info.addr = tp_addr;
2317 gt811_data.reset_pin= rst_port.gpio;
2318 gt811_data.x_max=tp_xmax;
2319 gt811_data.y_max=tp_ymax;
2320 i2c_register_board_info(tp_i2c, >811_info, 1);
2324 #if defined(CONFIG_TOUCHSCREEN_GT8XX)
2325 if(tp_type == TP_TYPE_GT8XX){
2326 goodix_data.irq_pin = irq_port.gpio;
2327 goodix_info.addr = tp_addr;
2328 goodix_data.reset_pin= rst_port.gpio;
2329 goodix_data.x_max=tp_xmax;
2330 goodix_data.y_max=tp_ymax;
2331 i2c_register_board_info(tp_i2c, &goodix_info, 1);
2338 static int __init codec_board_init(void)
2340 struct port_config spk_port;
2341 struct port_config hp_port;
2342 int ret = check_codec_param();
2347 spk_port = get_port_config(spk_ctl);
2348 hp_port = get_port_config(hp_det);
2350 #if defined (CONFIG_SND_RK29_SOC_RT5631)
2351 if(codec_type == CODEC_TYPE_RT5631){
2352 rt5631_data.spk_pin = spk_port.gpio;
2353 rt5631_info.addr = codec_addr;
2354 rt5631_data.hp_pin= hp_port.gpio;
2355 i2c_register_board_info(codec_i2c, &rt5631_info, 1);
2359 #if defined (CONFIG_SND_RK29_SOC_ES8323)
2360 if(codec_type == CODEC_TYPE_ES8323){
2361 es8323_data.spk_pin = spk_port.gpio;
2362 es8323_info.addr = codec_addr;
2363 es8323_data.hp_pin= hp_port.gpio;
2364 i2c_register_board_info(codec_i2c, &es8323_info, 1);
2368 #if defined (CONFIG_MFD_RK616)
2369 if(codec_type == CODEC_TYPE_RK616){
2370 rk616_pdata.spk_ctl_gpio = spk_port.gpio;
2371 rk616_info.addr = codec_addr;
2372 rk616_pdata.hdmi_irq= get_port_config(codec_hdmi_irq).gpio;
2373 i2c_register_board_info(codec_i2c, &rk616_info, 1);
2379 static int __init chg_board_init(void)
2381 int ret = check_chg_param();
2384 #ifdef CONFIG_BATTERY_RK30_ADC_FAC
2385 //rk30_adc_battery_platdata.adc_channel = chg_adc;
2387 rk30_adc_battery_platdata.dc_det_pin = get_port_config(dc_det).gpio;
2388 printk("rk30_adc_battery_platdata.dc_det_pin %d %d",rk30_adc_battery_platdata.dc_det_pin,RK30_PIN0_PB2);
2389 rk30_adc_battery_platdata.dc_det_level = !get_port_config(dc_det).io.active_low;
2392 rk30_adc_battery_platdata.dc_det_pin=INVALID_GPIO;
2395 rk30_adc_battery_platdata.batt_low_pin = get_port_config(bat_low).gpio;
2396 rk30_adc_battery_platdata.batt_low_level = !get_port_config(bat_low).io.active_low;
2399 rk30_adc_battery_platdata.batt_low_pin=INVALID_GPIO;
2402 rk30_adc_battery_platdata.charge_ok_pin = get_port_config(chg_ok).gpio;
2403 rk30_adc_battery_platdata.charge_ok_level = !get_port_config(chg_ok).io.active_low;
2406 rk30_adc_battery_platdata.charge_ok_pin=INVALID_GPIO;
2409 rk30_adc_battery_platdata.charge_set_pin = get_port_config(chg_set).gpio;
2410 rk30_adc_battery_platdata.charge_set_level = !get_port_config(chg_set).io.active_low;
2413 rk30_adc_battery_platdata.charge_set_pin=INVALID_GPIO;
2416 rk30_adc_battery_platdata.usb_det_pin = get_port_config(chg_set).gpio;
2417 rk30_adc_battery_platdata.usb_det_level = !get_port_config(chg_set).io.active_low;
2420 rk30_adc_battery_platdata.usb_det_pin=INVALID_GPIO;
2424 rk30_adc_battery_platdata.reference_voltage=ref_vol;
2428 rk30_adc_battery_platdata.pull_up_res=up_res;
2431 rk30_adc_battery_platdata.pull_down_res=down_res;
2434 rk30_adc_battery_platdata.is_reboot_charging=root_chg;
2437 rk30_adc_battery_platdata.save_capacity=save_cap;
2440 rk30_adc_battery_platdata.low_voltage_protection=low_vol;
2445 rk30_adc_battery_platdata.chargeArray[i]=bat_charge[i];
2446 rk30_adc_battery_platdata.dischargeArray[i]=bat_discharge[i];
2452 static int __init gs_board_init(void)
2455 struct port_config port;
2456 int ret = check_gs_param();
2459 port = get_port_config(gs_irq);
2461 #if defined (CONFIG_GS_MMA7660)
2462 if(gs_type == GS_TYPE_MMA7660){
2464 mma7660_info.irq = port.gpio;
2465 mma7660_info.addr = gs_addr;
2466 for(i = 0; i < 9; i++)
2467 mma7660_data.orientation[i] = gs_orig[i];
2468 i2c_register_board_info(gs_i2c, &mma7660_info, 1);
2472 #if defined (CONFIG_GS_LIS3DH)
2473 if(gs_type == GS_TYPE_LIS3DH){
2474 lis3dh_info.irq = port.gpio;
2475 lis3dh_info.addr = gs_addr;
2476 for(i = 0; i < 9; i++)
2477 lis3dh_data.orientation[i] = gs_orig[i];
2478 i2c_register_board_info(gs_i2c, &lis3dh_info, 1);
2482 #if defined (CONFIG_GS_MXC6225)
2483 if(gs_type == GS_TYPE_MXC6225){
2484 mxc6225_info.irq = port.gpio;
2485 mxc6225_info.addr = gs_addr;
2486 for(i = 0; i < 9; i++)
2487 mxc6225_data.orientation[i] = gs_orig[i];
2488 i2c_register_board_info(gs_i2c, &mxc6225_info, 1);
2492 #if defined (CONFIG_GS_DMT10)
2493 if(gs_type == GS_TYPE_DMARAD10){
2494 dmt10_info.irq = port.gpio;
2495 dmt10_info.addr = gs_addr;
2496 for(i = 0; i < 9; i++)
2497 dmt10_data.orientation[i] = gs_orig[i];
2498 i2c_register_board_info(gs_i2c, &dmt10_info, 1);
2502 #if defined (CONFIG_GS_MMA8452)
2503 if(gs_type == GS_TYPE_MMA8452){
2504 mma8452_info.irq = port.gpio;
2505 mma8452_info.addr = gs_addr;
2506 for(i = 0; i < 9; i++)
2507 mma8452_data.orientation[i] = gs_orig[i];
2508 i2c_register_board_info(gs_i2c, &mma8452_info, 1);
2512 #if defined (CONFIG_GS_LSM303D)
2513 if(gs_type == GS_TYPE_LSM303D){
2514 lms303d_info.irq = port.gpio;
2515 lms303d_info.addr = gs_addr;
2516 for(i = 0; i < 9; i++)
2517 lms303d_data.orientation[i] = gs_orig[i];
2518 i2c_register_board_info(gs_i2c, &lms303d_info, 1);
2526 static int __init bl_board_init(void){
2527 int ret = check_bl_param();
2547 rk29_bl_info.pwm_id = bl_pwmid;
2548 rk29_bl_info.brightness_mode=bl_mode;
2549 rk29_bl_info.pre_div=bl_div;
2550 rk29_bl_info.bl_ref = bl_ref;
2551 rk29_bl_info.min_brightness=bl_min;
2552 rk29_bl_info.max_brightness=bl_max;
2558 static int __init lcd_board_init(void)
2560 return check_lcd_param();
2563 static int __init key_board_init(void){
2565 struct port_config port;
2566 for(i = 0; i < key_val_size; i++){
2567 if(key_val[i] & (1<<31)){
2568 key_button[i].adc_value = key_val[i] & 0xffff;
2569 key_button[i].gpio = INVALID_GPIO;
2571 port = get_port_config(key_val[i]);
2572 key_button[i].gpio = port.gpio;
2573 key_button[i].active_low = port.io.active_low;
2576 rk29_keys_pdata.nbuttons = key_val_size;
2577 rk29_keys_pdata.chn = key_adc;
2581 static int __init wifi_board_init(void)
2583 return check_wifi_param();
2587 static int __init rk_config_init(void)
2590 ret = lcd_board_init();
2594 ret = bl_board_init();
2596 INIT_ERR("backlight");
2598 ret = tp_board_init();
2602 ret = gs_board_init();
2604 INIT_ERR("gsensor");
2606 ret = codec_board_init();
2610 ret = key_board_init();
2614 ret = chg_board_init();
2618 ret = wifi_board_init();
2625 static void __init machine_rk30_board_init(void)
2630 pm_power_off = rk30_pm_power_off;
2632 rk30_i2c_register_board_info();
2633 spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
2634 platform_add_devices(devices, ARRAY_SIZE(devices));
2635 rk_platform_add_display_devices();
2636 board_usb_detect_init(RK30_PIN0_PA7);
2638 #if defined(CONFIG_WIFI_CONTROL_FUNC)
2639 rk29sdk_wifi_bt_gpio_control_init();
2640 #elif defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC)
2641 rk29sdk_wifi_combo_module_gpio_init();
2644 #if defined(CONFIG_MT6620)
2645 clk_set_rate(clk_get_sys("rk_serial.0", "uart"), 48*1000000);
2648 #if defined(CONFIG_MT5931_MT6622)
2649 clk_set_rate(clk_get_sys("rk_serial.0", "uart"), 24*1000000);
2652 #define HD_SCREEN_SIZE 1920UL*1200UL*4*3
2653 static void __init rk30_reserve(void)
2655 size_t fbsize=get_fb_size();
2656 #if defined(CONFIG_ARCH_RK3188)
2657 /*if lcd resolution great than or equal to 1920*1200,reserve the ump memory */
2658 if(!(fbsize < ALIGN(HD_SCREEN_SIZE,SZ_1M)))
2660 int ump_mem_phy_size=512UL*1024UL*1024UL;
2661 resource_mali[0].start = board_mem_reserve_add("ump buf", ump_mem_phy_size);
2662 resource_mali[0].end = resource_mali[0].start + ump_mem_phy_size -1;
2666 rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
2668 #ifdef CONFIG_FB_ROCKCHIP
2669 resource_fb[0].start = board_mem_reserve_add("fb0 buf", fbsize);
2670 resource_fb[0].end = resource_fb[0].start + fbsize- 1;
2672 resource_fb[1].start = board_mem_reserve_add("ipp buf", RK30_FB0_MEM_SIZE);
2673 resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1;
2676 #if defined(CONFIG_FB_ROTATE) || !defined(CONFIG_THREE_FB_BUFFER)
2677 resource_fb[2].start = board_mem_reserve_add("fb2 buf",fbsize);
2678 resource_fb[2].end = resource_fb[2].start + fbsize - 1;
2682 #ifdef CONFIG_VIDEO_RK29
2683 rk30_camera_request_reserve_mem();
2686 #ifdef CONFIG_GPS_RK
2687 //it must be more than 8MB
2688 rk_gps_info.u32MemoryPhyAddr = board_mem_reserve_add("gps", SZ_8M);
2690 board_mem_reserved();
2692 /******************************** arm dvfs frequency volt table **********************************/
2694 * dvfs_cpu_logic_table: table for arm and logic dvfs
2695 * @frequency : arm frequency
2696 * @cpu_volt : arm voltage depend on frequency
2699 #if defined(CONFIG_ARCH_RK3188)
2701 static struct cpufreq_frequency_table dvfs_arm_table_volt_level0[] = {
2702 {.frequency = 312 * 1000, .index = 850 * 1000},
2703 {.frequency = 504 * 1000, .index = 900 * 1000},
2704 {.frequency = 816 * 1000, .index = 950 * 1000},
2705 {.frequency = 1008 * 1000, .index = 1025 * 1000},
2706 {.frequency = 1200 * 1000, .index = 1100 * 1000},
2707 {.frequency = 1416 * 1000, .index = 1200 * 1000},
2708 {.frequency = 1608 * 1000, .index = 1300 * 1000},
2709 {.frequency = CPUFREQ_TABLE_END},
2712 static struct cpufreq_frequency_table dvfs_arm_table_volt_level1[] = {
2713 {.frequency = 312 * 1000, .index = 875 * 1000},
2714 {.frequency = 504 * 1000, .index = 925 * 1000},
2715 {.frequency = 816 * 1000, .index = 975 * 1000},
2716 {.frequency = 1008 * 1000, .index = 1075 * 1000},
2717 {.frequency = 1200 * 1000, .index = 1150 * 1000},
2718 {.frequency = 1416 * 1000, .index = 1250 * 1000},
2719 {.frequency = 1608 * 1000, .index = 1350 * 1000},
2720 {.frequency = CPUFREQ_TABLE_END},
2723 static struct cpufreq_frequency_table dvfs_arm_table_volt_level2[] = {
2724 {.frequency = 312 * 1000, .index = 900 * 1000},
2725 {.frequency = 504 * 1000, .index = 925 * 1000},
2726 {.frequency = 816 * 1000, .index = 1000 * 1000},
2727 {.frequency = 1008 * 1000, .index = 1075 * 1000},
2728 {.frequency = 1200 * 1000, .index = 1200 * 1000},
2729 {.frequency = 1416 * 1000, .index = 1250 * 1000},
2730 {.frequency = 1608 * 1000, .index = 1350 * 1000},
2731 {.frequency = CPUFREQ_TABLE_END},
2734 /******************************** gpu dvfs frequency volt table **********************************/
2736 static struct cpufreq_frequency_table dvfs_gpu_table_volt_level0[] = {
2737 {.frequency = 133 * 1000, .index = 975 * 1000},//the mininum rate is limited 133M for rk3188
2738 {.frequency = 200 * 1000, .index = 975 * 1000},
2739 {.frequency = 266 * 1000, .index = 1000 * 1000},
2740 {.frequency = 300 * 1000, .index = 1050 * 1000},
2741 {.frequency = 400 * 1000, .index = 1100 * 1000},
2742 {.frequency = 600 * 1000, .index = 1200 * 1000},
2743 {.frequency = CPUFREQ_TABLE_END},
2746 static struct cpufreq_frequency_table dvfs_gpu_table_volt_level1[] = {
2747 {.frequency = 133 * 1000, .index = 975 * 1000},//the mininum rate is limited 133M for rk3188
2748 {.frequency = 200 * 1000, .index = 1000 * 1000},
2749 {.frequency = 266 * 1000, .index = 1025 * 1000},
2750 {.frequency = 300 * 1000, .index = 1050 * 1000},
2751 {.frequency = 400 * 1000, .index = 1100 * 1000},
2752 {.frequency = 600 * 1000, .index = 1250 * 1000},
2753 {.frequency = CPUFREQ_TABLE_END},
2756 /******************************** ddr dvfs frequency volt table **********************************/
2757 static struct cpufreq_frequency_table dvfs_ddr_table_volt_level0[] = {
2758 {.frequency = 200 * 1000 + DDR_FREQ_SUSPEND, .index = 950 * 1000},
2759 {.frequency = 300 * 1000 + DDR_FREQ_VIDEO, .index = 1000 * 1000},
2760 {.frequency = 396 * 1000 + DDR_FREQ_NORMAL, .index = 1100 * 1000},
2761 {.frequency = 460 * 1000 + DDR_FREQ_DUALVIEW, .index = 1150 * 1000},
2762 {.frequency = CPUFREQ_TABLE_END},
2765 //if you board is good for volt quality,select dvfs_arm_table_volt_level0
2766 #define dvfs_arm_table dvfs_arm_table_volt_level1
2767 #define dvfs_gpu_table dvfs_gpu_table_volt_level1
2768 #define dvfs_ddr_table dvfs_ddr_table_volt_level0
2771 //for RK3168 && RK3066B
2772 static struct cpufreq_frequency_table dvfs_arm_table[] = {
2773 {.frequency = 312 * 1000, .index = 950 * 1000},
2774 {.frequency = 504 * 1000, .index = 1000 * 1000},
2775 {.frequency = 816 * 1000, .index = 1050 * 1000},
2776 {.frequency = 1008 * 1000, .index = 1125 * 1000},
2777 {.frequency = 1200 * 1000, .index = 1200 * 1000},
2778 //{.frequency = 1416 * 1000, .index = 1250 * 1000},
2779 //{.frequency = 1608 * 1000, .index = 1300 * 1000},
2780 {.frequency = CPUFREQ_TABLE_END},
2783 static struct cpufreq_frequency_table dvfs_gpu_table[] = {
2784 {.frequency = 100 * 1000, .index = 1000 * 1000},
2785 {.frequency = 200 * 1000, .index = 1000 * 1000},
2786 {.frequency = 266 * 1000, .index = 1050 * 1000},
2787 //{.frequency = 300 * 1000, .index = 1050 * 1000},
2788 {.frequency = 400 * 1000, .index = 1125 * 1000},
2789 {.frequency = CPUFREQ_TABLE_END},
2792 static struct cpufreq_frequency_table dvfs_ddr_table[] = {
2793 {.frequency = 200 * 1000 + DDR_FREQ_SUSPEND, .index = 1000 * 1000},
2794 {.frequency = 300 * 1000 + DDR_FREQ_VIDEO, .index = 1050 * 1000},
2795 {.frequency = 400 * 1000 + DDR_FREQ_NORMAL, .index = 1100 * 1000},
2796 {.frequency = CPUFREQ_TABLE_END},
2799 /******************************** arm dvfs frequency volt table end **********************************/
2800 //#define DVFS_CPU_TABLE_SIZE (ARRAY_SIZE(dvfs_cpu_logic_table))
2801 //static struct cpufreq_frequency_table cpu_dvfs_table[DVFS_CPU_TABLE_SIZE];
2802 //static struct cpufreq_frequency_table dep_cpu2core_table[DVFS_CPU_TABLE_SIZE];
2804 void __init board_clock_init(void)
2806 rk30_clock_data_init(periph_pll_default, codec_pll_default, RK30_CLOCKS_DEFAULT_FLAGS);
2807 //dvfs_set_arm_logic_volt(dvfs_cpu_logic_table, cpu_dvfs_table, dep_cpu2core_table);
2808 dvfs_set_freq_volt_table(clk_get(NULL, "cpu"), dvfs_arm_table);
2809 dvfs_set_freq_volt_table(clk_get(NULL, "gpu"), dvfs_gpu_table);
2810 dvfs_set_freq_volt_table(clk_get(NULL, "ddr"), dvfs_ddr_table);
2813 MACHINE_START(RK30, "RK30board")
2814 .boot_params = PLAT_PHYS_OFFSET + 0x800,
2815 .fixup = rk30_fixup,
2816 .reserve = &rk30_reserve,
2817 .map_io = rk30_map_io,
2818 .init_irq = rk30_init_irq,
2819 .timer = &rk30_timer,
2820 .init_machine = machine_rk30_board_init,