libertas: fix power save issue in libertas_sdio module
authorBing Zhao <bzhao@marvell.com>
Thu, 5 Feb 2009 06:22:39 +0000 (22:22 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 27 Feb 2009 19:51:38 +0000 (14:51 -0500)
The problem: "iwconfig ethX power on" returns error

The cause: "ps_supported" flag was never set for SD8385/8686

The fix: check firmware capabilities returned by GET_HW_SPEC command.
Set "ps_supported" to 1 if FW_CAPINFO_PS bit is on. This fix applies
to SDIO interface only.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/defs.h
drivers/net/wireless/libertas/if_sdio.c

index 6388b05df4fcdd9f7da04bc5aaaaf79b4852178c..e8dfde39abfc1ccedf841bfb6b5783c730e229f2 100644 (file)
@@ -265,6 +265,7 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in
 
 #define        CMD_F_HOSTCMD           (1 << 0)
 #define FW_CAPINFO_WPA         (1 << 0)
+#define FW_CAPINFO_PS                  (1 << 1)
 #define FW_CAPINFO_FIRMWARE_UPGRADE    (1 << 13)
 #define FW_CAPINFO_BOOT2_UPGRADE       (1<<14)
 #define FW_CAPINFO_PERSISTENT_CONFIG   (1<<15)
index 4519d7314f47c37677df87ca51fc4b53bfeac2fe..987836865ea5f2cd303f19bcbd2d7a764ff281bc 100644 (file)
@@ -209,6 +209,9 @@ static int if_sdio_handle_event(struct if_sdio_card *card,
                event = sdio_readb(card->func, IF_SDIO_EVENT, &ret);
                if (ret)
                        goto out;
+
+               /* right shift 3 bits to get the event id */
+               event >>= 3;
        } else {
                if (size < 4) {
                        lbs_deb_sdio("event packet too small (%d bytes)\n",
@@ -921,6 +924,9 @@ static int if_sdio_probe(struct sdio_func *func,
        if (ret)
                goto err_activate_card;
 
+       if (priv->fwcapinfo & FW_CAPINFO_PS)
+               priv->ps_supported = 1;
+
 out:
        lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);