diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile index d6d031214fe..e53f91d0edd 100644 --- a/arch/arm/mach-msm/Makefile +++ b/arch/arm/mach-msm/Makefile @@ -251,7 +251,7 @@ obj-$(CONFIG_MACH_MSM8930_FLUID) += board-8930-all.o board-8960-regulator.o obj-$(CONFIG_ARCH_MSM8960) += bms-batterydata.o obj-$(CONFIG_MACH_APQ8064_SIM) += board-8064-all.o board-8064-regulator.o obj-$(CONFIG_MACH_APQ8064_RUMI3) += board-8064-all.o board-8064-regulator.o -obj-$(CONFIG_ARCH_MSM9615) += board-9615.o devices-9615.o board-9615-regulator.o +obj-$(CONFIG_ARCH_MSM9615) += board-9615.o devices-9615.o board-9615-regulator.o board-9615-gpiomux.o obj-$(CONFIG_ARCH_MSM9615) += clock-local.o clock-9615.o acpuclock-9615.o clock-rpm.o obj-$(CONFIG_ARCH_MSMCOPPER) += board-copper.o board-dt.o diff --git a/arch/arm/mach-msm/board-9615-gpiomux.c b/arch/arm/mach-msm/board-9615-gpiomux.c new file mode 100644 index 00000000000..4baa8516fe2 --- /dev/null +++ b/arch/arm/mach-msm/board-9615-gpiomux.c @@ -0,0 +1,252 @@ +/* Copyright (c) 2011, Code Aurora Forum. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include "board-9615.h" + +static struct gpiomux_setting ps_hold = { + .func = GPIOMUX_FUNC_1, + .drv = GPIOMUX_DRV_8MA, + .pull = GPIOMUX_PULL_NONE, +}; + +static struct gpiomux_setting gsbi4 = { + .func = GPIOMUX_FUNC_1, + .drv = GPIOMUX_DRV_8MA, + .pull = GPIOMUX_PULL_NONE, +}; + +static struct gpiomux_setting gsbi5 = { + .func = GPIOMUX_FUNC_1, + .drv = GPIOMUX_DRV_8MA, + .pull = GPIOMUX_PULL_NONE, +}; + +static struct gpiomux_setting gsbi3 = { + .func = GPIOMUX_FUNC_1, + .drv = GPIOMUX_DRV_8MA, + .pull = GPIOMUX_PULL_NONE, +}; + +static struct gpiomux_setting gsbi3_cs1_config = { + .func = GPIOMUX_FUNC_4, + .drv = GPIOMUX_DRV_8MA, + .pull = GPIOMUX_PULL_NONE, +}; + +#ifdef CONFIG_LTC4088_CHARGER +static struct gpiomux_setting ltc4088_chg_cfg = { + .func = GPIOMUX_FUNC_GPIO, + .drv = GPIOMUX_DRV_8MA, + .pull = GPIOMUX_PULL_NONE, +}; +#endif + +static struct gpiomux_setting sdcc2_clk_actv_cfg = { + .func = GPIOMUX_FUNC_1, + .drv = GPIOMUX_DRV_16MA, + .pull = GPIOMUX_PULL_NONE, +}; + +static struct gpiomux_setting sdcc2_cmd_data_0_3_actv_cfg = { + .func = GPIOMUX_FUNC_1, + .drv = GPIOMUX_DRV_8MA, + .pull = GPIOMUX_PULL_UP, +}; + +static struct gpiomux_setting sdcc2_suspend_cfg = { + .func = GPIOMUX_FUNC_1, + .drv = GPIOMUX_DRV_2MA, + .pull = GPIOMUX_PULL_DOWN, +}; + +static struct msm_gpiomux_config msm9615_sdcc2_configs[] __initdata = { + { + /* SDC2_DATA_0 */ + .gpio = 25, + .settings = { + [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, + [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, + }, + }, + { + /* SDC2_DATA_1 */ + .gpio = 26, + .settings = { + [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, + [GPIOMUX_SUSPENDED] = &sdcc2_cmd_data_0_3_actv_cfg, + }, + }, + { + /* SDC2_DATA_2 */ + .gpio = 27, + .settings = { + [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, + [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, + }, + }, + { + /* SDC2_DATA_3 */ + .gpio = 28, + .settings = { + [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, + [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, + }, + }, + { + /* SDC2_CMD */ + .gpio = 29, + .settings = { + [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, + [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, + }, + }, + { + /* SDC2_CLK */ + .gpio = 30, + .settings = { + [GPIOMUX_ACTIVE] = &sdcc2_clk_actv_cfg, + [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, + }, + }, +}; + +struct msm_gpiomux_config msm9615_ps_hold_config[] __initdata = { + { + .gpio = 83, + .settings = { + [GPIOMUX_SUSPENDED] = &ps_hold, + }, + }, +}; + +#ifdef CONFIG_LTC4088_CHARGER +static struct msm_gpiomux_config + msm9615_ltc4088_charger_config[] __initdata = { + { + .gpio = 4, + .settings = { + [GPIOMUX_SUSPENDED] = <c4088_chg_cfg, + }, + }, + { + .gpio = 6, + .settings = { + [GPIOMUX_SUSPENDED] = <c4088_chg_cfg, + }, + }, + { + .gpio = 7, + .settings = { + [GPIOMUX_SUSPENDED] = <c4088_chg_cfg, + }, + }, +}; +#endif + +struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = { + { + .gpio = 8, /* GSBI3 QUP SPI_CLK */ + .settings = { + [GPIOMUX_SUSPENDED] = &gsbi3, + }, + }, + { + .gpio = 9, /* GSBI3 QUP SPI_CS_N */ + .settings = { + [GPIOMUX_SUSPENDED] = &gsbi3, + }, + }, + { + .gpio = 10, /* GSBI3 QUP SPI_DATA_MISO */ + .settings = { + [GPIOMUX_SUSPENDED] = &gsbi3, + }, + }, + { + .gpio = 11, /* GSBI3 QUP SPI_DATA_MOSI */ + .settings = { + [GPIOMUX_SUSPENDED] = &gsbi3, + }, + }, + { + .gpio = 12, /* GSBI4 UART */ + .settings = { + [GPIOMUX_SUSPENDED] = &gsbi4, + }, + }, + { + .gpio = 13, /* GSBI4 UART */ + .settings = { + [GPIOMUX_SUSPENDED] = &gsbi4, + }, + }, + { + .gpio = 14, /* GSBI4 UART */ + .settings = { + [GPIOMUX_SUSPENDED] = &gsbi4, + }, + }, + { + .gpio = 15, /* GSBI4 UART */ + .settings = { + [GPIOMUX_SUSPENDED] = &gsbi4, + }, + }, + { + .gpio = 16, /* GSBI5 I2C QUP SCL */ + .settings = { + [GPIOMUX_SUSPENDED] = &gsbi5, + }, + }, + { + .gpio = 17, /* GSBI5 I2C QUP SDA */ + .settings = { + [GPIOMUX_SUSPENDED] = &gsbi5, + }, + }, + { + /* GPIO 19 can be used for I2C/UART on GSBI5 */ + .gpio = 19, /* GSBI3 QUP SPI_CS_1 */ + .settings = { + [GPIOMUX_SUSPENDED] = &gsbi3_cs1_config, + }, + }, +}; + +int __init msm9615_init_gpiomux(void) +{ + int rc; + + rc = msm_gpiomux_init(NR_GPIO_IRQS); + if (rc) { + pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc); + return rc; + } + msm_gpiomux_install(msm9615_gsbi_configs, + ARRAY_SIZE(msm9615_gsbi_configs)); + + msm_gpiomux_install(msm9615_ps_hold_config, + ARRAY_SIZE(msm9615_ps_hold_config)); + msm_gpiomux_install(msm9615_sdcc2_configs, + ARRAY_SIZE(msm9615_sdcc2_configs)); +#ifdef CONFIG_LTC4088_CHARGER + msm_gpiomux_install(msm9615_ltc4088_charger_config, + ARRAY_SIZE(msm9615_ltc4088_charger_config)); +#endif + + return 0; +} diff --git a/arch/arm/mach-msm/board-9615.c b/arch/arm/mach-msm/board-9615.c index 835a327bac8..bfd65fbaab3 100644 --- a/arch/arm/mach-msm/board-9615.c +++ b/arch/arm/mach-msm/board-9615.c @@ -15,19 +15,19 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include #include #include #include #include #include -#include #include -#include -#include -#include -#include -#include #include #include "timer.h" #include "devices.h" @@ -35,7 +35,6 @@ #include "cpuidle.h" #include "pm.h" #include "acpuclock.h" -#include #include "pm-boot.h" static struct pm8xxx_adc_amux pm8018_adc_channels_data[] = { @@ -181,147 +180,6 @@ static struct platform_device msm9615_device_ext_2p95v_vreg = { }, }; -static struct gpiomux_setting ps_hold = { - .func = GPIOMUX_FUNC_1, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_NONE, -}; - -static struct gpiomux_setting gsbi4 = { - .func = GPIOMUX_FUNC_1, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_NONE, -}; - -static struct gpiomux_setting gsbi5 = { - .func = GPIOMUX_FUNC_1, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_NONE, -}; - -static struct gpiomux_setting gsbi3 = { - .func = GPIOMUX_FUNC_1, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_NONE, -}; - -static struct gpiomux_setting gsbi3_cs1_config = { - .func = GPIOMUX_FUNC_4, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_NONE, -}; - -#ifdef CONFIG_LTC4088_CHARGER -static struct gpiomux_setting ltc4088_chg_cfg = { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_NONE, -}; -#endif - -struct msm_gpiomux_config msm9615_ps_hold_config[] __initdata = { - { - .gpio = 83, - .settings = { - [GPIOMUX_SUSPENDED] = &ps_hold, - }, - }, -}; - -#ifdef CONFIG_LTC4088_CHARGER -static struct msm_gpiomux_config - msm9615_ltc4088_charger_config[] __initdata = { - { - .gpio = 4, - .settings = { - [GPIOMUX_SUSPENDED] = <c4088_chg_cfg, - }, - }, - { - .gpio = 6, - .settings = { - [GPIOMUX_SUSPENDED] = <c4088_chg_cfg, - }, - }, - { - .gpio = 7, - .settings = { - [GPIOMUX_SUSPENDED] = <c4088_chg_cfg, - }, - }, -}; -#endif - -struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = { - { - .gpio = 8, /* GSBI3 QUP SPI_CLK */ - .settings = { - [GPIOMUX_SUSPENDED] = &gsbi3, - }, - }, - { - .gpio = 9, /* GSBI3 QUP SPI_CS_N */ - .settings = { - [GPIOMUX_SUSPENDED] = &gsbi3, - }, - }, - { - .gpio = 10, /* GSBI3 QUP SPI_DATA_MISO */ - .settings = { - [GPIOMUX_SUSPENDED] = &gsbi3, - }, - }, - { - .gpio = 11, /* GSBI3 QUP SPI_DATA_MOSI */ - .settings = { - [GPIOMUX_SUSPENDED] = &gsbi3, - }, - }, - { - .gpio = 12, /* GSBI4 UART */ - .settings = { - [GPIOMUX_SUSPENDED] = &gsbi4, - }, - }, - { - .gpio = 13, /* GSBI4 UART */ - .settings = { - [GPIOMUX_SUSPENDED] = &gsbi4, - }, - }, - { - .gpio = 14, /* GSBI4 UART */ - .settings = { - [GPIOMUX_SUSPENDED] = &gsbi4, - }, - }, - { - .gpio = 15, /* GSBI4 UART */ - .settings = { - [GPIOMUX_SUSPENDED] = &gsbi4, - }, - }, - { - .gpio = 16, /* GSBI5 I2C QUP SCL */ - .settings = { - [GPIOMUX_SUSPENDED] = &gsbi5, - }, - }, - { - .gpio = 17, /* GSBI5 I2C QUP SDA */ - .settings = { - [GPIOMUX_SUSPENDED] = &gsbi5, - }, - }, - { - /* GPIO 19 can be used for I2C/UART on GSBI5 */ - .gpio = 19, /* GSBI3 QUP SPI_CS_1 */ - .settings = { - [GPIOMUX_SUSPENDED] = &gsbi3_cs1_config, - }, - }, -}; - #if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\ || defined(CONFIG_MMC_MSM_SDC2_SUPPORT)) @@ -429,75 +287,6 @@ static struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = { #endif #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT -static struct gpiomux_setting sdcc2_clk_actv_cfg = { - .func = GPIOMUX_FUNC_1, - .drv = GPIOMUX_DRV_16MA, - .pull = GPIOMUX_PULL_NONE, -}; - -static struct gpiomux_setting sdcc2_cmd_data_0_3_actv_cfg = { - .func = GPIOMUX_FUNC_1, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_UP, -}; - -static struct gpiomux_setting sdcc2_suspend_cfg = { - .func = GPIOMUX_FUNC_1, - .drv = GPIOMUX_DRV_2MA, - .pull = GPIOMUX_PULL_DOWN, -}; - -static struct msm_gpiomux_config msm9615_sdcc2_configs[] __initdata = { - { - /* SDC2_DATA_0 */ - .gpio = 25, - .settings = { - [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, - [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, - }, - }, - { - /* SDC2_DATA_1 */ - .gpio = 26, - .settings = { - [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, - [GPIOMUX_SUSPENDED] = &sdcc2_cmd_data_0_3_actv_cfg, - }, - }, - { - /* SDC2_DATA_2 */ - .gpio = 27, - .settings = { - [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, - [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, - }, - }, - { - /* SDC2_DATA_3 */ - .gpio = 28, - .settings = { - [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, - [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, - }, - }, - { - /* SDC2_CMD */ - .gpio = 29, - .settings = { - [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, - [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, - }, - }, - { - /* SDC2_CLK */ - .gpio = 30, - .settings = { - [GPIOMUX_ACTIVE] = &sdcc2_clk_actv_cfg, - [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, - }, - }, -}; - static struct msm_mmc_gpio sdc2_gpio_cfg[] = { {25, "sdc2_dat_0"}, {26, "sdc2_dat_1"}, @@ -513,8 +302,6 @@ static struct msm_mmc_gpio_data mmc_gpio_data[MAX_SDCC_CONTROLLER] = { .size = ARRAY_SIZE(sdc2_gpio_cfg), }, }; -#else -static struct msm_gpiomux_config msm9615_sdcc2_configs[0]; #endif static struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = { @@ -588,9 +375,6 @@ static void __init msm9615_init_mmc(void) } if (msm9615_sdc2_pdata) { - msm_gpiomux_install(msm9615_sdcc2_configs, - ARRAY_SIZE(msm9615_sdcc2_configs)); - /* SDC2: External card slot used for WLAN */ msm_add_sdcc(2, msm9615_sdc2_pdata); } @@ -634,27 +418,6 @@ static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = { .v_addr = MSM_APCS_GLB_BASE + 0x24, }; -static int __init gpiomux_init(void) -{ - int rc; - - rc = msm_gpiomux_init(NR_GPIO_IRQS); - if (rc) { - pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc); - return rc; - } - msm_gpiomux_install(msm9615_gsbi_configs, - ARRAY_SIZE(msm9615_gsbi_configs)); - - msm_gpiomux_install(msm9615_ps_hold_config, - ARRAY_SIZE(msm9615_ps_hold_config)); -#ifdef CONFIG_LTC4088_CHARGER - msm_gpiomux_install(msm9615_ltc4088_charger_config, - ARRAY_SIZE(msm9615_ltc4088_charger_config)); -#endif - return 0; -} - static void __init msm9615_init_buses(void) { #ifdef CONFIG_MSM_BUS_SCALING @@ -865,7 +628,7 @@ static void __init msm9615_reserve(void) static void __init msm9615_common_init(void) { msm9615_device_init(); - gpiomux_init(); + msm9615_init_gpiomux(); msm9615_i2c_init(); regulator_suppress_info_printing(); platform_device_register(&msm9615_device_rpm_regulator); diff --git a/arch/arm/mach-msm/board-9615.h b/arch/arm/mach-msm/board-9615.h index 0f5adf0f758..044315a8c31 100644 --- a/arch/arm/mach-msm/board-9615.h +++ b/arch/arm/mach-msm/board-9615.h @@ -37,4 +37,5 @@ msm_rpm_regulator_9615_pdata __devinitdata; extern struct gpio_regulator_platform_data msm_gpio_regulator_pdata[]; +int msm9615_init_gpiomux(void); #endif