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_MODEM_SOUND)
50 #include "../../../drivers/misc/modem_sound.h"
52 #if defined(CONFIG_HDMI_RK30)
53 #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
55 #include "../../../drivers/headset_observe/rk_headset.h"
57 #if defined(CONFIG_SPIM_RK29)
58 #include "../../../drivers/spi/rk29_spim.h"
61 #if defined(CONFIG_SC6610)
62 #include <linux/mu509.h>
65 #include "board-rk2928-phonepad-camera.c"
66 #include "board-rk2928-phonepad-key.c"
68 #ifdef CONFIG_THREE_FB_BUFFER
69 #define RK30_FB0_MEM_SIZE 12*SZ_1M
71 #define RK30_FB0_MEM_SIZE 8*SZ_1M
74 static struct spi_board_info board_spi_devices[] = {
77 /***********************************************************
79 ************************************************************/
80 #ifdef CONFIG_BACKLIGHT_RK29_BL
82 #define PWM_MUX_NAME GPIO0D2_PWM_0_NAME
83 #define PWM_MUX_MODE GPIO0D_PWM_0
84 #define PWM_MUX_MODE_GPIO GPIO0D_GPIO0D2
85 #define PWM_GPIO RK2928_PIN0_PD2
86 #define PWM_EFFECT_VALUE 1
88 //#define LCD_DISP_ON_PIN
90 #ifdef LCD_DISP_ON_PIN
92 #define BL_EN_PIN RK2928_PIN1_PB0
93 #define BL_EN_VALUE GPIO_HIGH
95 static int rk29_backlight_io_init(void)
98 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
99 #ifdef LCD_DISP_ON_PIN
100 // rk30_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
102 ret = gpio_request(BL_EN_PIN, NULL);
104 gpio_free(BL_EN_PIN);
107 gpio_direction_output(BL_EN_PIN, 0);
108 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
113 static int rk29_backlight_io_deinit(void)
116 #ifdef LCD_DISP_ON_PIN
117 gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
118 gpio_free(BL_EN_PIN);
120 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
124 static int rk29_backlight_pwm_suspend(void)
127 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
128 if (gpio_request(PWM_GPIO, NULL)) {
129 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
132 gpio_direction_output(PWM_GPIO, GPIO_LOW);
133 #ifdef LCD_DISP_ON_PIN
134 gpio_direction_output(BL_EN_PIN, 0);
135 gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
141 static int rk29_backlight_pwm_resume(void)
144 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
145 #ifdef LCD_DISP_ON_PIN
147 gpio_direction_output(BL_EN_PIN, 1);
148 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
153 static struct rk29_bl_info rk29_bl_info = {
155 .min_brightness = 80,
156 .bl_ref = PWM_EFFECT_VALUE,
157 .io_init = rk29_backlight_io_init,
158 .io_deinit = rk29_backlight_io_deinit,
159 .pwm_suspend = rk29_backlight_pwm_suspend,
160 .pwm_resume = rk29_backlight_pwm_resume,
163 static struct platform_device rk29_device_backlight = {
164 .name = "rk29_backlight",
167 .platform_data = &rk29_bl_info,
173 #ifdef CONFIG_FB_ROCKCHIP
175 #define LCD_MUX_NAME GPIO0C3_UART0_CTSN_NAME
176 #define LCD_GPIO_MODE GPIO0C_GPIO0C3
178 #define LCD_EN RK2928_PIN0_PC3
179 #define LCD_EN_VALUE GPIO_LOW
181 static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
185 rk30_mux_api_set(LCD_MUX_NAME, LCD_GPIO_MODE);
186 ret = gpio_request(LCD_EN, NULL);
190 printk(KERN_ERR "request lcd en pin fail!\n");
195 gpio_direction_output(LCD_EN, LCD_EN_VALUE); //disable
199 static int rk_fb_io_disable(void)
201 gpio_set_value(LCD_EN, !LCD_EN_VALUE);
204 static int rk_fb_io_enable(void)
206 gpio_set_value(LCD_EN, LCD_EN_VALUE);
210 #if defined(CONFIG_LCDC_RK2928)
211 struct rk29fb_info lcdc_screen_info = {
212 .prop = PRMRY, //primary display device
213 .io_init = rk_fb_io_init,
214 .io_disable = rk_fb_io_disable,
215 .io_enable = rk_fb_io_enable,
216 .set_screen_info = set_lcd_info,
220 static struct resource resource_fb[] = {
224 .end = 0,//RK30_FB0_MEM_SIZE - 1,
225 .flags = IORESOURCE_MEM,
228 .name = "ipp buf", //for rotate
230 .end = 0,//RK30_FB0_MEM_SIZE - 1,
231 .flags = IORESOURCE_MEM,
236 .end = 0,//RK30_FB0_MEM_SIZE - 1,
237 .flags = IORESOURCE_MEM,
241 static struct platform_device device_fb = {
244 .num_resources = ARRAY_SIZE(resource_fb),
245 .resource = resource_fb,
250 #ifdef CONFIG_LCDC_RK2928
251 static struct resource resource_lcdc[] = {
254 .start = RK2928_LCDC_PHYS,
255 .end = RK2928_LCDC_PHYS + RK2928_LCDC_SIZE - 1,
256 .flags = IORESOURCE_MEM,
263 .flags = IORESOURCE_IRQ,
267 static struct platform_device device_lcdc = {
268 .name = "rk2928-lcdc",
270 .num_resources = ARRAY_SIZE(resource_lcdc),
271 .resource = resource_lcdc,
273 .platform_data = &lcdc_screen_info,
279 #define ION_RESERVE_SIZE (80 * SZ_1M)
280 static struct ion_platform_data rk30_ion_pdata = {
284 .type = ION_HEAP_TYPE_CARVEOUT,
285 .id = ION_NOR_HEAP_ID,
287 .size = ION_RESERVE_SIZE,
292 static struct platform_device device_ion = {
293 .name = "ion-rockchip",
296 .platform_data = &rk30_ion_pdata,
302 #if defined (CONFIG_TOUCHSCREEN_I30)
303 #define TOUCH_RESET_PIN RK2928_PIN3_PD5
304 #define TOUCH_INT_PIN RK2928_PIN3_PC7
305 int ft5306_init_platform_hw(void)
307 struct regulator *ldo;
308 // printk("ft5306_init_platform_hw\n");
310 ldo = regulator_get(NULL, "vaux33");
311 regulator_disable(ldo);
313 if(gpio_request(TOUCH_RESET_PIN,NULL) != 0)
315 gpio_free(TOUCH_RESET_PIN);
316 printk("ft5306_init_platform_hw TOUCH_RESET_PIN error\n");
320 if(gpio_request(TOUCH_INT_PIN,NULL) != 0)
322 gpio_free(TOUCH_INT_PIN);
323 printk("ift5306_init_platform_hw TOUCH_INT_PIN error\n");
326 gpio_direction_input(TOUCH_INT_PIN);
327 gpio_direction_output(TOUCH_RESET_PIN, 1);
328 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
330 regulator_enable(ldo);
337 void ft5306_exit_platform_hw(void)
339 // printk("ft5306_exit_platform_hw\n");
340 gpio_free(TOUCH_RESET_PIN);
341 gpio_free(TOUCH_INT_PIN);
344 int ft5306_platform_sleep(void)
347 struct regulator *ldo;
348 ldo = regulator_get(NULL, "ldo9");
349 regulator_disable(ldo);
352 printk("ft5306_platform_sleep\n");
354 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
358 int ft5306_platform_wakeup(void)
361 struct regulator *ldo;
362 ldo = regulator_get(NULL, "ldo9");
363 regulator_set_voltage(ldo, 3300000, 3300000);
364 regulator_enable(ldo);
367 printk("ft5306_platform_wakeup\n");
369 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
374 struct ft5306_platform_data ft5306_info = {
375 .irq_pin = TOUCH_INT_PIN,
376 .rest_pin = TOUCH_RESET_PIN,
377 .init_platform_hw= ft5306_init_platform_hw,
378 .exit_platform_hw= ft5306_exit_platform_hw,
379 .platform_sleep = ft5306_platform_sleep,
380 .platform_wakeup = ft5306_platform_wakeup,
385 #if defined(CONFIG_TOUCHSCREEN_BYD693X)
387 #define TOUCH_RESET_PIN RK2928_PIN3_PD5
388 #define TOUCH_INT_PIN RK2928_PIN3_PC7
389 struct byd_platform_data byd693x_info = {
390 .int_pin = TOUCH_INT_PIN,
391 .rst_pin = TOUCH_RESET_PIN,
399 #if defined (CONFIG_GS_MMA7660)
400 #define MMA7660_INT_PIN RK2928_PIN1_PB1
402 static int mma7660_init_platform_hw(void)
404 rk30_mux_api_set(GPIO1B1_SPI_TXD_UART1_SOUT_NAME, GPIO1B_GPIO1B1);
409 static struct sensor_platform_data mma7660_info = {
410 .type = SENSOR_TYPE_ACCEL,
413 .init_platform_hw = mma7660_init_platform_hw,
414 .orientation = {-1, 0, 0, 0, 0, -1, 0, 1, 0},
419 #if defined (CONFIG_GS_KXTIK)
420 #define KXTIK_INT_PIN RK2928_PIN3_PD1
423 static int kxtik_init_hw(void)
427 ret = gpio_request(KXTIK_INT_PIN,"kxtik_irq");
429 printk("kxtik gpio request fail!\n");
433 gpio_direction_input(KXTIK_INT_PIN);
437 static void kxtik_exit_hw(void)
439 gpio_free(KXTIK_INT_PIN);
442 static struct gsensor_platform_data kxtik_pdata = {
445 .init_platform_hw = kxtik_init_hw,
446 .exit_platform_hw = kxtik_exit_hw,
447 .orientation = {-1, 0, 0, 0, 0, -1, 0, 1, 0},
451 static int kxtik_init_platform_hw(void)
453 printk("%s: >>>>>>>>>>>>>>>>\n\n\n", __func__);
457 static struct sensor_platform_data kxtik_pdata = {
458 .type = SENSOR_TYPE_ACCEL,
461 .init_platform_hw = kxtik_init_platform_hw,
462 .orientation = {-1, 0, 0, 0, 0, -1, 0, 1, 0},
463 //.orientation = {0, 1, 0, 0, 0, -1, 1, 0, 0},
466 #endif /* CONFIG_GS_KXTIK*/
468 #ifdef CONFIG_INPUT_AP321XX
469 #define AP321XX_INT_PIN RK2928_PIN0_PC6
471 static int AP321XX_init_hw(void)
474 ret = gpio_request(AP321XX_INT_PIN, NULL);
477 gpio_free(AP321XX_INT_PIN);
478 printk(KERN_ERR "request AP321XX_INT_PIN fail!\n");
483 gpio_direction_input(AP321XX_INT_PIN);
488 static void AP321XX_exit_hw(void)
490 gpio_free(AP321XX_INT_PIN);
494 static struct ap321xx_platform_data ap321xx_info = {
495 .init_platform_hw = AP321XX_init_hw,
496 .exit_platform_hw = AP321XX_exit_hw,
501 #if defined(CONFIG_BATTERY_RK30_ADC)||defined(CONFIG_BATTERY_RK30_ADC_FAC)
502 static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
503 .dc_det_pin = RK2928_PIN1_PA5,
504 .batt_low_pin = INVALID_GPIO,
505 .charge_set_pin = INVALID_GPIO,
506 .charge_ok_pin = RK2928_PIN1_PA0,
507 .dc_det_level = GPIO_HIGH, //
508 .charge_ok_level = GPIO_HIGH,
511 static struct platform_device rk30_device_adc_battery = {
512 .name = "rk30-battery",
515 .platform_data = &rk30_adc_battery_platdata,
521 #if CONFIG_RK30_PWM_REGULATOR
522 const static int pwm_voltage_map[] = {
523 1000000, 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000
526 static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
528 .supply = "vdd_core",
532 struct regulator_init_data pwm_regulator_init_dcdc[1] =
538 .max_uV = 1800000, //0.6-1.8V
540 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
542 .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
543 .consumer_supplies = pwm_dcdc1_consumers,
547 static struct pwm_platform_data pwm_regulator_info[1] = {
550 .pwm_gpio = RK2928_PIN0_PD4,
551 .pwm_iomux_name = GPIO0D4_PWM_2_NAME,
552 .pwm_iomux_pwm = GPIO0D_PWM_2,
553 .pwm_iomux_gpio = GPIO0D_GPIO0D4,
554 .pwm_voltage = 1200000,
555 .suspend_voltage = 1050000,
558 .coefficient = 455, //45.5%
559 .pwm_voltage_map = pwm_voltage_map,
560 .init_data = &pwm_regulator_init_dcdc[0],
564 struct platform_device pwm_regulator_device[1] = {
566 .name = "pwm-voltage-regulator",
569 .platform_data = &pwm_regulator_info[0],
575 #if defined(CONFIG_MODEM_SOUND)
577 struct modem_sound_data modem_sound_info = {
578 .spkctl_io = RK2928_PIN3_PD4,
579 .spkctl_active = GPIO_HIGH,
582 struct platform_device modem_sound_device = {
583 .name = "modem_sound",
586 .platform_data = &modem_sound_info,
590 /**************************************************************************************************
591 * SDMMC devices, include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
592 **************************************************************************************************/
593 #ifdef CONFIG_SDMMC_RK29
594 #include "board-rk2928-phonepad-sdmmc.c"
596 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
597 #define SDMMC0_WRITE_PROTECT_PIN RK2928_PIN1_PA7 //According to your own project to set the value of write-protect-pin.
600 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
601 #define SDMMC1_WRITE_PROTECT_PIN RK2928_PIN0_PD5 //According to your own project to set the value of write-protect-pin.
604 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK2928_PIN0_PB2
606 #endif //endif ---#ifdef CONFIG_SDMMC_RK29
608 #ifdef CONFIG_SDMMC0_RK29
609 static int rk29_sdmmc0_cfg_gpio(void)
611 rk29_sdmmc_set_iomux(0, 0xFFFF);
613 rk30_mux_api_set(GPIO1C1_MMC0_DETN_NAME, GPIO1C_MMC0_DETN);
615 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
616 gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
617 gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
623 #define CONFIG_SDMMC0_USE_DMA
624 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
626 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
627 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
628 MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
630 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
631 .io_init = rk29_sdmmc0_cfg_gpio,
633 #if !defined(CONFIG_SDMMC_RK29_OLD)
634 .set_iomux = rk29_sdmmc_set_iomux,
637 .dma_name = "sd_mmc",
638 #ifdef CONFIG_SDMMC0_USE_DMA
643 .detect_irq = INVALID_GPIO,
644 .enable_sd_wakeup = 0,
646 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
647 .write_prt = SDMMC0_WRITE_PROTECT_PIN,
649 .write_prt = INVALID_GPIO,
652 #endif // CONFIG_SDMMC0_RK29
653 #ifdef CONFIG_SDMMC1_RK29
654 #define CONFIG_SDMMC1_USE_DMA
655 static int rk29_sdmmc1_cfg_gpio(void)
657 #if defined(CONFIG_SDMMC_RK29_OLD)
658 rk30_mux_api_set(GPIO0B0_MMC1_CMD_NAME, GPIO0B_MMC1_CMD);
659 rk30_mux_api_set(GPIO0B1_MMC1_CLKOUT_NAME, GPIO0B_MMC1_CLKOUT);
660 rk30_mux_api_set(GPIO0B3_MMC1_D0_NAME, GPIO0B_MMC1_D0);
661 rk30_mux_api_set(GPIO0B4_MMC1_D1_NAME, GPIO0B_MMC1_D1);
662 rk30_mux_api_set(GPIO0B5_MMC1_D2_NAME, GPIO0B_MMC1_D2);
663 rk30_mux_api_set(GPIO0B6_MMC1_D3_NAME, GPIO0B_MMC1_D3);
664 //rk30_mux_api_set(GPIO0B2_MMC1_DETN_NAME, GPIO0B_MMC1_DETN);
668 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
669 gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp");
670 gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN);
678 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
680 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
681 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
684 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
685 .host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |
686 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
689 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
692 .io_init = rk29_sdmmc1_cfg_gpio,
694 #if !defined(CONFIG_SDMMC_RK29_OLD)
695 .set_iomux = rk29_sdmmc_set_iomux,
699 #ifdef CONFIG_SDMMC1_USE_DMA
705 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
706 #ifdef CONFIG_WIFI_CONTROL_FUNC
707 .status = rk29sdk_wifi_status,
708 .register_status_notify = rk29sdk_wifi_status_register,
711 .detect_irq = INVALID_GPIO,//RK29SDK_WIFI_SDIO_CARD_DETECT_N,
714 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
715 .write_prt = SDMMC1_WRITE_PROTECT_PIN,
717 .write_prt = INVALID_GPIO,
721 .detect_irq = INVALID_GPIO,
722 .enable_sd_wakeup = 0,
726 #endif //endif--#ifdef CONFIG_SDMMC1_RK29
728 #if defined(CONFIG_SC6610)
729 static int sc6610_io_init(void)
735 static int sc6610_io_deinit(void)
742 struct rk29_mu509_data rk29_sc6610_info = {
743 .io_init = sc6610_io_init,
744 .io_deinit = sc6610_io_deinit,
745 .bp_power = RK2928_PIN3_PC2,//RK29_PIN0_PB4,
746 .bp_reset = NULL,//RK29_PIN0_PB3,
747 .bp_wakeup_ap = RK2928_PIN3_PC3,//RK29_PIN0_PC2,
748 .ap_wakeup_bp = RK2928_PIN3_PC4,//RK29_PIN0_PB0,
749 .modem_assert = RK2928_PIN3_PC5,
751 struct platform_device rk29_device_sc6610 = {
755 .platform_data = &rk29_sc6610_info,
759 #if defined (CONFIG_RK_HEADSET_DET) || defined (CONFIG_RK_HEADSET_IRQ_HOOK_ADC_DET)
760 static int rk_headset_io_init(int gpio, char *iomux_name, int iomux_mode)
763 ret = gpio_request(gpio, "headset_io");
767 rk30_mux_api_set(iomux_name, iomux_mode);
768 gpio_pull_updown(gpio, PullDisable);
769 gpio_direction_input(gpio);
774 static int rk_hook_io_init(int gpio, char *iomux_name, int iomux_mode)
777 ret = gpio_request(gpio, "hook_io");
781 rk30_mux_api_set(iomux_name, iomux_mode);
782 gpio_pull_updown(gpio, PullDisable);
783 gpio_direction_input(gpio);
788 struct rk_headset_pdata rk_headset_info = {
789 .Headset_gpio = RK2928_PIN1_PB4,
790 .Hook_gpio = RK2928_PIN0_PD1,
791 .headset_in_type = HEADSET_IN_HIGH,
792 .hook_key_code = KEY_MEDIA,
793 .headset_gpio_info = {GPIO1B4_SPI_CSN1_NAME, GPIO1B_GPIO1B4},
794 .headset_io_init = rk_headset_io_init,
795 .hook_gpio_info = {GPIO0D1_UART2_CTSN_NAME, GPIO0D_GPIO0D1},
796 .hook_io_init = rk_hook_io_init,
798 struct platform_device rk_device_headset = {
799 .name = "rk_headsetdet",
802 .platform_data = &rk_headset_info,
806 #ifdef CONFIG_SND_SOC_RK2928
807 static struct resource resources_acodec[] = {
809 .start = RK2928_ACODEC_PHYS,
810 .end = RK2928_ACODEC_PHYS + RK2928_ACODEC_SIZE - 1,
811 .flags = IORESOURCE_MEM,
814 .start = RK2928_PIN3_PD4,
815 .end = RK2928_PIN3_PD4,
816 .flags = IORESOURCE_IO,
820 static struct platform_device device_acodec = {
821 .name = "rk2928-codec",
823 .num_resources = ARRAY_SIZE(resources_acodec),
824 .resource = resources_acodec,
828 static struct platform_device *devices[] __initdata = {
829 #ifdef CONFIG_FB_ROCKCHIP
832 #ifdef CONFIG_LCDC_RK2928
835 #ifdef CONFIG_BACKLIGHT_RK29_BL
836 &rk29_device_backlight,
841 #ifdef CONFIG_SND_SOC_RK2928
845 #if defined(CONFIG_BATTERY_RK30_ADC)||defined(CONFIG_BATTERY_RK30_ADC_FAC)
846 &rk30_device_adc_battery,
848 #if defined(CONFIG_SC6610)
852 #if defined (CONFIG_RK_HEADSET_DET) || defined (CONFIG_RK_HEADSET_IRQ_HOOK_ADC_DET)
855 #if defined (CONFIG_MODEM_SOUND)
860 #ifdef CONFIG_I2C0_RK30
861 #ifdef CONFIG_MFD_TPS65910
862 #define TPS65910_HOST_IRQ RK2928_PIN3_PC6
863 #include "board-rk2928-phonepad-tps65910.c"
865 #ifdef CONFIG_REGULATOR_ACT8931
866 #include "board-rk2928-sdk-act8931.c"
869 static struct i2c_board_info __initdata i2c0_info[] = {
870 #if defined (CONFIG_MFD_TPS65910)
873 .addr = TPS65910_I2C_ID0,
875 .irq = TPS65910_HOST_IRQ,
876 .platform_data = &tps65910_data,
879 #if defined (CONFIG_REGULATOR_ACT8931)
884 .platform_data=&act8931_data,
889 #ifdef CONFIG_I2C1_RK30
890 static struct i2c_board_info __initdata i2c1_info[] = {
891 #if defined (CONFIG_GS_MMA7660)
893 .type = "gs_mma7660",
896 .irq = MMA7660_INT_PIN,
897 .platform_data = &mma7660_info,
902 #if defined (CONFIG_GS_KXTIK)
907 .platform_data = &kxtik_pdata,
908 .irq = KXTIK_INT_PIN, // Replace with appropriate GPIO setup
912 #ifdef CONFIG_INPUT_AP321XX
917 .irq = AP321XX_INT_PIN,
918 .platform_data = &ap321xx_info
921 #ifdef CONFIG_RDA5990
922 #define RDA_WIFI_CORE_ADDR (0x13)
923 #define RDA_WIFI_RF_ADDR (0x14) //correct add is 0x14
924 #define RDA_BT_CORE_ADDR (0x15)
925 #define RDA_BT_RF_ADDR (0x16)
927 #define RDA_WIFI_RF_I2C_DEVNAME "rda_wifi_rf_i2c"
928 #define RDA_WIFI_CORE_I2C_DEVNAME "rda_wifi_core_i2c"
929 #define RDA_BT_RF_I2C_DEVNAME "rda_bt_rf_i2c"
930 #define RDA_BT_CORE_I2C_DEVNAME "rda_bt_core_i2c"
932 .type = RDA_WIFI_CORE_I2C_DEVNAME,
933 .addr = RDA_WIFI_CORE_ADDR,
939 .type = RDA_WIFI_RF_I2C_DEVNAME,
940 .addr = RDA_WIFI_RF_ADDR,
945 .type = RDA_BT_CORE_I2C_DEVNAME,
946 .addr = RDA_BT_CORE_ADDR,
951 .type = RDA_BT_RF_I2C_DEVNAME,
952 .addr = RDA_BT_RF_ADDR,
960 #ifdef CONFIG_I2C2_RK30
961 static struct i2c_board_info __initdata i2c2_info[] = {
962 #if defined (CONFIG_TOUCHSCREEN_I30)
967 .irq = TOUCH_INT_PIN,
968 .platform_data = &ft5306_info,
971 #if defined(CONFIG_TOUCHSCREEN_BYD693X)
973 .type = "byd693x-ts",
976 .irq = TOUCH_INT_PIN,
977 .platform_data = &byd693x_info,
982 #ifdef CONFIG_I2C3_RK30
983 static struct i2c_board_info __initdata i2c3_info[] = {
986 #ifdef CONFIG_I2C_GPIO_RK30
987 #define I2C_SDA_PIN INVALID_GPIO //set sda_pin here
988 #define I2C_SCL_PIN INVALID_GPIO //set scl_pin here
989 static int rk30_i2c_io_init(void)
991 //set iomux (gpio) here
995 struct i2c_gpio_platform_data default_i2c_gpio_data = {
996 .sda_pin = I2C_SDA_PIN,
997 .scl_pin = I2C_SCL_PIN,
998 .udelay = 5, // clk = 500/udelay = 100Khz
999 .timeout = 100,//msecs_to_jiffies(100),
1001 .io_init = rk30_i2c_io_init,
1003 static struct i2c_board_info __initdata i2c_gpio_info[] = {
1006 static void __init rk30_i2c_register_board_info(void)
1008 #ifdef CONFIG_I2C0_RK30
1009 i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
1011 #ifdef CONFIG_I2C1_RK30
1012 i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
1014 #ifdef CONFIG_I2C2_RK30
1015 i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
1017 #ifdef CONFIG_I2C3_RK30
1018 i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
1020 #ifdef CONFIG_I2C_GPIO_RK30
1021 i2c_register_board_info(4, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
1026 #define POWER_ON_PIN RK2928_PIN1_PA2 //power_hold
1027 static void rk2928_pm_power_off(void)
1029 printk(KERN_ERR "rk2928_pm_power_off start...\n");
1031 #if defined(CONFIG_MFD_TPS65910)
1032 tps65910_device_shutdown();//tps65910 shutdown
1034 gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
1038 static void __init rk2928_board_init(void)
1040 gpio_request(POWER_ON_PIN, "poweronpin");
1041 gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
1042 gpio_free(POWER_ON_PIN);
1044 pm_power_off = rk2928_pm_power_off;
1046 rk30_i2c_register_board_info();
1047 spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
1048 platform_add_devices(devices, ARRAY_SIZE(devices));
1052 static void __init rk2928_reserve(void)
1055 rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
1057 #ifdef CONFIG_FB_ROCKCHIP
1058 resource_fb[0].start = board_mem_reserve_add("fb0", RK30_FB0_MEM_SIZE);
1059 resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1;
1061 #ifdef CONFIG_VIDEO_RK29
1062 rk30_camera_request_reserve_mem();
1064 board_mem_reserved();
1067 * dvfs_cpu_logic_table: table for arm and logic dvfs
1068 * @frequency : arm frequency
1069 * @cpu_volt : arm voltage depend on frequency
1070 * @logic_volt : logic voltage arm requests depend on frequency
1071 * comments : min arm/logic voltage
1073 static struct dvfs_arm_table dvfs_cpu_logic_table[] = {
1074 {.frequency = 216 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000},
1075 {.frequency = 312 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000},
1076 {.frequency = 408 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000},
1077 {.frequency = 504 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000},
1078 {.frequency = 600 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000},
1079 {.frequency = 696 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},
1080 {.frequency = 816 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},
1081 //{.frequency = 912 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},
1082 //{.frequency = 1008 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},
1084 {.frequency = 1104 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},
1085 {.frequency = 1200 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},
1086 {.frequency = 1104 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},
1087 {.frequency = 1248 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},
1089 //{.frequency = 1000 * 1000, .cpu_volt = 1225 * 1000, .logic_volt = 1200 * 1000},
1090 {.frequency = CPUFREQ_TABLE_END},
1093 static struct cpufreq_frequency_table dvfs_gpu_table[] = {
1094 {.frequency = 266 * 1000, .index = 1050 * 1000},
1095 {.frequency = 400 * 1000, .index = 1275 * 1000},
1096 {.frequency = CPUFREQ_TABLE_END},
1099 static struct cpufreq_frequency_table dvfs_ddr_table[] = {
1100 {.frequency = 300 * 1000, .index = 1050 * 1000},
1101 {.frequency = 400 * 1000, .index = 1125 * 1000},
1102 {.frequency = CPUFREQ_TABLE_END},
1105 #define DVFS_CPU_TABLE_SIZE (ARRAY_SIZE(dvfs_cpu_logic_table))
1106 static struct cpufreq_frequency_table cpu_dvfs_table[DVFS_CPU_TABLE_SIZE];
1107 static struct cpufreq_frequency_table dep_cpu2core_table[DVFS_CPU_TABLE_SIZE];
1109 void __init board_clock_init(void)
1111 rk2928_clock_data_init(periph_pll_default, codec_pll_default, RK30_CLOCKS_DEFAULT_FLAGS);
1112 dvfs_set_arm_logic_volt(dvfs_cpu_logic_table, cpu_dvfs_table, dep_cpu2core_table);
1113 dvfs_set_freq_volt_table(clk_get(NULL, "gpu"), dvfs_gpu_table);
1114 //dvfs_set_freq_volt_table(clk_get(NULL, "ddr"), dvfs_ddr_table);
1115 printk("%s end\n", __func__);
1119 MACHINE_START(RK2928, "RK2928board")
1120 .boot_params = PLAT_PHYS_OFFSET + 0x800,
1121 .fixup = rk2928_fixup,
1122 .reserve = &rk2928_reserve,
1123 .map_io = rk2928_map_io,
1124 .init_irq = rk2928_init_irq,
1125 .timer = &rk2928_timer,
1126 .init_machine = rk2928_board_init,