aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/b43/phy_common.c15
-rw-r--r--drivers/net/wireless/b43/phy_common.h6
-rw-r--r--drivers/net/wireless/b43/phy_n.c12
3 files changed, 22 insertions, 11 deletions
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
index f627cef33227..f01676ac481b 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -240,6 +240,21 @@ void b43_radio_maskset(struct b43_wldev *dev, u16 offset, u16 mask, u16 set)
240 (b43_radio_read16(dev, offset) & mask) | set); 240 (b43_radio_read16(dev, offset) & mask) | set);
241} 241}
242 242
243bool b43_radio_wait_value(struct b43_wldev *dev, u16 offset, u16 mask,
244 u16 value, int delay, int timeout)
245{
246 u16 val;
247 int i;
248
249 for (i = 0; i < timeout; i += delay) {
250 val = b43_radio_read(dev, offset);
251 if ((val & mask) == value)
252 return true;
253 udelay(delay);
254 }
255 return false;
256}
257
243u16 b43_phy_read(struct b43_wldev *dev, u16 reg) 258u16 b43_phy_read(struct b43_wldev *dev, u16 reg)
244{ 259{
245 assert_mac_suspended(dev); 260 assert_mac_suspended(dev);
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h
index 9233b13fc16d..f1b999349876 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -365,6 +365,12 @@ void b43_radio_set(struct b43_wldev *dev, u16 offset, u16 set);
365void b43_radio_maskset(struct b43_wldev *dev, u16 offset, u16 mask, u16 set); 365void b43_radio_maskset(struct b43_wldev *dev, u16 offset, u16 mask, u16 set);
366 366
367/** 367/**
368 * b43_radio_wait_value - Waits for a given value in masked register read
369 */
370bool b43_radio_wait_value(struct b43_wldev *dev, u16 offset, u16 mask,
371 u16 value, int delay, int timeout);
372
373/**
368 * b43_radio_lock - Lock firmware radio register access 374 * b43_radio_lock - Lock firmware radio register access
369 */ 375 */
370void b43_radio_lock(struct b43_wldev *dev); 376void b43_radio_lock(struct b43_wldev *dev);
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index e49d847c59f8..0963d593b247 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -753,8 +753,6 @@ static void b43_radio_init2055_post(struct b43_wldev *dev)
753{ 753{
754 struct b43_phy_n *nphy = dev->phy.n; 754 struct b43_phy_n *nphy = dev->phy.n;
755 struct ssb_sprom *sprom = dev->dev->bus_sprom; 755 struct ssb_sprom *sprom = dev->dev->bus_sprom;
756 int i;
757 u16 val;
758 bool workaround = false; 756 bool workaround = false;
759 757
760 if (sprom->revision < 4) 758 if (sprom->revision < 4)
@@ -777,15 +775,7 @@ static void b43_radio_init2055_post(struct b43_wldev *dev)
777 b43_radio_set(dev, B2055_CAL_MISC, 0x1); 775 b43_radio_set(dev, B2055_CAL_MISC, 0x1);
778 msleep(1); 776 msleep(1);
779 b43_radio_set(dev, B2055_CAL_MISC, 0x40); 777 b43_radio_set(dev, B2055_CAL_MISC, 0x40);
780 for (i = 0; i < 200; i++) { 778 if (!b43_radio_wait_value(dev, B2055_CAL_COUT2, 0x80, 0x80, 10, 2000))
781 val = b43_radio_read(dev, B2055_CAL_COUT2);
782 if (val & 0x80) {
783 i = 0;
784 break;
785 }
786 udelay(10);
787 }
788 if (i)
789 b43err(dev->wl, "radio post init timeout\n"); 779 b43err(dev->wl, "radio post init timeout\n");
790 b43_radio_mask(dev, B2055_CAL_LPOCTL, 0xFF7F); 780 b43_radio_mask(dev, B2055_CAL_LPOCTL, 0xFF7F);
791 b43_switch_channel(dev, dev->phy.channel); 781 b43_switch_channel(dev, dev->phy.channel);