aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2014-07-31 15:59:42 -0400
committerJohn W. Linville <linville@tuxdriver.com>2014-08-25 16:00:42 -0400
commit6247d2aa5188ac0ace33d8390341075c04107218 (patch)
treeb7b4076bbe3bd173d25afcc3977a7d6a9399fcdd /drivers/net/wireless/b43
parent07bc788424b9a2ee6cc20b70311c0950897ee0eb (diff)
b43: update flushing many writes performed in a row
Flush radio writes as well and add some tiny optimizations (e.g. masksetting PHY reg involves reading it, so reset the counter). Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43')
-rw-r--r--drivers/net/wireless/b43/bus.h14
-rw-r--r--drivers/net/wireless/b43/phy_common.c13
-rw-r--r--drivers/net/wireless/b43/phy_n.c1
3 files changed, 25 insertions, 3 deletions
diff --git a/drivers/net/wireless/b43/bus.h b/drivers/net/wireless/b43/bus.h
index f3205c6988bc..460d9d90bdde 100644
--- a/drivers/net/wireless/b43/bus.h
+++ b/drivers/net/wireless/b43/bus.h
@@ -60,7 +60,21 @@ static inline bool b43_bus_host_is_pcmcia(struct b43_bus_dev *dev)
60#else 60#else
61 return false; 61 return false;
62#endif 62#endif
63};
64
65static inline bool b43_bus_host_is_pci(struct b43_bus_dev *dev)
66{
67#ifdef CONFIG_B43_BCMA
68 if (dev->bus_type == B43_BUS_BCMA)
69 return (dev->bdev->bus->hosttype == BCMA_HOSTTYPE_PCI);
70#endif
71#ifdef CONFIG_B43_SSB
72 if (dev->bus_type == B43_BUS_SSB)
73 return (dev->sdev->bus->bustype == SSB_BUSTYPE_PCI);
74#endif
75 return false;
63} 76}
77
64static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev) 78static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev)
65{ 79{
66#ifdef CONFIG_B43_SSB 80#ifdef CONFIG_B43_SSB
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
index 3cbef21b4726..c868748b3f9e 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -222,12 +222,18 @@ static inline void assert_mac_suspended(struct b43_wldev *dev)
222u16 b43_radio_read(struct b43_wldev *dev, u16 reg) 222u16 b43_radio_read(struct b43_wldev *dev, u16 reg)
223{ 223{
224 assert_mac_suspended(dev); 224 assert_mac_suspended(dev);
225 dev->phy.writes_counter = 0;
225 return dev->phy.ops->radio_read(dev, reg); 226 return dev->phy.ops->radio_read(dev, reg);
226} 227}
227 228
228void b43_radio_write(struct b43_wldev *dev, u16 reg, u16 value) 229void b43_radio_write(struct b43_wldev *dev, u16 reg, u16 value)
229{ 230{
230 assert_mac_suspended(dev); 231 assert_mac_suspended(dev);
232 if (b43_bus_host_is_pci(dev->dev) &&
233 ++dev->phy.writes_counter > B43_MAX_WRITES_IN_ROW) {
234 b43_read32(dev, B43_MMIO_MACCTL);
235 dev->phy.writes_counter = 1;
236 }
231 dev->phy.ops->radio_write(dev, reg, value); 237 dev->phy.ops->radio_write(dev, reg, value);
232} 238}
233 239
@@ -274,11 +280,12 @@ u16 b43_phy_read(struct b43_wldev *dev, u16 reg)
274void b43_phy_write(struct b43_wldev *dev, u16 reg, u16 value) 280void b43_phy_write(struct b43_wldev *dev, u16 reg, u16 value)
275{ 281{
276 assert_mac_suspended(dev); 282 assert_mac_suspended(dev);
277 dev->phy.ops->phy_write(dev, reg, value); 283 if (b43_bus_host_is_pci(dev->dev) &&
278 if (++dev->phy.writes_counter == B43_MAX_WRITES_IN_ROW) { 284 ++dev->phy.writes_counter > B43_MAX_WRITES_IN_ROW) {
279 b43_read16(dev, B43_MMIO_PHY_VER); 285 b43_read16(dev, B43_MMIO_PHY_VER);
280 dev->phy.writes_counter = 0; 286 dev->phy.writes_counter = 1;
281 } 287 }
288 dev->phy.ops->phy_write(dev, reg, value);
282} 289}
283 290
284void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg) 291void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg)
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index e2a3f0d5bcc2..b04aa34b0277 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -6517,6 +6517,7 @@ static void b43_nphy_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask,
6517 check_phyreg(dev, reg); 6517 check_phyreg(dev, reg);
6518 b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); 6518 b43_write16(dev, B43_MMIO_PHY_CONTROL, reg);
6519 b43_maskset16(dev, B43_MMIO_PHY_DATA, mask, set); 6519 b43_maskset16(dev, B43_MMIO_PHY_DATA, mask, set);
6520 dev->phy.writes_counter = 1;
6520} 6521}
6521 6522
6522static u16 b43_nphy_op_radio_read(struct b43_wldev *dev, u16 reg) 6523static u16 b43_nphy_op_radio_read(struct b43_wldev *dev, u16 reg)