add Marvell 88W8688 support to libertas_sdio
authorHarro Haan <hrhaan@gmail.com>
Wed, 31 Oct 2012 22:24:26 +0000 (23:24 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 14 Nov 2012 19:55:34 +0000 (14:55 -0500)
This chip is for example used in the GuruPlug.
This patch avoids the following error:
libertas_sdio: failed to load firmware
libertas_sdio: probe of mmc0:0001:1 failed with error -5

The fix is based on code in:
drivers/net/wireless/libertas_uap/uap_sdio_mmc.c

This file can for example be found on the following links:
http://www.xilka.com/sheeva/2.6/2.6.36/2.6.36.2/source/0002-Driver-for-Marvell-Libertas-8688-SDIO-micro-AP-suppo-2.6.35.patch
http://www.downloadsnewit.co.uk/kernel-v3.0.7/

I followed the following wiki to setup a working WiFi client mode
connection on the GuruPlug:
http://wiki.debian.org/libertas

Signed-off-by: Harro Haan <hrhaan@gmail.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/if_sdio.c

index 4cb234349fbfacc305b1565ed5f1a30ba16aa108..739309e70d8be7872e9272c9e25dcb7e3a5b2a4a 100644 (file)
@@ -588,17 +588,38 @@ static int if_sdio_prog_real(struct if_sdio_card *card,
        size = fw->size;
 
        while (size) {
-               ret = if_sdio_wait_status(card, FW_DL_READY_STATUS);
-               if (ret)
-                       goto release;
+               timeout = jiffies + HZ;
+               while (1) {
+                       ret = if_sdio_wait_status(card, FW_DL_READY_STATUS);
+                       if (ret)
+                               goto release;
 
-               req_size = sdio_readb(card->func, IF_SDIO_RD_BASE, &ret);
-               if (ret)
-                       goto release;
+                       req_size = sdio_readb(card->func, IF_SDIO_RD_BASE,
+                                       &ret);
+                       if (ret)
+                               goto release;
+
+                       req_size |= sdio_readb(card->func, IF_SDIO_RD_BASE + 1,
+                                       &ret) << 8;
+                       if (ret)
+                               goto release;
+
+                       /*
+                        * For SD8688 wait until the length is not 0, 1 or 2
+                        * before downloading the first FW block,
+                        * since BOOT code writes the register to indicate the
+                        * helper/FW download winner,
+                        * the value could be 1 or 2 (Func1 or Func2).
+                        */
+                       if ((size != fw->size) || (req_size > 2))
+                               break;
+                       if (time_after(jiffies, timeout)) {
+                               ret = -ETIMEDOUT;
+                               goto release;
+                       }
+                       mdelay(1);
+               }
 
-               req_size |= sdio_readb(card->func, IF_SDIO_RD_BASE + 1, &ret) << 8;
-               if (ret)
-                       goto release;
 /*
                lbs_deb_sdio("firmware wants %d bytes\n", (int)req_size);
 */
This page took 0.027054 seconds and 5 git commands to generate.