OSDN Git Service

staging: wilc1000: sdio_init: add resume argument
authorGlen Lee <glen.lee@atmel.com>
Mon, 25 Jan 2016 07:35:09 +0000 (16:35 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Feb 2016 23:25:40 +0000 (15:25 -0800)
Part of sdio init codes should not run when sdio init function is called on
sdio resume so skip them.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/wilc_sdio.c
drivers/staging/wilc1000/wilc_spi.c
drivers/staging/wilc1000/wilc_wlan.c
drivers/staging/wilc1000/wilc_wlan.h

index f40a527..7c20c8c 100644 (file)
@@ -42,7 +42,7 @@ static wilc_sdio_t g_sdio;
 
 static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data);
 static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data);
-static int sdio_init(struct wilc *wilc);
+static int sdio_init(struct wilc *wilc, bool resume);
 
 static void wilc_sdio_interrupt(struct sdio_func *func)
 {
@@ -196,7 +196,7 @@ static int wilc_sdio_resume(struct device *dev)
        dev_info(dev, "sdio resume\n");
        sdio_release_host(func);
        chip_wakeup(wilc);
-       sdio_init(wilc);
+       sdio_init(wilc, true);
 
        if (wilc->suspend_event)
                host_wakeup_notify(wilc);
@@ -667,16 +667,17 @@ static int sdio_deinit(struct wilc *wilc)
        return 1;
 }
 
-static int sdio_init(struct wilc *wilc)
+static int sdio_init(struct wilc *wilc, bool resume)
 {
        struct sdio_func *func = dev_to_sdio_func(wilc->dev);
        sdio_cmd52_t cmd;
        int loop, ret;
        u32 chipid;
 
-       memset(&g_sdio, 0, sizeof(wilc_sdio_t));
-
-       g_sdio.irq_gpio = (wilc->dev_irq_num);
+       if (!resume) {
+               memset(&g_sdio, 0, sizeof(wilc_sdio_t));
+               g_sdio.irq_gpio = (wilc->dev_irq_num);
+       }
 
        /**
         *      function 0 csa enable
@@ -766,16 +767,19 @@ static int sdio_init(struct wilc *wilc)
        /**
         *      make sure can read back chip id correctly
         **/
-       if (!sdio_read_reg(wilc, 0x1000, &chipid)) {
-               dev_err(&func->dev, "Fail cmd read chip id...\n");
-               goto _fail_;
+       if (!resume) {
+               if (!sdio_read_reg(wilc, 0x1000, &chipid)) {
+                       dev_err(&func->dev, "Fail cmd read chip id...\n");
+                       goto _fail_;
+               }
+               dev_err(&func->dev, "chipid (%08x)\n", chipid);
+               if ((chipid & 0xfff) > 0x2a0)
+                       g_sdio.has_thrpt_enh3 = 1;
+               else
+                       g_sdio.has_thrpt_enh3 = 0;
+               dev_info(&func->dev, "has_thrpt_enh3 = %d...\n",
+                        g_sdio.has_thrpt_enh3);
        }
-       dev_err(&func->dev, "chipid (%08x)\n", chipid);
-       if ((chipid & 0xfff) > 0x2a0)
-               g_sdio.has_thrpt_enh3 = 1;
-       else
-               g_sdio.has_thrpt_enh3 = 0;
-       dev_info(&func->dev, "has_thrpt_enh3 = %d...\n", g_sdio.has_thrpt_enh3);
 
        return 1;
 
index 1df07e7..2928712 100644 (file)
@@ -850,7 +850,7 @@ static int _wilc_spi_deinit(struct wilc *wilc)
        return 1;
 }
 
-static int wilc_spi_init(struct wilc *wilc)
+static int wilc_spi_init(struct wilc *wilc, bool resume)
 {
        struct spi_device *spi = to_spi_device(wilc->dev);
        u32 reg;
index 74e2087..36debb4 100644 (file)
@@ -1530,7 +1530,7 @@ int wilc_wlan_init(struct net_device *dev)
 
        wilc->quit = 0;
 
-       if (!wilc->hif_func->hif_init(wilc)) {
+       if (!wilc->hif_func->hif_init(wilc, false)) {
                ret = -EIO;
                goto _fail_;
        }
index 53e56ff..a1096ed 100644 (file)
@@ -227,7 +227,7 @@ struct rxq_entry_t {
  ********************************************/
 struct wilc;
 struct wilc_hif_func {
-       int (*hif_init)(struct wilc *);
+       int (*hif_init)(struct wilc *, bool resume);
        int (*hif_deinit)(struct wilc *);
        int (*hif_read_reg)(struct wilc *, u32, u32 *);
        int (*hif_write_reg)(struct wilc *, u32, u32);