From f6dac2097799c9d6c2bea9b83178cf2a9a141a9c Mon Sep 17 00:00:00 2001 From: kfx Date: Thu, 18 Oct 2012 16:09:15 +0800 Subject: [PATCH] rk2928: update rk2928 tb config --- arch/arm/configs/rk2928_tb_defconfig | 11 +- .../mach-rk2928/board-rk2928-sdk-tps65910.c | 85 +++++++--- arch/arm/mach-rk2928/board-rk2928-tb-key.c | 67 ++++++++ arch/arm/mach-rk2928/board-rk2928-tb.c | 155 +++++------------- 4 files changed, 173 insertions(+), 145 deletions(-) create mode 100755 arch/arm/mach-rk2928/board-rk2928-tb-key.c diff --git a/arch/arm/configs/rk2928_tb_defconfig b/arch/arm/configs/rk2928_tb_defconfig index c7e17964db33..da309299382e 100644 --- a/arch/arm/configs/rk2928_tb_defconfig +++ b/arch/arm/configs/rk2928_tb_defconfig @@ -238,21 +238,12 @@ CONFIG_EETI_EGALAX_MAX_Y=800 CONFIG_INPUT_MISC=y CONFIG_INPUT_KEYCHORD=y CONFIG_INPUT_UINPUT=y -CONFIG_COMPASS_AK8975=y CONFIG_GS_MMA8452=y -CONFIG_GYRO_L3G4200D=y -CONFIG_LS_CM3217=y CONFIG_SENSOR_DEVICE=y CONFIG_GSENSOR_DEVICE=y -CONFIG_COMPASS_DEVICE=y -CONFIG_GYROSCOPE_DEVICE=y -CONFIG_LIGHT_DEVICE=y # CONFIG_SERIO is not set # CONFIG_CONSOLE_TRANSLATIONS is not set # CONFIG_LEGACY_PTYS is not set -CONFIG_SERIAL_RK29=y -CONFIG_UART0_RK29=y -CONFIG_UART0_CTS_RTS_RK29=y # CONFIG_HW_RANDOM is not set CONFIG_I2C=y # CONFIG_I2C_COMPAT is not set @@ -267,7 +258,6 @@ CONFIG_EXPANDED_GPIO_IRQ_NUM=0 CONFIG_SPI_FPGA_GPIO_NUM=0 CONFIG_SPI_FPGA_GPIO_IRQ_NUM=0 CONFIG_POWER_SUPPLY=y -CONFIG_TEST_POWER=y # CONFIG_HWMON is not set CONFIG_MFD_TPS65910=y CONFIG_MFD_TPS65090=y @@ -376,6 +366,7 @@ CONFIG_USB_SERIAL_OPTION=y CONFIG_USB_GADGET=y CONFIG_USB20_HOST=y CONFIG_USB20_OTG=y +CONFIG_DWC_OTG_BOTH_HOST_SLAVE=y CONFIG_MMC=y CONFIG_MMC_UNSAFE_RESUME=y CONFIG_MMC_EMBEDDED_SDIO=y diff --git a/arch/arm/mach-rk2928/board-rk2928-sdk-tps65910.c b/arch/arm/mach-rk2928/board-rk2928-sdk-tps65910.c index 7215da55b8b7..b79c8ce8f3bb 100755 --- a/arch/arm/mach-rk2928/board-rk2928-sdk-tps65910.c +++ b/arch/arm/mach-rk2928/board-rk2928-sdk-tps65910.c @@ -7,22 +7,53 @@ #include #include -#define gpio_readl(offset) readl_relaxed(RK2928_GPIO1_BASE + offset) -#define gpio_writel(v, offset) do { writel_relaxed(v, RK2928_GPIO1_BASE + offset); dsb(); } while (0) - -#define GPIO_SWPORTA_DR 0x0000 -#define GPIO_SWPORTA_DDR 0x0004 - -#define GPIO1_A1_OUTPUT (1<<1) -#define GPIO1_A1_OUTPUT_HIGH (1<<1) -#define GPIO1_A1_OUTPUT_LOW (~(1<<1)) - #ifdef CONFIG_MFD_TPS65910 + #if defined(CONFIG_MACH_RK2928_SDK) #define PMU_POWER_SLEEP RK2928_PIN0_PD0 +#elif defined(CONFIG_MACH_RK2928_TB) +#define PMU_POWER_SLEEP RK2928_PIN3_PD2 #else -#define PMU_POWER_SLEEP RK2928_PIN1_PA1 +#define PMU_POWER_SLEEP RK2928_PIN1_PA1 #endif + +#define GPIO_SWPORTA_DR 0x0000 +#define GPIO_SWPORTA_DDR 0x0004 +struct sram_gpio_data { + void __iomem *base; + uint offset; +}; + +static __sramdata struct sram_gpio_data pmic_sleep; +static void __iomem *gpio_base[] = {RK2928_GPIO0_BASE, RK2928_GPIO1_BASE, RK2928_GPIO2_BASE, RK2928_GPIO3_BASE}; + +static int sram_gpio_init(int gpio, struct sram_gpio_data *data) +{ + unsigned index; + + if(gpio == INVALID_GPIO) + return -EINVAL; + index = gpio - PIN_BASE; + if(index/NUM_GROUP >= ARRAY_SIZE(gpio_base)) + return -EINVAL; + + data->base = gpio_base[index/NUM_GROUP]; + data->offset = index%NUM_GROUP; + + return 0; +} + +static __sramfunc void sram_gpio_set_value(struct sram_gpio_data data, uint value) +{ + writel_relaxed(readl_relaxed(data.base + GPIO_SWPORTA_DDR)| (1< +#include + +#define EV_ENCALL KEY_F4 +#define EV_MENU KEY_F1 + +#define PRESS_LEV_LOW 1 +#define PRESS_LEV_HIGH 0 + +static struct rk29_keys_button key_button[] = { + { + .desc = "vol-", + .code = KEY_VOLUMEDOWN, + .gpio = RK2928_PIN0_PD1, + .active_low = PRESS_LEV_LOW, + }, + { + .desc = "play", + .code = KEY_POWER, + .gpio = RK2928_PIN3_PC5, + .active_low = PRESS_LEV_LOW, + //.code_long_press = EV_ENCALL, + .wakeup = 1, + }, + { + .desc = "vol+", + .code = KEY_VOLUMEUP, + .adc_value = 1, + .gpio = INVALID_GPIO, + //.gpio = RK2928_PIN0_PD0, + .active_low = PRESS_LEV_LOW, + }, + { + .desc = "menu", + .code = EV_MENU, + .adc_value = 135, + .gpio = INVALID_GPIO, + .active_low = PRESS_LEV_LOW, + }, + { + .desc = "home", + .code = KEY_HOME, + .adc_value = 550, + .gpio = INVALID_GPIO, + .active_low = PRESS_LEV_LOW, + }, + { + .desc = "esc", + .code = KEY_BACK, + .adc_value = 334, + .gpio = INVALID_GPIO, + .active_low = PRESS_LEV_LOW, + }, + { + .desc = "camera", + .code = KEY_CAMERA, + .adc_value = 700, + .gpio = INVALID_GPIO, + .active_low = PRESS_LEV_LOW, + }, +}; +struct rk29_keys_platform_data rk29_keys_pdata = { + .buttons = key_button, + .nbuttons = ARRAY_SIZE(key_button), + .chn = 1, //chn: 0-7, if do not use ADC,set 'chn' -1 +}; + diff --git a/arch/arm/mach-rk2928/board-rk2928-tb.c b/arch/arm/mach-rk2928/board-rk2928-tb.c index 51ae93133d71..eb1aea9bebc2 100755 --- a/arch/arm/mach-rk2928/board-rk2928-tb.c +++ b/arch/arm/mach-rk2928/board-rk2928-tb.c @@ -64,6 +64,8 @@ #define RK30_FB0_MEM_SIZE 8*SZ_1M #endif +int __sramdata g_pmic_type = 0; + #include "board-rk2928-tb-camera.c" #include "board-rk2928-tb-key.c" @@ -217,72 +219,6 @@ static struct sensor_platform_data mma8452_info = { .init_platform_hw = mma8452_init_platform_hw, .orientation = {-1, 0, 0, 0, 0, 1, 0, -1, 0}, }; -#endif -#if defined (CONFIG_COMPASS_AK8975) -static struct sensor_platform_data akm8975_info = -{ - .type = SENSOR_TYPE_COMPASS, - .irq_enable = 1, - .poll_delay_ms = 30, - .m_layout = - { - { - {1, 0, 0}, - {0, 1, 0}, - {0, 0, 1}, - }, - - { - {1, 0, 0}, - {0, 1, 0}, - {0, 0, 1}, - }, - - { - {1, 0, 0}, - {0, 1, 0}, - {0, 0, 1}, - }, - - { - {1, 0, 0}, - {0, 1, 0}, - {0, 0, 1}, - }, - } -}; - -#endif - -#if defined(CONFIG_GYRO_L3G4200D) - -#include - -static int l3g4200d_init_platform_hw(void) -{ - return 0; -} - -static struct sensor_platform_data l3g4200d_info = { - .type = SENSOR_TYPE_GYROSCOPE, - .irq_enable = 1, - .poll_delay_ms = 30, - .orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1}, - .init_platform_hw = l3g4200d_init_platform_hw, - .x_min = 40,//x_min,y_min,z_min = (0-100) according to hardware - .y_min = 40, - .z_min = 20, -}; - -#endif - -#ifdef CONFIG_LS_CM3217 -static struct sensor_platform_data cm3217_info = { - .type = SENSOR_TYPE_LIGHT, - .irq_enable = 0, - .poll_delay_ms = 500, -}; - #endif #ifdef CONFIG_FB_ROCKCHIP @@ -465,6 +401,38 @@ struct platform_device pwm_regulator_device[1] = { }, }; #endif + +/*********************************************************** +* usb wifi +************************************************************/ +#if defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) + +static void rkusb_wifi_power(int on) { + struct regulator *ldo = NULL; + +#if defined(CONFIG_MFD_TPS65910) + if (pmic_is_tps65910() ) + ldo = regulator_get(NULL, "vmmc"); //vccio_wl +#endif +#if defined(CONFIG_REGULATOR_ACT8931) + if(pmic_is_act8931() ) + ldo = regulator_get(NULL, "act_ldo4"); //vccio_wl +#endif + + if(on) { + regulator_enable(ldo); + printk("%s: vccio_wl enable\n", __func__); + } else { + printk("%s: vccio_wl disable\n", __func__); + regulator_disable(ldo); + } + + regulator_put(ldo); + udelay(100); +} + +#endif + /************************************************************************************************** * SDMMC devices, include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05 **************************************************************************************************/ @@ -816,30 +784,12 @@ static struct i2c_board_info __initdata i2c0_info[] = { .platform_data = &mma8452_info, }, #endif -#if defined (CONFIG_COMPASS_AK8975) - { - .type = "ak8975", - .addr = 0x0d, - .flags = 0, - .irq = RK2928_PIN3_PD2, - .platform_data = &akm8975_info, - }, -#endif -#if defined (CONFIG_GYRO_L3G4200D) - { - .type = "l3g4200d_gryo", - .addr = 0x69, - .flags = 0, - .irq = RK2928_PIN3_PD3, - .platform_data = &l3g4200d_info, - }, -#endif }; #endif #ifdef CONFIG_I2C1_RK30 #ifdef CONFIG_MFD_TPS65910 #define TPS65910_HOST_IRQ RK2928_PIN3_PC6 -#include "board-rk2928-tb-tps65910.c" +#include "board-rk2928-sdk-tps65910.c" #endif static struct i2c_board_info __initdata i2c1_info[] = { @@ -866,14 +816,6 @@ static struct i2c_board_info __initdata i2c2_info[] = { .platform_data = &eeti_egalax_info, }, #endif -#if defined (CONFIG_LS_CM3217) - { - .type = "lightsensor", - .addr = 0x10, - .flags = 0, - .platform_data = &cm3217_info, - }, -#endif }; #endif #ifdef CONFIG_I2C3_RK30 @@ -943,8 +885,6 @@ static void __init rk2928_board_init(void) rk30_i2c_register_board_info(); spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices)); platform_add_devices(devices, ARRAY_SIZE(devices)); - //RK2928 USB DETECT IRQ: IRQ_OTG_BVALID - //board_usb_detect_init(RK30_PIN6_PA3); #ifdef CONFIG_WIFI_CONTROL_FUNC rk29sdk_wifi_bt_gpio_control_init(); @@ -959,12 +899,6 @@ static void __init rk2928_reserve(void) #ifdef CONFIG_FB_ROCKCHIP resource_fb[0].start = board_mem_reserve_add("fb0", RK30_FB0_MEM_SIZE); resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1; -#if 0 - resource_fb[1].start = board_mem_reserve_add("ipp buf", RK30_FB0_MEM_SIZE); - resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1; - resource_fb[2].start = board_mem_reserve_add("fb2", RK30_FB0_MEM_SIZE); - resource_fb[2].end = resource_fb[2].start + RK30_FB0_MEM_SIZE - 1; -#endif #endif #ifdef CONFIG_VIDEO_RK29 rk30_camera_request_reserve_mem(); @@ -985,22 +919,21 @@ static void __init rk2928_reserve(void) * comments : min arm/logic voltage */ static struct dvfs_arm_table dvfs_cpu_logic_table[] = { - {.frequency = 216 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000}, - {.frequency = 312 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000}, - {.frequency = 408 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000}, - {.frequency = 504 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000}, - {.frequency = 600 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000}, - {.frequency = 696 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000}, - {.frequency = 816 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000}, - {.frequency = 912 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000}, + {.frequency = 216 * 1000, .cpu_volt = 850 * 1000, .logic_volt = 1200 * 1000}, + {.frequency = 312 * 1000, .cpu_volt = 900 * 1000, .logic_volt = 1200 * 1000}, + {.frequency = 408 * 1000, .cpu_volt = 950 * 1000, .logic_volt = 1200 * 1000}, + {.frequency = 504 * 1000, .cpu_volt = 1000 * 1000, .logic_volt = 1200 * 1000}, + {.frequency = 600 * 1000, .cpu_volt = 1100 * 1000, .logic_volt = 1200 * 1000}, + {.frequency = 696 * 1000, .cpu_volt = 1175 * 1000, .logic_volt = 1200 * 1000}, + {.frequency = 816 * 1000, .cpu_volt = 1250 * 1000, .logic_volt = 1200 * 1000}, + {.frequency = 912 * 1000, .cpu_volt = 1350 * 1000, .logic_volt = 1200 * 1000}, + {.frequency = 1008 * 1000, .cpu_volt = 1450 * 1000, .logic_volt = 1200 * 1000}, #if 0 - {.frequency = 1008 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000}, {.frequency = 1104 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000}, {.frequency = 1200 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000}, {.frequency = 1104 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000}, {.frequency = 1248 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000}, #endif - //{.frequency = 1000 * 1000, .cpu_volt = 1225 * 1000, .logic_volt = 1200 * 1000}, {.frequency = CPUFREQ_TABLE_END}, }; -- 2.34.1