From 2eb3742db1ecd3d9ffe8f02eaa8def1b2bd2a2c2 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sat, 6 Dec 2008 11:51:58 +0000 Subject: fix-gta03-wlan-power-sequence.patch Signed-off-by: Andy Green --- arch/arm/mach-s3c6410/mach-om-gta03.c | 27 ------------------------ arch/arm/mach-s3c6410/om-gta03-features.c | 35 ++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 34 deletions(-) (limited to 'arch/arm/mach-s3c6410') diff --git a/arch/arm/mach-s3c6410/mach-om-gta03.c b/arch/arm/mach-s3c6410/mach-om-gta03.c index 61c0c7be180..4c23401285d 100644 --- a/arch/arm/mach-s3c6410/mach-om-gta03.c +++ b/arch/arm/mach-s3c6410/mach-om-gta03.c @@ -629,33 +629,6 @@ static void __init om_gta03_machine_init(void) s3c_gpio_setpull(S3C64XX_GPH(5), S3C_GPIO_PULL_UP); - /* give power to WLAN / BT module */ - s3c_gpio_setpull(S3C64XX_GPK(0), S3C_GPIO_PULL_NONE); - s3c_gpio_cfgpin(S3C64XX_GPK(0), S3C_GPIO_SFN(1)); - gpio_direction_output(S3C64XX_GPK(0), 0); - - mdelay(50); - - s3c_gpio_setpull(S3C64XX_GPH(6), S3C_GPIO_PULL_NONE); - s3c_gpio_cfgpin(S3C64XX_GPH(6), S3C_GPIO_SFN(1)); - gpio_direction_output(S3C64XX_GPH(6), 0); - mdelay(1); - gpio_direction_output(S3C64XX_GPH(6), 1); - - s3c_gpio_setpull(S3C64XX_GPH(8), S3C_GPIO_PULL_NONE); - s3c_gpio_cfgpin(S3C64XX_GPH(8), S3C_GPIO_SFN(1)); - gpio_direction_output(S3C64XX_GPH(8), 1); - - s3c_gpio_setpull(S3C64XX_GPJ(8), S3C_GPIO_PULL_NONE); - s3c_gpio_cfgpin(S3C64XX_GPJ(8), S3C_GPIO_SFN(2)); - s3c_gpio_setpull(S3C64XX_GPJ(9), S3C_GPIO_PULL_NONE); - s3c_gpio_cfgpin(S3C64XX_GPJ(9), S3C_GPIO_SFN(2)); - s3c_gpio_setpull(S3C64XX_GPJ(10), S3C_GPIO_PULL_NONE); - s3c_gpio_cfgpin(S3C64XX_GPJ(10), S3C_GPIO_SFN(2)); - s3c_gpio_setpull(S3C64XX_GPJ(11), S3C_GPIO_PULL_NONE); - s3c_gpio_cfgpin(S3C64XX_GPJ(11), S3C_GPIO_SFN(2)); - - i2c_register_board_info(0, om_gta03_i2c_devs, ARRAY_SIZE(om_gta03_i2c_devs)); diff --git a/arch/arm/mach-s3c6410/om-gta03-features.c b/arch/arm/mach-s3c6410/om-gta03-features.c index 8467750d9d1..3f53b4c5e75 100644 --- a/arch/arm/mach-s3c6410/om-gta03-features.c +++ b/arch/arm/mach-s3c6410/om-gta03-features.c @@ -64,6 +64,8 @@ static struct regulator *gps_regulator; static void om_gta03_features_pwron_set_on(enum feature feature) { + int gpio; + switch (feature) { case OM_GTA03_GPS: regulator_enable(gps_regulator); @@ -71,21 +73,29 @@ static void om_gta03_features_pwron_set_on(enum feature feature) gpio_direction_output(GTA03_GPIO_GPS_LNA_EN, 1); break; case OM_GTA03_WLAN_BT: - /* give power to WLAN / BT module */ + + for (gpio = S3C64XX_GPH(0); gpio < S3C64XX_GPH(6); gpio++) { + s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); /* sdio */ + s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); + } + /* assert reset */ s3c_gpio_setpull(GTA03_GPIO_WLAN_RESET, S3C_GPIO_PULL_NONE); s3c_gpio_cfgpin(GTA03_GPIO_WLAN_RESET, S3C_GPIO_SFN(1)); gpio_direction_output(GTA03_GPIO_WLAN_RESET, 0); - gpio_direction_output(GTA03_GPIO_NWLAN_POWER, 0); - s3c_gpio_setpull(GTA03_GPIO_NWLAN_POWER, S3C_GPIO_PULL_NONE); - s3c_gpio_cfgpin(GTA03_GPIO_NWLAN_POWER, S3C_GPIO_SFN(1)); - msleep(500); + /* "full power down (active low)" -- deassert it*/ gpio_direction_output(GTA03_GPIO_WLAN_PWRDN, 1); s3c_gpio_setpull(GTA03_GPIO_WLAN_PWRDN, S3C_GPIO_PULL_NONE); s3c_gpio_cfgpin(GTA03_GPIO_WLAN_PWRDN, S3C_GPIO_SFN(1)); - msleep(500); + + /* enable P-Channel mosfet switch for power */ + gpio_direction_output(GTA03_GPIO_NWLAN_POWER, 0); + s3c_gpio_setpull(GTA03_GPIO_NWLAN_POWER, S3C_GPIO_PULL_NONE); + s3c_gpio_cfgpin(GTA03_GPIO_NWLAN_POWER, S3C_GPIO_SFN(1)); + msleep(50); + /* deassert reset */ gpio_direction_output(GTA03_GPIO_WLAN_RESET, 1); - msleep(500); + msleep(1500); sdhci_s3c_force_presence_change(&s3c_device_hsmmc1); break; case OM_GTA03_GSM: @@ -113,6 +123,8 @@ static void om_gta03_features_pwron_set_on(enum feature feature) static void om_gta03_features_pwron_set_off(enum feature feature) { + int gpio; + switch (feature) { case OM_GTA03_GPS: /* disable LNA */ @@ -120,6 +132,10 @@ static void om_gta03_features_pwron_set_off(enum feature feature) regulator_disable(gps_regulator); break; case OM_GTA03_WLAN_BT: + gpio_direction_output(GTA03_GPIO_WLAN_RESET, 0); + s3c_gpio_setpull(GTA03_GPIO_WLAN_RESET, S3C_GPIO_PULL_NONE); + s3c_gpio_cfgpin(GTA03_GPIO_WLAN_RESET, S3C_GPIO_SFN(1)); + gpio_direction_output(GTA03_GPIO_WLAN_PWRDN, 0); s3c_gpio_setpull(GTA03_GPIO_WLAN_PWRDN, S3C_GPIO_PULL_NONE); s3c_gpio_cfgpin(GTA03_GPIO_WLAN_PWRDN, S3C_GPIO_SFN(1)); @@ -128,7 +144,12 @@ static void om_gta03_features_pwron_set_off(enum feature feature) gpio_direction_output(GTA03_GPIO_NWLAN_POWER, 1); s3c_gpio_setpull(GTA03_GPIO_NWLAN_POWER, S3C_GPIO_PULL_NONE); s3c_gpio_cfgpin(GTA03_GPIO_NWLAN_POWER, S3C_GPIO_SFN(1)); + sdhci_s3c_force_presence_change(&s3c_device_hsmmc1); + for (gpio = S3C64XX_GPH(0); gpio < S3C64XX_GPH(6); gpio++) { + s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0)); /* input */ + s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN); + } break; case OM_GTA03_GSM: /* remove power from WLAN / BT module */ -- cgit v1.2.3