aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c28
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.h1
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c12
3 files changed, 20 insertions, 21 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 25c44cfd7452..7c68bf35951f 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -255,6 +255,23 @@ void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev,
255} 255}
256EXPORT_SYMBOL_GPL(rt2800_mcu_request); 256EXPORT_SYMBOL_GPL(rt2800_mcu_request);
257 257
258int rt2800_wait_csr_ready(struct rt2x00_dev *rt2x00dev)
259{
260 unsigned int i = 0;
261 u32 reg;
262
263 for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
264 rt2800_register_read(rt2x00dev, MAC_CSR0, &reg);
265 if (reg && reg != ~0)
266 return 0;
267 msleep(1);
268 }
269
270 ERROR(rt2x00dev, "Unstable hardware.\n");
271 return -EBUSY;
272}
273EXPORT_SYMBOL_GPL(rt2800_wait_csr_ready);
274
258int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev) 275int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev)
259{ 276{
260 unsigned int i; 277 unsigned int i;
@@ -370,17 +387,8 @@ int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,
370 /* 387 /*
371 * Wait for stable hardware. 388 * Wait for stable hardware.
372 */ 389 */
373 for (i = 0; i < REGISTER_BUSY_COUNT; i++) { 390 if (rt2800_wait_csr_ready(rt2x00dev))
374 rt2800_register_read(rt2x00dev, MAC_CSR0, &reg);
375 if (reg && reg != ~0)
376 break;
377 msleep(1);
378 }
379
380 if (i == REGISTER_BUSY_COUNT) {
381 ERROR(rt2x00dev, "Unstable hardware.\n");
382 return -EBUSY; 391 return -EBUSY;
383 }
384 392
385 if (rt2x00_is_pci(rt2x00dev)) 393 if (rt2x00_is_pci(rt2x00dev))
386 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000002); 394 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000002);
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.h b/drivers/net/wireless/rt2x00/rt2800lib.h
index deb10b14157b..986229c06c19 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
@@ -140,6 +140,7 @@ void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev,
140 const u8 command, const u8 token, 140 const u8 command, const u8 token,
141 const u8 arg0, const u8 arg1); 141 const u8 arg0, const u8 arg1);
142 142
143int rt2800_wait_csr_ready(struct rt2x00_dev *rt2x00dev);
143int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev); 144int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev);
144 145
145int rt2800_check_firmware(struct rt2x00_dev *rt2x00dev, 146int rt2800_check_firmware(struct rt2x00_dev *rt2x00dev,
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 82ae58e0c5d7..b1a8e943750b 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -122,22 +122,12 @@ static void rt2800usb_toggle_rx(struct rt2x00_dev *rt2x00dev,
122static int rt2800usb_init_registers(struct rt2x00_dev *rt2x00dev) 122static int rt2800usb_init_registers(struct rt2x00_dev *rt2x00dev)
123{ 123{
124 u32 reg; 124 u32 reg;
125 int i;
126 125
127 /* 126 /*
128 * Wait until BBP and RF are ready. 127 * Wait until BBP and RF are ready.
129 */ 128 */
130 for (i = 0; i < REGISTER_BUSY_COUNT; i++) { 129 if (rt2800_wait_csr_ready(rt2x00dev))
131 rt2800_register_read(rt2x00dev, MAC_CSR0, &reg);
132 if (reg && reg != ~0)
133 break;
134 msleep(1);
135 }
136
137 if (i == REGISTER_BUSY_COUNT) {
138 ERROR(rt2x00dev, "Unstable hardware.\n");
139 return -EBUSY; 130 return -EBUSY;
140 }
141 131
142 rt2800_register_read(rt2x00dev, PBF_SYS_CTRL, &reg); 132 rt2800_register_read(rt2x00dev, PBF_SYS_CTRL, &reg);
143 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, reg & ~0x00002000); 133 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, reg & ~0x00002000);