Commit 591f3dc2 authored by Michael Buesch's avatar Michael Buesch Committed by John W. Linville

b43: Do radio lock assertion in software

The assertion of the lock-bit in the hardware register is unreliable,
because there are devices with quirks that will randomly set the bit.

Do the assertion in software, only.
Signed-off-by: default avatarMichael Buesch <mb@bu3sch.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 6aabd4c4
...@@ -3974,6 +3974,11 @@ static void setup_struct_phy_for_init(struct b43_wldev *dev, ...@@ -3974,6 +3974,11 @@ static void setup_struct_phy_for_init(struct b43_wldev *dev,
phy->next_txpwr_check_time = jiffies; phy->next_txpwr_check_time = jiffies;
/* PHY TX errors counter. */ /* PHY TX errors counter. */
atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT); atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT);
#if B43_DEBUG
phy->phy_locked = 0;
phy->radio_locked = 0;
#endif
} }
static void setup_struct_wldev_for_init(struct b43_wldev *dev) static void setup_struct_wldev_for_init(struct b43_wldev *dev)
......
...@@ -131,12 +131,16 @@ void b43_radio_lock(struct b43_wldev *dev) ...@@ -131,12 +131,16 @@ void b43_radio_lock(struct b43_wldev *dev)
{ {
u32 macctl; u32 macctl;
#if B43_DEBUG
B43_WARN_ON(dev->phy.radio_locked);
dev->phy.radio_locked = 1;
#endif
macctl = b43_read32(dev, B43_MMIO_MACCTL); macctl = b43_read32(dev, B43_MMIO_MACCTL);
B43_WARN_ON(macctl & B43_MACCTL_RADIOLOCK);
macctl |= B43_MACCTL_RADIOLOCK; macctl |= B43_MACCTL_RADIOLOCK;
b43_write32(dev, B43_MMIO_MACCTL, macctl); b43_write32(dev, B43_MMIO_MACCTL, macctl);
/* Commit the write and wait for the device /* Commit the write and wait for the firmware
* to exit any radio register access. */ * to finish any radio register access. */
b43_read32(dev, B43_MMIO_MACCTL); b43_read32(dev, B43_MMIO_MACCTL);
udelay(10); udelay(10);
} }
...@@ -145,11 +149,15 @@ void b43_radio_unlock(struct b43_wldev *dev) ...@@ -145,11 +149,15 @@ void b43_radio_unlock(struct b43_wldev *dev)
{ {
u32 macctl; u32 macctl;
#if B43_DEBUG
B43_WARN_ON(!dev->phy.radio_locked);
dev->phy.radio_locked = 0;
#endif
/* Commit any write */ /* Commit any write */
b43_read16(dev, B43_MMIO_PHY_VER); b43_read16(dev, B43_MMIO_PHY_VER);
/* unlock */ /* unlock */
macctl = b43_read32(dev, B43_MMIO_MACCTL); macctl = b43_read32(dev, B43_MMIO_MACCTL);
B43_WARN_ON(!(macctl & B43_MACCTL_RADIOLOCK));
macctl &= ~B43_MACCTL_RADIOLOCK; macctl &= ~B43_MACCTL_RADIOLOCK;
b43_write32(dev, B43_MMIO_MACCTL, macctl); b43_write32(dev, B43_MMIO_MACCTL, macctl);
} }
......
...@@ -245,8 +245,10 @@ struct b43_phy { ...@@ -245,8 +245,10 @@ struct b43_phy {
atomic_t txerr_cnt; atomic_t txerr_cnt;
#ifdef CONFIG_B43_DEBUG #ifdef CONFIG_B43_DEBUG
/* PHY registers locked by b43_phy_lock()? */ /* PHY registers locked (w.r.t. firmware) */
bool phy_locked; bool phy_locked;
/* Radio registers locked (w.r.t. firmware) */
bool radio_locked;
#endif /* B43_DEBUG */ #endif /* B43_DEBUG */
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment