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/regulator/rk29-pwm-regulator.h>
50 #if defined(CONFIG_CT36X_TS)
51 #include <linux/ct36x.h>
53 #if defined(CONFIG_MFD_RK610)
54 #include <linux/mfd/rk610_core.h>
57 #if defined(CONFIG_RK_HDMI)
58 #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
61 #if defined(CONFIG_SPIM_RK29)
62 #include "../../../drivers/spi/rk29_spim.h"
64 #if defined(CONFIG_GPS_RK)
65 #include "../../../drivers/misc/gps/rk_gps/rk_gps.h"
68 #if defined(CONFIG_MT6620)
69 #include <linux/gps.h>
72 #include "../mach-rk30/board-rk3168-ds1006h-camera.c"
75 static struct rk29_keys_button key_button[] = {
79 .gpio = RK30_PIN0_PA4,
80 .active_low = PRESS_LEV_LOW,
88 .active_low = PRESS_LEV_LOW,
91 struct rk29_keys_platform_data rk29_keys_pdata = {
92 .buttons = key_button,
93 .nbuttons = ARRAY_SIZE(key_button),
94 .chn = 1, //chn: 0-7, if do not use ADC,set 'chn' -1
97 #if defined(CONFIG_CT36X_TS)
99 #define TOUCH_MODEL 363
100 #define TOUCH_MAX_X 1280
101 #define TOUCH_MAX_y 800
102 #define TOUCH_RESET_PIN RK30_PIN0_PB6
103 #define TOUCH_INT_PIN RK30_PIN1_PB7
105 static struct ct36x_platform_data ct36x_info = {
106 .model = TOUCH_MODEL,
107 .x_max = TOUCH_MAX_X,
108 .y_max = TOUCH_MAX_y,
111 .gpio = TOUCH_RESET_PIN,
115 .gpio = TOUCH_INT_PIN,
118 .orientation = {1, 0, 1, 0},
121 static struct spi_board_info board_spi_devices[] = {
124 /***********************************************************
126 ************************************************************/
127 #ifdef CONFIG_BACKLIGHT_RK29_BL
129 #define PWM_MODE PWM3
130 #define PWM_EFFECT_VALUE 1
132 #define LCD_DISP_ON_PIN
134 #ifdef LCD_DISP_ON_PIN
135 #define BL_EN_PIN RK30_PIN0_PA2
136 #define BL_EN_VALUE GPIO_HIGH
138 static int rk29_backlight_io_init(void)
143 #ifdef LCD_DISP_ON_PIN
144 ret = gpio_request(BL_EN_PIN, NULL);
146 gpio_free(BL_EN_PIN);
149 gpio_direction_output(BL_EN_PIN, 0);
150 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
156 static int rk29_backlight_io_deinit(void)
158 int ret = 0, pwm_gpio;
160 #ifdef LCD_DISP_ON_PIN
161 gpio_free(BL_EN_PIN);
164 pwm_gpio = iomux_mode_to_gpio(PWM_MODE);
165 gpio_request(pwm_gpio, NULL);
166 gpio_direction_output(pwm_gpio, GPIO_LOW);
170 static int rk29_backlight_pwm_suspend(void)
172 int ret = 0, pwm_gpio;
174 pwm_gpio = iomux_mode_to_gpio(PWM_MODE);
175 if (gpio_request(pwm_gpio, NULL)) {
176 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
179 gpio_direction_output(pwm_gpio, GPIO_LOW);
180 #ifdef LCD_DISP_ON_PIN
181 gpio_direction_output(BL_EN_PIN, 0);
182 gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
187 static int rk29_backlight_pwm_resume(void)
189 int pwm_gpio = iomux_mode_to_gpio(PWM_MODE);
193 #ifdef LCD_DISP_ON_PIN
195 gpio_direction_output(BL_EN_PIN, 1);
196 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
201 static struct rk29_bl_info rk29_bl_info = {
202 .min_brightness = 30,
203 .pre_div = 20 * 1000, // pwm output clk: 20k;
205 .bl_ref = PWM_EFFECT_VALUE,
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,
223 #if defined (CONFIG_GS_MMA8452)
224 #define MMA8452_INT_PIN RK30_PIN0_PB7
226 static int mma8452_init_platform_hw(void)
231 static struct sensor_platform_data mma8452_info = {
232 .type = SENSOR_TYPE_ACCEL,
235 .init_platform_hw = mma8452_init_platform_hw,
236 .orientation = {-1, 0, 0, 0, 0, -1, 0, 1, 0},
239 #if defined (CONFIG_GS_LIS3DH)
240 #define LIS3DH_INT_PIN RK30_PIN0_PB7
242 static int lis3dh_init_platform_hw(void)
248 static struct sensor_platform_data lis3dh_info = {
249 .type = SENSOR_TYPE_ACCEL,
252 .init_platform_hw = lis3dh_init_platform_hw,
253 .orientation = {-1, 0, 0, 0, 0, -1, 0, 1, 0},
256 #if defined (CONFIG_COMPASS_AK8975)
257 static struct sensor_platform_data akm8975_info =
259 .type = SENSOR_TYPE_COMPASS,
292 #if defined(CONFIG_GYRO_L3G4200D)
294 #include <linux/l3g4200d.h>
295 #define L3G4200D_INT_PIN RK30_PIN0_PB4
297 static int l3g4200d_init_platform_hw(void)
302 static struct sensor_platform_data l3g4200d_info = {
303 .type = SENSOR_TYPE_GYROSCOPE,
306 .orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1},
307 .init_platform_hw = l3g4200d_init_platform_hw,
308 .x_min = 40,//x_min,y_min,z_min = (0-100) according to hardware
315 #ifdef CONFIG_LS_CM3217
316 static struct sensor_platform_data cm3217_info = {
317 .type = SENSOR_TYPE_LIGHT,
319 .poll_delay_ms = 500,
324 #ifdef CONFIG_FB_ROCKCHIP
326 #define LCD_CS_PIN INVALID_GPIO
327 #define LCD_CS_VALUE GPIO_HIGH
329 #define LCD_EN_PIN RK30_PIN0_PB0
330 #define LCD_EN_VALUE GPIO_LOW
332 static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
336 if(LCD_CS_PIN !=INVALID_GPIO)
338 ret = gpio_request(LCD_CS_PIN, NULL);
341 gpio_free(LCD_CS_PIN);
342 printk(KERN_ERR "request lcd cs pin fail!\n");
347 gpio_direction_output(LCD_CS_PIN, LCD_CS_VALUE);
351 if(LCD_EN_PIN !=INVALID_GPIO)
353 ret = gpio_request(LCD_EN_PIN, NULL);
356 gpio_free(LCD_EN_PIN);
357 printk(KERN_ERR "request lcd en pin fail!\n");
362 gpio_direction_output(LCD_EN_PIN, LCD_EN_VALUE);
367 static int rk_fb_io_disable(void)
369 if(LCD_CS_PIN !=INVALID_GPIO)
371 gpio_set_value(LCD_CS_PIN, !LCD_CS_VALUE);
373 if(LCD_EN_PIN !=INVALID_GPIO)
375 gpio_set_value(LCD_EN_PIN, !LCD_EN_VALUE);
379 static int rk_fb_io_enable(void)
381 if(LCD_CS_PIN !=INVALID_GPIO)
383 gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE);
385 if(LCD_EN_PIN !=INVALID_GPIO)
387 gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE);
392 #if defined(CONFIG_LCDC0_RK3188)
393 struct rk29fb_info lcdc0_screen_info = {
394 .prop = EXTEND, //extend display device
396 .set_screen_info = hdmi_init_lcdc,
401 #if defined(CONFIG_LCDC1_RK3188)
402 struct rk29fb_info lcdc1_screen_info = {
403 .prop = PRMRY, //primary display device
404 .io_init = rk_fb_io_init,
405 .io_disable = rk_fb_io_disable,
406 .io_enable = rk_fb_io_enable,
407 .set_screen_info = set_lcd_info,
412 static struct resource resource_fb[] = {
416 .end = 0,//RK30_FB0_MEM_SIZE - 1,
417 .flags = IORESOURCE_MEM,
420 .name = "ipp buf", //for rotate
422 .end = 0,//RK30_FB0_MEM_SIZE - 1,
423 .flags = IORESOURCE_MEM,
428 .end = 0,//RK30_FB0_MEM_SIZE - 1,
429 .flags = IORESOURCE_MEM,
433 static struct platform_device device_fb = {
436 .num_resources = ARRAY_SIZE(resource_fb),
437 .resource = resource_fb,
441 #if defined(CONFIG_LCDC0_RK3188)
442 static struct resource resource_lcdc0[] = {
445 .start = RK30_LCDC0_PHYS,
446 .end = RK30_LCDC0_PHYS + RK30_LCDC0_SIZE - 1,
447 .flags = IORESOURCE_MEM,
454 .flags = IORESOURCE_IRQ,
458 static struct platform_device device_lcdc0 = {
461 .num_resources = ARRAY_SIZE(resource_lcdc0),
462 .resource = resource_lcdc0,
464 .platform_data = &lcdc0_screen_info,
468 #if defined(CONFIG_LCDC1_RK3188)
469 static struct resource resource_lcdc1[] = {
472 .start = RK30_LCDC1_PHYS,
473 .end = RK30_LCDC1_PHYS + RK30_LCDC1_SIZE - 1,
474 .flags = IORESOURCE_MEM,
480 .flags = IORESOURCE_IRQ,
484 static struct platform_device device_lcdc1 = {
487 .num_resources = ARRAY_SIZE(resource_lcdc1),
488 .resource = resource_lcdc1,
490 .platform_data = &lcdc1_screen_info,
495 #if defined(CONFIG_MFD_RK610)
496 #define RK610_RST_PIN RK30_PIN3_PB2
497 static int rk610_power_on_init(void)
500 if(RK610_RST_PIN != INVALID_GPIO)
502 ret = gpio_request(RK610_RST_PIN, "rk610 reset");
505 printk(KERN_ERR "rk610_control_probe request gpio fail\n");
509 gpio_direction_output(RK610_RST_PIN, GPIO_HIGH);
511 gpio_direction_output(RK610_RST_PIN, GPIO_LOW);
513 gpio_set_value(RK610_RST_PIN, GPIO_HIGH);
522 static struct rk610_ctl_platform_data rk610_ctl_pdata = {
523 .rk610_power_on_init = rk610_power_on_init,
527 #ifdef CONFIG_SND_SOC_RK610
528 static int rk610_codec_io_init(void)
531 //Must not gpio_request
535 static struct rk610_codec_platform_data rk610_codec_pdata = {
536 .spk_ctl_io = RK30_PIN2_PD7,
537 .io_init = rk610_codec_io_init,
542 #ifdef CONFIG_RK_HDMI
543 #define RK_HDMI_RST_PIN RK30_PIN3_PB2
544 static int rk_hdmi_power_init(void)
548 if(RK_HDMI_RST_PIN != INVALID_GPIO)
550 if (gpio_request(RK_HDMI_RST_PIN, NULL)) {
551 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
554 gpio_direction_output(RK_HDMI_RST_PIN, GPIO_LOW);
555 gpio_set_value(RK_HDMI_RST_PIN, GPIO_LOW);
557 gpio_set_value(RK_HDMI_RST_PIN, GPIO_HIGH);
562 static struct rk_hdmi_platform_data rk_hdmi_pdata = {
563 .io_init = rk_hdmi_power_init,
567 #define ION_RESERVE_SIZE (80 * SZ_1M)
568 static struct ion_platform_data rk30_ion_pdata = {
572 .type = ION_HEAP_TYPE_CARVEOUT,
573 .id = ION_NOR_HEAP_ID,
575 .size = ION_RESERVE_SIZE,
580 static struct platform_device device_ion = {
581 .name = "ion-rockchip",
584 .platform_data = &rk30_ion_pdata,
589 /**************************************************************************************************
590 * SDMMC devices, include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
591 **************************************************************************************************/
592 #ifdef CONFIG_SDMMC_RK29
593 #include "board-rk3188-ds1006h-sdmmc-config.c"
594 #include "../plat-rk/rk-sdmmc-ops.c"
595 #include "../plat-rk/rk-sdmmc-wifi.c"
596 #endif //endif ---#ifdef CONFIG_SDMMC_RK29
598 #ifdef CONFIG_SDMMC0_RK29
599 static int rk29_sdmmc0_cfg_gpio(void)
601 #ifdef CONFIG_SDMMC_RK29_OLD
603 iomux_set(MMC0_CLKOUT);
609 iomux_set_gpio_mode(iomux_mode_to_gpio(MMC0_DETN));
611 gpio_request(RK30_PIN3_PA7, "sdmmc-power");
612 gpio_direction_output(RK30_PIN3_PA7, GPIO_LOW);
615 rk29_sdmmc_set_iomux(0, 0xFFFF);
617 #if defined(CONFIG_SDMMC0_RK29_SDCARD_DET_FROM_GPIO)
618 #if SDMMC_USE_NEW_IOMUX_API
619 iomux_set_gpio_mode(iomux_gpio_to_mode(RK29SDK_SD_CARD_DETECT_N));
621 rk30_mux_api_set(RK29SDK_SD_CARD_DETECT_PIN_NAME, RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO);
624 #if SDMMC_USE_NEW_IOMUX_API
625 iomux_set(MMC0_DETN);
627 rk30_mux_api_set(RK29SDK_SD_CARD_DETECT_PIN_NAME, RK29SDK_SD_CARD_DETECT_IOMUX_FMUX);
631 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
632 gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
633 gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
641 #define CONFIG_SDMMC0_USE_DMA
642 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
644 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
645 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
646 MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
648 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
649 .io_init = rk29_sdmmc0_cfg_gpio,
651 #if !defined(CONFIG_SDMMC_RK29_OLD)
652 .set_iomux = rk29_sdmmc_set_iomux,
655 .dma_name = "sd_mmc",
656 #ifdef CONFIG_SDMMC0_USE_DMA
662 #if defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC) && defined(CONFIG_USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD)
663 .status = rk29sdk_wifi_mmc0_status,
664 .register_status_notify = rk29sdk_wifi_mmc0_status_register,
667 #if defined(RK29SDK_SD_CARD_PWR_EN) || (INVALID_GPIO != RK29SDK_SD_CARD_PWR_EN)
668 .power_en = RK29SDK_SD_CARD_PWR_EN,
669 .power_en_level = RK29SDK_SD_CARD_PWR_EN_LEVEL,
671 .power_en = INVALID_GPIO,
672 .power_en_level = GPIO_LOW,
674 .enable_sd_wakeup = 0,
676 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
677 .write_prt = SDMMC0_WRITE_PROTECT_PIN,
678 .write_prt_enalbe_level = SDMMC0_WRITE_PROTECT_ENABLE_VALUE;
680 .write_prt = INVALID_GPIO,
684 #if defined(RK29SDK_SD_CARD_DETECT_N) || (INVALID_GPIO != RK29SDK_SD_CARD_DETECT_N)
685 .io = RK29SDK_SD_CARD_DETECT_N, //INVALID_GPIO,
686 .enable = RK29SDK_SD_CARD_INSERT_LEVEL,
687 #ifdef RK29SDK_SD_CARD_DETECT_PIN_NAME
689 .name = RK29SDK_SD_CARD_DETECT_PIN_NAME,
690 #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO
691 .fgpio = RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO,
693 #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FMUX
694 .fmux = RK29SDK_SD_CARD_DETECT_IOMUX_FMUX,
705 #endif // CONFIG_SDMMC0_RK29
707 #ifdef CONFIG_SDMMC1_RK29
708 #define CONFIG_SDMMC1_USE_DMA
709 static int rk29_sdmmc1_cfg_gpio(void)
711 #if defined(CONFIG_SDMMC_RK29_OLD)
713 iomux_set(MMC1_CLKOUT);
720 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
721 gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp");
722 gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN);
730 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
732 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
733 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
736 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
737 .host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |
738 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
741 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
744 .io_init = rk29_sdmmc1_cfg_gpio,
746 #if !defined(CONFIG_SDMMC_RK29_OLD)
747 .set_iomux = rk29_sdmmc_set_iomux,
751 #ifdef CONFIG_SDMMC1_USE_DMA
757 #if defined(CONFIG_WIFI_CONTROL_FUNC) || defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC)
758 .status = rk29sdk_wifi_status,
759 .register_status_notify = rk29sdk_wifi_status_register,
762 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
763 .write_prt = SDMMC1_WRITE_PROTECT_PIN,
764 .write_prt_enalbe_level = SDMMC1_WRITE_PROTECT_ENABLE_VALUE;
766 .write_prt = INVALID_GPIO,
769 #if defined(CONFIG_RK29_SDIO_IRQ_FROM_GPIO)
770 .sdio_INT_gpio = RK29SDK_WIFI_SDIO_CARD_INT,
774 #if defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
775 #if defined(RK29SDK_SD_CARD_DETECT_N) || (INVALID_GPIO != RK29SDK_SD_CARD_DETECT_N)
776 .io = RK29SDK_SD_CARD_DETECT_N,
781 .enable = RK29SDK_SD_CARD_INSERT_LEVEL,
782 #ifdef RK29SDK_SD_CARD_DETECT_PIN_NAME
784 .name = RK29SDK_SD_CARD_DETECT_PIN_NAME,
785 #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO
786 .fgpio = RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO,
788 #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FMUX
789 .fmux = RK29SDK_SD_CARD_DETECT_IOMUX_FMUX,
799 .enable_sd_wakeup = 0,
801 #endif //endif--#ifdef CONFIG_SDMMC1_RK29
803 /**************************************************************************************************
804 * the end of setting for SDMMC devices
805 **************************************************************************************************/
807 #ifdef CONFIG_BATTERY_RK30_ADC_FAC
808 static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
809 .dc_det_pin = RK30_PIN0_PB2,
810 .batt_low_pin = INVALID_GPIO,
811 .charge_set_pin = INVALID_GPIO,
812 .charge_ok_pin = RK30_PIN0_PA6,
813 .usb_det_pin = INVALID_GPIO,
814 .dc_det_level = GPIO_LOW,
815 .charge_ok_level = GPIO_HIGH,
817 .reference_voltage = 1800, // the rK2928 is 3300;RK3066 and rk29 are 2500;rk3066B is 1800;
818 .pull_up_res = 200, //divider resistance , pull-up resistor
819 .pull_down_res = 120, //divider resistance , pull-down resistor
821 .is_reboot_charging = 1,
823 .low_voltage_protection = 3600,
826 static struct platform_device rk30_device_adc_battery = {
827 .name = "rk30-battery",
830 .platform_data = &rk30_adc_battery_platdata,
834 #ifdef CONFIG_RK30_PWM_REGULATOR
835 static int pwm_voltage_map[] = {
836 950000, 975000,1000000, 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000
839 static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
845 struct regulator_init_data pwm_regulator_init_dcdc[1] =
851 .max_uV = 1800000, //0.6-1.8V
853 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
855 .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
856 .consumer_supplies = pwm_dcdc1_consumers,
860 static struct pwm_platform_data pwm_regulator_info[1] = {
863 .pwm_gpio = RK30_PIN3_PD4,
864 .pwm_iomux_pwm = PWM1,
865 .pwm_iomux_gpio = GPIO3_D4,
866 .pwm_voltage = 1100000,
867 .suspend_voltage = 1050000,
870 .coefficient = 455, //45.5%
871 .pwm_voltage_map = pwm_voltage_map,
872 .init_data = &pwm_regulator_init_dcdc[0],
876 struct platform_device pwm_regulator_device[1] = {
878 .name = "pwm-voltage-regulator",
881 .platform_data = &pwm_regulator_info[0],
887 #ifdef CONFIG_RFKILL_RK
888 // bluetooth rfkill device, its driver in net/rfkill/rfkill-rk.c
889 static struct rfkill_rk_platform_data rfkill_rk_platdata = {
890 .type = RFKILL_TYPE_BLUETOOTH,
892 .poweron_gpio = { // BT_REG_ON
893 .io = INVALID_GPIO, //RK30_PIN3_PC7,
896 .name = "bt_poweron",
901 .reset_gpio = { // BT_RST
902 .io = RK30_PIN3_PD1, // set io to INVALID_GPIO for disable it
910 .wake_gpio = { // BT_WAKE, use to control bt's sleep and wakeup
911 .io = RK30_PIN3_PC6, // set io to INVALID_GPIO for disable it
919 .wake_host_irq = { // BT_HOST_WAKE, for bt wakeup host when it is in deep sleep
921 .io = RK30_PIN0_PA5, // set io to INVALID_GPIO for disable it
922 .enable = GPIO_LOW, // set GPIO_LOW for falling, set 0 for rising
929 .rts_gpio = { // UART_RTS, enable or disable BT's data coming
930 .io = RK30_PIN1_PA3, // set io to INVALID_GPIO for disable it
940 static struct platform_device device_rfkill_rk = {
944 .platform_data = &rfkill_rk_platdata,
949 #if defined(CONFIG_GPS_RK)
950 int rk_gps_io_init(void)
952 printk("%s \n", __FUNCTION__);
954 rk30_mux_api_set(GPIO1B5_UART3RTSN_NAME, GPIO1B_GPIO1B5);//VCC_EN
955 gpio_request(RK30_PIN1_PB5, NULL);
956 gpio_direction_output(RK30_PIN1_PB5, GPIO_LOW);
958 rk30_mux_api_set(GPIO1B4_UART3CTSN_GPSRFCLK_NAME, GPIO1B_GPSRFCLK);//GPS_CLK
959 rk30_mux_api_set(GPIO1B2_UART3SIN_GPSMAG_NAME, GPIO1B_GPSMAG);//GPS_MAG
960 rk30_mux_api_set(GPIO1B3_UART3SOUT_GPSSIG_NAME, GPIO1B_GPSSIG);//GPS_SIGN
962 rk30_mux_api_set(GPIO1A6_UART1CTSN_SPI0CLK_NAME, GPIO1A_GPIO1A6);//SPI_CLK
963 gpio_request(RK30_PIN1_PA6, NULL);
964 gpio_direction_output(RK30_PIN1_PA6, GPIO_LOW);
966 rk30_mux_api_set(GPIO1A5_UART1SOUT_SPI0TXD_NAME, GPIO1A_GPIO1A5);//SPI_MOSI
967 gpio_request(RK30_PIN1_PA5, NULL);
968 gpio_direction_output(RK30_PIN1_PA5, GPIO_LOW);
970 rk30_mux_api_set(GPIO1A7_UART1RTSN_SPI0CSN0_NAME, GPIO1A_GPIO1A7);//SPI_CS
971 gpio_request(RK30_PIN1_PA7, NULL);
972 gpio_direction_output(RK30_PIN1_PA7, GPIO_LOW);
975 int rk_gps_power_up(void)
977 printk("%s \n", __FUNCTION__);
982 int rk_gps_power_down(void)
984 printk("%s \n", __FUNCTION__);
989 int rk_gps_reset_set(int level)
993 int rk_enable_hclk_gps(void)
995 printk("%s \n", __FUNCTION__);
996 clk_enable(clk_get(NULL, "hclk_gps"));
999 int rk_disable_hclk_gps(void)
1001 printk("%s \n", __FUNCTION__);
1002 clk_disable(clk_get(NULL, "hclk_gps"));
1005 struct rk_gps_data rk_gps_info = {
1006 .io_init = rk_gps_io_init,
1007 .power_up = rk_gps_power_up,
1008 .power_down = rk_gps_power_down,
1009 .reset = rk_gps_reset_set,
1010 .enable_hclk_gps = rk_enable_hclk_gps,
1011 .disable_hclk_gps = rk_disable_hclk_gps,
1012 .GpsSign = RK30_PIN1_PB3,
1013 .GpsMag = RK30_PIN1_PB2, //GPIO index
1014 .GpsClk = RK30_PIN1_PB4, //GPIO index
1015 .GpsVCCEn = RK30_PIN1_PB5, //GPIO index
1016 .GpsSpi_CSO = RK30_PIN1_PA4, //GPIO index
1017 .GpsSpiClk = RK30_PIN1_PA5, //GPIO index
1018 .GpsSpiMOSI = RK30_PIN1_PA7, //GPIO index
1022 .u32GpsPhyAddr = RK30_GPS_PHYS,
1023 .u32GpsPhySize = RK30_GPS_SIZE,
1026 struct platform_device rk_device_gps = {
1027 .name = "gps_hv5820b",
1030 .platform_data = &rk_gps_info,
1035 #if defined(CONFIG_MT5931_MT6622)
1036 static struct mt6622_platform_data mt6622_platdata = {
1037 .power_gpio = { // BT_REG_ON
1038 .io = RK30_PIN3_PD5, // set io to INVALID_GPIO for disable it
1039 .enable = GPIO_HIGH,
1045 .reset_gpio = { // BT_RST
1046 .io = RK30_PIN0_PD7,
1047 .enable = GPIO_HIGH,
1054 .io = RK30_PIN3_PD2,
1055 .enable = GPIO_HIGH,
1062 static struct platform_device device_mt6622 = {
1066 .platform_data = &mt6622_platdata,
1071 static struct platform_device *devices[] __initdata = {
1076 #ifdef CONFIG_WIFI_CONTROL_FUNC
1077 &rk29sdk_wifi_device,
1080 #if defined(CONFIG_MT6620)
1084 #ifdef CONFIG_BATTERY_RK30_ADC_FAC
1085 &rk30_device_adc_battery,
1087 #ifdef CONFIG_RFKILL_RK
1090 #ifdef CONFIG_GPS_RK
1093 #ifdef CONFIG_MT5931_MT6622
1099 static int rk_platform_add_display_devices(void)
1101 struct platform_device *fb = NULL; //fb
1102 struct platform_device *lcdc0 = NULL; //lcdc0
1103 struct platform_device *lcdc1 = NULL; //lcdc1
1104 struct platform_device *bl = NULL; //backlight
1105 #ifdef CONFIG_FB_ROCKCHIP
1109 #if defined(CONFIG_LCDC0_RK3188)
1110 lcdc0 = &device_lcdc0,
1113 #if defined(CONFIG_LCDC1_RK3188)
1114 lcdc1 = &device_lcdc1,
1117 #ifdef CONFIG_BACKLIGHT_RK29_BL
1118 bl = &rk29_device_backlight,
1120 __rk_platform_add_display_devices(fb,lcdc0,lcdc1,bl);
1127 #ifdef CONFIG_I2C0_RK30
1128 static struct i2c_board_info __initdata i2c0_info[] = {
1129 #if defined (CONFIG_GS_MMA8452)
1131 .type = "gs_mma8452",
1134 .irq = MMA8452_INT_PIN,
1135 .platform_data = &mma8452_info,
1138 #if defined (CONFIG_LS_US5151)
1145 #if defined (CONFIG_GS_LIS3DH)
1147 .type = "gs_lis3dh",
1148 .addr = 0x19, //0x19(SA0-->VCC), 0x18(SA0-->GND)
1150 .irq = LIS3DH_INT_PIN,
1151 .platform_data = &lis3dh_info,
1154 #if defined (CONFIG_COMPASS_AK8975)
1159 .irq = RK30_PIN3_PD7,
1160 .platform_data = &akm8975_info,
1161 .irq = RK30_PIN3_PD7,
1162 .platform_data = &akm8975_info,
1165 #if defined (CONFIG_GYRO_L3G4200D)
1167 .type = "l3g4200d_gryo",
1170 .irq = L3G4200D_INT_PIN,
1171 .platform_data = &l3g4200d_info,
1174 #if defined (CONFIG_SND_SOC_RK1000)
1176 .type = "rk1000_i2c_codec",
1181 .type = "rk1000_control",
1186 #if defined (CONFIG_SND_SOC_RT5631)
1196 int __sramdata g_pmic_type = 0;
1197 #ifdef CONFIG_I2C1_RK30
1198 #ifdef CONFIG_REGULATOR_ACT8846
1199 #define PMU_POWER_SLEEP RK30_PIN0_PA1
1200 #define PMU_VSEL RK30_PIN3_PD3
1201 #define ACT8846_HOST_IRQ RK30_PIN0_PB3
1203 static struct pmu_info act8846_dcdc_info[] = {
1205 .name = "act_dcdc1", //ddr
1208 .suspend_vol = 1200000,
1211 .name = "vdd_core", //logic
1214 .suspend_vol = 900000,
1217 .name = "vdd_cpu", //arm
1220 .suspend_vol = 900000,
1223 .name = "act_dcdc4", //vccio
1226 .suspend_vol = 2800000,
1230 static struct pmu_info act8846_ldo_info[] = {
1232 .name = "act_ldo1", //vdd10
1237 .name = "act_ldo2", //vdd12
1242 .name = "act_ldo3", //vcc18_cif
1247 .name = "act_ldo4", //vcca33
1252 .name = "act_ldo5", //vcctp
1257 .name = "act_ldo6", //vcc_jetta
1262 .name = "act_ldo7", //vcc18
1267 .name = "act_ldo8", //vcc28_cif
1273 #include "../mach-rk30/board-pmu-act8846.c"
1276 #ifdef CONFIG_MFD_WM831X_I2C
1277 #define PMU_POWER_SLEEP RK30_PIN0_PA1
1279 static struct pmu_info wm8326_dcdc_info[] = {
1281 .name = "vdd_core", //logic
1284 .suspend_vol = 950000,
1287 .name = "vdd_cpu", //arm
1290 .suspend_vol = 950000,
1293 .name = "dcdc3", //ddr
1296 .suspend_vol = 1150000,
1298 #ifdef CONFIG_MACH_RK3066_SDK
1300 .name = "dcdc4", //vcc_io
1303 .suspend_vol = 3000000,
1307 .name = "dcdc4", //vcc_io
1310 .suspend_vol = 2800000,
1315 static struct pmu_info wm8326_ldo_info[] = {
1317 .name = "ldo1", //vcc18_cif
1320 .suspend_vol = 1800000,
1323 .name = "ldo2", //vccio_wl
1326 .suspend_vol = 1800000,
1332 .suspend_vol = 1100000,
1335 .name = "ldo4", //vdd11
1338 .suspend_vol = 1000000,
1341 .name = "ldo5", //vcc25
1344 .suspend_vol = 1800000,
1347 .name = "ldo6", //vcc33
1350 .suspend_vol = 3300000,
1353 .name = "ldo7", //vcc28_cif
1356 .suspend_vol = 2800000,
1359 .name = "ldo8", //vcca33
1362 .suspend_vol = 3300000,
1365 .name = "ldo9", //vcc_tp
1368 .suspend_vol = 3300000,
1371 .name = "ldo10", //flash_io
1374 .suspend_vol = 1800000,
1378 #include "../mach-rk30/board-pmu-wm8326.c"
1381 #ifdef CONFIG_MFD_TPS65910
1382 #ifdef CONFIG_ARCH_RK3188
1383 #define TPS65910_HOST_IRQ RK30_PIN0_PB3
1385 #define TPS65910_HOST_IRQ RK30_PIN6_PA4
1388 #define PMU_POWER_SLEEP RK30_PIN0_PA1
1390 static struct pmu_info tps65910_dcdc_info[] = {
1392 .name = "vdd_core", //logic
1397 .name = "vdd2", //ddr
1402 .name = "vio", //vcc_io
1408 static struct pmu_info tps65910_ldo_info[] = {
1410 .name = "vpll", //vdd10
1415 .name = "vdig1", //vcc18_cif
1420 .name = "vdig2", //vdd_jetta
1425 .name = "vaux1", //vcc28_cif
1430 .name = "vaux2", //vcca33
1435 .name = "vaux33", //vcc_tp
1440 .name = "vmmc", //vcc30
1445 .name = "vdac", //vcc18
1451 #include "../mach-rk30/board-pmu-tps65910.c"
1454 static struct i2c_board_info __initdata i2c1_info[] = {
1455 #if defined (CONFIG_REGULATOR_ACT8846)
1460 .irq = ACT8846_HOST_IRQ,
1461 .platform_data=&act8846_data,
1464 #if defined (CONFIG_RTC_HYM8563)
1466 .type = "rtc_hym8563",
1469 .irq = RK30_PIN0_PB5,
1472 #if defined (CONFIG_MFD_WM831X_I2C)
1477 .irq = RK30_PIN0_PB3,
1478 .platform_data = &wm831x_platdata,
1481 #if defined (CONFIG_MFD_TPS65910)
1484 .addr = TPS65910_I2C_ID0,
1486 .irq = TPS65910_HOST_IRQ,
1487 .platform_data = &tps65910_data,
1493 void __sramfunc board_pmu_suspend(void)
1495 #if defined (CONFIG_REGULATOR_ACT8846)
1496 if(pmic_is_act8846())
1497 board_pmu_act8846_suspend();
1499 #if defined (CONFIG_MFD_WM831X_I2C)
1500 if(pmic_is_wm8326())
1501 board_pmu_wm8326_suspend();
1503 #if defined (CONFIG_MFD_TPS65910)
1504 if(pmic_is_tps65910())
1505 board_pmu_tps65910_suspend();
1509 void __sramfunc board_pmu_resume(void)
1511 #if defined (CONFIG_REGULATOR_ACT8846)
1512 if(pmic_is_act8846())
1513 board_pmu_act8846_resume();
1515 #if defined (CONFIG_MFD_WM831X_I2C)
1516 if(pmic_is_wm8326())
1517 board_pmu_wm8326_resume();
1519 #if defined (CONFIG_MFD_TPS65910)
1520 if(pmic_is_tps65910())
1521 board_pmu_tps65910_resume();
1525 int __sramdata gpio3d6_iomux,gpio3d6_do,gpio3d6_dir,gpio3d6_en;
1527 #define grf_readl(offset) readl_relaxed(RK30_GRF_BASE + offset)
1528 #define grf_writel(v, offset) do { writel_relaxed(v, RK30_GRF_BASE + offset); dsb(); } while (0)
1530 void __sramfunc rk30_pwm_logic_suspend_voltage(void)
1532 #ifdef CONFIG_RK30_PWM_REGULATOR
1534 // int gpio0d7_iomux,gpio0d7_do,gpio0d7_dir,gpio0d7_en;
1536 gpio3d6_iomux = grf_readl(GRF_GPIO3D_IOMUX);
1537 gpio3d6_do = grf_readl(GRF_GPIO3H_DO);
1538 gpio3d6_dir = grf_readl(GRF_GPIO3H_DIR);
1539 gpio3d6_en = grf_readl(GRF_GPIO3H_EN);
1541 grf_writel((1<<28), GRF_GPIO3D_IOMUX);
1542 grf_writel((1<<30)|(1<<14), GRF_GPIO3H_DIR);
1543 grf_writel((1<<30)|(1<<14), GRF_GPIO3H_DO);
1544 grf_writel((1<<30)|(1<<14), GRF_GPIO3H_EN);
1547 void __sramfunc rk30_pwm_logic_resume_voltage(void)
1549 #ifdef CONFIG_RK30_PWM_REGULATOR
1550 grf_writel((1<<28)|gpio3d6_iomux, GRF_GPIO3D_IOMUX);
1551 grf_writel((1<<30)|gpio3d6_en, GRF_GPIO3H_EN);
1552 grf_writel((1<<30)|gpio3d6_dir, GRF_GPIO3H_DIR);
1553 grf_writel((1<<30)|gpio3d6_do, GRF_GPIO3H_DO);
1559 extern void pwm_suspend_voltage(void);
1560 extern void pwm_resume_voltage(void);
1561 void rk30_pwm_suspend_voltage_set(void)
1563 #ifdef CONFIG_RK30_PWM_REGULATOR
1564 pwm_suspend_voltage();
1567 void rk30_pwm_resume_voltage_set(void)
1569 #ifdef CONFIG_RK30_PWM_REGULATOR
1570 pwm_resume_voltage();
1575 #ifdef CONFIG_I2C2_RK30
1576 static struct i2c_board_info __initdata i2c2_info[] = {
1577 #if defined (CONFIG_CT36X_TS)
1582 .platform_data = &ct36x_info,
1585 #if defined (CONFIG_LS_CM3217)
1587 .type = "lightsensor",
1590 .platform_data = &cm3217_info,
1593 #if defined(CONFIG_HDMI_CAT66121)
1595 .type = "cat66121_hdmi",
1598 .irq = RK30_PIN2_PD6,
1599 .platform_data = &rk_hdmi_pdata,
1605 #ifdef CONFIG_I2C3_RK30
1606 static struct i2c_board_info __initdata i2c3_info[] = {
1610 #ifdef CONFIG_I2C4_RK30
1611 static struct i2c_board_info __initdata i2c4_info[] = {
1612 #ifdef CONFIG_MFD_RK610
1614 .type = "rk610_ctl",
1617 .platform_data = &rk610_ctl_pdata,
1619 #ifdef CONFIG_RK610_TVOUT
1621 .type = "rk610_tvout",
1626 #ifdef CONFIG_HDMI_RK610
1628 .type = "rk610_hdmi",
1631 .irq = INVALID_GPIO,
1634 #ifdef CONFIG_SND_SOC_RK610
1635 {//RK610_CODEC addr from 0x60 to 0x80 (0x60~0x80)
1636 .type = "rk610_i2c_codec",
1639 .platform_data = &rk610_codec_pdata,
1647 #ifdef CONFIG_I2C_GPIO_RK30
1648 #define I2C_SDA_PIN INVALID_GPIO// RK30_PIN2_PD6 //set sda_pin here
1649 #define I2C_SCL_PIN INVALID_GPIO//RK30_PIN2_PD7 //set scl_pin here
1650 static int rk30_i2c_io_init(void)
1652 //set iomux (gpio) here
1653 //rk30_mux_api_set(GPIO2D7_I2C1SCL_NAME, GPIO2D_GPIO2D7);
1654 //rk30_mux_api_set(GPIO2D6_I2C1SDA_NAME, GPIO2D_GPIO2D6);
1658 struct i2c_gpio_platform_data default_i2c_gpio_data = {
1659 .sda_pin = I2C_SDA_PIN,
1660 .scl_pin = I2C_SCL_PIN,
1661 .udelay = 5, // clk = 500/udelay = 100Khz
1662 .timeout = 100,//msecs_to_jiffies(100),
1664 .io_init = rk30_i2c_io_init,
1666 static struct i2c_board_info __initdata i2c_gpio_info[] = {
1670 static void __init rk30_i2c_register_board_info(void)
1672 #ifdef CONFIG_I2C0_RK30
1673 i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
1675 #ifdef CONFIG_I2C1_RK30
1676 i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
1678 #ifdef CONFIG_I2C2_RK30
1679 i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
1681 #ifdef CONFIG_I2C3_RK30
1682 i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
1684 #ifdef CONFIG_I2C4_RK30
1685 i2c_register_board_info(4, i2c4_info, ARRAY_SIZE(i2c4_info));
1687 #ifdef CONFIG_I2C_GPIO_RK30
1688 i2c_register_board_info(5, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
1693 #define POWER_ON_PIN RK30_PIN0_PA0 //power_hold
1694 static void rk30_pm_power_off(void)
1696 printk(KERN_ERR "rk30_pm_power_off start...\n");
1697 #if defined(CONFIG_MFD_WM831X)
1698 wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000); //set sys_pwr 0
1699 wm831x_device_shutdown(Wm831x);//wm8326 shutdown
1701 #if defined(CONFIG_REGULATOR_ACT8846)
1702 if (pmic_is_act8846()) {
1703 printk("enter dcdet===========\n");
1704 if(gpio_get_value (RK30_PIN0_PB2) == GPIO_LOW)
1706 printk("enter restart===========\n");
1707 arm_pm_restart(0, NULL);
1711 act8846_device_shutdown();
1715 gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
1719 static void __init machine_rk30_board_init(void)
1722 gpio_request(POWER_ON_PIN, "poweronpin");
1723 gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
1725 pm_power_off = rk30_pm_power_off;
1727 gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
1730 rk30_i2c_register_board_info();
1731 spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
1732 platform_add_devices(devices, ARRAY_SIZE(devices));
1733 rk_platform_add_display_devices();
1734 board_usb_detect_init(RK30_PIN0_PA7);
1736 #ifdef CONFIG_WIFI_CONTROL_FUNC
1737 rk29sdk_wifi_bt_gpio_control_init();
1740 #if defined(CONFIG_MT6620)
1741 clk_set_rate(clk_get_sys("rk_serial.1", "uart"), 48*1000000);
1744 #if defined(CONFIG_MT5931_MT6622)
1745 clk_set_rate(clk_get_sys("rk_serial.0", "uart"), 24*1000000);
1749 static void __init rk30_reserve(void)
1752 rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
1755 #ifdef CONFIG_FB_ROCKCHIP
1756 resource_fb[0].start = board_mem_reserve_add("fb0 buf", get_fb_size());
1757 resource_fb[0].end = resource_fb[0].start + get_fb_size()- 1;
1759 resource_fb[1].start = board_mem_reserve_add("ipp buf", RK30_FB0_MEM_SIZE);
1760 resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1;
1763 #if defined(CONFIG_FB_ROTATE) || !defined(CONFIG_THREE_FB_BUFFER)
1764 resource_fb[2].start = board_mem_reserve_add("fb2 buf",get_fb_size());
1765 resource_fb[2].end = resource_fb[2].start + get_fb_size() - 1;
1770 #ifdef CONFIG_VIDEO_RK29
1771 rk30_camera_request_reserve_mem();
1774 #ifdef CONFIG_GPS_RK
1775 //it must be more than 8MB
1776 rk_gps_info.u32MemoryPhyAddr = board_mem_reserve_add("gps", SZ_8M);
1778 board_mem_reserved();
1782 * dvfs_cpu_logic_table: table for arm and logic dvfs
1783 * @frequency : arm frequency
1784 * @cpu_volt : arm voltage depend on frequency
1785 * @logic_volt : logic voltage arm requests depend on frequency
1786 * comments : min arm/logic voltage
1788 static struct cpufreq_frequency_table dvfs_arm_table[] = {
1790 {.frequency = 312 * 1000, .index = 850 * 1000},
1791 {.frequency = 504 * 1000, .index = 900 * 1000},
1792 {.frequency = 816 * 1000, .index = 950 * 1000},
1793 {.frequency = 1008 * 1000, .index = 1025 * 1000},
1794 {.frequency = 1200 * 1000, .index = 1100 * 1000},
1795 {.frequency = 1416 * 1000, .index = 1200 * 1000},
1796 //{.frequency = 1608 * 1000, .index = 1300 * 1000},
1798 {.frequency = 312 * 1000, .index = 800 * 1000},
1799 {.frequency = 504 * 1000, .index = 850 * 1000},
1800 {.frequency = 816 * 1000, .index = 950 * 1000},
1801 {.frequency = 1008 * 1000, .index = 1000 * 1000},
1802 {.frequency = 1200 * 1000, .index = 1075 * 1000},
1803 {.frequency = 1416 * 1000, .index = 1175 * 1000},
1804 {.frequency = 1608 * 1000, .index = 1275 * 1000},
1807 {.frequency = CPUFREQ_TABLE_END},
1810 static struct cpufreq_frequency_table dvfs_gpu_table[] = {
1811 {.frequency = 100 * 1000, .index = 950 * 1000},
1812 {.frequency = 200 * 1000, .index = 975 * 1000},
1813 {.frequency = 266 * 1000, .index = 1000 * 1000},
1814 {.frequency = 300 * 1000, .index = 1050 * 1000},
1815 {.frequency = 400 * 1000, .index = 1100 * 1000},
1816 //{.frequency = 600 * 1000, .index = 1200 * 1000},
1817 {.frequency = CPUFREQ_TABLE_END},
1820 static struct cpufreq_frequency_table dvfs_ddr_table[] = {
1821 //{.frequency = 200 * 1000 + DDR_FREQ_SUSPEND, .index = 950 * 1000},
1822 //{.frequency = 300 * 1000 + DDR_FREQ_VIDEO, .index = 1000 * 1000},
1823 {.frequency = 400 * 1000 + DDR_FREQ_NORMAL, .index = 1100 * 1000},
1824 {.frequency = CPUFREQ_TABLE_END},
1827 //#define DVFS_CPU_TABLE_SIZE (ARRAY_SIZE(dvfs_cpu_logic_table))
1828 //static struct cpufreq_frequency_table cpu_dvfs_table[DVFS_CPU_TABLE_SIZE];
1829 //static struct cpufreq_frequency_table dep_cpu2core_table[DVFS_CPU_TABLE_SIZE];
1831 void __init board_clock_init(void)
1833 rk30_clock_data_init(periph_pll_default, codec_pll_default, RK30_CLOCKS_DEFAULT_FLAGS);
1834 //dvfs_set_arm_logic_volt(dvfs_cpu_logic_table, cpu_dvfs_table, dep_cpu2core_table);
1835 dvfs_set_freq_volt_table(clk_get(NULL, "cpu"), dvfs_arm_table);
1836 dvfs_set_freq_volt_table(clk_get(NULL, "gpu"), dvfs_gpu_table);
1837 dvfs_set_freq_volt_table(clk_get(NULL, "ddr"), dvfs_ddr_table);
1840 MACHINE_START(RK30, "RK30board")
1841 .boot_params = PLAT_PHYS_OFFSET + 0x800,
1842 .fixup = rk30_fixup,
1843 .reserve = &rk30_reserve,
1844 .map_io = rk30_map_io,
1845 .init_irq = rk30_init_irq,
1846 .timer = &rk30_timer,
1847 .init_machine = machine_rk30_board_init,