1 /* arch/arm/mach-rk2928/board-rk2928-fpga.c
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>
30 #include <asm/setup.h>
31 #include <asm/mach-types.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach/map.h>
34 #include <asm/mach/flash.h>
35 #include <asm/hardware/gic.h>
36 #include <mach/dvfs.h>
38 #include <mach/board.h>
39 #include <mach/hardware.h>
41 #include <mach/gpio.h>
42 #include <mach/iomux.h>
44 #include <linux/regulator/machine.h>
45 #include <linux/rfkill-rk.h>
46 #include <linux/sensor-dev.h>
47 #include <linux/mfd/tps65910.h>
48 #include <linux/regulator/rk29-pwm-regulator.h>
49 #if defined(CONFIG_HDMI_RK30)
50 #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
53 #if defined(CONFIG_SPIM_RK29)
54 #include "../../../drivers/spi/rk29_spim.h"
57 #if defined(CONFIG_SC6610)
58 #include <linux/mu509.h>
61 #include "board-rk2928-phonepad-camera.c"
62 #include "board-rk2928-phonepad-key.c"
64 #ifdef CONFIG_THREE_FB_BUFFER
65 #define RK30_FB0_MEM_SIZE 12*SZ_1M
67 #define RK30_FB0_MEM_SIZE 8*SZ_1M
70 static struct spi_board_info board_spi_devices[] = {
73 /***********************************************************
75 ************************************************************/
76 #ifdef CONFIG_BACKLIGHT_RK29_BL
78 #define PWM_MUX_NAME GPIO0D2_PWM_0_NAME
79 #define PWM_MUX_MODE GPIO0D_PWM_0
80 #define PWM_MUX_MODE_GPIO GPIO0D_GPIO0D2
81 #define PWM_GPIO RK2928_PIN0_PD2
82 #define PWM_EFFECT_VALUE 1
84 //#define LCD_DISP_ON_PIN
86 #ifdef LCD_DISP_ON_PIN
88 #define BL_EN_PIN RK2928_PIN1_PB0
89 #define BL_EN_VALUE GPIO_HIGH
91 static int rk29_backlight_io_init(void)
94 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
95 #ifdef LCD_DISP_ON_PIN
96 // rk30_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
98 ret = gpio_request(BL_EN_PIN, NULL);
100 gpio_free(BL_EN_PIN);
103 gpio_direction_output(BL_EN_PIN, 0);
104 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
109 static int rk29_backlight_io_deinit(void)
112 #ifdef LCD_DISP_ON_PIN
113 gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
114 gpio_free(BL_EN_PIN);
116 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
120 static int rk29_backlight_pwm_suspend(void)
123 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
124 if (gpio_request(PWM_GPIO, NULL)) {
125 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
128 gpio_direction_output(PWM_GPIO, GPIO_LOW);
129 #ifdef LCD_DISP_ON_PIN
130 gpio_direction_output(BL_EN_PIN, 0);
131 gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
137 static int rk29_backlight_pwm_resume(void)
140 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
141 #ifdef LCD_DISP_ON_PIN
143 gpio_direction_output(BL_EN_PIN, 1);
144 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
149 static struct rk29_bl_info rk29_bl_info = {
151 .min_brightness = 80,
152 .bl_ref = PWM_EFFECT_VALUE,
153 .io_init = rk29_backlight_io_init,
154 .io_deinit = rk29_backlight_io_deinit,
155 .pwm_suspend = rk29_backlight_pwm_suspend,
156 .pwm_resume = rk29_backlight_pwm_resume,
159 static struct platform_device rk29_device_backlight = {
160 .name = "rk29_backlight",
163 .platform_data = &rk29_bl_info,
169 #ifdef CONFIG_FB_ROCKCHIP
171 #define LCD_MUX_NAME GPIO0C3_UART0_CTSN_NAME
172 #define LCD_GPIO_MODE GPIO0C_GPIO0C3
174 #define LCD_EN RK2928_PIN0_PC3
175 #define LCD_EN_VALUE GPIO_LOW
177 static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
181 rk30_mux_api_set(LCD_MUX_NAME, LCD_GPIO_MODE);
182 ret = gpio_request(LCD_EN, NULL);
186 printk(KERN_ERR "request lcd en pin fail!\n");
191 gpio_direction_output(LCD_EN, LCD_EN_VALUE); //disable
195 static int rk_fb_io_disable(void)
197 gpio_set_value(LCD_EN, !LCD_EN_VALUE);
200 static int rk_fb_io_enable(void)
202 gpio_set_value(LCD_EN, LCD_EN_VALUE);
206 #if defined(CONFIG_LCDC_RK2928)
207 struct rk29fb_info lcdc_screen_info = {
208 .prop = PRMRY, //primary display device
209 .io_init = rk_fb_io_init,
210 .io_disable = rk_fb_io_disable,
211 .io_enable = rk_fb_io_enable,
212 .set_screen_info = set_lcd_info,
216 static struct resource resource_fb[] = {
220 .end = 0,//RK30_FB0_MEM_SIZE - 1,
221 .flags = IORESOURCE_MEM,
224 .name = "ipp buf", //for rotate
226 .end = 0,//RK30_FB0_MEM_SIZE - 1,
227 .flags = IORESOURCE_MEM,
232 .end = 0,//RK30_FB0_MEM_SIZE - 1,
233 .flags = IORESOURCE_MEM,
237 static struct platform_device device_fb = {
240 .num_resources = ARRAY_SIZE(resource_fb),
241 .resource = resource_fb,
246 #ifdef CONFIG_LCDC_RK2928
247 static struct resource resource_lcdc[] = {
250 .start = RK2928_LCDC_PHYS,
251 .end = RK2928_LCDC_PHYS + RK2928_LCDC_SIZE - 1,
252 .flags = IORESOURCE_MEM,
259 .flags = IORESOURCE_IRQ,
263 static struct platform_device device_lcdc = {
264 .name = "rk2928-lcdc",
266 .num_resources = ARRAY_SIZE(resource_lcdc),
267 .resource = resource_lcdc,
269 .platform_data = &lcdc_screen_info,
275 #define ION_RESERVE_SIZE (80 * SZ_1M)
276 static struct ion_platform_data rk30_ion_pdata = {
280 .type = ION_HEAP_TYPE_CARVEOUT,
281 .id = ION_NOR_HEAP_ID,
283 .size = ION_RESERVE_SIZE,
288 static struct platform_device device_ion = {
289 .name = "ion-rockchip",
292 .platform_data = &rk30_ion_pdata,
298 #if defined (CONFIG_TOUCHSCREEN_I30)
299 #define TOUCH_RESET_PIN RK2928_PIN3_PD5
300 #define TOUCH_INT_PIN RK2928_PIN3_PC7
301 int ft5306_init_platform_hw(void)
303 struct regulator *ldo;
304 // printk("ft5306_init_platform_hw\n");
306 ldo = regulator_get(NULL, "vaux33");
307 regulator_disable(ldo);
309 if(gpio_request(TOUCH_RESET_PIN,NULL) != 0)
311 gpio_free(TOUCH_RESET_PIN);
312 printk("ft5306_init_platform_hw TOUCH_RESET_PIN error\n");
316 if(gpio_request(TOUCH_INT_PIN,NULL) != 0)
318 gpio_free(TOUCH_INT_PIN);
319 printk("ift5306_init_platform_hw TOUCH_INT_PIN error\n");
322 gpio_direction_input(TOUCH_INT_PIN);
323 gpio_direction_output(TOUCH_RESET_PIN, 1);
324 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
326 regulator_enable(ldo);
333 void ft5306_exit_platform_hw(void)
335 // printk("ft5306_exit_platform_hw\n");
336 gpio_free(TOUCH_RESET_PIN);
337 gpio_free(TOUCH_INT_PIN);
340 int ft5306_platform_sleep(void)
343 struct regulator *ldo;
344 ldo = regulator_get(NULL, "ldo9");
345 regulator_disable(ldo);
348 printk("ft5306_platform_sleep\n");
350 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
354 int ft5306_platform_wakeup(void)
357 struct regulator *ldo;
358 ldo = regulator_get(NULL, "ldo9");
359 regulator_set_voltage(ldo, 3300000, 3300000);
360 regulator_enable(ldo);
363 printk("ft5306_platform_wakeup\n");
365 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
370 struct ft5306_platform_data ft5306_info = {
371 .irq_pin = TOUCH_INT_PIN,
372 .rest_pin = TOUCH_RESET_PIN,
373 .init_platform_hw= ft5306_init_platform_hw,
374 .exit_platform_hw= ft5306_exit_platform_hw,
375 .platform_sleep = ft5306_platform_sleep,
376 .platform_wakeup = ft5306_platform_wakeup,
381 #if defined(CONFIG_TOUCHSCREEN_BYD693X)
383 #define TOUCH_RESET_PIN RK2928_PIN3_PD5
384 #define TOUCH_INT_PIN RK2928_PIN3_PC7
385 struct byd_platform_data byd693x_info = {
386 .int_pin = TOUCH_INT_PIN,
387 .rst_pin = TOUCH_RESET_PIN,
395 #if defined (CONFIG_GS_MMA7660)
396 #define MMA7660_INT_PIN RK2928_PIN1_PB1
398 static int mma7660_init_platform_hw(void)
400 rk30_mux_api_set(GPIO1B1_SPI_TXD_UART1_SOUT_NAME, GPIO1B_GPIO1B1);
405 static struct sensor_platform_data mma7660_info = {
406 .type = SENSOR_TYPE_ACCEL,
409 .init_platform_hw = mma7660_init_platform_hw,
410 .orientation = {-1, 0, 0, 0, 0, -1, 0, 1, 0},
415 #if defined (CONFIG_GS_KXTIK)
416 #define KXTIK_INT_PIN RK2928_PIN3_PD1
419 static int kxtik_init_hw(void)
423 ret = gpio_request(KXTIK_INT_PIN,"kxtik_irq");
425 printk("kxtik gpio request fail!\n");
429 gpio_direction_input(KXTIK_INT_PIN);
433 static void kxtik_exit_hw(void)
435 gpio_free(KXTIK_INT_PIN);
438 static struct gsensor_platform_data kxtik_pdata = {
441 .init_platform_hw = kxtik_init_hw,
442 .exit_platform_hw = kxtik_exit_hw,
443 .orientation = {-1, 0, 0, 0, 0, -1, 0, 1, 0},
447 static int kxtik_init_platform_hw(void)
449 printk("%s: >>>>>>>>>>>>>>>>\n\n\n", __func__);
453 static struct sensor_platform_data kxtik_pdata = {
454 .type = SENSOR_TYPE_ACCEL,
457 .init_platform_hw = kxtik_init_platform_hw,
458 .orientation = {-1, 0, 0, 0, 0, -1, 0, 1, 0},
459 //.orientation = {0, 1, 0, 0, 0, -1, 1, 0, 0},
462 #endif /* CONFIG_GS_KXTIK*/
464 #ifdef CONFIG_INPUT_AP321XX
465 #define AP321XX_INT_PIN RK2928_PIN0_PC6
467 static int AP321XX_init_hw(void)
470 ret = gpio_request(AP321XX_INT_PIN, NULL);
473 gpio_free(AP321XX_INT_PIN);
474 printk(KERN_ERR "request AP321XX_INT_PIN fail!\n");
479 gpio_direction_input(AP321XX_INT_PIN);
484 static void AP321XX_exit_hw(void)
486 gpio_free(AP321XX_INT_PIN);
490 static struct ap321xx_platform_data ap321xx_info = {
491 .init_platform_hw = AP321XX_init_hw,
492 .exit_platform_hw = AP321XX_exit_hw,
497 #if defined(CONFIG_BATTERY_RK30_ADC)||defined(CONFIG_BATTERY_RK30_ADC_FAC)
498 static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
499 .dc_det_pin = RK2928_PIN1_PA5,
500 .batt_low_pin = INVALID_GPIO,
501 .charge_set_pin = INVALID_GPIO,
502 .charge_ok_pin = RK2928_PIN1_PA0,
503 .dc_det_level = GPIO_LOW, //
504 .charge_ok_level = GPIO_HIGH,
507 static struct platform_device rk30_device_adc_battery = {
508 .name = "rk30-battery",
511 .platform_data = &rk30_adc_battery_platdata,
517 #if CONFIG_RK30_PWM_REGULATOR
518 const static int pwm_voltage_map[] = {
519 1000000, 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000
522 static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
524 .supply = "vdd_core",
528 struct regulator_init_data pwm_regulator_init_dcdc[1] =
534 .max_uV = 1800000, //0.6-1.8V
536 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
538 .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
539 .consumer_supplies = pwm_dcdc1_consumers,
543 static struct pwm_platform_data pwm_regulator_info[1] = {
546 .pwm_gpio = RK2928_PIN0_PD4,
547 .pwm_iomux_name = GPIO0D4_PWM_2_NAME,
548 .pwm_iomux_pwm = GPIO0D_PWM_2,
549 .pwm_iomux_gpio = GPIO0D_GPIO0D4,
550 .pwm_voltage = 1200000,
551 .suspend_voltage = 1050000,
554 .coefficient = 455, //45.5%
555 .pwm_voltage_map = pwm_voltage_map,
556 .init_data = &pwm_regulator_init_dcdc[0],
560 struct platform_device pwm_regulator_device[1] = {
562 .name = "pwm-voltage-regulator",
565 .platform_data = &pwm_regulator_info[0],
570 /**************************************************************************************************
571 * SDMMC devices, include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
572 **************************************************************************************************/
573 #ifdef CONFIG_SDMMC_RK29
574 #include "board-rk2928-phonepad-sdmmc.c"
576 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
577 #define SDMMC0_WRITE_PROTECT_PIN RK2928_PIN1_PA7 //According to your own project to set the value of write-protect-pin.
580 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
581 #define SDMMC1_WRITE_PROTECT_PIN RK2928_PIN0_PD5 //According to your own project to set the value of write-protect-pin.
584 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK2928_PIN0_PB2
586 #endif //endif ---#ifdef CONFIG_SDMMC_RK29
588 #ifdef CONFIG_SDMMC0_RK29
589 static int rk29_sdmmc0_cfg_gpio(void)
591 rk29_sdmmc_set_iomux(0, 0xFFFF);
593 rk30_mux_api_set(GPIO1C1_MMC0_DETN_NAME, GPIO1C_MMC0_DETN);
595 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
596 gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
597 gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
603 #define CONFIG_SDMMC0_USE_DMA
604 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
606 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
607 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
608 MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
610 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
611 .io_init = rk29_sdmmc0_cfg_gpio,
613 #if !defined(CONFIG_SDMMC_RK29_OLD)
614 .set_iomux = rk29_sdmmc_set_iomux,
617 .dma_name = "sd_mmc",
618 #ifdef CONFIG_SDMMC0_USE_DMA
623 .detect_irq = INVALID_GPIO,
624 .enable_sd_wakeup = 0,
626 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
627 .write_prt = SDMMC0_WRITE_PROTECT_PIN,
629 .write_prt = INVALID_GPIO,
632 #endif // CONFIG_SDMMC0_RK29
633 #ifdef CONFIG_SDMMC1_RK29
634 #define CONFIG_SDMMC1_USE_DMA
635 static int rk29_sdmmc1_cfg_gpio(void)
637 #if defined(CONFIG_SDMMC_RK29_OLD)
638 rk30_mux_api_set(GPIO0B0_MMC1_CMD_NAME, GPIO0B_MMC1_CMD);
639 rk30_mux_api_set(GPIO0B1_MMC1_CLKOUT_NAME, GPIO0B_MMC1_CLKOUT);
640 rk30_mux_api_set(GPIO0B3_MMC1_D0_NAME, GPIO0B_MMC1_D0);
641 rk30_mux_api_set(GPIO0B4_MMC1_D1_NAME, GPIO0B_MMC1_D1);
642 rk30_mux_api_set(GPIO0B5_MMC1_D2_NAME, GPIO0B_MMC1_D2);
643 rk30_mux_api_set(GPIO0B6_MMC1_D3_NAME, GPIO0B_MMC1_D3);
644 //rk30_mux_api_set(GPIO0B2_MMC1_DETN_NAME, GPIO0B_MMC1_DETN);
648 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
649 gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp");
650 gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN);
658 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
660 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
661 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
664 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
665 .host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |
666 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
669 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
672 .io_init = rk29_sdmmc1_cfg_gpio,
674 #if !defined(CONFIG_SDMMC_RK29_OLD)
675 .set_iomux = rk29_sdmmc_set_iomux,
679 #ifdef CONFIG_SDMMC1_USE_DMA
685 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
686 #ifdef CONFIG_WIFI_CONTROL_FUNC
687 .status = rk29sdk_wifi_status,
688 .register_status_notify = rk29sdk_wifi_status_register,
691 .detect_irq = INVALID_GPIO,//RK29SDK_WIFI_SDIO_CARD_DETECT_N,
694 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
695 .write_prt = SDMMC1_WRITE_PROTECT_PIN,
697 .write_prt = INVALID_GPIO,
701 .detect_irq = INVALID_GPIO,
702 .enable_sd_wakeup = 0,
706 #endif //endif--#ifdef CONFIG_SDMMC1_RK29
708 #if defined(CONFIG_SC6610)
709 static int sc6610_io_init(void)
715 static int sc6610_io_deinit(void)
722 struct rk29_mu509_data rk29_sc6610_info = {
723 .io_init = sc6610_io_init,
724 .io_deinit = sc6610_io_deinit,
725 .bp_power = RK2928_PIN3_PC2,//RK29_PIN0_PB4,
726 .bp_reset = NULL,//RK29_PIN0_PB3,
727 .bp_wakeup_ap = RK2928_PIN3_PC3,//RK29_PIN0_PC2,
728 .ap_wakeup_bp = RK2928_PIN3_PC4,//RK29_PIN0_PB0,
729 .modem_assert = RK2928_PIN3_PC5,
731 struct platform_device rk29_device_sc6610 = {
735 .platform_data = &rk29_sc6610_info,
739 #ifdef CONFIG_SND_SOC_RK2928
740 static struct resource resources_acodec[] = {
742 .start = RK2928_ACODEC_PHYS,
743 .end = RK2928_ACODEC_PHYS + RK2928_ACODEC_SIZE - 1,
744 .flags = IORESOURCE_MEM,
747 .start = RK2928_PIN3_PD4,
748 .end = RK2928_PIN3_PD4,
749 .flags = IORESOURCE_IO,
753 static struct platform_device device_acodec = {
754 .name = "rk2928-codec",
756 .num_resources = ARRAY_SIZE(resources_acodec),
757 .resource = resources_acodec,
761 static struct platform_device *devices[] __initdata = {
762 #ifdef CONFIG_FB_ROCKCHIP
765 #ifdef CONFIG_LCDC_RK2928
768 #ifdef CONFIG_BACKLIGHT_RK29_BL
769 &rk29_device_backlight,
774 #ifdef CONFIG_SND_SOC_RK2928
778 #if defined(CONFIG_BATTERY_RK30_ADC)||defined(CONFIG_BATTERY_RK30_ADC_FAC)
779 &rk30_device_adc_battery,
781 #if defined(CONFIG_SC6610)
787 #ifdef CONFIG_I2C0_RK30
788 #ifdef CONFIG_MFD_TPS65910
789 #define TPS65910_HOST_IRQ RK2928_PIN3_PC6
790 #include "board-rk2928-phonepad-tps65910.c"
792 #ifdef CONFIG_REGULATOR_ACT8931
793 #include "board-rk2928-sdk-act8931.c"
796 static struct i2c_board_info __initdata i2c0_info[] = {
797 #if defined (CONFIG_MFD_TPS65910)
800 .addr = TPS65910_I2C_ID0,
802 .irq = TPS65910_HOST_IRQ,
803 .platform_data = &tps65910_data,
806 #if defined (CONFIG_REGULATOR_ACT8931)
811 .platform_data=&act8931_data,
816 #ifdef CONFIG_I2C1_RK30
817 static struct i2c_board_info __initdata i2c1_info[] = {
818 #if defined (CONFIG_GS_MMA7660)
820 .type = "gs_mma7660",
823 .irq = MMA7660_INT_PIN,
824 .platform_data = &mma7660_info,
829 #if defined (CONFIG_GS_KXTIK)
834 .platform_data = &kxtik_pdata,
835 .irq = KXTIK_INT_PIN, // Replace with appropriate GPIO setup
839 #ifdef CONFIG_INPUT_AP321XX
844 .irq = AP321XX_INT_PIN,
845 .platform_data = &ap321xx_info
848 #ifdef CONFIG_RDA5990
849 #define RDA_WIFI_CORE_ADDR (0x13)
850 #define RDA_WIFI_RF_ADDR (0x14) //correct add is 0x14
851 #define RDA_BT_CORE_ADDR (0x15)
852 #define RDA_BT_RF_ADDR (0x16)
854 #define RDA_WIFI_RF_I2C_DEVNAME "rda_wifi_rf_i2c"
855 #define RDA_WIFI_CORE_I2C_DEVNAME "rda_wifi_core_i2c"
856 #define RDA_BT_RF_I2C_DEVNAME "rda_bt_rf_i2c"
857 #define RDA_BT_CORE_I2C_DEVNAME "rda_bt_core_i2c"
859 .type = RDA_WIFI_CORE_I2C_DEVNAME,
860 .addr = RDA_WIFI_CORE_ADDR,
866 .type = RDA_WIFI_RF_I2C_DEVNAME,
867 .addr = RDA_WIFI_RF_ADDR,
872 .type = RDA_BT_CORE_I2C_DEVNAME,
873 .addr = RDA_BT_CORE_ADDR,
878 .type = RDA_BT_RF_I2C_DEVNAME,
879 .addr = RDA_BT_RF_ADDR,
887 #ifdef CONFIG_I2C2_RK30
888 static struct i2c_board_info __initdata i2c2_info[] = {
889 #if defined (CONFIG_TOUCHSCREEN_I30)
894 .irq = TOUCH_INT_PIN,
895 .platform_data = &ft5306_info,
898 #if defined(CONFIG_TOUCHSCREEN_BYD693X)
900 .type = "byd693x-ts",
903 .irq = TOUCH_INT_PIN,
904 .platform_data = &byd693x_info,
909 #ifdef CONFIG_I2C3_RK30
910 static struct i2c_board_info __initdata i2c3_info[] = {
913 #ifdef CONFIG_I2C_GPIO_RK30
914 #define I2C_SDA_PIN INVALID_GPIO //set sda_pin here
915 #define I2C_SCL_PIN INVALID_GPIO //set scl_pin here
916 static int rk30_i2c_io_init(void)
918 //set iomux (gpio) here
922 struct i2c_gpio_platform_data default_i2c_gpio_data = {
923 .sda_pin = I2C_SDA_PIN,
924 .scl_pin = I2C_SCL_PIN,
925 .udelay = 5, // clk = 500/udelay = 100Khz
926 .timeout = 100,//msecs_to_jiffies(100),
928 .io_init = rk30_i2c_io_init,
930 static struct i2c_board_info __initdata i2c_gpio_info[] = {
933 static void __init rk30_i2c_register_board_info(void)
935 #ifdef CONFIG_I2C0_RK30
936 i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
938 #ifdef CONFIG_I2C1_RK30
939 i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
941 #ifdef CONFIG_I2C2_RK30
942 i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
944 #ifdef CONFIG_I2C3_RK30
945 i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
947 #ifdef CONFIG_I2C_GPIO_RK30
948 i2c_register_board_info(4, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
953 #define POWER_ON_PIN RK2928_PIN1_PA2 //power_hold
954 static void rk2928_pm_power_off(void)
956 printk(KERN_ERR "rk2928_pm_power_off start...\n");
958 #if defined(CONFIG_MFD_TPS65910)
959 tps65910_device_shutdown();//tps65910 shutdown
961 gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
965 static void __init rk2928_board_init(void)
967 gpio_request(POWER_ON_PIN, "poweronpin");
968 gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
969 gpio_free(POWER_ON_PIN);
971 pm_power_off = rk2928_pm_power_off;
973 rk30_i2c_register_board_info();
974 spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
975 platform_add_devices(devices, ARRAY_SIZE(devices));
979 static void __init rk2928_reserve(void)
982 rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
984 #ifdef CONFIG_FB_ROCKCHIP
985 resource_fb[0].start = board_mem_reserve_add("fb0", RK30_FB0_MEM_SIZE);
986 resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1;
988 #ifdef CONFIG_VIDEO_RK29
989 rk30_camera_request_reserve_mem();
991 board_mem_reserved();
994 * dvfs_cpu_logic_table: table for arm and logic dvfs
995 * @frequency : arm frequency
996 * @cpu_volt : arm voltage depend on frequency
997 * @logic_volt : logic voltage arm requests depend on frequency
998 * comments : min arm/logic voltage
1000 static struct dvfs_arm_table dvfs_cpu_logic_table[] = {
1001 {.frequency = 216 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000},//0.975V/1.000V
1002 {.frequency = 312 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000},//0.975V/1.000V
1003 {.frequency = 408 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000},//1.000V/1.025V
1004 {.frequency = 504 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000},//1.000V/1.025V
1005 {.frequency = 600 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000},//1.025V/1.050V
1006 {.frequency = 696 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},//1.000V/1.025V
1007 {.frequency = 816 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},//1.100V/1.050V
1008 //{.frequency = 912 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},//1.100V/1.050V
1009 //{.frequency = 1008 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},//1.100V/1.050V
1011 {.frequency = 1104 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},//1.100V/1.050V
1012 {.frequency = 1200 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},//1.100V/1.050V
1013 {.frequency = 1104 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},//1.100V/1.050V
1014 {.frequency = 1248 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},//1.100V/1.050V
1016 //{.frequency = 1000 * 1000, .cpu_volt = 1225 * 1000, .logic_volt = 1200 * 1000},//1.150V/1.100V
1017 {.frequency = CPUFREQ_TABLE_END},
1020 static struct cpufreq_frequency_table dvfs_gpu_table[] = {
1021 {.frequency = 266 * 1000, .index = 1050 * 1000},
1022 {.frequency = 400 * 1000, .index = 1275 * 1000},
1023 {.frequency = CPUFREQ_TABLE_END},
1026 static struct cpufreq_frequency_table dvfs_ddr_table[] = {
1027 {.frequency = 300 * 1000, .index = 1050 * 1000},
1028 {.frequency = 400 * 1000, .index = 1125 * 1000},
1029 {.frequency = CPUFREQ_TABLE_END},
1032 #define DVFS_CPU_TABLE_SIZE (ARRAY_SIZE(dvfs_cpu_logic_table))
1033 static struct cpufreq_frequency_table cpu_dvfs_table[DVFS_CPU_TABLE_SIZE];
1034 static struct cpufreq_frequency_table dep_cpu2core_table[DVFS_CPU_TABLE_SIZE];
1036 void __init board_clock_init(void)
1038 rk2928_clock_data_init(periph_pll_default, codec_pll_default, RK30_CLOCKS_DEFAULT_FLAGS);
1039 dvfs_set_arm_logic_volt(dvfs_cpu_logic_table, cpu_dvfs_table, dep_cpu2core_table);
1040 dvfs_set_freq_volt_table(clk_get(NULL, "gpu"), dvfs_gpu_table);
1041 //dvfs_set_freq_volt_table(clk_get(NULL, "ddr"), dvfs_ddr_table);
1042 printk("%s end\n", __func__);
1046 MACHINE_START(RK2928, "RK2928board")
1047 .boot_params = PLAT_PHYS_OFFSET + 0x800,
1048 .fixup = rk2928_fixup,
1049 .reserve = &rk2928_reserve,
1050 .map_io = rk2928_map_io,
1051 .init_irq = rk2928_init_irq,
1052 .timer = &rk2928_timer,
1053 .init_machine = rk2928_board_init,