diff mbox

[Maverick,SRU,4/6] UBUNTU - ARM: igepv2: Fix handling of GPIOs for WLAN-BT combo

Message ID 1286815006.3125.35.camel@black
State Accepted
Delegated to: Brad Figg
Headers show

Commit Message

Mathieu Poirier Oct. 11, 2010, 4:36 p.m. UTC
SRU Justification:

Impact: This patch is part of a series of fix for the IGEPv2 board.
Initialization of the GPIOs used by the WLAN-BT must be tailored to the
underlying HW.

Fix: The fix entails checking the "hwrev" flag and make the proper
configuration.  This patch depends on [PATCH 3/6], applied to fix
BugLink: https://bugs.launchpad.net/bugs/654586

Testcase:  Without this patch the WLAN BT combo simply won't work on
newer boards.


>From d469541061c47082a71525dcd2c005d3d5c17f61 Mon Sep 17 00:00:00 2001
From: Enric Balletbo i Serra <eballetbo@gmail.com>
Date: Mon, 11 Oct 2010 10:13:12 -0600
Subject: [PATCH 4/6] UBUNTU - ARM: igepv2: Fix handling of GPIOs for WLAN-BT combo

Some GPIO's used by WLAN-BT combo on IGEP v2 depends on hardware
revision. This patch handles these GPIO's.

  ----------------------------------------------------------
 |       Hw Rev.       | WIFI_NPD | WIFI_NRESET | BT_NRESET |
  ----------------------------------------------------------
 |  B                  | gpio94  |   gpio95    |     -      |
 |  B/C (B-compatible) | gpio94  |   gpio95    |  gpio137   |
 |  C                  | gpio138 |   gpio139   |  gpio137   |
  ----------------------------------------------------------

This work was tested by the community and also been submitted here:
http://marc.info/?l=linux-omap&m=128628863419775&w=2

BugLink: https://bugs.launchpad.net/bugs/654590

Signed-off-by: Enric Balletbo i Serra <eballetbo@gmail.com>
Signed-off-by: Mathieu J Poirier <mathieu.poirier@canonical.com>
---
 arch/arm/mach-omap2/board-igep0020.c |   98 ++++++++++++++++++++++++----------
 1 files changed, 70 insertions(+), 28 deletions(-)

Comments

Lee Jones Oct. 12, 2010, 8:20 a.m. UTC | #1
On 11/10/10 17:36, Mathieu Poirier wrote:
> SRU Justification:
> 
> Impact: This patch is part of a series of fix for the IGEPv2 board.
> Initialization of the GPIOs used by the WLAN-BT must be tailored to the
> underlying HW.
> 
> Fix: The fix entails checking the "hwrev" flag and make the proper
> configuration.  This patch depends on [PATCH 3/6], applied to fix
> BugLink: https://bugs.launchpad.net/bugs/654586
> 
> Testcase:  Without this patch the WLAN BT combo simply won't work on
> newer boards.
> 
> 
>>From d469541061c47082a71525dcd2c005d3d5c17f61 Mon Sep 17 00:00:00 2001
> From: Enric Balletbo i Serra <eballetbo@gmail.com>
> Date: Mon, 11 Oct 2010 10:13:12 -0600
> Subject: [PATCH 4/6] UBUNTU - ARM: igepv2: Fix handling of GPIOs for WLAN-BT combo
> 
> Some GPIO's used by WLAN-BT combo on IGEP v2 depends on hardware
> revision. This patch handles these GPIO's.
> 
>   ----------------------------------------------------------
>  |       Hw Rev.       | WIFI_NPD | WIFI_NRESET | BT_NRESET |
>   ----------------------------------------------------------
>  |  B                  | gpio94  |   gpio95    |     -      |
>  |  B/C (B-compatible) | gpio94  |   gpio95    |  gpio137   |
>  |  C                  | gpio138 |   gpio139   |  gpio137   |
>   ----------------------------------------------------------
> 
> This work was tested by the community and also been submitted here:
> http://marc.info/?l=linux-omap&m=128628863419775&w=2
> 
> BugLink: https://bugs.launchpad.net/bugs/654590
> 
> Signed-off-by: Enric Balletbo i Serra <eballetbo@gmail.com>
> Signed-off-by: Mathieu J Poirier <mathieu.poirier@canonical.com>
> ---
>  arch/arm/mach-omap2/board-igep0020.c |   98 ++++++++++++++++++++++++----------
>  1 files changed, 70 insertions(+), 28 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
> index 7715701..1047477 100644
> --- a/arch/arm/mach-omap2/board-igep0020.c
> +++ b/arch/arm/mach-omap2/board-igep0020.c
> @@ -38,22 +38,28 @@
>  #define IGEP2_SMSC911X_CS       5
>  #define IGEP2_SMSC911X_GPIO     176
>  #define IGEP2_GPIO_USBH_NRESET  24
> -#define IGEP2_GPIO_LED0_GREEN 	26
> -#define IGEP2_GPIO_LED0_RED 	27
> -#define IGEP2_GPIO_LED1_RED   	28
> -#define IGEP2_GPIO_DVI_PUP	170
> -#define IGEP2_GPIO_WIFI_NPD 	94
> -#define IGEP2_GPIO_WIFI_NRESET 	95
> +#define IGEP2_GPIO_LED0_GREEN   26
> +#define IGEP2_GPIO_LED0_RED     27
> +#define IGEP2_GPIO_LED1_RED     28
> +#define IGEP2_GPIO_DVI_PUP      170
> +
> +#define IGEP2_RB_GPIO_WIFI_NPD     94
> +#define IGEP2_RB_GPIO_WIFI_NRESET  95
> +#define IGEP2_RB_GPIO_BT_NRESET    137
> +#define IGEP2_RC_GPIO_WIFI_NPD     138
> +#define IGEP2_RC_GPIO_WIFI_NRESET  139
> +#define IGEP2_RC_GPIO_BT_NRESET    137
>  
>  /*
>   * IGEP2 Hardware Revision Table
>   *
> - *  --------------------------
> - * | Id. | Hw Rev. | HW0 (28) |
> - *  --------------------------
> - * |  0  |   B/C   |   high   |
> - * |  1  |   C     |   low    |
> - *  --------------------------
> + *  --------------------------------------------------------------------------
> + * | Id. | Hw Rev.            | HW0 (28) | WIFI_NPD | WIFI_NRESET | BT_NRESET |
> + *  --------------------------------------------------------------------------
> + * |  0  | B                  |   high   |  gpio94  |   gpio95    |     -     |
> + * |  0  | B/C (B-compatible) |   high   |  gpio94  |   gpio95    |  gpio137  |
> + * |  1  | C                  |   low    |  gpio138 |   gpio139   |  gpio137  |
> + *  --------------------------------------------------------------------------
>   */
>  
>  #define IGEP2_BOARD_HWREV_B	0
> @@ -295,12 +301,14 @@ static struct omap2_hsmmc_info mmc[] = {
>  		.gpio_cd	= -EINVAL,
>  		.gpio_wp	= -EINVAL,
>  	},
> +#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
>  	{
>  		.mmc		= 2,
>  		.wires		= 4,
>  		.gpio_cd	= -EINVAL,
>  		.gpio_wp	= -EINVAL,
>  	},
> +#endif
>  	{}      /* Terminator */
>  };
>  
> @@ -577,6 +585,50 @@ static struct omap_board_mux board_mux[] __initdata = {
>  #define board_mux	NULL
>  #endif
>  
> +#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
> +
> +static void __init igep2_wlan_bt_init(void)
> +{
> +       unsigned npd, wreset, btreset;
> +
> +       /* GPIO's for WLAN-BT combo depends on hardware revision */
> +       if (hwrev == IGEP2_BOARD_HWREV_B) {
> +               npd = IGEP2_RB_GPIO_WIFI_NPD;
> +               wreset = IGEP2_RB_GPIO_WIFI_NRESET;
> +               btreset = IGEP2_RB_GPIO_BT_NRESET;
> +       } else if (hwrev == IGEP2_BOARD_HWREV_C) {
> +               npd = IGEP2_RC_GPIO_WIFI_NPD;
> +               wreset = IGEP2_RC_GPIO_WIFI_NRESET;
> +               btreset = IGEP2_RC_GPIO_BT_NRESET;
> +       } else
> +               return;
> +
> +       /* Set GPIO's for  WLAN-BT combo module */
> +       if ((gpio_request(npd, "GPIO_WIFI_NPD") == 0) &&
> +           (gpio_direction_output(npd, 1) == 0)) {
> +               gpio_export(npd, 0);
> +       } else
> +               pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NPD\n");
> +
> +       if ((gpio_request(wreset, "GPIO_WIFI_NRESET") == 0) &&
> +           (gpio_direction_output(wreset, 1) == 0)) {
> +               gpio_export(wreset, 0);
> +               gpio_set_value(wreset, 0);
> +               udelay(10);
> +               gpio_set_value(wreset, 1);
> +       } else
> +               pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NRESET\n");
> +
> +       if ((gpio_request(btreset, "GPIO_BT_NRESET") == 0) &&
> +           (gpio_direction_output(btreset, 1) == 0)) {
> +               gpio_export(btreset, 0);
> +       } else
> +               pr_warning("IGEP2: Could not obtain gpio GPIO_BT_NRESET\n");
> +}
> +#else
> +static inline void __init igep2_wlan_bt_init(void) { }
> +#endif
> +
>  static void __init igep2_init(void)
>  {
>  	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
> @@ -595,22 +647,12 @@ static void __init igep2_init(void)
>  	igep2_display_init();
>  	igep2_init_smsc911x();
>  
> -	/* GPIO W-LAN + Bluetooth combo module */
> -	if ((gpio_request(IGEP2_GPIO_WIFI_NPD, "GPIO_WIFI_NPD") == 0) &&
> -	    (gpio_direction_output(IGEP2_GPIO_WIFI_NPD, 1) == 0)) {
> -		gpio_export(IGEP2_GPIO_WIFI_NPD, 0);
> -/* 		gpio_set_value(IGEP2_GPIO_WIFI_NPD, 0); */
> -	} else
> -		pr_warning("IGEP v2: Could not obtain gpio GPIO_WIFI_NPD\n");
> -
> -	if ((gpio_request(IGEP2_GPIO_WIFI_NRESET, "GPIO_WIFI_NRESET") == 0) &&
> -	    (gpio_direction_output(IGEP2_GPIO_WIFI_NRESET, 1) == 0)) {
> -		gpio_export(IGEP2_GPIO_WIFI_NRESET, 0);
> -		gpio_set_value(IGEP2_GPIO_WIFI_NRESET, 0);
> -		udelay(10);
> -		gpio_set_value(IGEP2_GPIO_WIFI_NRESET, 1);
> -	} else
> -		pr_warning("IGEP v2: Could not obtain gpio GPIO_WIFI_NRESET\n");
> +       /*
> +        * WLAN-BT combo module from MuRata wich has a Marvell WLAN
> +        * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface.
> +        */
> +       igep2_wlan_bt_init();
> +
>  }
>  
>  static void __init igep2_map_io(void)

Signed-off-by: Lee Jones <lee.jones@canonical.com>
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 7715701..1047477 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -38,22 +38,28 @@ 
 #define IGEP2_SMSC911X_CS       5
 #define IGEP2_SMSC911X_GPIO     176
 #define IGEP2_GPIO_USBH_NRESET  24
-#define IGEP2_GPIO_LED0_GREEN 	26
-#define IGEP2_GPIO_LED0_RED 	27
-#define IGEP2_GPIO_LED1_RED   	28
-#define IGEP2_GPIO_DVI_PUP	170
-#define IGEP2_GPIO_WIFI_NPD 	94
-#define IGEP2_GPIO_WIFI_NRESET 	95
+#define IGEP2_GPIO_LED0_GREEN   26
+#define IGEP2_GPIO_LED0_RED     27
+#define IGEP2_GPIO_LED1_RED     28
+#define IGEP2_GPIO_DVI_PUP      170
+
+#define IGEP2_RB_GPIO_WIFI_NPD     94
+#define IGEP2_RB_GPIO_WIFI_NRESET  95
+#define IGEP2_RB_GPIO_BT_NRESET    137
+#define IGEP2_RC_GPIO_WIFI_NPD     138
+#define IGEP2_RC_GPIO_WIFI_NRESET  139
+#define IGEP2_RC_GPIO_BT_NRESET    137
 
 /*
  * IGEP2 Hardware Revision Table
  *
- *  --------------------------
- * | Id. | Hw Rev. | HW0 (28) |
- *  --------------------------
- * |  0  |   B/C   |   high   |
- * |  1  |   C     |   low    |
- *  --------------------------
+ *  --------------------------------------------------------------------------
+ * | Id. | Hw Rev.            | HW0 (28) | WIFI_NPD | WIFI_NRESET | BT_NRESET |
+ *  --------------------------------------------------------------------------
+ * |  0  | B                  |   high   |  gpio94  |   gpio95    |     -     |
+ * |  0  | B/C (B-compatible) |   high   |  gpio94  |   gpio95    |  gpio137  |
+ * |  1  | C                  |   low    |  gpio138 |   gpio139   |  gpio137  |
+ *  --------------------------------------------------------------------------
  */
 
 #define IGEP2_BOARD_HWREV_B	0
@@ -295,12 +301,14 @@  static struct omap2_hsmmc_info mmc[] = {
 		.gpio_cd	= -EINVAL,
 		.gpio_wp	= -EINVAL,
 	},
+#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
 	{
 		.mmc		= 2,
 		.wires		= 4,
 		.gpio_cd	= -EINVAL,
 		.gpio_wp	= -EINVAL,
 	},
+#endif
 	{}      /* Terminator */
 };
 
@@ -577,6 +585,50 @@  static struct omap_board_mux board_mux[] __initdata = {
 #define board_mux	NULL
 #endif
 
+#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
+
+static void __init igep2_wlan_bt_init(void)
+{
+       unsigned npd, wreset, btreset;
+
+       /* GPIO's for WLAN-BT combo depends on hardware revision */
+       if (hwrev == IGEP2_BOARD_HWREV_B) {
+               npd = IGEP2_RB_GPIO_WIFI_NPD;
+               wreset = IGEP2_RB_GPIO_WIFI_NRESET;
+               btreset = IGEP2_RB_GPIO_BT_NRESET;
+       } else if (hwrev == IGEP2_BOARD_HWREV_C) {
+               npd = IGEP2_RC_GPIO_WIFI_NPD;
+               wreset = IGEP2_RC_GPIO_WIFI_NRESET;
+               btreset = IGEP2_RC_GPIO_BT_NRESET;
+       } else
+               return;
+
+       /* Set GPIO's for  WLAN-BT combo module */
+       if ((gpio_request(npd, "GPIO_WIFI_NPD") == 0) &&
+           (gpio_direction_output(npd, 1) == 0)) {
+               gpio_export(npd, 0);
+       } else
+               pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NPD\n");
+
+       if ((gpio_request(wreset, "GPIO_WIFI_NRESET") == 0) &&
+           (gpio_direction_output(wreset, 1) == 0)) {
+               gpio_export(wreset, 0);
+               gpio_set_value(wreset, 0);
+               udelay(10);
+               gpio_set_value(wreset, 1);
+       } else
+               pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NRESET\n");
+
+       if ((gpio_request(btreset, "GPIO_BT_NRESET") == 0) &&
+           (gpio_direction_output(btreset, 1) == 0)) {
+               gpio_export(btreset, 0);
+       } else
+               pr_warning("IGEP2: Could not obtain gpio GPIO_BT_NRESET\n");
+}
+#else
+static inline void __init igep2_wlan_bt_init(void) { }
+#endif
+
 static void __init igep2_init(void)
 {
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
@@ -595,22 +647,12 @@  static void __init igep2_init(void)
 	igep2_display_init();
 	igep2_init_smsc911x();
 
-	/* GPIO W-LAN + Bluetooth combo module */
-	if ((gpio_request(IGEP2_GPIO_WIFI_NPD, "GPIO_WIFI_NPD") == 0) &&
-	    (gpio_direction_output(IGEP2_GPIO_WIFI_NPD, 1) == 0)) {
-		gpio_export(IGEP2_GPIO_WIFI_NPD, 0);
-/* 		gpio_set_value(IGEP2_GPIO_WIFI_NPD, 0); */
-	} else
-		pr_warning("IGEP v2: Could not obtain gpio GPIO_WIFI_NPD\n");
-
-	if ((gpio_request(IGEP2_GPIO_WIFI_NRESET, "GPIO_WIFI_NRESET") == 0) &&
-	    (gpio_direction_output(IGEP2_GPIO_WIFI_NRESET, 1) == 0)) {
-		gpio_export(IGEP2_GPIO_WIFI_NRESET, 0);
-		gpio_set_value(IGEP2_GPIO_WIFI_NRESET, 0);
-		udelay(10);
-		gpio_set_value(IGEP2_GPIO_WIFI_NRESET, 1);
-	} else
-		pr_warning("IGEP v2: Could not obtain gpio GPIO_WIFI_NRESET\n");
+       /*
+        * WLAN-BT combo module from MuRata wich has a Marvell WLAN
+        * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface.
+        */
+       igep2_wlan_bt_init();
+
 }
 
 static void __init igep2_map_io(void)