wlcore: block read/writes to FW during ELP
authorBarak Bercovitz <barak@wizery.com>
Mon, 10 Feb 2014 11:47:19 +0000 (13:47 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 13 Feb 2014 20:20:14 +0000 (15:20 -0500)
When the chip is in ELP mode read/write to FW is invalid and may cause
the lower layers to get stuck. The reads/writes concerning ELP wakeup
are the exception here and are checked for. In addition to blocking the
IO, produce a warning.

Signed-off-by: Barak Bercovitz <barak@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ti/wlcore/io.h

index 07e3d6a049adf33d40dc586c27ef66c4428b83d1..0305729d09868230b2d75a5d5ce3b546b858ced6 100644 (file)
@@ -60,7 +60,9 @@ static inline int __must_check wlcore_raw_write(struct wl1271 *wl, int addr,
 {
        int ret;
 
-       if (test_bit(WL1271_FLAG_IO_FAILED, &wl->flags))
+       if (test_bit(WL1271_FLAG_IO_FAILED, &wl->flags) ||
+           WARN_ON((test_bit(WL1271_FLAG_IN_ELP, &wl->flags) &&
+                    addr != HW_ACCESS_ELP_CTRL_REG)))
                return -EIO;
 
        ret = wl->if_ops->write(wl->dev, addr, buf, len, fixed);
@@ -76,7 +78,9 @@ static inline int __must_check wlcore_raw_read(struct wl1271 *wl, int addr,
 {
        int ret;
 
-       if (test_bit(WL1271_FLAG_IO_FAILED, &wl->flags))
+       if (test_bit(WL1271_FLAG_IO_FAILED, &wl->flags) ||
+           WARN_ON((test_bit(WL1271_FLAG_IN_ELP, &wl->flags) &&
+                    addr != HW_ACCESS_ELP_CTRL_REG)))
                return -EIO;
 
        ret = wl->if_ops->read(wl->dev, addr, buf, len, fixed);