aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2011-05-17 20:06:38 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-06-01 15:10:56 -0400
commit21d889d433eb962b70ad88d554a4a7658067596f (patch)
tree8cebeaca665dc1e349cb07f057aed1d5053e479a /drivers/net
parentc0b4c00907c7f611ef328de73967d7913e137df8 (diff)
b43: bus: abstract 80211 core info
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/b43/bus.c3
-rw-r--r--drivers/net/wireless/b43/bus.h3
-rw-r--r--drivers/net/wireless/b43/dma.c2
-rw-r--r--drivers/net/wireless/b43/main.c30
-rw-r--r--drivers/net/wireless/b43/phy_common.c4
-rw-r--r--drivers/net/wireless/b43/phy_n.c4
-rw-r--r--drivers/net/wireless/b43/pio.c10
7 files changed, 31 insertions, 25 deletions
diff --git a/drivers/net/wireless/b43/bus.c b/drivers/net/wireless/b43/bus.c
index fe5fa267bc5b..be3d206e356f 100644
--- a/drivers/net/wireless/b43/bus.c
+++ b/drivers/net/wireless/b43/bus.c
@@ -70,5 +70,8 @@ struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev)
70 dev->block_read = b43_bus_ssb_block_read; 70 dev->block_read = b43_bus_ssb_block_read;
71 dev->block_write = b43_bus_ssb_block_write; 71 dev->block_write = b43_bus_ssb_block_write;
72 72
73 dev->core_id = sdev->id.coreid;
74 dev->core_rev = sdev->id.revision;
75
73 return dev; 76 return dev;
74} 77}
diff --git a/drivers/net/wireless/b43/bus.h b/drivers/net/wireless/b43/bus.h
index 9b390020fb52..742f08441949 100644
--- a/drivers/net/wireless/b43/bus.h
+++ b/drivers/net/wireless/b43/bus.h
@@ -19,6 +19,9 @@ struct b43_bus_dev {
19 size_t count, u16 offset, u8 reg_width); 19 size_t count, u16 offset, u8 reg_width);
20 void (*block_write)(struct b43_bus_dev *dev, const void *buffer, 20 void (*block_write)(struct b43_bus_dev *dev, const void *buffer,
21 size_t count, u16 offset, u8 reg_width); 21 size_t count, u16 offset, u8 reg_width);
22
23 u16 core_id;
24 u8 core_rev;
22}; 25};
23 26
24struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev); 27struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev);
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index 47d44bcff37d..ee45ab9af238 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -1085,7 +1085,7 @@ int b43_dma_init(struct b43_wldev *dev)
1085 goto err_destroy_mcast; 1085 goto err_destroy_mcast;
1086 1086
1087 /* No support for the TX status DMA ring. */ 1087 /* No support for the TX status DMA ring. */
1088 B43_WARN_ON(dev->sdev->id.revision < 5); 1088 B43_WARN_ON(dev->dev->core_rev < 5);
1089 1089
1090 b43dbg(dev->wl, "%u-bit DMA initialized\n", 1090 b43dbg(dev->wl, "%u-bit DMA initialized\n",
1091 (unsigned int)type); 1091 (unsigned int)type);
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 6356fbc8aec1..971ec1b56b06 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->sdev->id.revision < 3); 551 B43_WARN_ON(dev->dev->core_rev < 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->sdev->id.revision < 3); 589 B43_WARN_ON(dev->dev->core_rev < 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->sdev->id.revision < 11) 717 if (dev->dev->core_rev < 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->sdev->id.revision >= 5) { 1135 if (awake && dev->dev->core_rev >= 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,
@@ -1221,7 +1221,7 @@ static void drain_txstatus_queue(struct b43_wldev *dev)
1221{ 1221{
1222 u32 dummy; 1222 u32 dummy;
1223 1223
1224 if (dev->sdev->id.revision < 5) 1224 if (dev->dev->core_rev < 5)
1225 return; 1225 return;
1226 /* Read all entries from the microcode TXstatus FIFO 1226 /* Read all entries from the microcode TXstatus FIFO
1227 * and throw them away. 1227 * and throw them away.
@@ -1689,7 +1689,7 @@ static void b43_update_templates(struct b43_wl *wl)
1689static 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)
1690{ 1690{
1691 b43_time_lock(dev); 1691 b43_time_lock(dev);
1692 if (dev->sdev->id.revision >= 3) { 1692 if (dev->dev->core_rev >= 3) {
1693 b43_write32(dev, B43_MMIO_TSF_CFP_REP, (beacon_int << 16)); 1693 b43_write32(dev, B43_MMIO_TSF_CFP_REP, (beacon_int << 16));
1694 b43_write32(dev, B43_MMIO_TSF_CFP_START, (beacon_int << 10)); 1694 b43_write32(dev, B43_MMIO_TSF_CFP_START, (beacon_int << 10));
1695 } else { 1695 } else {
@@ -2113,7 +2113,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)
2113{ 2113{
2114 struct b43_wldev *dev = ctx->dev; 2114 struct b43_wldev *dev = ctx->dev;
2115 struct b43_firmware *fw = &ctx->dev->fw; 2115 struct b43_firmware *fw = &ctx->dev->fw;
2116 const u8 rev = ctx->dev->sdev->id.revision; 2116 const u8 rev = ctx->dev->dev->core_rev;
2117 const char *filename; 2117 const char *filename;
2118 u32 tmshigh; 2118 u32 tmshigh;
2119 int err; 2119 int err;
@@ -2448,7 +2448,7 @@ static int b43_upload_microcode(struct b43_wldev *dev)
2448 2448
2449 snprintf(wiphy->fw_version, sizeof(wiphy->fw_version), "%u.%u", 2449 snprintf(wiphy->fw_version, sizeof(wiphy->fw_version), "%u.%u",
2450 dev->fw.rev, dev->fw.patch); 2450 dev->fw.rev, dev->fw.patch);
2451 wiphy->hw_version = dev->sdev->id.coreid; 2451 wiphy->hw_version = dev->dev->core_id;
2452 2452
2453 if (b43_is_old_txhdr_format(dev)) { 2453 if (b43_is_old_txhdr_format(dev)) {
2454 /* 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
@@ -2606,7 +2606,7 @@ static int b43_gpio_init(struct b43_wldev *dev)
2606 mask |= 0x0200; 2606 mask |= 0x0200;
2607 set |= 0x0200; 2607 set |= 0x0200;
2608 } 2608 }
2609 if (dev->sdev->id.revision >= 2) 2609 if (dev->dev->core_rev >= 2)
2610 mask |= 0x0010; /* FIXME: This is redundant. */ 2610 mask |= 0x0010; /* FIXME: This is redundant. */
2611 2611
2612 gpiodev = b43_ssb_gpio_dev(dev); 2612 gpiodev = b43_ssb_gpio_dev(dev);
@@ -2741,7 +2741,7 @@ static void b43_adjust_opmode(struct b43_wldev *dev)
2741 /* Workaround: On old hardware the HW-MAC-address-filter 2741 /* Workaround: On old hardware the HW-MAC-address-filter
2742 * doesn't work properly, so always run promisc in filter 2742 * doesn't work properly, so always run promisc in filter
2743 * it in software. */ 2743 * it in software. */
2744 if (dev->sdev->id.revision <= 4) 2744 if (dev->dev->core_rev <= 4)
2745 ctl |= B43_MACCTL_PROMISC; 2745 ctl |= B43_MACCTL_PROMISC;
2746 2746
2747 b43_write32(dev, B43_MMIO_MACCTL, ctl); 2747 b43_write32(dev, B43_MMIO_MACCTL, ctl);
@@ -2907,7 +2907,7 @@ static int b43_chip_init(struct b43_wldev *dev)
2907 b43_write16(dev, 0x005E, value16); 2907 b43_write16(dev, 0x005E, value16);
2908 } 2908 }
2909 b43_write32(dev, 0x0100, 0x01000000); 2909 b43_write32(dev, 0x0100, 0x01000000);
2910 if (dev->sdev->id.revision < 5) 2910 if (dev->dev->core_rev < 5)
2911 b43_write32(dev, 0x010C, 0x01000000); 2911 b43_write32(dev, 0x010C, 0x01000000);
2912 2912
2913 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)
@@ -2922,7 +2922,7 @@ static int b43_chip_init(struct b43_wldev *dev)
2922 /* Initially set the wireless operation mode. */ 2922 /* Initially set the wireless operation mode. */
2923 b43_adjust_opmode(dev); 2923 b43_adjust_opmode(dev);
2924 2924
2925 if (dev->sdev->id.revision < 3) { 2925 if (dev->dev->core_rev < 3) {
2926 b43_write16(dev, 0x060E, 0x0000); 2926 b43_write16(dev, 0x060E, 0x0000);
2927 b43_write16(dev, 0x0610, 0x8000); 2927 b43_write16(dev, 0x0610, 0x8000);
2928 b43_write16(dev, 0x0604, 0x0000); 2928 b43_write16(dev, 0x0604, 0x0000);
@@ -3105,7 +3105,7 @@ static int b43_validate_chipaccess(struct b43_wldev *dev)
3105 b43_shm_write32(dev, B43_SHM_SHARED, 0, backup0); 3105 b43_shm_write32(dev, B43_SHM_SHARED, 0, backup0);
3106 b43_shm_write32(dev, B43_SHM_SHARED, 4, backup4); 3106 b43_shm_write32(dev, B43_SHM_SHARED, 4, backup4);
3107 3107
3108 if ((dev->sdev->id.revision >= 3) && (dev->sdev->id.revision <= 10)) { 3108 if ((dev->dev->core_rev >= 3) && (dev->dev->core_rev <= 10)) {
3109 /* The 32bit register shadows the two 16bit registers 3109 /* The 32bit register shadows the two 16bit registers
3110 * with update sideeffects. Validate this. */ 3110 * with update sideeffects. Validate this. */
3111 b43_write16(dev, B43_MMIO_TSF_CFP_START, 0xAAAA); 3111 b43_write16(dev, B43_MMIO_TSF_CFP_START, 0xAAAA);
@@ -4352,7 +4352,7 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
4352 if (err) 4352 if (err)
4353 goto err_busdown; 4353 goto err_busdown;
4354 b43_shm_write16(dev, B43_SHM_SHARED, 4354 b43_shm_write16(dev, B43_SHM_SHARED,
4355 B43_SHM_SH_WLCOREREV, dev->sdev->id.revision); 4355 B43_SHM_SH_WLCOREREV, dev->dev->core_rev);
4356 hf = b43_hf_read(dev); 4356 hf = b43_hf_read(dev);
4357 if (phy->type == B43_PHYTYPE_G) { 4357 if (phy->type == B43_PHYTYPE_G) {
4358 hf |= B43_HF_SYMW; 4358 hf |= B43_HF_SYMW;
@@ -4756,7 +4756,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
4756 goto out; 4756 goto out;
4757 } 4757 }
4758 /* Get the PHY type. */ 4758 /* Get the PHY type. */
4759 if (dev->sdev->id.revision >= 5) { 4759 if (dev->dev->core_rev >= 5) {
4760 u32 tmshigh; 4760 u32 tmshigh;
4761 4761
4762 tmshigh = ssb_read32(dev->sdev, SSB_TMSHIGH); 4762 tmshigh = ssb_read32(dev->sdev, SSB_TMSHIGH);
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
index e46b2f4f0920..3f7bdf845446 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->sdev->id.revision < 3); 171 B43_WARN_ON(dev->dev->core_rev < 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->sdev->id.revision < 3); 183 B43_WARN_ON(dev->dev->core_rev < 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);
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 05960ddde24e..e395550222d6 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -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->sdev->id.revision == 16) 986 if (dev->dev->core_rev == 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->sdev->id.revision == 16) 996 if (dev->dev->core_rev == 16)
997 b43_mac_enable(dev); 997 b43_mac_enable(dev);
998 998
999 return tmp; 999 return tmp;
diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c
index 72ab94df7569..44da620d9cc2 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->sdev->id.revision >= 11) { 114 if (dev->dev->core_rev >= 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->sdev->id.revision >= 11) 124 if (dev->dev->core_rev >= 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->sdev->id.revision >= 11) 131 if (dev->dev->core_rev >= 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->sdev->id.revision; 147 q->rev = dev->dev->core_rev;
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->sdev->id.revision; 181 q->rev = dev->dev->core_rev;
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