aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/b43/leds.c15
-rw-r--r--drivers/net/wireless/b43/main.c23
-rw-r--r--drivers/net/wireless/b43/main.h17
3 files changed, 26 insertions, 29 deletions
diff --git a/drivers/net/wireless/b43/leds.c b/drivers/net/wireless/b43/leds.c
index 85d965de5791..0f155b4f34eb 100644
--- a/drivers/net/wireless/b43/leds.c
+++ b/drivers/net/wireless/b43/leds.c
@@ -176,6 +176,7 @@ void b43_leds_update(struct b43_wldev *dev, int activity)
176 unsigned long interval = 0; 176 unsigned long interval = 0;
177 u16 ledctl; 177 u16 ledctl;
178 unsigned long flags; 178 unsigned long flags;
179 bool radio_enabled = (phy->radio_on && dev->radio_hw_enable);
179 180
180 spin_lock_irqsave(&dev->wl->leds_lock, flags); 181 spin_lock_irqsave(&dev->wl->leds_lock, flags);
181 ledctl = b43_read16(dev, B43_MMIO_GPIO_CONTROL); 182 ledctl = b43_read16(dev, B43_MMIO_GPIO_CONTROL);
@@ -195,21 +196,19 @@ void b43_leds_update(struct b43_wldev *dev, int activity)
195 turn_on = activity; 196 turn_on = activity;
196 break; 197 break;
197 case B43_LED_RADIO_ALL: 198 case B43_LED_RADIO_ALL:
198 turn_on = phy->radio_on && b43_is_hw_radio_enabled(dev); 199 turn_on = radio_enabled;
199 break; 200 break;
200 case B43_LED_RADIO_A: 201 case B43_LED_RADIO_A:
201 turn_on = (phy->radio_on && b43_is_hw_radio_enabled(dev) 202 turn_on = (radio_enabled && phy->type == B43_PHYTYPE_A);
202 && phy->type == B43_PHYTYPE_A);
203 break; 203 break;
204 case B43_LED_RADIO_B: 204 case B43_LED_RADIO_B:
205 turn_on = (phy->radio_on && b43_is_hw_radio_enabled(dev) 205 turn_on = (radio_enabled &&
206 && (phy->type == B43_PHYTYPE_B 206 (phy->type == B43_PHYTYPE_B
207 || phy->type == B43_PHYTYPE_G)); 207 || phy->type == B43_PHYTYPE_G));
208 break; 208 break;
209 case B43_LED_MODE_BG: 209 case B43_LED_MODE_BG:
210 if (phy->type == B43_PHYTYPE_G 210 if (phy->type == B43_PHYTYPE_G
211 && b43_is_hw_radio_enabled(dev) 211 && radio_enabled)
212 && 1 /*FIXME: using G rates. */ )
213 turn_on = 1; 212 turn_on = 1;
214 break; 213 break;
215 case B43_LED_TRANSFER: 214 case B43_LED_TRANSFER:
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 66c89df51fb8..1390f41425f1 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2175,6 +2175,21 @@ static void b43_mgmtframe_txantenna(struct b43_wldev *dev, int antenna)
2175 b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_PRPHYCTL, tmp); 2175 b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_PRPHYCTL, tmp);
2176} 2176}
2177 2177
2178/* Returns TRUE, if the radio is enabled in hardware. */
2179static bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
2180{
2181 if (dev->phy.rev >= 3) {
2182 if (!(b43_read32(dev, B43_MMIO_RADIO_HWENABLED_HI)
2183 & B43_MMIO_RADIO_HWENABLED_HI_MASK))
2184 return 1;
2185 } else {
2186 if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
2187 & B43_MMIO_RADIO_HWENABLED_LO_MASK)
2188 return 1;
2189 }
2190 return 0;
2191}
2192
2178/* This is the opposite of b43_chip_init() */ 2193/* This is the opposite of b43_chip_init() */
2179static void b43_chip_exit(struct b43_wldev *dev) 2194static void b43_chip_exit(struct b43_wldev *dev)
2180{ 2195{
@@ -2214,7 +2229,7 @@ static int b43_chip_init(struct b43_wldev *dev)
2214 b43_radio_turn_on(dev); 2229 b43_radio_turn_on(dev);
2215 dev->radio_hw_enable = b43_is_hw_radio_enabled(dev); 2230 dev->radio_hw_enable = b43_is_hw_radio_enabled(dev);
2216 b43dbg(dev->wl, "Radio %s by hardware\n", 2231 b43dbg(dev->wl, "Radio %s by hardware\n",
2217 (dev->radio_hw_enable == 0) ? "disabled" : "enabled"); 2232 dev->radio_hw_enable ? "enabled" : "disabled");
2218 2233
2219 b43_write16(dev, 0x03E6, 0x0000); 2234 b43_write16(dev, 0x03E6, 0x0000);
2220 err = b43_phy_init(dev); 2235 err = b43_phy_init(dev);
@@ -2373,14 +2388,14 @@ static void b43_periodic_every15sec(struct b43_wldev *dev)
2373 2388
2374static void b43_periodic_every1sec(struct b43_wldev *dev) 2389static void b43_periodic_every1sec(struct b43_wldev *dev)
2375{ 2390{
2376 int radio_hw_enable; 2391 bool radio_hw_enable;
2377 2392
2378 /* check if radio hardware enabled status changed */ 2393 /* check if radio hardware enabled status changed */
2379 radio_hw_enable = b43_is_hw_radio_enabled(dev); 2394 radio_hw_enable = b43_is_hw_radio_enabled(dev);
2380 if (unlikely(dev->radio_hw_enable != radio_hw_enable)) { 2395 if (unlikely(dev->radio_hw_enable != radio_hw_enable)) {
2381 dev->radio_hw_enable = radio_hw_enable; 2396 dev->radio_hw_enable = radio_hw_enable;
2382 b43dbg(dev->wl, "Radio hardware status changed to %s\n", 2397 b43info(dev->wl, "Radio hardware status changed to %s\n",
2383 (radio_hw_enable == 0) ? "disabled" : "enabled"); 2398 radio_hw_enable ? "ENABLED" : "DISABLED");
2384 b43_leds_update(dev, 0); 2399 b43_leds_update(dev, 0);
2385 } 2400 }
2386} 2401}
diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h
index bd8fcf72dc5d..284d17da17d1 100644
--- a/drivers/net/wireless/b43/main.h
+++ b/drivers/net/wireless/b43/main.h
@@ -96,23 +96,6 @@ static inline int b43_is_ofdm_rate(int rate)
96 return !b43_is_cck_rate(rate); 96 return !b43_is_cck_rate(rate);
97} 97}
98 98
99static inline int b43_is_hw_radio_enabled(struct b43_wldev *dev)
100{
101 /* function to return state of hardware enable of radio
102 * returns 0 if radio disabled, 1 if radio enabled
103 */
104 struct b43_phy *phy = &dev->phy;
105
106 if (phy->rev >= 3)
107 return ((b43_read32(dev, B43_MMIO_RADIO_HWENABLED_HI)
108 & B43_MMIO_RADIO_HWENABLED_HI_MASK)
109 == 0) ? 1 : 0;
110 else
111 return ((b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
112 & B43_MMIO_RADIO_HWENABLED_LO_MASK)
113 == 0) ? 0 : 1;
114}
115
116void b43_tsf_read(struct b43_wldev *dev, u64 * tsf); 99void b43_tsf_read(struct b43_wldev *dev, u64 * tsf);
117void b43_tsf_write(struct b43_wldev *dev, u64 tsf); 100void b43_tsf_write(struct b43_wldev *dev, u64 tsf);
118 101