aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-25 20:00:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-25 20:00:17 -0400
commit3f5785ec31adcb7cafa9135087297a38d9698cf8 (patch)
treeb7d06f14e1aea0292a88c4bc0305ea602f6ebd33 /drivers/net/wireless/b43
parent8c1c77ff9be27137fa7cbbf51efedef1a2ae915b (diff)
parent94265cf5f731c7df29fdfde262ca3e6d51e6828c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (89 commits) bonding: documentation and code cleanup for resend_igmp bonding: prevent deadlock on slave store with alb mode (v3) net: hold rtnl again in dump callbacks Add Fujitsu 1000base-SX PCI ID to tg3 bnx2x: protect sequence increment with mutex sch_sfq: fix peek() implementation isdn: netjet - blacklist Digium TDM400P via-velocity: don't annotate MAC registers as packed xen: netfront: hold RTNL when updating features. sctp: fix memory leak of the ASCONF queue when free asoc net: make dev_disable_lro use physical device if passed a vlan dev (v2) net: move is_vlan_dev into public header file (v2) bug.h: Fix build with CONFIG_PRINTK disabled. wireless: fix fatal kernel-doc error + warning in mac80211.h wireless: fix cfg80211.h new kernel-doc warnings iwlagn: dbg_fixed_rate only used when CONFIG_MAC80211_DEBUGFS enabled dst: catch uninitialized metrics be2net: hash key for rss-config cmd not set bridge: initialize fake_rtable metrics net: fix __dst_destroy_metrics_generic() ... Fix up trivial conflicts in drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
Diffstat (limited to 'drivers/net/wireless/b43')
-rw-r--r--drivers/net/wireless/b43/b43.h24
-rw-r--r--drivers/net/wireless/b43/dma.c37
-rw-r--r--drivers/net/wireless/b43/leds.c4
-rw-r--r--drivers/net/wireless/b43/lo.c4
-rw-r--r--drivers/net/wireless/b43/main.c194
-rw-r--r--drivers/net/wireless/b43/phy_a.c16
-rw-r--r--drivers/net/wireless/b43/phy_common.c8
-rw-r--r--drivers/net/wireless/b43/phy_g.c48
-rw-r--r--drivers/net/wireless/b43/phy_lp.c22
-rw-r--r--drivers/net/wireless/b43/phy_n.c24
-rw-r--r--drivers/net/wireless/b43/pio.c30
-rw-r--r--drivers/net/wireless/b43/rfkill.c6
-rw-r--r--drivers/net/wireless/b43/sdio.c4
-rw-r--r--drivers/net/wireless/b43/sysfs.c4
-rw-r--r--drivers/net/wireless/b43/tables_lpphy.c4
-rw-r--r--drivers/net/wireless/b43/wa.c4
-rw-r--r--drivers/net/wireless/b43/xmit.c2
17 files changed, 228 insertions, 207 deletions
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index ebc93c1bb5e7..25a78cfb7d15 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -567,6 +567,8 @@ struct b43_dma {
567 struct b43_dmaring *tx_ring_mcast; /* Multicast */ 567 struct b43_dmaring *tx_ring_mcast; /* Multicast */
568 568
569 struct b43_dmaring *rx_ring; 569 struct b43_dmaring *rx_ring;
570
571 u32 translation; /* Routing bits */
570}; 572};
571 573
572struct b43_pio_txqueue; 574struct b43_pio_txqueue;
@@ -705,7 +707,7 @@ enum {
705 707
706/* Data structure for one wireless device (802.11 core) */ 708/* Data structure for one wireless device (802.11 core) */
707struct b43_wldev { 709struct b43_wldev {
708 struct ssb_device *dev; 710 struct ssb_device *sdev;
709 struct b43_wl *wl; 711 struct b43_wl *wl;
710 712
711 /* The device initialization status. 713 /* The device initialization status.
@@ -879,22 +881,34 @@ static inline enum ieee80211_band b43_current_band(struct b43_wl *wl)
879 881
880static inline u16 b43_read16(struct b43_wldev *dev, u16 offset) 882static inline u16 b43_read16(struct b43_wldev *dev, u16 offset)
881{ 883{
882 return ssb_read16(dev->dev, offset); 884 return ssb_read16(dev->sdev, offset);
883} 885}
884 886
885static inline void b43_write16(struct b43_wldev *dev, u16 offset, u16 value) 887static inline void b43_write16(struct b43_wldev *dev, u16 offset, u16 value)
886{ 888{
887 ssb_write16(dev->dev, offset, value); 889 ssb_write16(dev->sdev, offset, value);
888} 890}
889 891
890static inline u32 b43_read32(struct b43_wldev *dev, u16 offset) 892static inline u32 b43_read32(struct b43_wldev *dev, u16 offset)
891{ 893{
892 return ssb_read32(dev->dev, offset); 894 return ssb_read32(dev->sdev, offset);
893} 895}
894 896
895static inline void b43_write32(struct b43_wldev *dev, u16 offset, u32 value) 897static inline void b43_write32(struct b43_wldev *dev, u16 offset, u32 value)
896{ 898{
897 ssb_write32(dev->dev, offset, value); 899 ssb_write32(dev->sdev, offset, value);
900}
901
902static inline void b43_block_read(struct b43_wldev *dev, void *buffer,
903 size_t count, u16 offset, u8 reg_width)
904{
905 ssb_block_read(dev->sdev, buffer, count, offset, reg_width);
906}
907
908static inline void b43_block_write(struct b43_wldev *dev, const void *buffer,
909 size_t count, u16 offset, u8 reg_width)
910{
911 ssb_block_write(dev->sdev, buffer, count, offset, reg_width);
898} 912}
899 913
900static inline bool b43_using_pio_transfers(struct b43_wldev *dev) 914static inline bool b43_using_pio_transfers(struct b43_wldev *dev)
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index ff0f5ba14b2c..47d44bcff37d 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -80,7 +80,7 @@ static void op32_fill_descriptor(struct b43_dmaring *ring,
80 addr = (u32) (dmaaddr & ~SSB_DMA_TRANSLATION_MASK); 80 addr = (u32) (dmaaddr & ~SSB_DMA_TRANSLATION_MASK);
81 addrext = (u32) (dmaaddr & SSB_DMA_TRANSLATION_MASK) 81 addrext = (u32) (dmaaddr & SSB_DMA_TRANSLATION_MASK)
82 >> SSB_DMA_TRANSLATION_SHIFT; 82 >> SSB_DMA_TRANSLATION_SHIFT;
83 addr |= ssb_dma_translation(ring->dev->dev); 83 addr |= ring->dev->dma.translation;
84 ctl = bufsize & B43_DMA32_DCTL_BYTECNT; 84 ctl = bufsize & B43_DMA32_DCTL_BYTECNT;
85 if (slot == ring->nr_slots - 1) 85 if (slot == ring->nr_slots - 1)
86 ctl |= B43_DMA32_DCTL_DTABLEEND; 86 ctl |= B43_DMA32_DCTL_DTABLEEND;
@@ -174,7 +174,7 @@ static void op64_fill_descriptor(struct b43_dmaring *ring,
174 addrhi = (((u64) dmaaddr >> 32) & ~SSB_DMA_TRANSLATION_MASK); 174 addrhi = (((u64) dmaaddr >> 32) & ~SSB_DMA_TRANSLATION_MASK);
175 addrext = (((u64) dmaaddr >> 32) & SSB_DMA_TRANSLATION_MASK) 175 addrext = (((u64) dmaaddr >> 32) & SSB_DMA_TRANSLATION_MASK)
176 >> SSB_DMA_TRANSLATION_SHIFT; 176 >> SSB_DMA_TRANSLATION_SHIFT;
177 addrhi |= (ssb_dma_translation(ring->dev->dev) << 1); 177 addrhi |= (ring->dev->dma.translation << 1);
178 if (slot == ring->nr_slots - 1) 178 if (slot == ring->nr_slots - 1)
179 ctl0 |= B43_DMA64_DCTL0_DTABLEEND; 179 ctl0 |= B43_DMA64_DCTL0_DTABLEEND;
180 if (start) 180 if (start)
@@ -333,10 +333,10 @@ static inline
333 dma_addr_t dmaaddr; 333 dma_addr_t dmaaddr;
334 334
335 if (tx) { 335 if (tx) {
336 dmaaddr = dma_map_single(ring->dev->dev->dma_dev, 336 dmaaddr = dma_map_single(ring->dev->sdev->dma_dev,
337 buf, len, DMA_TO_DEVICE); 337 buf, len, DMA_TO_DEVICE);
338 } else { 338 } else {
339 dmaaddr = dma_map_single(ring->dev->dev->dma_dev, 339 dmaaddr = dma_map_single(ring->dev->sdev->dma_dev,
340 buf, len, DMA_FROM_DEVICE); 340 buf, len, DMA_FROM_DEVICE);
341 } 341 }
342 342
@@ -348,10 +348,10 @@ static inline
348 dma_addr_t addr, size_t len, int tx) 348 dma_addr_t addr, size_t len, int tx)
349{ 349{
350 if (tx) { 350 if (tx) {
351 dma_unmap_single(ring->dev->dev->dma_dev, 351 dma_unmap_single(ring->dev->sdev->dma_dev,
352 addr, len, DMA_TO_DEVICE); 352 addr, len, DMA_TO_DEVICE);
353 } else { 353 } else {
354 dma_unmap_single(ring->dev->dev->dma_dev, 354 dma_unmap_single(ring->dev->sdev->dma_dev,
355 addr, len, DMA_FROM_DEVICE); 355 addr, len, DMA_FROM_DEVICE);
356 } 356 }
357} 357}
@@ -361,7 +361,7 @@ static inline
361 dma_addr_t addr, size_t len) 361 dma_addr_t addr, size_t len)
362{ 362{
363 B43_WARN_ON(ring->tx); 363 B43_WARN_ON(ring->tx);
364 dma_sync_single_for_cpu(ring->dev->dev->dma_dev, 364 dma_sync_single_for_cpu(ring->dev->sdev->dma_dev,
365 addr, len, DMA_FROM_DEVICE); 365 addr, len, DMA_FROM_DEVICE);
366} 366}
367 367
@@ -370,7 +370,7 @@ static inline
370 dma_addr_t addr, size_t len) 370 dma_addr_t addr, size_t len)
371{ 371{
372 B43_WARN_ON(ring->tx); 372 B43_WARN_ON(ring->tx);
373 dma_sync_single_for_device(ring->dev->dev->dma_dev, 373 dma_sync_single_for_device(ring->dev->sdev->dma_dev,
374 addr, len, DMA_FROM_DEVICE); 374 addr, len, DMA_FROM_DEVICE);
375} 375}
376 376
@@ -401,7 +401,7 @@ static int alloc_ringmemory(struct b43_dmaring *ring)
401 */ 401 */
402 if (ring->type == B43_DMA_64BIT) 402 if (ring->type == B43_DMA_64BIT)
403 flags |= GFP_DMA; 403 flags |= GFP_DMA;
404 ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev, 404 ring->descbase = dma_alloc_coherent(ring->dev->sdev->dma_dev,
405 B43_DMA_RINGMEMSIZE, 405 B43_DMA_RINGMEMSIZE,
406 &(ring->dmabase), flags); 406 &(ring->dmabase), flags);
407 if (!ring->descbase) { 407 if (!ring->descbase) {
@@ -415,7 +415,7 @@ static int alloc_ringmemory(struct b43_dmaring *ring)
415 415
416static void free_ringmemory(struct b43_dmaring *ring) 416static void free_ringmemory(struct b43_dmaring *ring)
417{ 417{
418 dma_free_coherent(ring->dev->dev->dma_dev, B43_DMA_RINGMEMSIZE, 418 dma_free_coherent(ring->dev->sdev->dma_dev, B43_DMA_RINGMEMSIZE,
419 ring->descbase, ring->dmabase); 419 ring->descbase, ring->dmabase);
420} 420}
421 421
@@ -523,7 +523,7 @@ static bool b43_dma_mapping_error(struct b43_dmaring *ring,
523 dma_addr_t addr, 523 dma_addr_t addr,
524 size_t buffersize, bool dma_to_device) 524 size_t buffersize, bool dma_to_device)
525{ 525{
526 if (unlikely(dma_mapping_error(ring->dev->dev->dma_dev, addr))) 526 if (unlikely(dma_mapping_error(ring->dev->sdev->dma_dev, addr)))
527 return 1; 527 return 1;
528 528
529 switch (ring->type) { 529 switch (ring->type) {
@@ -658,7 +658,7 @@ static int dmacontroller_setup(struct b43_dmaring *ring)
658 int err = 0; 658 int err = 0;
659 u32 value; 659 u32 value;
660 u32 addrext; 660 u32 addrext;
661 u32 trans = ssb_dma_translation(ring->dev->dev); 661 u32 trans = ring->dev->dma.translation;
662 662
663 if (ring->tx) { 663 if (ring->tx) {
664 if (ring->type == B43_DMA_64BIT) { 664 if (ring->type == B43_DMA_64BIT) {
@@ -869,7 +869,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
869 goto err_kfree_meta; 869 goto err_kfree_meta;
870 870
871 /* test for ability to dma to txhdr_cache */ 871 /* test for ability to dma to txhdr_cache */
872 dma_test = dma_map_single(dev->dev->dma_dev, 872 dma_test = dma_map_single(dev->sdev->dma_dev,
873 ring->txhdr_cache, 873 ring->txhdr_cache,
874 b43_txhdr_size(dev), 874 b43_txhdr_size(dev),
875 DMA_TO_DEVICE); 875 DMA_TO_DEVICE);
@@ -884,7 +884,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
884 if (!ring->txhdr_cache) 884 if (!ring->txhdr_cache)
885 goto err_kfree_meta; 885 goto err_kfree_meta;
886 886
887 dma_test = dma_map_single(dev->dev->dma_dev, 887 dma_test = dma_map_single(dev->sdev->dma_dev,
888 ring->txhdr_cache, 888 ring->txhdr_cache,
889 b43_txhdr_size(dev), 889 b43_txhdr_size(dev),
890 DMA_TO_DEVICE); 890 DMA_TO_DEVICE);
@@ -898,7 +898,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
898 } 898 }
899 } 899 }
900 900
901 dma_unmap_single(dev->dev->dma_dev, 901 dma_unmap_single(dev->sdev->dma_dev,
902 dma_test, b43_txhdr_size(dev), 902 dma_test, b43_txhdr_size(dev),
903 DMA_TO_DEVICE); 903 DMA_TO_DEVICE);
904 } 904 }
@@ -1013,9 +1013,9 @@ static int b43_dma_set_mask(struct b43_wldev *dev, u64 mask)
1013 /* Try to set the DMA mask. If it fails, try falling back to a 1013 /* Try to set the DMA mask. If it fails, try falling back to a
1014 * lower mask, as we can always also support a lower one. */ 1014 * lower mask, as we can always also support a lower one. */
1015 while (1) { 1015 while (1) {
1016 err = dma_set_mask(dev->dev->dma_dev, mask); 1016 err = dma_set_mask(dev->sdev->dma_dev, mask);
1017 if (!err) { 1017 if (!err) {
1018 err = dma_set_coherent_mask(dev->dev->dma_dev, mask); 1018 err = dma_set_coherent_mask(dev->sdev->dma_dev, mask);
1019 if (!err) 1019 if (!err)
1020 break; 1020 break;
1021 } 1021 }
@@ -1055,6 +1055,7 @@ int b43_dma_init(struct b43_wldev *dev)
1055 err = b43_dma_set_mask(dev, dmamask); 1055 err = b43_dma_set_mask(dev, dmamask);
1056 if (err) 1056 if (err)
1057 return err; 1057 return err;
1058 dma->translation = ssb_dma_translation(dev->sdev);
1058 1059
1059 err = -ENOMEM; 1060 err = -ENOMEM;
1060 /* setup TX DMA channels. */ 1061 /* setup TX DMA channels. */
@@ -1084,7 +1085,7 @@ int b43_dma_init(struct b43_wldev *dev)
1084 goto err_destroy_mcast; 1085 goto err_destroy_mcast;
1085 1086
1086 /* No support for the TX status DMA ring. */ 1087 /* No support for the TX status DMA ring. */
1087 B43_WARN_ON(dev->dev->id.revision < 5); 1088 B43_WARN_ON(dev->sdev->id.revision < 5);
1088 1089
1089 b43dbg(dev->wl, "%u-bit DMA initialized\n", 1090 b43dbg(dev->wl, "%u-bit DMA initialized\n",
1090 (unsigned int)type); 1091 (unsigned int)type);
diff --git a/drivers/net/wireless/b43/leds.c b/drivers/net/wireless/b43/leds.c
index c587115dd2b9..0cafafe368af 100644
--- a/drivers/net/wireless/b43/leds.c
+++ b/drivers/net/wireless/b43/leds.c
@@ -138,7 +138,7 @@ static int b43_register_led(struct b43_wldev *dev, struct b43_led *led,
138 led->led_dev.default_trigger = default_trigger; 138 led->led_dev.default_trigger = default_trigger;
139 led->led_dev.brightness_set = b43_led_brightness_set; 139 led->led_dev.brightness_set = b43_led_brightness_set;
140 140
141 err = led_classdev_register(dev->dev->dev, &led->led_dev); 141 err = led_classdev_register(dev->sdev->dev, &led->led_dev);
142 if (err) { 142 if (err) {
143 b43warn(dev->wl, "LEDs: Failed to register %s\n", name); 143 b43warn(dev->wl, "LEDs: Failed to register %s\n", name);
144 led->wl = NULL; 144 led->wl = NULL;
@@ -215,7 +215,7 @@ static void b43_led_get_sprominfo(struct b43_wldev *dev,
215 enum b43_led_behaviour *behaviour, 215 enum b43_led_behaviour *behaviour,
216 bool *activelow) 216 bool *activelow)
217{ 217{
218 struct ssb_bus *bus = dev->dev->bus; 218 struct ssb_bus *bus = dev->sdev->bus;
219 u8 sprom[4]; 219 u8 sprom[4];
220 220
221 sprom[0] = bus->sprom.gpio0; 221 sprom[0] = bus->sprom.gpio0;
diff --git a/drivers/net/wireless/b43/lo.c b/drivers/net/wireless/b43/lo.c
index 94e4f1378fc3..2ef7d4b38540 100644
--- a/drivers/net/wireless/b43/lo.c
+++ b/drivers/net/wireless/b43/lo.c
@@ -98,7 +98,7 @@ static u16 lo_measure_feedthrough(struct b43_wldev *dev,
98 rfover |= pga; 98 rfover |= pga;
99 rfover |= lna; 99 rfover |= lna;
100 rfover |= trsw_rx; 100 rfover |= trsw_rx;
101 if ((dev->dev->bus->sprom.boardflags_lo & B43_BFL_EXTLNA) 101 if ((dev->sdev->bus->sprom.boardflags_lo & B43_BFL_EXTLNA)
102 && phy->rev > 6) 102 && phy->rev > 6)
103 rfover |= B43_PHY_RFOVERVAL_EXTLNA; 103 rfover |= B43_PHY_RFOVERVAL_EXTLNA;
104 104
@@ -387,7 +387,7 @@ struct lo_g_saved_values {
387static void lo_measure_setup(struct b43_wldev *dev, 387static void lo_measure_setup(struct b43_wldev *dev,
388 struct lo_g_saved_values *sav) 388 struct lo_g_saved_values *sav)
389{ 389{
390 struct ssb_sprom *sprom = &dev->dev->bus->sprom; 390 struct ssb_sprom *sprom = &dev->sdev->bus->sprom;
391 struct b43_phy *phy = &dev->phy; 391 struct b43_phy *phy = &dev->phy;
392 struct b43_phy_g *gphy = phy->g; 392 struct b43_phy_g *gphy = phy->g;
393 struct b43_txpower_lo_control *lo = gphy->lo_control; 393 struct b43_txpower_lo_control *lo = gphy->lo_control;
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 5a43984bdcea..eb4159686985 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -548,7 +548,7 @@ void b43_tsf_read(struct b43_wldev *dev, u64 *tsf)
548{ 548{
549 u32 low, high; 549 u32 low, high;
550 550
551 B43_WARN_ON(dev->dev->id.revision < 3); 551 B43_WARN_ON(dev->sdev->id.revision < 3);
552 552
553 /* The hardware guarantees us an atomic read, if we 553 /* The hardware guarantees us an atomic read, if we
554 * read the low register first. */ 554 * read the low register first. */
@@ -586,7 +586,7 @@ static void b43_tsf_write_locked(struct b43_wldev *dev, u64 tsf)
586{ 586{
587 u32 low, high; 587 u32 low, high;
588 588
589 B43_WARN_ON(dev->dev->id.revision < 3); 589 B43_WARN_ON(dev->sdev->id.revision < 3);
590 590
591 low = tsf; 591 low = tsf;
592 high = (tsf >> 32); 592 high = (tsf >> 32);
@@ -714,7 +714,7 @@ void b43_dummy_transmission(struct b43_wldev *dev, bool ofdm, bool pa_on)
714 b43_ram_write(dev, i * 4, buffer[i]); 714 b43_ram_write(dev, i * 4, buffer[i]);
715 715
716 b43_write16(dev, 0x0568, 0x0000); 716 b43_write16(dev, 0x0568, 0x0000);
717 if (dev->dev->id.revision < 11) 717 if (dev->sdev->id.revision < 11)
718 b43_write16(dev, 0x07C0, 0x0000); 718 b43_write16(dev, 0x07C0, 0x0000);
719 else 719 else
720 b43_write16(dev, 0x07C0, 0x0100); 720 b43_write16(dev, 0x07C0, 0x0100);
@@ -1132,7 +1132,7 @@ void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags)
1132 b43_write32(dev, B43_MMIO_MACCTL, macctl); 1132 b43_write32(dev, B43_MMIO_MACCTL, macctl);
1133 /* Commit write */ 1133 /* Commit write */
1134 b43_read32(dev, B43_MMIO_MACCTL); 1134 b43_read32(dev, B43_MMIO_MACCTL);
1135 if (awake && dev->dev->id.revision >= 5) { 1135 if (awake && dev->sdev->id.revision >= 5) {
1136 /* Wait for the microcode to wake up. */ 1136 /* Wait for the microcode to wake up. */
1137 for (i = 0; i < 100; i++) { 1137 for (i = 0; i < 100; i++) {
1138 ucstat = b43_shm_read16(dev, B43_SHM_SHARED, 1138 ucstat = b43_shm_read16(dev, B43_SHM_SHARED,
@@ -1144,29 +1144,35 @@ void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags)
1144 } 1144 }
1145} 1145}
1146 1146
1147void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags) 1147static void b43_ssb_wireless_core_reset(struct b43_wldev *dev, u32 flags)
1148{ 1148{
1149 u32 tmslow; 1149 u32 tmslow;
1150 u32 macctl;
1151 1150
1152 flags |= B43_TMSLOW_PHYCLKEN; 1151 flags |= B43_TMSLOW_PHYCLKEN;
1153 flags |= B43_TMSLOW_PHYRESET; 1152 flags |= B43_TMSLOW_PHYRESET;
1154 if (dev->phy.type == B43_PHYTYPE_N) 1153 if (dev->phy.type == B43_PHYTYPE_N)
1155 flags |= B43_TMSLOW_PHY_BANDWIDTH_20MHZ; /* Make 20 MHz def */ 1154 flags |= B43_TMSLOW_PHY_BANDWIDTH_20MHZ; /* Make 20 MHz def */
1156 ssb_device_enable(dev->dev, flags); 1155 ssb_device_enable(dev->sdev, flags);
1157 msleep(2); /* Wait for the PLL to turn on. */ 1156 msleep(2); /* Wait for the PLL to turn on. */
1158 1157
1159 /* Now take the PHY out of Reset again */ 1158 /* Now take the PHY out of Reset again */
1160 tmslow = ssb_read32(dev->dev, SSB_TMSLOW); 1159 tmslow = ssb_read32(dev->sdev, SSB_TMSLOW);
1161 tmslow |= SSB_TMSLOW_FGC; 1160 tmslow |= SSB_TMSLOW_FGC;
1162 tmslow &= ~B43_TMSLOW_PHYRESET; 1161 tmslow &= ~B43_TMSLOW_PHYRESET;
1163 ssb_write32(dev->dev, SSB_TMSLOW, tmslow); 1162 ssb_write32(dev->sdev, SSB_TMSLOW, tmslow);
1164 ssb_read32(dev->dev, SSB_TMSLOW); /* flush */ 1163 ssb_read32(dev->sdev, SSB_TMSLOW); /* flush */
1165 msleep(1); 1164 msleep(1);
1166 tmslow &= ~SSB_TMSLOW_FGC; 1165 tmslow &= ~SSB_TMSLOW_FGC;
1167 ssb_write32(dev->dev, SSB_TMSLOW, tmslow); 1166 ssb_write32(dev->sdev, SSB_TMSLOW, tmslow);
1168 ssb_read32(dev->dev, SSB_TMSLOW); /* flush */ 1167 ssb_read32(dev->sdev, SSB_TMSLOW); /* flush */
1169 msleep(1); 1168 msleep(1);
1169}
1170
1171void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags)
1172{
1173 u32 macctl;
1174
1175 b43_ssb_wireless_core_reset(dev, flags);
1170 1176
1171 /* Turn Analog ON, but only if we already know the PHY-type. 1177 /* Turn Analog ON, but only if we already know the PHY-type.
1172 * This protects against very early setup where we don't know the 1178 * This protects against very early setup where we don't know the
@@ -1215,7 +1221,7 @@ static void drain_txstatus_queue(struct b43_wldev *dev)
1215{ 1221{
1216 u32 dummy; 1222 u32 dummy;
1217 1223
1218 if (dev->dev->id.revision < 5) 1224 if (dev->sdev->id.revision < 5)
1219 return; 1225 return;
1220 /* Read all entries from the microcode TXstatus FIFO 1226 /* Read all entries from the microcode TXstatus FIFO
1221 * and throw them away. 1227 * and throw them away.
@@ -1421,9 +1427,9 @@ u8 b43_ieee80211_antenna_sanitize(struct b43_wldev *dev,
1421 1427
1422 /* Get the mask of available antennas. */ 1428 /* Get the mask of available antennas. */
1423 if (dev->phy.gmode) 1429 if (dev->phy.gmode)
1424 antenna_mask = dev->dev->bus->sprom.ant_available_bg; 1430 antenna_mask = dev->sdev->bus->sprom.ant_available_bg;
1425 else 1431 else
1426 antenna_mask = dev->dev->bus->sprom.ant_available_a; 1432 antenna_mask = dev->sdev->bus->sprom.ant_available_a;
1427 1433
1428 if (!(antenna_mask & (1 << (antenna_nr - 1)))) { 1434 if (!(antenna_mask & (1 << (antenna_nr - 1)))) {
1429 /* This antenna is not available. Fall back to default. */ 1435 /* This antenna is not available. Fall back to default. */
@@ -1638,7 +1644,7 @@ static void b43_beacon_update_trigger_work(struct work_struct *work)
1638 mutex_lock(&wl->mutex); 1644 mutex_lock(&wl->mutex);
1639 dev = wl->current_dev; 1645 dev = wl->current_dev;
1640 if (likely(dev && (b43_status(dev) >= B43_STAT_INITIALIZED))) { 1646 if (likely(dev && (b43_status(dev) >= B43_STAT_INITIALIZED))) {
1641 if (dev->dev->bus->bustype == SSB_BUSTYPE_SDIO) { 1647 if (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) {
1642 /* wl->mutex is enough. */ 1648 /* wl->mutex is enough. */
1643 b43_do_beacon_update_trigger_work(dev); 1649 b43_do_beacon_update_trigger_work(dev);
1644 mmiowb(); 1650 mmiowb();
@@ -1683,7 +1689,7 @@ static void b43_update_templates(struct b43_wl *wl)
1683static void b43_set_beacon_int(struct b43_wldev *dev, u16 beacon_int) 1689static void b43_set_beacon_int(struct b43_wldev *dev, u16 beacon_int)
1684{ 1690{
1685 b43_time_lock(dev); 1691 b43_time_lock(dev);
1686 if (dev->dev->id.revision >= 3) { 1692 if (dev->sdev->id.revision >= 3) {
1687 b43_write32(dev, B43_MMIO_TSF_CFP_REP, (beacon_int << 16)); 1693 b43_write32(dev, B43_MMIO_TSF_CFP_REP, (beacon_int << 16));
1688 b43_write32(dev, B43_MMIO_TSF_CFP_START, (beacon_int << 10)); 1694 b43_write32(dev, B43_MMIO_TSF_CFP_START, (beacon_int << 10));
1689 } else { 1695 } else {
@@ -2057,7 +2063,7 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx,
2057 B43_WARN_ON(1); 2063 B43_WARN_ON(1);
2058 return -ENOSYS; 2064 return -ENOSYS;
2059 } 2065 }
2060 err = request_firmware(&blob, ctx->fwname, ctx->dev->dev->dev); 2066 err = request_firmware(&blob, ctx->fwname, ctx->dev->sdev->dev);
2061 if (err == -ENOENT) { 2067 if (err == -ENOENT) {
2062 snprintf(ctx->errors[ctx->req_type], 2068 snprintf(ctx->errors[ctx->req_type],
2063 sizeof(ctx->errors[ctx->req_type]), 2069 sizeof(ctx->errors[ctx->req_type]),
@@ -2107,13 +2113,12 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)
2107{ 2113{
2108 struct b43_wldev *dev = ctx->dev; 2114 struct b43_wldev *dev = ctx->dev;
2109 struct b43_firmware *fw = &ctx->dev->fw; 2115 struct b43_firmware *fw = &ctx->dev->fw;
2110 const u8 rev = ctx->dev->dev->id.revision; 2116 const u8 rev = ctx->dev->sdev->id.revision;
2111 const char *filename; 2117 const char *filename;
2112 u32 tmshigh; 2118 u32 tmshigh;
2113 int err; 2119 int err;
2114 2120
2115 /* Get microcode */ 2121 /* Get microcode */
2116 tmshigh = ssb_read32(dev->dev, SSB_TMSHIGH);
2117 if ((rev >= 5) && (rev <= 10)) 2122 if ((rev >= 5) && (rev <= 10))
2118 filename = "ucode5"; 2123 filename = "ucode5";
2119 else if ((rev >= 11) && (rev <= 12)) 2124 else if ((rev >= 11) && (rev <= 12))
@@ -2152,6 +2157,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)
2152 switch (dev->phy.type) { 2157 switch (dev->phy.type) {
2153 case B43_PHYTYPE_A: 2158 case B43_PHYTYPE_A:
2154 if ((rev >= 5) && (rev <= 10)) { 2159 if ((rev >= 5) && (rev <= 10)) {
2160 tmshigh = ssb_read32(dev->sdev, SSB_TMSHIGH);
2155 if (tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY) 2161 if (tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY)
2156 filename = "a0g1initvals5"; 2162 filename = "a0g1initvals5";
2157 else 2163 else
@@ -2196,6 +2202,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)
2196 switch (dev->phy.type) { 2202 switch (dev->phy.type) {
2197 case B43_PHYTYPE_A: 2203 case B43_PHYTYPE_A:
2198 if ((rev >= 5) && (rev <= 10)) { 2204 if ((rev >= 5) && (rev <= 10)) {
2205 tmshigh = ssb_read32(dev->sdev, SSB_TMSHIGH);
2199 if (tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY) 2206 if (tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY)
2200 filename = "a0g1bsinitvals5"; 2207 filename = "a0g1bsinitvals5";
2201 else 2208 else
@@ -2441,7 +2448,7 @@ static int b43_upload_microcode(struct b43_wldev *dev)
2441 2448
2442 snprintf(wiphy->fw_version, sizeof(wiphy->fw_version), "%u.%u", 2449 snprintf(wiphy->fw_version, sizeof(wiphy->fw_version), "%u.%u",
2443 dev->fw.rev, dev->fw.patch); 2450 dev->fw.rev, dev->fw.patch);
2444 wiphy->hw_version = dev->dev->id.coreid; 2451 wiphy->hw_version = dev->sdev->id.coreid;
2445 2452
2446 if (b43_is_old_txhdr_format(dev)) { 2453 if (b43_is_old_txhdr_format(dev)) {
2447 /* We're over the deadline, but we keep support for old fw 2454 /* We're over the deadline, but we keep support for old fw
@@ -2557,10 +2564,20 @@ out:
2557/* Initialize the GPIOs 2564/* Initialize the GPIOs
2558 * http://bcm-specs.sipsolutions.net/GPIO 2565 * http://bcm-specs.sipsolutions.net/GPIO
2559 */ 2566 */
2567static struct ssb_device *b43_ssb_gpio_dev(struct b43_wldev *dev)
2568{
2569 struct ssb_bus *bus = dev->sdev->bus;
2570
2571#ifdef CONFIG_SSB_DRIVER_PCICORE
2572 return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
2573#else
2574 return bus->chipco.dev;
2575#endif
2576}
2577
2560static int b43_gpio_init(struct b43_wldev *dev) 2578static int b43_gpio_init(struct b43_wldev *dev)
2561{ 2579{
2562 struct ssb_bus *bus = dev->dev->bus; 2580 struct ssb_device *gpiodev;
2563 struct ssb_device *gpiodev, *pcidev = NULL;
2564 u32 mask, set; 2581 u32 mask, set;
2565 2582
2566 b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL) 2583 b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL)
@@ -2571,7 +2588,7 @@ static int b43_gpio_init(struct b43_wldev *dev)
2571 2588
2572 mask = 0x0000001F; 2589 mask = 0x0000001F;
2573 set = 0x0000000F; 2590 set = 0x0000000F;
2574 if (dev->dev->bus->chip_id == 0x4301) { 2591 if (dev->sdev->bus->chip_id == 0x4301) {
2575 mask |= 0x0060; 2592 mask |= 0x0060;
2576 set |= 0x0060; 2593 set |= 0x0060;
2577 } 2594 }
@@ -2582,25 +2599,21 @@ static int b43_gpio_init(struct b43_wldev *dev)
2582 mask |= 0x0180; 2599 mask |= 0x0180;
2583 set |= 0x0180; 2600 set |= 0x0180;
2584 } 2601 }
2585 if (dev->dev->bus->sprom.boardflags_lo & B43_BFL_PACTRL) { 2602 if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_PACTRL) {
2586 b43_write16(dev, B43_MMIO_GPIO_MASK, 2603 b43_write16(dev, B43_MMIO_GPIO_MASK,
2587 b43_read16(dev, B43_MMIO_GPIO_MASK) 2604 b43_read16(dev, B43_MMIO_GPIO_MASK)
2588 | 0x0200); 2605 | 0x0200);
2589 mask |= 0x0200; 2606 mask |= 0x0200;
2590 set |= 0x0200; 2607 set |= 0x0200;
2591 } 2608 }
2592 if (dev->dev->id.revision >= 2) 2609 if (dev->sdev->id.revision >= 2)
2593 mask |= 0x0010; /* FIXME: This is redundant. */ 2610 mask |= 0x0010; /* FIXME: This is redundant. */
2594 2611
2595#ifdef CONFIG_SSB_DRIVER_PCICORE 2612 gpiodev = b43_ssb_gpio_dev(dev);
2596 pcidev = bus->pcicore.dev; 2613 if (gpiodev)
2597#endif 2614 ssb_write32(gpiodev, B43_GPIO_CONTROL,
2598 gpiodev = bus->chipco.dev ? : pcidev; 2615 (ssb_read32(gpiodev, B43_GPIO_CONTROL)
2599 if (!gpiodev) 2616 & mask) | set);
2600 return 0;
2601 ssb_write32(gpiodev, B43_GPIO_CONTROL,
2602 (ssb_read32(gpiodev, B43_GPIO_CONTROL)
2603 & mask) | set);
2604 2617
2605 return 0; 2618 return 0;
2606} 2619}
@@ -2608,16 +2621,11 @@ static int b43_gpio_init(struct b43_wldev *dev)
2608/* Turn off all GPIO stuff. Call this on module unload, for example. */ 2621/* Turn off all GPIO stuff. Call this on module unload, for example. */
2609static void b43_gpio_cleanup(struct b43_wldev *dev) 2622static void b43_gpio_cleanup(struct b43_wldev *dev)
2610{ 2623{
2611 struct ssb_bus *bus = dev->dev->bus; 2624 struct ssb_device *gpiodev;
2612 struct ssb_device *gpiodev, *pcidev = NULL;
2613 2625
2614#ifdef CONFIG_SSB_DRIVER_PCICORE 2626 gpiodev = b43_ssb_gpio_dev(dev);
2615 pcidev = bus->pcicore.dev; 2627 if (gpiodev)
2616#endif 2628 ssb_write32(gpiodev, B43_GPIO_CONTROL, 0);
2617 gpiodev = bus->chipco.dev ? : pcidev;
2618 if (!gpiodev)
2619 return;
2620 ssb_write32(gpiodev, B43_GPIO_CONTROL, 0);
2621} 2629}
2622 2630
2623/* http://bcm-specs.sipsolutions.net/EnableMac */ 2631/* http://bcm-specs.sipsolutions.net/EnableMac */
@@ -2689,12 +2697,12 @@ out:
2689/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/MacPhyClkSet */ 2697/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/MacPhyClkSet */
2690void b43_mac_phy_clock_set(struct b43_wldev *dev, bool on) 2698void b43_mac_phy_clock_set(struct b43_wldev *dev, bool on)
2691{ 2699{
2692 u32 tmslow = ssb_read32(dev->dev, SSB_TMSLOW); 2700 u32 tmslow = ssb_read32(dev->sdev, SSB_TMSLOW);
2693 if (on) 2701 if (on)
2694 tmslow |= B43_TMSLOW_MACPHYCLKEN; 2702 tmslow |= B43_TMSLOW_MACPHYCLKEN;
2695 else 2703 else
2696 tmslow &= ~B43_TMSLOW_MACPHYCLKEN; 2704 tmslow &= ~B43_TMSLOW_MACPHYCLKEN;
2697 ssb_write32(dev->dev, SSB_TMSLOW, tmslow); 2705 ssb_write32(dev->sdev, SSB_TMSLOW, tmslow);
2698} 2706}
2699 2707
2700static void b43_adjust_opmode(struct b43_wldev *dev) 2708static void b43_adjust_opmode(struct b43_wldev *dev)
@@ -2733,15 +2741,15 @@ static void b43_adjust_opmode(struct b43_wldev *dev)
2733 /* Workaround: On old hardware the HW-MAC-address-filter 2741 /* Workaround: On old hardware the HW-MAC-address-filter
2734 * doesn't work properly, so always run promisc in filter 2742 * doesn't work properly, so always run promisc in filter
2735 * it in software. */ 2743 * it in software. */
2736 if (dev->dev->id.revision <= 4) 2744 if (dev->sdev->id.revision <= 4)
2737 ctl |= B43_MACCTL_PROMISC; 2745 ctl |= B43_MACCTL_PROMISC;
2738 2746
2739 b43_write32(dev, B43_MMIO_MACCTL, ctl); 2747 b43_write32(dev, B43_MMIO_MACCTL, ctl);
2740 2748
2741 cfp_pretbtt = 2; 2749 cfp_pretbtt = 2;
2742 if ((ctl & B43_MACCTL_INFRA) && !(ctl & B43_MACCTL_AP)) { 2750 if ((ctl & B43_MACCTL_INFRA) && !(ctl & B43_MACCTL_AP)) {
2743 if (dev->dev->bus->chip_id == 0x4306 && 2751 if (dev->sdev->bus->chip_id == 0x4306 &&
2744 dev->dev->bus->chip_rev == 3) 2752 dev->sdev->bus->chip_rev == 3)
2745 cfp_pretbtt = 100; 2753 cfp_pretbtt = 100;
2746 else 2754 else
2747 cfp_pretbtt = 50; 2755 cfp_pretbtt = 50;
@@ -2899,7 +2907,7 @@ static int b43_chip_init(struct b43_wldev *dev)
2899 b43_write16(dev, 0x005E, value16); 2907 b43_write16(dev, 0x005E, value16);
2900 } 2908 }
2901 b43_write32(dev, 0x0100, 0x01000000); 2909 b43_write32(dev, 0x0100, 0x01000000);
2902 if (dev->dev->id.revision < 5) 2910 if (dev->sdev->id.revision < 5)
2903 b43_write32(dev, 0x010C, 0x01000000); 2911 b43_write32(dev, 0x010C, 0x01000000);
2904 2912
2905 b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL) 2913 b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL)
@@ -2914,7 +2922,7 @@ static int b43_chip_init(struct b43_wldev *dev)
2914 /* Initially set the wireless operation mode. */ 2922 /* Initially set the wireless operation mode. */
2915 b43_adjust_opmode(dev); 2923 b43_adjust_opmode(dev);
2916 2924
2917 if (dev->dev->id.revision < 3) { 2925 if (dev->sdev->id.revision < 3) {
2918 b43_write16(dev, 0x060E, 0x0000); 2926 b43_write16(dev, 0x060E, 0x0000);
2919 b43_write16(dev, 0x0610, 0x8000); 2927 b43_write16(dev, 0x0610, 0x8000);
2920 b43_write16(dev, 0x0604, 0x0000); 2928 b43_write16(dev, 0x0604, 0x0000);
@@ -2934,7 +2942,7 @@ static int b43_chip_init(struct b43_wldev *dev)
2934 b43_mac_phy_clock_set(dev, true); 2942 b43_mac_phy_clock_set(dev, true);
2935 2943
2936 b43_write16(dev, B43_MMIO_POWERUP_DELAY, 2944 b43_write16(dev, B43_MMIO_POWERUP_DELAY,
2937 dev->dev->bus->chipco.fast_pwrup_delay); 2945 dev->sdev->bus->chipco.fast_pwrup_delay);
2938 2946
2939 err = 0; 2947 err = 0;
2940 b43dbg(dev->wl, "Chip initialized\n"); 2948 b43dbg(dev->wl, "Chip initialized\n");
@@ -3097,7 +3105,7 @@ static int b43_validate_chipaccess(struct b43_wldev *dev)
3097 b43_shm_write32(dev, B43_SHM_SHARED, 0, backup0); 3105 b43_shm_write32(dev, B43_SHM_SHARED, 0, backup0);
3098 b43_shm_write32(dev, B43_SHM_SHARED, 4, backup4); 3106 b43_shm_write32(dev, B43_SHM_SHARED, 4, backup4);
3099 3107
3100 if ((dev->dev->id.revision >= 3) && (dev->dev->id.revision <= 10)) { 3108 if ((dev->sdev->id.revision >= 3) && (dev->sdev->id.revision <= 10)) {
3101 /* The 32bit register shadows the two 16bit registers 3109 /* The 32bit register shadows the two 16bit registers
3102 * with update sideeffects. Validate this. */ 3110 * with update sideeffects. Validate this. */
3103 b43_write16(dev, B43_MMIO_TSF_CFP_START, 0xAAAA); 3111 b43_write16(dev, B43_MMIO_TSF_CFP_START, 0xAAAA);
@@ -3450,7 +3458,7 @@ static void b43_op_set_tsf(struct ieee80211_hw *hw, u64 tsf)
3450 3458
3451static void b43_put_phy_into_reset(struct b43_wldev *dev) 3459static void b43_put_phy_into_reset(struct b43_wldev *dev)
3452{ 3460{
3453 struct ssb_device *sdev = dev->dev; 3461 struct ssb_device *sdev = dev->sdev;
3454 u32 tmslow; 3462 u32 tmslow;
3455 3463
3456 tmslow = ssb_read32(sdev, SSB_TMSLOW); 3464 tmslow = ssb_read32(sdev, SSB_TMSLOW);
@@ -3946,7 +3954,7 @@ redo:
3946 3954
3947 /* Disable interrupts on the device. */ 3955 /* Disable interrupts on the device. */
3948 b43_set_status(dev, B43_STAT_INITIALIZED); 3956 b43_set_status(dev, B43_STAT_INITIALIZED);
3949 if (dev->dev->bus->bustype == SSB_BUSTYPE_SDIO) { 3957 if (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) {
3950 /* wl->mutex is locked. That is enough. */ 3958 /* wl->mutex is locked. That is enough. */
3951 b43_write32(dev, B43_MMIO_GEN_IRQ_MASK, 0); 3959 b43_write32(dev, B43_MMIO_GEN_IRQ_MASK, 0);
3952 b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); /* Flush */ 3960 b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); /* Flush */
@@ -3959,11 +3967,11 @@ redo:
3959 /* Synchronize and free the interrupt handlers. Unlock to avoid deadlocks. */ 3967 /* Synchronize and free the interrupt handlers. Unlock to avoid deadlocks. */
3960 orig_dev = dev; 3968 orig_dev = dev;
3961 mutex_unlock(&wl->mutex); 3969 mutex_unlock(&wl->mutex);
3962 if (dev->dev->bus->bustype == SSB_BUSTYPE_SDIO) { 3970 if (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) {
3963 b43_sdio_free_irq(dev); 3971 b43_sdio_free_irq(dev);
3964 } else { 3972 } else {
3965 synchronize_irq(dev->dev->irq); 3973 synchronize_irq(dev->sdev->irq);
3966 free_irq(dev->dev->irq, dev); 3974 free_irq(dev->sdev->irq, dev);
3967 } 3975 }
3968 mutex_lock(&wl->mutex); 3976 mutex_lock(&wl->mutex);
3969 dev = wl->current_dev; 3977 dev = wl->current_dev;
@@ -3996,18 +4004,19 @@ static int b43_wireless_core_start(struct b43_wldev *dev)
3996 B43_WARN_ON(b43_status(dev) != B43_STAT_INITIALIZED); 4004 B43_WARN_ON(b43_status(dev) != B43_STAT_INITIALIZED);
3997 4005
3998 drain_txstatus_queue(dev); 4006 drain_txstatus_queue(dev);
3999 if (dev->dev->bus->bustype == SSB_BUSTYPE_SDIO) { 4007 if (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) {
4000 err = b43_sdio_request_irq(dev, b43_sdio_interrupt_handler); 4008 err = b43_sdio_request_irq(dev, b43_sdio_interrupt_handler);
4001 if (err) { 4009 if (err) {
4002 b43err(dev->wl, "Cannot request SDIO IRQ\n"); 4010 b43err(dev->wl, "Cannot request SDIO IRQ\n");
4003 goto out; 4011 goto out;
4004 } 4012 }
4005 } else { 4013 } else {
4006 err = request_threaded_irq(dev->dev->irq, b43_interrupt_handler, 4014 err = request_threaded_irq(dev->sdev->irq, b43_interrupt_handler,
4007 b43_interrupt_thread_handler, 4015 b43_interrupt_thread_handler,
4008 IRQF_SHARED, KBUILD_MODNAME, dev); 4016 IRQF_SHARED, KBUILD_MODNAME, dev);
4009 if (err) { 4017 if (err) {
4010 b43err(dev->wl, "Cannot request IRQ-%d\n", dev->dev->irq); 4018 b43err(dev->wl, "Cannot request IRQ-%d\n",
4019 dev->sdev->irq);
4011 goto out; 4020 goto out;
4012 } 4021 }
4013 } 4022 }
@@ -4087,10 +4096,10 @@ static int b43_phy_versioning(struct b43_wldev *dev)
4087 analog_type, phy_type, phy_rev); 4096 analog_type, phy_type, phy_rev);
4088 4097
4089 /* Get RADIO versioning */ 4098 /* Get RADIO versioning */
4090 if (dev->dev->bus->chip_id == 0x4317) { 4099 if (dev->sdev->bus->chip_id == 0x4317) {
4091 if (dev->dev->bus->chip_rev == 0) 4100 if (dev->sdev->bus->chip_rev == 0)
4092 tmp = 0x3205017F; 4101 tmp = 0x3205017F;
4093 else if (dev->dev->bus->chip_rev == 1) 4102 else if (dev->sdev->bus->chip_rev == 1)
4094 tmp = 0x4205017F; 4103 tmp = 0x4205017F;
4095 else 4104 else
4096 tmp = 0x5205017F; 4105 tmp = 0x5205017F;
@@ -4195,7 +4204,7 @@ static void setup_struct_wldev_for_init(struct b43_wldev *dev)
4195 4204
4196static void b43_bluetooth_coext_enable(struct b43_wldev *dev) 4205static void b43_bluetooth_coext_enable(struct b43_wldev *dev)
4197{ 4206{
4198 struct ssb_sprom *sprom = &dev->dev->bus->sprom; 4207 struct ssb_sprom *sprom = &dev->sdev->bus->sprom;
4199 u64 hf; 4208 u64 hf;
4200 4209
4201 if (!modparam_btcoex) 4210 if (!modparam_btcoex)
@@ -4222,16 +4231,16 @@ static void b43_bluetooth_coext_disable(struct b43_wldev *dev)
4222 4231
4223static void b43_imcfglo_timeouts_workaround(struct b43_wldev *dev) 4232static void b43_imcfglo_timeouts_workaround(struct b43_wldev *dev)
4224{ 4233{
4225 struct ssb_bus *bus = dev->dev->bus; 4234 struct ssb_bus *bus = dev->sdev->bus;
4226 u32 tmp; 4235 u32 tmp;
4227 4236
4228 if ((bus->chip_id == 0x4311 && bus->chip_rev == 2) || 4237 if ((bus->chip_id == 0x4311 && bus->chip_rev == 2) ||
4229 (bus->chip_id == 0x4312)) { 4238 (bus->chip_id == 0x4312)) {
4230 tmp = ssb_read32(dev->dev, SSB_IMCFGLO); 4239 tmp = ssb_read32(dev->sdev, SSB_IMCFGLO);
4231 tmp &= ~SSB_IMCFGLO_REQTO; 4240 tmp &= ~SSB_IMCFGLO_REQTO;
4232 tmp &= ~SSB_IMCFGLO_SERTO; 4241 tmp &= ~SSB_IMCFGLO_SERTO;
4233 tmp |= 0x3; 4242 tmp |= 0x3;
4234 ssb_write32(dev->dev, SSB_IMCFGLO, tmp); 4243 ssb_write32(dev->sdev, SSB_IMCFGLO, tmp);
4235 ssb_commit_settings(bus); 4244 ssb_commit_settings(bus);
4236 } 4245 }
4237} 4246}
@@ -4301,14 +4310,14 @@ static void b43_wireless_core_exit(struct b43_wldev *dev)
4301 dev->wl->current_beacon = NULL; 4310 dev->wl->current_beacon = NULL;
4302 } 4311 }
4303 4312
4304 ssb_device_disable(dev->dev, 0); 4313 ssb_device_disable(dev->sdev, 0);
4305 ssb_bus_may_powerdown(dev->dev->bus); 4314 ssb_bus_may_powerdown(dev->sdev->bus);
4306} 4315}
4307 4316
4308/* Initialize a wireless core */ 4317/* Initialize a wireless core */
4309static int b43_wireless_core_init(struct b43_wldev *dev) 4318static int b43_wireless_core_init(struct b43_wldev *dev)
4310{ 4319{
4311 struct ssb_bus *bus = dev->dev->bus; 4320 struct ssb_bus *bus = dev->sdev->bus;
4312 struct ssb_sprom *sprom = &bus->sprom; 4321 struct ssb_sprom *sprom = &bus->sprom;
4313 struct b43_phy *phy = &dev->phy; 4322 struct b43_phy *phy = &dev->phy;
4314 int err; 4323 int err;
@@ -4320,7 +4329,7 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
4320 err = ssb_bus_powerup(bus, 0); 4329 err = ssb_bus_powerup(bus, 0);
4321 if (err) 4330 if (err)
4322 goto out; 4331 goto out;
4323 if (!ssb_device_is_enabled(dev->dev)) { 4332 if (!ssb_device_is_enabled(dev->sdev)) {
4324 tmp = phy->gmode ? B43_TMSLOW_GMODE : 0; 4333 tmp = phy->gmode ? B43_TMSLOW_GMODE : 0;
4325 b43_wireless_core_reset(dev, tmp); 4334 b43_wireless_core_reset(dev, tmp);
4326 } 4335 }
@@ -4330,7 +4339,7 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
4330 phy->ops->prepare_structs(dev); 4339 phy->ops->prepare_structs(dev);
4331 4340
4332 /* Enable IRQ routing to this device. */ 4341 /* Enable IRQ routing to this device. */
4333 ssb_pcicore_dev_irqvecs_enable(&bus->pcicore, dev->dev); 4342 ssb_pcicore_dev_irqvecs_enable(&bus->pcicore, dev->sdev);
4334 4343
4335 b43_imcfglo_timeouts_workaround(dev); 4344 b43_imcfglo_timeouts_workaround(dev);
4336 b43_bluetooth_coext_disable(dev); 4345 b43_bluetooth_coext_disable(dev);
@@ -4343,7 +4352,7 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
4343 if (err) 4352 if (err)
4344 goto err_busdown; 4353 goto err_busdown;
4345 b43_shm_write16(dev, B43_SHM_SHARED, 4354 b43_shm_write16(dev, B43_SHM_SHARED,
4346 B43_SHM_SH_WLCOREREV, dev->dev->id.revision); 4355 B43_SHM_SH_WLCOREREV, dev->sdev->id.revision);
4347 hf = b43_hf_read(dev); 4356 hf = b43_hf_read(dev);
4348 if (phy->type == B43_PHYTYPE_G) { 4357 if (phy->type == B43_PHYTYPE_G) {
4349 hf |= B43_HF_SYMW; 4358 hf |= B43_HF_SYMW;
@@ -4390,8 +4399,8 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
4390 /* Maximum Contention Window */ 4399 /* Maximum Contention Window */
4391 b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_MAXCONT, 0x3FF); 4400 b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_MAXCONT, 0x3FF);
4392 4401
4393 if ((dev->dev->bus->bustype == SSB_BUSTYPE_PCMCIA) || 4402 if ((dev->sdev->bus->bustype == SSB_BUSTYPE_PCMCIA) ||
4394 (dev->dev->bus->bustype == SSB_BUSTYPE_SDIO) || 4403 (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) ||
4395 dev->use_pio) { 4404 dev->use_pio) {
4396 dev->__using_pio_transfers = 1; 4405 dev->__using_pio_transfers = 1;
4397 err = b43_pio_init(dev); 4406 err = b43_pio_init(dev);
@@ -4728,7 +4737,7 @@ static void b43_wireless_core_detach(struct b43_wldev *dev)
4728static int b43_wireless_core_attach(struct b43_wldev *dev) 4737static int b43_wireless_core_attach(struct b43_wldev *dev)
4729{ 4738{
4730 struct b43_wl *wl = dev->wl; 4739 struct b43_wl *wl = dev->wl;
4731 struct ssb_bus *bus = dev->dev->bus; 4740 struct ssb_bus *bus = dev->sdev->bus;
4732 struct pci_dev *pdev = (bus->bustype == SSB_BUSTYPE_PCI) ? bus->host_pci : NULL; 4741 struct pci_dev *pdev = (bus->bustype == SSB_BUSTYPE_PCI) ? bus->host_pci : NULL;
4733 int err; 4742 int err;
4734 bool have_2ghz_phy = 0, have_5ghz_phy = 0; 4743 bool have_2ghz_phy = 0, have_5ghz_phy = 0;
@@ -4747,10 +4756,10 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
4747 goto out; 4756 goto out;
4748 } 4757 }
4749 /* Get the PHY type. */ 4758 /* Get the PHY type. */
4750 if (dev->dev->id.revision >= 5) { 4759 if (dev->sdev->id.revision >= 5) {
4751 u32 tmshigh; 4760 u32 tmshigh;
4752 4761
4753 tmshigh = ssb_read32(dev->dev, SSB_TMSHIGH); 4762 tmshigh = ssb_read32(dev->sdev, SSB_TMSHIGH);
4754 have_2ghz_phy = !!(tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY); 4763 have_2ghz_phy = !!(tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY);
4755 have_5ghz_phy = !!(tmshigh & B43_TMSHIGH_HAVE_5GHZ_PHY); 4764 have_5ghz_phy = !!(tmshigh & B43_TMSHIGH_HAVE_5GHZ_PHY);
4756 } else 4765 } else
@@ -4823,7 +4832,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
4823 INIT_WORK(&dev->restart_work, b43_chip_reset); 4832 INIT_WORK(&dev->restart_work, b43_chip_reset);
4824 4833
4825 dev->phy.ops->switch_analog(dev, 0); 4834 dev->phy.ops->switch_analog(dev, 0);
4826 ssb_device_disable(dev->dev, 0); 4835 ssb_device_disable(dev->sdev, 0);
4827 ssb_bus_may_powerdown(bus); 4836 ssb_bus_may_powerdown(bus);
4828 4837
4829out: 4838out:
@@ -4864,7 +4873,7 @@ static int b43_one_core_attach(struct ssb_device *dev, struct b43_wl *wl)
4864 goto out; 4873 goto out;
4865 4874
4866 wldev->use_pio = b43_modparam_pio; 4875 wldev->use_pio = b43_modparam_pio;
4867 wldev->dev = dev; 4876 wldev->sdev = dev;
4868 wldev->wl = wl; 4877 wldev->wl = wl;
4869 b43_set_status(wldev, B43_STAT_UNINIT); 4878 b43_set_status(wldev, B43_STAT_UNINIT);
4870 wldev->bad_frames_preempt = modparam_bad_frames_preempt; 4879 wldev->bad_frames_preempt = modparam_bad_frames_preempt;
@@ -4925,19 +4934,16 @@ static void b43_wireless_exit(struct ssb_device *dev, struct b43_wl *wl)
4925 ieee80211_free_hw(hw); 4934 ieee80211_free_hw(hw);
4926} 4935}
4927 4936
4928static int b43_wireless_init(struct ssb_device *dev) 4937static struct b43_wl *b43_wireless_init(struct ssb_device *dev)
4929{ 4938{
4930 struct ssb_sprom *sprom = &dev->bus->sprom; 4939 struct ssb_sprom *sprom = &dev->bus->sprom;
4931 struct ieee80211_hw *hw; 4940 struct ieee80211_hw *hw;
4932 struct b43_wl *wl; 4941 struct b43_wl *wl;
4933 int err = -ENOMEM;
4934
4935 b43_sprom_fixup(dev->bus);
4936 4942
4937 hw = ieee80211_alloc_hw(sizeof(*wl), &b43_hw_ops); 4943 hw = ieee80211_alloc_hw(sizeof(*wl), &b43_hw_ops);
4938 if (!hw) { 4944 if (!hw) {
4939 b43err(NULL, "Could not allocate ieee80211 device\n"); 4945 b43err(NULL, "Could not allocate ieee80211 device\n");
4940 goto out; 4946 return ERR_PTR(-ENOMEM);
4941 } 4947 }
4942 wl = hw_to_b43_wl(hw); 4948 wl = hw_to_b43_wl(hw);
4943 4949
@@ -4971,12 +4977,9 @@ static int b43_wireless_init(struct ssb_device *dev)
4971 INIT_WORK(&wl->tx_work, b43_tx_work); 4977 INIT_WORK(&wl->tx_work, b43_tx_work);
4972 skb_queue_head_init(&wl->tx_queue); 4978 skb_queue_head_init(&wl->tx_queue);
4973 4979
4974 ssb_set_devtypedata(dev, wl);
4975 b43info(wl, "Broadcom %04X WLAN found (core revision %u)\n", 4980 b43info(wl, "Broadcom %04X WLAN found (core revision %u)\n",
4976 dev->bus->chip_id, dev->id.revision); 4981 dev->bus->chip_id, dev->id.revision);
4977 err = 0; 4982 return wl;
4978out:
4979 return err;
4980} 4983}
4981 4984
4982static int b43_ssb_probe(struct ssb_device *dev, const struct ssb_device_id *id) 4985static int b43_ssb_probe(struct ssb_device *dev, const struct ssb_device_id *id)
@@ -4989,11 +4992,14 @@ static int b43_ssb_probe(struct ssb_device *dev, const struct ssb_device_id *id)
4989 if (!wl) { 4992 if (!wl) {
4990 /* Probing the first core. Must setup common struct b43_wl */ 4993 /* Probing the first core. Must setup common struct b43_wl */
4991 first = 1; 4994 first = 1;
4992 err = b43_wireless_init(dev); 4995 b43_sprom_fixup(dev->bus);
4993 if (err) 4996 wl = b43_wireless_init(dev);
4997 if (IS_ERR(wl)) {
4998 err = PTR_ERR(wl);
4994 goto out; 4999 goto out;
4995 wl = ssb_get_devtypedata(dev); 5000 }
4996 B43_WARN_ON(!wl); 5001 ssb_set_devtypedata(dev, wl);
5002 B43_WARN_ON(ssb_get_devtypedata(dev) != wl);
4997 } 5003 }
4998 err = b43_one_core_attach(dev, wl); 5004 err = b43_one_core_attach(dev, wl);
4999 if (err) 5005 if (err)
diff --git a/drivers/net/wireless/b43/phy_a.c b/drivers/net/wireless/b43/phy_a.c
index b6428ec16dd6..b01c8ced57c3 100644
--- a/drivers/net/wireless/b43/phy_a.c
+++ b/drivers/net/wireless/b43/phy_a.c
@@ -265,7 +265,7 @@ static void hardware_pctl_init_aphy(struct b43_wldev *dev)
265 265
266void b43_phy_inita(struct b43_wldev *dev) 266void b43_phy_inita(struct b43_wldev *dev)
267{ 267{
268 struct ssb_bus *bus = dev->dev->bus; 268 struct ssb_bus *bus = dev->sdev->bus;
269 struct b43_phy *phy = &dev->phy; 269 struct b43_phy *phy = &dev->phy;
270 270
271 /* This lowlevel A-PHY init is also called from G-PHY init. 271 /* This lowlevel A-PHY init is also called from G-PHY init.
@@ -311,7 +311,7 @@ void b43_phy_inita(struct b43_wldev *dev)
311 } 311 }
312 312
313 if ((phy->type == B43_PHYTYPE_G) && 313 if ((phy->type == B43_PHYTYPE_G) &&
314 (dev->dev->bus->sprom.boardflags_lo & B43_BFL_PACTRL)) { 314 (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_PACTRL)) {
315 b43_phy_maskset(dev, B43_PHY_OFDM(0x6E), 0xE000, 0x3CF); 315 b43_phy_maskset(dev, B43_PHY_OFDM(0x6E), 0xE000, 0x3CF);
316 } 316 }
317} 317}
@@ -323,17 +323,17 @@ static int b43_aphy_init_tssi2dbm_table(struct b43_wldev *dev)
323 struct b43_phy_a *aphy = phy->a; 323 struct b43_phy_a *aphy = phy->a;
324 s16 pab0, pab1, pab2; 324 s16 pab0, pab1, pab2;
325 325
326 pab0 = (s16) (dev->dev->bus->sprom.pa1b0); 326 pab0 = (s16) (dev->sdev->bus->sprom.pa1b0);
327 pab1 = (s16) (dev->dev->bus->sprom.pa1b1); 327 pab1 = (s16) (dev->sdev->bus->sprom.pa1b1);
328 pab2 = (s16) (dev->dev->bus->sprom.pa1b2); 328 pab2 = (s16) (dev->sdev->bus->sprom.pa1b2);
329 329
330 if (pab0 != 0 && pab1 != 0 && pab2 != 0 && 330 if (pab0 != 0 && pab1 != 0 && pab2 != 0 &&
331 pab0 != -1 && pab1 != -1 && pab2 != -1) { 331 pab0 != -1 && pab1 != -1 && pab2 != -1) {
332 /* The pabX values are set in SPROM. Use them. */ 332 /* The pabX values are set in SPROM. Use them. */
333 if ((s8) dev->dev->bus->sprom.itssi_a != 0 && 333 if ((s8) dev->sdev->bus->sprom.itssi_a != 0 &&
334 (s8) dev->dev->bus->sprom.itssi_a != -1) 334 (s8) dev->sdev->bus->sprom.itssi_a != -1)
335 aphy->tgt_idle_tssi = 335 aphy->tgt_idle_tssi =
336 (s8) (dev->dev->bus->sprom.itssi_a); 336 (s8) (dev->sdev->bus->sprom.itssi_a);
337 else 337 else
338 aphy->tgt_idle_tssi = 62; 338 aphy->tgt_idle_tssi = 62;
339 aphy->tssi2dbm = b43_generate_dyn_tssi2dbm_tab(dev, pab0, 339 aphy->tssi2dbm = b43_generate_dyn_tssi2dbm_tab(dev, pab0,
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
index b5c5ce94d3fd..e46b2f4f0920 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -168,7 +168,7 @@ void b43_phy_lock(struct b43_wldev *dev)
168 B43_WARN_ON(dev->phy.phy_locked); 168 B43_WARN_ON(dev->phy.phy_locked);
169 dev->phy.phy_locked = 1; 169 dev->phy.phy_locked = 1;
170#endif 170#endif
171 B43_WARN_ON(dev->dev->id.revision < 3); 171 B43_WARN_ON(dev->sdev->id.revision < 3);
172 172
173 if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP)) 173 if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP))
174 b43_power_saving_ctl_bits(dev, B43_PS_AWAKE); 174 b43_power_saving_ctl_bits(dev, B43_PS_AWAKE);
@@ -180,7 +180,7 @@ void b43_phy_unlock(struct b43_wldev *dev)
180 B43_WARN_ON(!dev->phy.phy_locked); 180 B43_WARN_ON(!dev->phy.phy_locked);
181 dev->phy.phy_locked = 0; 181 dev->phy.phy_locked = 0;
182#endif 182#endif
183 B43_WARN_ON(dev->dev->id.revision < 3); 183 B43_WARN_ON(dev->sdev->id.revision < 3);
184 184
185 if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP)) 185 if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP))
186 b43_power_saving_ctl_bits(dev, 0); 186 b43_power_saving_ctl_bits(dev, 0);
@@ -368,8 +368,8 @@ void b43_phy_txpower_check(struct b43_wldev *dev, unsigned int flags)
368 /* The next check will be needed in two seconds, or later. */ 368 /* The next check will be needed in two seconds, or later. */
369 phy->next_txpwr_check_time = round_jiffies(now + (HZ * 2)); 369 phy->next_txpwr_check_time = round_jiffies(now + (HZ * 2));
370 370
371 if ((dev->dev->bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM) && 371 if ((dev->sdev->bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM) &&
372 (dev->dev->bus->boardinfo.type == SSB_BOARD_BU4306)) 372 (dev->sdev->bus->boardinfo.type == SSB_BOARD_BU4306))
373 return; /* No software txpower adjustment needed */ 373 return; /* No software txpower adjustment needed */
374 374
375 result = phy->ops->recalc_txpower(dev, !!(flags & B43_TXPWR_IGNORE_TSSI)); 375 result = phy->ops->recalc_txpower(dev, !!(flags & B43_TXPWR_IGNORE_TSSI));
diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c
index be4828167012..1758a282f913 100644
--- a/drivers/net/wireless/b43/phy_g.c
+++ b/drivers/net/wireless/b43/phy_g.c
@@ -718,7 +718,7 @@ static void b43_calc_nrssi_threshold(struct b43_wldev *dev)
718 B43_WARN_ON(phy->type != B43_PHYTYPE_G); 718 B43_WARN_ON(phy->type != B43_PHYTYPE_G);
719 719
720 if (!phy->gmode || 720 if (!phy->gmode ||
721 !(dev->dev->bus->sprom.boardflags_lo & B43_BFL_RSSI)) { 721 !(dev->sdev->bus->sprom.boardflags_lo & B43_BFL_RSSI)) {
722 tmp16 = b43_nrssi_hw_read(dev, 0x20); 722 tmp16 = b43_nrssi_hw_read(dev, 0x20);
723 if (tmp16 >= 0x20) 723 if (tmp16 >= 0x20)
724 tmp16 -= 0x40; 724 tmp16 -= 0x40;
@@ -1114,7 +1114,7 @@ static u16 radio2050_rfover_val(struct b43_wldev *dev,
1114{ 1114{
1115 struct b43_phy *phy = &dev->phy; 1115 struct b43_phy *phy = &dev->phy;
1116 struct b43_phy_g *gphy = phy->g; 1116 struct b43_phy_g *gphy = phy->g;
1117 struct ssb_sprom *sprom = &(dev->dev->bus->sprom); 1117 struct ssb_sprom *sprom = &(dev->sdev->bus->sprom);
1118 1118
1119 if (!phy->gmode) 1119 if (!phy->gmode)
1120 return 0; 1120 return 0;
@@ -1491,7 +1491,7 @@ static u16 b43_radio_init2050(struct b43_wldev *dev)
1491 1491
1492static void b43_phy_initb5(struct b43_wldev *dev) 1492static void b43_phy_initb5(struct b43_wldev *dev)
1493{ 1493{
1494 struct ssb_bus *bus = dev->dev->bus; 1494 struct ssb_bus *bus = dev->sdev->bus;
1495 struct b43_phy *phy = &dev->phy; 1495 struct b43_phy *phy = &dev->phy;
1496 struct b43_phy_g *gphy = phy->g; 1496 struct b43_phy_g *gphy = phy->g;
1497 u16 offset, value; 1497 u16 offset, value;
@@ -1620,7 +1620,7 @@ static void b43_phy_initb6(struct b43_wldev *dev)
1620 b43_radio_write16(dev, 0x5A, 0x88); 1620 b43_radio_write16(dev, 0x5A, 0x88);
1621 b43_radio_write16(dev, 0x5B, 0x6B); 1621 b43_radio_write16(dev, 0x5B, 0x6B);
1622 b43_radio_write16(dev, 0x5C, 0x0F); 1622 b43_radio_write16(dev, 0x5C, 0x0F);
1623 if (dev->dev->bus->sprom.boardflags_lo & B43_BFL_ALTIQ) { 1623 if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_ALTIQ) {
1624 b43_radio_write16(dev, 0x5D, 0xFA); 1624 b43_radio_write16(dev, 0x5D, 0xFA);
1625 b43_radio_write16(dev, 0x5E, 0xD8); 1625 b43_radio_write16(dev, 0x5E, 0xD8);
1626 } else { 1626 } else {
@@ -1787,7 +1787,7 @@ static void b43_calc_loopback_gain(struct b43_wldev *dev)
1787 b43_phy_set(dev, B43_PHY_RFOVER, 0x0100); 1787 b43_phy_set(dev, B43_PHY_RFOVER, 0x0100);
1788 b43_phy_mask(dev, B43_PHY_RFOVERVAL, 0xCFFF); 1788 b43_phy_mask(dev, B43_PHY_RFOVERVAL, 0xCFFF);
1789 1789
1790 if (dev->dev->bus->sprom.boardflags_lo & B43_BFL_EXTLNA) { 1790 if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_EXTLNA) {
1791 if (phy->rev >= 7) { 1791 if (phy->rev >= 7) {
1792 b43_phy_set(dev, B43_PHY_RFOVER, 0x0800); 1792 b43_phy_set(dev, B43_PHY_RFOVER, 0x0800);
1793 b43_phy_set(dev, B43_PHY_RFOVERVAL, 0x8000); 1793 b43_phy_set(dev, B43_PHY_RFOVERVAL, 0x8000);
@@ -1922,7 +1922,7 @@ static void b43_hardware_pctl_init_gphy(struct b43_wldev *dev)
1922/* Initialize B/G PHY power control */ 1922/* Initialize B/G PHY power control */
1923static void b43_phy_init_pctl(struct b43_wldev *dev) 1923static void b43_phy_init_pctl(struct b43_wldev *dev)
1924{ 1924{
1925 struct ssb_bus *bus = dev->dev->bus; 1925 struct ssb_bus *bus = dev->sdev->bus;
1926 struct b43_phy *phy = &dev->phy; 1926 struct b43_phy *phy = &dev->phy;
1927 struct b43_phy_g *gphy = phy->g; 1927 struct b43_phy_g *gphy = phy->g;
1928 struct b43_rfatt old_rfatt; 1928 struct b43_rfatt old_rfatt;
@@ -2053,7 +2053,7 @@ static void b43_phy_initg(struct b43_wldev *dev)
2053 if (phy->rev >= 6) { 2053 if (phy->rev >= 6) {
2054 b43_phy_maskset(dev, B43_PHY_CCK(0x36), 0x0FFF, (gphy->lo_control->tx_bias << 12)); 2054 b43_phy_maskset(dev, B43_PHY_CCK(0x36), 0x0FFF, (gphy->lo_control->tx_bias << 12));
2055 } 2055 }
2056 if (dev->dev->bus->sprom.boardflags_lo & B43_BFL_PACTRL) 2056 if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_PACTRL)
2057 b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x8075); 2057 b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x8075);
2058 else 2058 else
2059 b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x807F); 2059 b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x807F);
@@ -2066,7 +2066,7 @@ static void b43_phy_initg(struct b43_wldev *dev)
2066 b43_phy_write(dev, B43_PHY_LO_MASK, 0x8078); 2066 b43_phy_write(dev, B43_PHY_LO_MASK, 0x8078);
2067 } 2067 }
2068 2068
2069 if (!(dev->dev->bus->sprom.boardflags_lo & B43_BFL_RSSI)) { 2069 if (!(dev->sdev->bus->sprom.boardflags_lo & B43_BFL_RSSI)) {
2070 /* The specs state to update the NRSSI LT with 2070 /* The specs state to update the NRSSI LT with
2071 * the value 0x7FFFFFFF here. I think that is some weird 2071 * the value 0x7FFFFFFF here. I think that is some weird
2072 * compiler optimization in the original driver. 2072 * compiler optimization in the original driver.
@@ -2088,8 +2088,8 @@ static void b43_phy_initg(struct b43_wldev *dev)
2088 /* FIXME: The spec says in the following if, the 0 should be replaced 2088 /* FIXME: The spec says in the following if, the 0 should be replaced
2089 'if OFDM may not be used in the current locale' 2089 'if OFDM may not be used in the current locale'
2090 but OFDM is legal everywhere */ 2090 but OFDM is legal everywhere */
2091 if ((dev->dev->bus->chip_id == 0x4306 2091 if ((dev->sdev->bus->chip_id == 0x4306
2092 && dev->dev->bus->chip_package == 2) || 0) { 2092 && dev->sdev->bus->chip_package == 2) || 0) {
2093 b43_phy_mask(dev, B43_PHY_CRS0, 0xBFFF); 2093 b43_phy_mask(dev, B43_PHY_CRS0, 0xBFFF);
2094 b43_phy_mask(dev, B43_PHY_OFDM(0xC3), 0x7FFF); 2094 b43_phy_mask(dev, B43_PHY_OFDM(0xC3), 0x7FFF);
2095 } 2095 }
@@ -2105,7 +2105,7 @@ void b43_gphy_channel_switch(struct b43_wldev *dev,
2105 b43_write16(dev, B43_MMIO_CHANNEL, channel2freq_bg(channel)); 2105 b43_write16(dev, B43_MMIO_CHANNEL, channel2freq_bg(channel));
2106 2106
2107 if (channel == 14) { 2107 if (channel == 14) {
2108 if (dev->dev->bus->sprom.country_code == 2108 if (dev->sdev->bus->sprom.country_code ==
2109 SSB_SPROM1CCODE_JAPAN) 2109 SSB_SPROM1CCODE_JAPAN)
2110 b43_hf_write(dev, 2110 b43_hf_write(dev,
2111 b43_hf_read(dev) & ~B43_HF_ACPR); 2111 b43_hf_read(dev) & ~B43_HF_ACPR);
@@ -2136,7 +2136,7 @@ static void default_baseband_attenuation(struct b43_wldev *dev,
2136static void default_radio_attenuation(struct b43_wldev *dev, 2136static void default_radio_attenuation(struct b43_wldev *dev,
2137 struct b43_rfatt *rf) 2137 struct b43_rfatt *rf)
2138{ 2138{
2139 struct ssb_bus *bus = dev->dev->bus; 2139 struct ssb_bus *bus = dev->sdev->bus;
2140 struct b43_phy *phy = &dev->phy; 2140 struct b43_phy *phy = &dev->phy;
2141 2141
2142 rf->with_padmix = 0; 2142 rf->with_padmix = 0;
@@ -2384,11 +2384,11 @@ static int b43_gphy_init_tssi2dbm_table(struct b43_wldev *dev)
2384 struct b43_phy_g *gphy = phy->g; 2384 struct b43_phy_g *gphy = phy->g;
2385 s16 pab0, pab1, pab2; 2385 s16 pab0, pab1, pab2;
2386 2386
2387 pab0 = (s16) (dev->dev->bus->sprom.pa0b0); 2387 pab0 = (s16) (dev->sdev->bus->sprom.pa0b0);
2388 pab1 = (s16) (dev->dev->bus->sprom.pa0b1); 2388 pab1 = (s16) (dev->sdev->bus->sprom.pa0b1);
2389 pab2 = (s16) (dev->dev->bus->sprom.pa0b2); 2389 pab2 = (s16) (dev->sdev->bus->sprom.pa0b2);
2390 2390
2391 B43_WARN_ON((dev->dev->bus->chip_id == 0x4301) && 2391 B43_WARN_ON((dev->sdev->bus->chip_id == 0x4301) &&
2392 (phy->radio_ver != 0x2050)); /* Not supported anymore */ 2392 (phy->radio_ver != 0x2050)); /* Not supported anymore */
2393 2393
2394 gphy->dyn_tssi_tbl = 0; 2394 gphy->dyn_tssi_tbl = 0;
@@ -2396,10 +2396,10 @@ static int b43_gphy_init_tssi2dbm_table(struct b43_wldev *dev)
2396 if (pab0 != 0 && pab1 != 0 && pab2 != 0 && 2396 if (pab0 != 0 && pab1 != 0 && pab2 != 0 &&
2397 pab0 != -1 && pab1 != -1 && pab2 != -1) { 2397 pab0 != -1 && pab1 != -1 && pab2 != -1) {
2398 /* The pabX values are set in SPROM. Use them. */ 2398 /* The pabX values are set in SPROM. Use them. */
2399 if ((s8) dev->dev->bus->sprom.itssi_bg != 0 && 2399 if ((s8) dev->sdev->bus->sprom.itssi_bg != 0 &&
2400 (s8) dev->dev->bus->sprom.itssi_bg != -1) { 2400 (s8) dev->sdev->bus->sprom.itssi_bg != -1) {
2401 gphy->tgt_idle_tssi = 2401 gphy->tgt_idle_tssi =
2402 (s8) (dev->dev->bus->sprom.itssi_bg); 2402 (s8) (dev->sdev->bus->sprom.itssi_bg);
2403 } else 2403 } else
2404 gphy->tgt_idle_tssi = 62; 2404 gphy->tgt_idle_tssi = 62;
2405 gphy->tssi2dbm = b43_generate_dyn_tssi2dbm_tab(dev, pab0, 2405 gphy->tssi2dbm = b43_generate_dyn_tssi2dbm_tab(dev, pab0,
@@ -2840,7 +2840,7 @@ static void b43_gphy_op_adjust_txpower(struct b43_wldev *dev)
2840 B43_TXCTL_TXMIX; 2840 B43_TXCTL_TXMIX;
2841 rfatt += 2; 2841 rfatt += 2;
2842 bbatt += 2; 2842 bbatt += 2;
2843 } else if (dev->dev->bus->sprom. 2843 } else if (dev->sdev->bus->sprom.
2844 boardflags_lo & 2844 boardflags_lo &
2845 B43_BFL_PACTRL) { 2845 B43_BFL_PACTRL) {
2846 bbatt += 4 * (rfatt - 2); 2846 bbatt += 4 * (rfatt - 2);
@@ -2914,14 +2914,14 @@ static enum b43_txpwr_result b43_gphy_op_recalc_txpower(struct b43_wldev *dev,
2914 estimated_pwr = b43_gphy_estimate_power_out(dev, average_tssi); 2914 estimated_pwr = b43_gphy_estimate_power_out(dev, average_tssi);
2915 2915
2916 B43_WARN_ON(phy->type != B43_PHYTYPE_G); 2916 B43_WARN_ON(phy->type != B43_PHYTYPE_G);
2917 max_pwr = dev->dev->bus->sprom.maxpwr_bg; 2917 max_pwr = dev->sdev->bus->sprom.maxpwr_bg;
2918 if (dev->dev->bus->sprom.boardflags_lo & B43_BFL_PACTRL) 2918 if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_PACTRL)
2919 max_pwr -= 3; /* minus 0.75 */ 2919 max_pwr -= 3; /* minus 0.75 */
2920 if (unlikely(max_pwr >= INT_TO_Q52(30/*dBm*/))) { 2920 if (unlikely(max_pwr >= INT_TO_Q52(30/*dBm*/))) {
2921 b43warn(dev->wl, 2921 b43warn(dev->wl,
2922 "Invalid max-TX-power value in SPROM.\n"); 2922 "Invalid max-TX-power value in SPROM.\n");
2923 max_pwr = INT_TO_Q52(20); /* fake it */ 2923 max_pwr = INT_TO_Q52(20); /* fake it */
2924 dev->dev->bus->sprom.maxpwr_bg = max_pwr; 2924 dev->sdev->bus->sprom.maxpwr_bg = max_pwr;
2925 } 2925 }
2926 2926
2927 /* Get desired power (in Q5.2) */ 2927 /* Get desired power (in Q5.2) */
@@ -3014,7 +3014,7 @@ static void b43_gphy_op_pwork_60sec(struct b43_wldev *dev)
3014{ 3014{
3015 struct b43_phy *phy = &dev->phy; 3015 struct b43_phy *phy = &dev->phy;
3016 3016
3017 if (!(dev->dev->bus->sprom.boardflags_lo & B43_BFL_RSSI)) 3017 if (!(dev->sdev->bus->sprom.boardflags_lo & B43_BFL_RSSI))
3018 return; 3018 return;
3019 3019
3020 b43_mac_suspend(dev); 3020 b43_mac_suspend(dev);
diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c
index fd50eb116243..012c8da2f944 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -86,7 +86,7 @@ static void b43_lpphy_op_free(struct b43_wldev *dev)
86static void lpphy_read_band_sprom(struct b43_wldev *dev) 86static void lpphy_read_band_sprom(struct b43_wldev *dev)
87{ 87{
88 struct b43_phy_lp *lpphy = dev->phy.lp; 88 struct b43_phy_lp *lpphy = dev->phy.lp;
89 struct ssb_bus *bus = dev->dev->bus; 89 struct ssb_bus *bus = dev->sdev->bus;
90 u16 cckpo, maxpwr; 90 u16 cckpo, maxpwr;
91 u32 ofdmpo; 91 u32 ofdmpo;
92 int i; 92 int i;
@@ -214,7 +214,7 @@ static void lpphy_table_init(struct b43_wldev *dev)
214 214
215static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev) 215static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
216{ 216{
217 struct ssb_bus *bus = dev->dev->bus; 217 struct ssb_bus *bus = dev->sdev->bus;
218 struct b43_phy_lp *lpphy = dev->phy.lp; 218 struct b43_phy_lp *lpphy = dev->phy.lp;
219 u16 tmp, tmp2; 219 u16 tmp, tmp2;
220 220
@@ -412,7 +412,7 @@ static void lpphy_restore_dig_flt_state(struct b43_wldev *dev)
412 412
413static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) 413static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev)
414{ 414{
415 struct ssb_bus *bus = dev->dev->bus; 415 struct ssb_bus *bus = dev->sdev->bus;
416 struct b43_phy_lp *lpphy = dev->phy.lp; 416 struct b43_phy_lp *lpphy = dev->phy.lp;
417 417
418 b43_phy_write(dev, B43_LPPHY_AFE_DAC_CTL, 0x50); 418 b43_phy_write(dev, B43_LPPHY_AFE_DAC_CTL, 0x50);
@@ -519,7 +519,7 @@ struct b2062_freqdata {
519static void lpphy_2062_init(struct b43_wldev *dev) 519static void lpphy_2062_init(struct b43_wldev *dev)
520{ 520{
521 struct b43_phy_lp *lpphy = dev->phy.lp; 521 struct b43_phy_lp *lpphy = dev->phy.lp;
522 struct ssb_bus *bus = dev->dev->bus; 522 struct ssb_bus *bus = dev->sdev->bus;
523 u32 crystalfreq, tmp, ref; 523 u32 crystalfreq, tmp, ref;
524 unsigned int i; 524 unsigned int i;
525 const struct b2062_freqdata *fd = NULL; 525 const struct b2062_freqdata *fd = NULL;
@@ -697,7 +697,7 @@ static void lpphy_radio_init(struct b43_wldev *dev)
697 lpphy_sync_stx(dev); 697 lpphy_sync_stx(dev);
698 b43_phy_write(dev, B43_PHY_OFDM(0xF0), 0x5F80); 698 b43_phy_write(dev, B43_PHY_OFDM(0xF0), 0x5F80);
699 b43_phy_write(dev, B43_PHY_OFDM(0xF1), 0); 699 b43_phy_write(dev, B43_PHY_OFDM(0xF1), 0);
700 if (dev->dev->bus->chip_id == 0x4325) { 700 if (dev->sdev->bus->chip_id == 0x4325) {
701 // TODO SSB PMU recalibration 701 // TODO SSB PMU recalibration
702 } 702 }
703 } 703 }
@@ -1289,7 +1289,7 @@ finish:
1289 1289
1290static void lpphy_rev2plus_rc_calib(struct b43_wldev *dev) 1290static void lpphy_rev2plus_rc_calib(struct b43_wldev *dev)
1291{ 1291{
1292 struct ssb_bus *bus = dev->dev->bus; 1292 struct ssb_bus *bus = dev->sdev->bus;
1293 u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000; 1293 u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000;
1294 u8 tmp = b43_radio_read(dev, B2063_RX_BB_SP8) & 0xFF; 1294 u8 tmp = b43_radio_read(dev, B2063_RX_BB_SP8) & 0xFF;
1295 int i; 1295 int i;
@@ -1840,7 +1840,7 @@ static void lpphy_papd_cal(struct b43_wldev *dev, struct lpphy_tx_gains gains,
1840static void lpphy_papd_cal_txpwr(struct b43_wldev *dev) 1840static void lpphy_papd_cal_txpwr(struct b43_wldev *dev)
1841{ 1841{
1842 struct b43_phy_lp *lpphy = dev->phy.lp; 1842 struct b43_phy_lp *lpphy = dev->phy.lp;
1843 struct ssb_bus *bus = dev->dev->bus; 1843 struct ssb_bus *bus = dev->sdev->bus;
1844 struct lpphy_tx_gains gains, oldgains; 1844 struct lpphy_tx_gains gains, oldgains;
1845 int old_txpctl, old_afe_ovr, old_rf, old_bbmult; 1845 int old_txpctl, old_afe_ovr, old_rf, old_bbmult;
1846 1846
@@ -1870,7 +1870,7 @@ static int lpphy_rx_iq_cal(struct b43_wldev *dev, bool noise, bool tx,
1870 bool rx, bool pa, struct lpphy_tx_gains *gains) 1870 bool rx, bool pa, struct lpphy_tx_gains *gains)
1871{ 1871{
1872 struct b43_phy_lp *lpphy = dev->phy.lp; 1872 struct b43_phy_lp *lpphy = dev->phy.lp;
1873 struct ssb_bus *bus = dev->dev->bus; 1873 struct ssb_bus *bus = dev->sdev->bus;
1874 const struct lpphy_rx_iq_comp *iqcomp = NULL; 1874 const struct lpphy_rx_iq_comp *iqcomp = NULL;
1875 struct lpphy_tx_gains nogains, oldgains; 1875 struct lpphy_tx_gains nogains, oldgains;
1876 u16 tmp; 1876 u16 tmp;
@@ -2408,7 +2408,7 @@ static const struct b206x_channel b2063_chantbl[] = {
2408 2408
2409static void lpphy_b2062_reset_pll_bias(struct b43_wldev *dev) 2409static void lpphy_b2062_reset_pll_bias(struct b43_wldev *dev)
2410{ 2410{
2411 struct ssb_bus *bus = dev->dev->bus; 2411 struct ssb_bus *bus = dev->sdev->bus;
2412 2412
2413 b43_radio_write(dev, B2062_S_RFPLL_CTL2, 0xFF); 2413 b43_radio_write(dev, B2062_S_RFPLL_CTL2, 0xFF);
2414 udelay(20); 2414 udelay(20);
@@ -2432,7 +2432,7 @@ static int lpphy_b2062_tune(struct b43_wldev *dev,
2432 unsigned int channel) 2432 unsigned int channel)
2433{ 2433{
2434 struct b43_phy_lp *lpphy = dev->phy.lp; 2434 struct b43_phy_lp *lpphy = dev->phy.lp;
2435 struct ssb_bus *bus = dev->dev->bus; 2435 struct ssb_bus *bus = dev->sdev->bus;
2436 const struct b206x_channel *chandata = NULL; 2436 const struct b206x_channel *chandata = NULL;
2437 u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000; 2437 u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000;
2438 u32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9; 2438 u32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9;
@@ -2522,7 +2522,7 @@ static void lpphy_b2063_vco_calib(struct b43_wldev *dev)
2522static int lpphy_b2063_tune(struct b43_wldev *dev, 2522static int lpphy_b2063_tune(struct b43_wldev *dev,
2523 unsigned int channel) 2523 unsigned int channel)
2524{ 2524{
2525 struct ssb_bus *bus = dev->dev->bus; 2525 struct ssb_bus *bus = dev->sdev->bus;
2526 2526
2527 static const struct b206x_channel *chandata = NULL; 2527 static const struct b206x_channel *chandata = NULL;
2528 u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000; 2528 u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000;
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index b075a3f82a43..9ed65157bef5 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -299,7 +299,7 @@ static void b43_nphy_tx_power_ctrl(struct b43_wldev *dev, bool enable)
299static void b43_nphy_tx_power_fix(struct b43_wldev *dev) 299static void b43_nphy_tx_power_fix(struct b43_wldev *dev)
300{ 300{
301 struct b43_phy_n *nphy = dev->phy.n; 301 struct b43_phy_n *nphy = dev->phy.n;
302 struct ssb_sprom *sprom = &(dev->dev->bus->sprom); 302 struct ssb_sprom *sprom = &(dev->sdev->bus->sprom);
303 303
304 u8 txpi[2], bbmult, i; 304 u8 txpi[2], bbmult, i;
305 u16 tmp, radio_gain, dac_gain; 305 u16 tmp, radio_gain, dac_gain;
@@ -423,8 +423,8 @@ static void b43_radio_init2055_pre(struct b43_wldev *dev)
423static void b43_radio_init2055_post(struct b43_wldev *dev) 423static void b43_radio_init2055_post(struct b43_wldev *dev)
424{ 424{
425 struct b43_phy_n *nphy = dev->phy.n; 425 struct b43_phy_n *nphy = dev->phy.n;
426 struct ssb_sprom *sprom = &(dev->dev->bus->sprom); 426 struct ssb_sprom *sprom = &(dev->sdev->bus->sprom);
427 struct ssb_boardinfo *binfo = &(dev->dev->bus->boardinfo); 427 struct ssb_boardinfo *binfo = &(dev->sdev->bus->boardinfo);
428 int i; 428 int i;
429 u16 val; 429 u16 val;
430 bool workaround = false; 430 bool workaround = false;
@@ -609,12 +609,12 @@ static void b43_nphy_bmac_clock_fgc(struct b43_wldev *dev, bool force)
609 if (dev->phy.type != B43_PHYTYPE_N) 609 if (dev->phy.type != B43_PHYTYPE_N)
610 return; 610 return;
611 611
612 tmslow = ssb_read32(dev->dev, SSB_TMSLOW); 612 tmslow = ssb_read32(dev->sdev, SSB_TMSLOW);
613 if (force) 613 if (force)
614 tmslow |= SSB_TMSLOW_FGC; 614 tmslow |= SSB_TMSLOW_FGC;
615 else 615 else
616 tmslow &= ~SSB_TMSLOW_FGC; 616 tmslow &= ~SSB_TMSLOW_FGC;
617 ssb_write32(dev->dev, SSB_TMSLOW, tmslow); 617 ssb_write32(dev->sdev, SSB_TMSLOW, tmslow);
618} 618}
619 619
620/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CCA */ 620/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CCA */
@@ -959,7 +959,7 @@ static void b43_nphy_superswitch_init(struct b43_wldev *dev, bool init)
959 b43_phy_write(dev, B43_NPHY_GPIO_LOOEN, 0); 959 b43_phy_write(dev, B43_NPHY_GPIO_LOOEN, 0);
960 b43_phy_write(dev, B43_NPHY_GPIO_HIOEN, 0); 960 b43_phy_write(dev, B43_NPHY_GPIO_HIOEN, 0);
961 961
962 ssb_chipco_gpio_control(&dev->dev->bus->chipco, 0xFC00, 962 ssb_chipco_gpio_control(&dev->sdev->bus->chipco, 0xFC00,
963 0xFC00); 963 0xFC00);
964 b43_write32(dev, B43_MMIO_MACCTL, 964 b43_write32(dev, B43_MMIO_MACCTL,
965 b43_read32(dev, B43_MMIO_MACCTL) & 965 b43_read32(dev, B43_MMIO_MACCTL) &
@@ -983,7 +983,7 @@ static u16 b43_nphy_classifier(struct b43_wldev *dev, u16 mask, u16 val)
983{ 983{
984 u16 tmp; 984 u16 tmp;
985 985
986 if (dev->dev->id.revision == 16) 986 if (dev->sdev->id.revision == 16)
987 b43_mac_suspend(dev); 987 b43_mac_suspend(dev);
988 988
989 tmp = b43_phy_read(dev, B43_NPHY_CLASSCTL); 989 tmp = b43_phy_read(dev, B43_NPHY_CLASSCTL);
@@ -993,7 +993,7 @@ static u16 b43_nphy_classifier(struct b43_wldev *dev, u16 mask, u16 val)
993 tmp |= (val & mask); 993 tmp |= (val & mask);
994 b43_phy_maskset(dev, B43_NPHY_CLASSCTL, 0xFFF8, tmp); 994 b43_phy_maskset(dev, B43_NPHY_CLASSCTL, 0xFFF8, tmp);
995 995
996 if (dev->dev->id.revision == 16) 996 if (dev->sdev->id.revision == 16)
997 b43_mac_enable(dev); 997 b43_mac_enable(dev);
998 998
999 return tmp; 999 return tmp;
@@ -1168,7 +1168,7 @@ static void b43_nphy_adjust_lna_gain_table(struct b43_wldev *dev)
1168static void b43_nphy_gain_ctrl_workarounds(struct b43_wldev *dev) 1168static void b43_nphy_gain_ctrl_workarounds(struct b43_wldev *dev)
1169{ 1169{
1170 struct b43_phy_n *nphy = dev->phy.n; 1170 struct b43_phy_n *nphy = dev->phy.n;
1171 struct ssb_sprom *sprom = &(dev->dev->bus->sprom); 1171 struct ssb_sprom *sprom = &(dev->sdev->bus->sprom);
1172 1172
1173 /* PHY rev 0, 1, 2 */ 1173 /* PHY rev 0, 1, 2 */
1174 u8 i, j; 1174 u8 i, j;
@@ -1373,7 +1373,7 @@ static void b43_nphy_gain_ctrl_workarounds(struct b43_wldev *dev)
1373/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/Workarounds */ 1373/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/Workarounds */
1374static void b43_nphy_workarounds(struct b43_wldev *dev) 1374static void b43_nphy_workarounds(struct b43_wldev *dev)
1375{ 1375{
1376 struct ssb_bus *bus = dev->dev->bus; 1376 struct ssb_bus *bus = dev->sdev->bus;
1377 struct b43_phy *phy = &dev->phy; 1377 struct b43_phy *phy = &dev->phy;
1378 struct b43_phy_n *nphy = phy->n; 1378 struct b43_phy_n *nphy = phy->n;
1379 1379
@@ -3586,7 +3586,7 @@ static void b43_nphy_set_rx_core_state(struct b43_wldev *dev, u8 mask)
3586 */ 3586 */
3587int b43_phy_initn(struct b43_wldev *dev) 3587int b43_phy_initn(struct b43_wldev *dev)
3588{ 3588{
3589 struct ssb_bus *bus = dev->dev->bus; 3589 struct ssb_bus *bus = dev->sdev->bus;
3590 struct b43_phy *phy = &dev->phy; 3590 struct b43_phy *phy = &dev->phy;
3591 struct b43_phy_n *nphy = phy->n; 3591 struct b43_phy_n *nphy = phy->n;
3592 u8 tx_pwr_state; 3592 u8 tx_pwr_state;
@@ -3601,7 +3601,7 @@ int b43_phy_initn(struct b43_wldev *dev)
3601 if ((dev->phy.rev >= 3) && 3601 if ((dev->phy.rev >= 3) &&
3602 (bus->sprom.boardflags_lo & B43_BFL_EXTLNA) && 3602 (bus->sprom.boardflags_lo & B43_BFL_EXTLNA) &&
3603 (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)) { 3603 (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)) {
3604 chipco_set32(&dev->dev->bus->chipco, SSB_CHIPCO_CHIPCTL, 0x40); 3604 chipco_set32(&dev->sdev->bus->chipco, SSB_CHIPCO_CHIPCTL, 0x40);
3605 } 3605 }
3606 nphy->deaf_count = 0; 3606 nphy->deaf_count = 0;
3607 b43_nphy_tables_init(dev); 3607 b43_nphy_tables_init(dev);
diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c
index aa12273ae716..72ab94df7569 100644
--- a/drivers/net/wireless/b43/pio.c
+++ b/drivers/net/wireless/b43/pio.c
@@ -111,7 +111,7 @@ static u16 index_to_pioqueue_base(struct b43_wldev *dev,
111 B43_MMIO_PIO11_BASE5, 111 B43_MMIO_PIO11_BASE5,
112 }; 112 };
113 113
114 if (dev->dev->id.revision >= 11) { 114 if (dev->sdev->id.revision >= 11) {
115 B43_WARN_ON(index >= ARRAY_SIZE(bases_rev11)); 115 B43_WARN_ON(index >= ARRAY_SIZE(bases_rev11));
116 return bases_rev11[index]; 116 return bases_rev11[index];
117 } 117 }
@@ -121,14 +121,14 @@ static u16 index_to_pioqueue_base(struct b43_wldev *dev,
121 121
122static u16 pio_txqueue_offset(struct b43_wldev *dev) 122static u16 pio_txqueue_offset(struct b43_wldev *dev)
123{ 123{
124 if (dev->dev->id.revision >= 11) 124 if (dev->sdev->id.revision >= 11)
125 return 0x18; 125 return 0x18;
126 return 0; 126 return 0;
127} 127}
128 128
129static u16 pio_rxqueue_offset(struct b43_wldev *dev) 129static u16 pio_rxqueue_offset(struct b43_wldev *dev)
130{ 130{
131 if (dev->dev->id.revision >= 11) 131 if (dev->sdev->id.revision >= 11)
132 return 0x38; 132 return 0x38;
133 return 8; 133 return 8;
134} 134}
@@ -144,7 +144,7 @@ static struct b43_pio_txqueue *b43_setup_pioqueue_tx(struct b43_wldev *dev,
144 if (!q) 144 if (!q)
145 return NULL; 145 return NULL;
146 q->dev = dev; 146 q->dev = dev;
147 q->rev = dev->dev->id.revision; 147 q->rev = dev->sdev->id.revision;
148 q->mmio_base = index_to_pioqueue_base(dev, index) + 148 q->mmio_base = index_to_pioqueue_base(dev, index) +
149 pio_txqueue_offset(dev); 149 pio_txqueue_offset(dev);
150 q->index = index; 150 q->index = index;
@@ -178,7 +178,7 @@ static struct b43_pio_rxqueue *b43_setup_pioqueue_rx(struct b43_wldev *dev,
178 if (!q) 178 if (!q)
179 return NULL; 179 return NULL;
180 q->dev = dev; 180 q->dev = dev;
181 q->rev = dev->dev->id.revision; 181 q->rev = dev->sdev->id.revision;
182 q->mmio_base = index_to_pioqueue_base(dev, index) + 182 q->mmio_base = index_to_pioqueue_base(dev, index) +
183 pio_rxqueue_offset(dev); 183 pio_rxqueue_offset(dev);
184 184
@@ -339,7 +339,7 @@ static u16 tx_write_2byte_queue(struct b43_pio_txqueue *q,
339 ctl |= B43_PIO_TXCTL_WRITELO | B43_PIO_TXCTL_WRITEHI; 339 ctl |= B43_PIO_TXCTL_WRITELO | B43_PIO_TXCTL_WRITEHI;
340 b43_piotx_write16(q, B43_PIO_TXCTL, ctl); 340 b43_piotx_write16(q, B43_PIO_TXCTL, ctl);
341 341
342 ssb_block_write(dev->dev, data, (data_len & ~1), 342 b43_block_write(dev, data, (data_len & ~1),
343 q->mmio_base + B43_PIO_TXDATA, 343 q->mmio_base + B43_PIO_TXDATA,
344 sizeof(u16)); 344 sizeof(u16));
345 if (data_len & 1) { 345 if (data_len & 1) {
@@ -351,7 +351,7 @@ static u16 tx_write_2byte_queue(struct b43_pio_txqueue *q,
351 b43_piotx_write16(q, B43_PIO_TXCTL, ctl); 351 b43_piotx_write16(q, B43_PIO_TXCTL, ctl);
352 tail[0] = data[data_len - 1]; 352 tail[0] = data[data_len - 1];
353 tail[1] = 0; 353 tail[1] = 0;
354 ssb_block_write(dev->dev, tail, 2, 354 b43_block_write(dev, tail, 2,
355 q->mmio_base + B43_PIO_TXDATA, 355 q->mmio_base + B43_PIO_TXDATA,
356 sizeof(u16)); 356 sizeof(u16));
357 } 357 }
@@ -393,7 +393,7 @@ static u32 tx_write_4byte_queue(struct b43_pio_txqueue *q,
393 B43_PIO8_TXCTL_16_23 | B43_PIO8_TXCTL_24_31; 393 B43_PIO8_TXCTL_16_23 | B43_PIO8_TXCTL_24_31;
394 b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); 394 b43_piotx_write32(q, B43_PIO8_TXCTL, ctl);
395 395
396 ssb_block_write(dev->dev, data, (data_len & ~3), 396 b43_block_write(dev, data, (data_len & ~3),
397 q->mmio_base + B43_PIO8_TXDATA, 397 q->mmio_base + B43_PIO8_TXDATA,
398 sizeof(u32)); 398 sizeof(u32));
399 if (data_len & 3) { 399 if (data_len & 3) {
@@ -421,7 +421,7 @@ static u32 tx_write_4byte_queue(struct b43_pio_txqueue *q,
421 break; 421 break;
422 } 422 }
423 b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); 423 b43_piotx_write32(q, B43_PIO8_TXCTL, ctl);
424 ssb_block_write(dev->dev, tail, 4, 424 b43_block_write(dev, tail, 4,
425 q->mmio_base + B43_PIO8_TXDATA, 425 q->mmio_base + B43_PIO8_TXDATA,
426 sizeof(u32)); 426 sizeof(u32));
427 } 427 }
@@ -657,11 +657,11 @@ data_ready:
657 657
658 /* Get the preamble (RX header) */ 658 /* Get the preamble (RX header) */
659 if (q->rev >= 8) { 659 if (q->rev >= 8) {
660 ssb_block_read(dev->dev, rxhdr, sizeof(*rxhdr), 660 b43_block_read(dev, rxhdr, sizeof(*rxhdr),
661 q->mmio_base + B43_PIO8_RXDATA, 661 q->mmio_base + B43_PIO8_RXDATA,
662 sizeof(u32)); 662 sizeof(u32));
663 } else { 663 } else {
664 ssb_block_read(dev->dev, rxhdr, sizeof(*rxhdr), 664 b43_block_read(dev, rxhdr, sizeof(*rxhdr),
665 q->mmio_base + B43_PIO_RXDATA, 665 q->mmio_base + B43_PIO_RXDATA,
666 sizeof(u16)); 666 sizeof(u16));
667 } 667 }
@@ -697,7 +697,7 @@ data_ready:
697 skb_reserve(skb, 2); 697 skb_reserve(skb, 2);
698 skb_put(skb, len + padding); 698 skb_put(skb, len + padding);
699 if (q->rev >= 8) { 699 if (q->rev >= 8) {
700 ssb_block_read(dev->dev, skb->data + padding, (len & ~3), 700 b43_block_read(dev, skb->data + padding, (len & ~3),
701 q->mmio_base + B43_PIO8_RXDATA, 701 q->mmio_base + B43_PIO8_RXDATA,
702 sizeof(u32)); 702 sizeof(u32));
703 if (len & 3) { 703 if (len & 3) {
@@ -705,7 +705,7 @@ data_ready:
705 BUILD_BUG_ON(sizeof(wl->pio_tailspace) < 4); 705 BUILD_BUG_ON(sizeof(wl->pio_tailspace) < 4);
706 706
707 /* Read the last few bytes. */ 707 /* Read the last few bytes. */
708 ssb_block_read(dev->dev, tail, 4, 708 b43_block_read(dev, tail, 4,
709 q->mmio_base + B43_PIO8_RXDATA, 709 q->mmio_base + B43_PIO8_RXDATA,
710 sizeof(u32)); 710 sizeof(u32));
711 switch (len & 3) { 711 switch (len & 3) {
@@ -724,7 +724,7 @@ data_ready:
724 } 724 }
725 } 725 }
726 } else { 726 } else {
727 ssb_block_read(dev->dev, skb->data + padding, (len & ~1), 727 b43_block_read(dev, skb->data + padding, (len & ~1),
728 q->mmio_base + B43_PIO_RXDATA, 728 q->mmio_base + B43_PIO_RXDATA,
729 sizeof(u16)); 729 sizeof(u16));
730 if (len & 1) { 730 if (len & 1) {
@@ -732,7 +732,7 @@ data_ready:
732 BUILD_BUG_ON(sizeof(wl->pio_tailspace) < 2); 732 BUILD_BUG_ON(sizeof(wl->pio_tailspace) < 2);
733 733
734 /* Read the last byte. */ 734 /* Read the last byte. */
735 ssb_block_read(dev->dev, tail, 2, 735 b43_block_read(dev, tail, 2,
736 q->mmio_base + B43_PIO_RXDATA, 736 q->mmio_base + B43_PIO_RXDATA,
737 sizeof(u16)); 737 sizeof(u16));
738 skb->data[len + padding - 1] = tail[0]; 738 skb->data[len + padding - 1] = tail[0];
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
index 86bc0a0f735c..a617efe38289 100644
--- a/drivers/net/wireless/b43/rfkill.c
+++ b/drivers/net/wireless/b43/rfkill.c
@@ -37,7 +37,7 @@ void b43_rfkill_poll(struct ieee80211_hw *hw)
37{ 37{
38 struct b43_wl *wl = hw_to_b43_wl(hw); 38 struct b43_wl *wl = hw_to_b43_wl(hw);
39 struct b43_wldev *dev = wl->current_dev; 39 struct b43_wldev *dev = wl->current_dev;
40 struct ssb_bus *bus = dev->dev->bus; 40 struct ssb_bus *bus = dev->sdev->bus;
41 bool enabled; 41 bool enabled;
42 bool brought_up = false; 42 bool brought_up = false;
43 43
@@ -47,7 +47,7 @@ void b43_rfkill_poll(struct ieee80211_hw *hw)
47 mutex_unlock(&wl->mutex); 47 mutex_unlock(&wl->mutex);
48 return; 48 return;
49 } 49 }
50 ssb_device_enable(dev->dev, 0); 50 ssb_device_enable(dev->sdev, 0);
51 brought_up = true; 51 brought_up = true;
52 } 52 }
53 53
@@ -63,7 +63,7 @@ void b43_rfkill_poll(struct ieee80211_hw *hw)
63 } 63 }
64 64
65 if (brought_up) { 65 if (brought_up) {
66 ssb_device_disable(dev->dev, 0); 66 ssb_device_disable(dev->sdev, 0);
67 ssb_bus_may_powerdown(bus); 67 ssb_bus_may_powerdown(bus);
68 } 68 }
69 69
diff --git a/drivers/net/wireless/b43/sdio.c b/drivers/net/wireless/b43/sdio.c
index 09e2dfd7b175..808e25b79703 100644
--- a/drivers/net/wireless/b43/sdio.c
+++ b/drivers/net/wireless/b43/sdio.c
@@ -66,7 +66,7 @@ static void b43_sdio_interrupt_dispatcher(struct sdio_func *func)
66int b43_sdio_request_irq(struct b43_wldev *dev, 66int b43_sdio_request_irq(struct b43_wldev *dev,
67 void (*handler)(struct b43_wldev *dev)) 67 void (*handler)(struct b43_wldev *dev))
68{ 68{
69 struct ssb_bus *bus = dev->dev->bus; 69 struct ssb_bus *bus = dev->sdev->bus;
70 struct sdio_func *func = bus->host_sdio; 70 struct sdio_func *func = bus->host_sdio;
71 struct b43_sdio *sdio = sdio_get_drvdata(func); 71 struct b43_sdio *sdio = sdio_get_drvdata(func);
72 int err; 72 int err;
@@ -82,7 +82,7 @@ int b43_sdio_request_irq(struct b43_wldev *dev,
82 82
83void b43_sdio_free_irq(struct b43_wldev *dev) 83void b43_sdio_free_irq(struct b43_wldev *dev)
84{ 84{
85 struct ssb_bus *bus = dev->dev->bus; 85 struct ssb_bus *bus = dev->sdev->bus;
86 struct sdio_func *func = bus->host_sdio; 86 struct sdio_func *func = bus->host_sdio;
87 struct b43_sdio *sdio = sdio_get_drvdata(func); 87 struct b43_sdio *sdio = sdio_get_drvdata(func);
88 88
diff --git a/drivers/net/wireless/b43/sysfs.c b/drivers/net/wireless/b43/sysfs.c
index f1ae4e05a32c..57af619725c3 100644
--- a/drivers/net/wireless/b43/sysfs.c
+++ b/drivers/net/wireless/b43/sysfs.c
@@ -140,7 +140,7 @@ static DEVICE_ATTR(interference, 0644,
140 140
141int b43_sysfs_register(struct b43_wldev *wldev) 141int b43_sysfs_register(struct b43_wldev *wldev)
142{ 142{
143 struct device *dev = wldev->dev->dev; 143 struct device *dev = wldev->sdev->dev;
144 144
145 B43_WARN_ON(b43_status(wldev) != B43_STAT_INITIALIZED); 145 B43_WARN_ON(b43_status(wldev) != B43_STAT_INITIALIZED);
146 146
@@ -149,7 +149,7 @@ int b43_sysfs_register(struct b43_wldev *wldev)
149 149
150void b43_sysfs_unregister(struct b43_wldev *wldev) 150void b43_sysfs_unregister(struct b43_wldev *wldev)
151{ 151{
152 struct device *dev = wldev->dev->dev; 152 struct device *dev = wldev->sdev->dev;
153 153
154 device_remove_file(dev, &dev_attr_interference); 154 device_remove_file(dev, &dev_attr_interference);
155} 155}
diff --git a/drivers/net/wireless/b43/tables_lpphy.c b/drivers/net/wireless/b43/tables_lpphy.c
index 61027ee84fb5..59df3c64af63 100644
--- a/drivers/net/wireless/b43/tables_lpphy.c
+++ b/drivers/net/wireless/b43/tables_lpphy.c
@@ -2304,7 +2304,7 @@ void lpphy_rev0_1_table_init(struct b43_wldev *dev)
2304 2304
2305void lpphy_rev2plus_table_init(struct b43_wldev *dev) 2305void lpphy_rev2plus_table_init(struct b43_wldev *dev)
2306{ 2306{
2307 struct ssb_bus *bus = dev->dev->bus; 2307 struct ssb_bus *bus = dev->sdev->bus;
2308 int i; 2308 int i;
2309 2309
2310 B43_WARN_ON(dev->phy.rev < 2); 2310 B43_WARN_ON(dev->phy.rev < 2);
@@ -2416,7 +2416,7 @@ void lpphy_write_gain_table_bulk(struct b43_wldev *dev, int offset, int count,
2416 2416
2417void lpphy_init_tx_gain_table(struct b43_wldev *dev) 2417void lpphy_init_tx_gain_table(struct b43_wldev *dev)
2418{ 2418{
2419 struct ssb_bus *bus = dev->dev->bus; 2419 struct ssb_bus *bus = dev->sdev->bus;
2420 2420
2421 switch (dev->phy.rev) { 2421 switch (dev->phy.rev) {
2422 case 0: 2422 case 0:
diff --git a/drivers/net/wireless/b43/wa.c b/drivers/net/wireless/b43/wa.c
index 9a335da65b42..8f4db448ec33 100644
--- a/drivers/net/wireless/b43/wa.c
+++ b/drivers/net/wireless/b43/wa.c
@@ -458,7 +458,7 @@ static void b43_wa_rssi_adc(struct b43_wldev *dev)
458 458
459static void b43_wa_boards_a(struct b43_wldev *dev) 459static void b43_wa_boards_a(struct b43_wldev *dev)
460{ 460{
461 struct ssb_bus *bus = dev->dev->bus; 461 struct ssb_bus *bus = dev->sdev->bus;
462 462
463 if (bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM && 463 if (bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM &&
464 bus->boardinfo.type == SSB_BOARD_BU4306 && 464 bus->boardinfo.type == SSB_BOARD_BU4306 &&
@@ -486,7 +486,7 @@ static void b43_wa_boards_a(struct b43_wldev *dev)
486 486
487static void b43_wa_boards_g(struct b43_wldev *dev) 487static void b43_wa_boards_g(struct b43_wldev *dev)
488{ 488{
489 struct ssb_bus *bus = dev->dev->bus; 489 struct ssb_bus *bus = dev->sdev->bus;
490 struct b43_phy *phy = &dev->phy; 490 struct b43_phy *phy = &dev->phy;
491 491
492 if (bus->boardinfo.vendor != SSB_BOARDVENDOR_BCM || 492 if (bus->boardinfo.vendor != SSB_BOARDVENDOR_BCM ||
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index e5be381c17bc..c8f99aebe01f 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -547,7 +547,7 @@ static s8 b43_rssi_postprocess(struct b43_wldev *dev,
547 else 547 else
548 tmp -= 3; 548 tmp -= 3;
549 } else { 549 } else {
550 if (dev->dev->bus->sprom. 550 if (dev->sdev->bus->sprom.
551 boardflags_lo & B43_BFL_RSSI) { 551 boardflags_lo & B43_BFL_RSSI) {
552 if (in_rssi > 63) 552 if (in_rssi > 63)
553 in_rssi = 63; 553 in_rssi = 63;