aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-10-23 03:44:04 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-23 03:44:04 -0400
commitdcc51417e5ee71bc1984825c23616030d57b83a4 (patch)
tree0c0c4122cf27bf6bd96477341ba292d2b6ef436b /drivers
parentbd28bdb18f1028f8f0a3f83291336529b2cb5b7a (diff)
parent4cc683c9adbe644323e978bc63b2ab12606bb3c8 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath5k/base.c27
-rw-r--r--drivers/net/wireless/ath5k/base.h3
-rw-r--r--drivers/net/wireless/orinoco.c42
-rw-r--r--drivers/net/wireless/p54/p54common.c28
4 files changed, 60 insertions, 40 deletions
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 9b95c4049b31..0f1d6bdd51a2 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -340,9 +340,9 @@ static inline u64 ath5k_extend_tsf(struct ath5k_hw *ah, u32 rstamp)
340} 340}
341 341
342/* Interrupt handling */ 342/* Interrupt handling */
343static int ath5k_init(struct ath5k_softc *sc); 343static int ath5k_init(struct ath5k_softc *sc, bool is_resume);
344static int ath5k_stop_locked(struct ath5k_softc *sc); 344static int ath5k_stop_locked(struct ath5k_softc *sc);
345static int ath5k_stop_hw(struct ath5k_softc *sc); 345static int ath5k_stop_hw(struct ath5k_softc *sc, bool is_suspend);
346static irqreturn_t ath5k_intr(int irq, void *dev_id); 346static irqreturn_t ath5k_intr(int irq, void *dev_id);
347static void ath5k_tasklet_reset(unsigned long data); 347static void ath5k_tasklet_reset(unsigned long data);
348 348
@@ -646,7 +646,7 @@ ath5k_pci_suspend(struct pci_dev *pdev, pm_message_t state)
646 646
647 ath5k_led_off(sc); 647 ath5k_led_off(sc);
648 648
649 ath5k_stop_hw(sc); 649 ath5k_stop_hw(sc, true);
650 650
651 free_irq(pdev->irq, sc); 651 free_irq(pdev->irq, sc);
652 pci_save_state(pdev); 652 pci_save_state(pdev);
@@ -683,7 +683,7 @@ ath5k_pci_resume(struct pci_dev *pdev)
683 goto err_no_irq; 683 goto err_no_irq;
684 } 684 }
685 685
686 err = ath5k_init(sc); 686 err = ath5k_init(sc, true);
687 if (err) 687 if (err)
688 goto err_irq; 688 goto err_irq;
689 ath5k_led_enable(sc); 689 ath5k_led_enable(sc);
@@ -2200,12 +2200,17 @@ ath5k_beacon_config(struct ath5k_softc *sc)
2200\********************/ 2200\********************/
2201 2201
2202static int 2202static int
2203ath5k_init(struct ath5k_softc *sc) 2203ath5k_init(struct ath5k_softc *sc, bool is_resume)
2204{ 2204{
2205 int ret; 2205 int ret;
2206 2206
2207 mutex_lock(&sc->lock); 2207 mutex_lock(&sc->lock);
2208 2208
2209 if (is_resume && !test_bit(ATH_STAT_STARTED, sc->status))
2210 goto out_ok;
2211
2212 __clear_bit(ATH_STAT_STARTED, sc->status);
2213
2209 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "mode %d\n", sc->opmode); 2214 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "mode %d\n", sc->opmode);
2210 2215
2211 /* 2216 /*
@@ -2230,12 +2235,15 @@ ath5k_init(struct ath5k_softc *sc)
2230 if (ret) 2235 if (ret)
2231 goto done; 2236 goto done;
2232 2237
2238 __set_bit(ATH_STAT_STARTED, sc->status);
2239
2233 /* Set ack to be sent at low bit-rates */ 2240 /* Set ack to be sent at low bit-rates */
2234 ath5k_hw_set_ack_bitrate_high(sc->ah, false); 2241 ath5k_hw_set_ack_bitrate_high(sc->ah, false);
2235 2242
2236 mod_timer(&sc->calib_tim, round_jiffies(jiffies + 2243 mod_timer(&sc->calib_tim, round_jiffies(jiffies +
2237 msecs_to_jiffies(ath5k_calinterval * 1000))); 2244 msecs_to_jiffies(ath5k_calinterval * 1000)));
2238 2245
2246out_ok:
2239 ret = 0; 2247 ret = 0;
2240done: 2248done:
2241 mmiowb(); 2249 mmiowb();
@@ -2290,7 +2298,7 @@ ath5k_stop_locked(struct ath5k_softc *sc)
2290 * stop is preempted). 2298 * stop is preempted).
2291 */ 2299 */
2292static int 2300static int
2293ath5k_stop_hw(struct ath5k_softc *sc) 2301ath5k_stop_hw(struct ath5k_softc *sc, bool is_suspend)
2294{ 2302{
2295 int ret; 2303 int ret;
2296 2304
@@ -2321,6 +2329,9 @@ ath5k_stop_hw(struct ath5k_softc *sc)
2321 } 2329 }
2322 } 2330 }
2323 ath5k_txbuf_free(sc, sc->bbuf); 2331 ath5k_txbuf_free(sc, sc->bbuf);
2332 if (!is_suspend)
2333 __clear_bit(ATH_STAT_STARTED, sc->status);
2334
2324 mmiowb(); 2335 mmiowb();
2325 mutex_unlock(&sc->lock); 2336 mutex_unlock(&sc->lock);
2326 2337
@@ -2718,12 +2729,12 @@ ath5k_reset_wake(struct ath5k_softc *sc)
2718 2729
2719static int ath5k_start(struct ieee80211_hw *hw) 2730static int ath5k_start(struct ieee80211_hw *hw)
2720{ 2731{
2721 return ath5k_init(hw->priv); 2732 return ath5k_init(hw->priv, false);
2722} 2733}
2723 2734
2724static void ath5k_stop(struct ieee80211_hw *hw) 2735static void ath5k_stop(struct ieee80211_hw *hw)
2725{ 2736{
2726 ath5k_stop_hw(hw->priv); 2737 ath5k_stop_hw(hw->priv, false);
2727} 2738}
2728 2739
2729static int ath5k_add_interface(struct ieee80211_hw *hw, 2740static int ath5k_add_interface(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/ath5k/base.h b/drivers/net/wireless/ath5k/base.h
index 9d0b728928e3..06d1054ca94b 100644
--- a/drivers/net/wireless/ath5k/base.h
+++ b/drivers/net/wireless/ath5k/base.h
@@ -128,11 +128,12 @@ struct ath5k_softc {
128 size_t desc_len; /* size of TX/RX descriptors */ 128 size_t desc_len; /* size of TX/RX descriptors */
129 u16 cachelsz; /* cache line size */ 129 u16 cachelsz; /* cache line size */
130 130
131 DECLARE_BITMAP(status, 4); 131 DECLARE_BITMAP(status, 5);
132#define ATH_STAT_INVALID 0 /* disable hardware accesses */ 132#define ATH_STAT_INVALID 0 /* disable hardware accesses */
133#define ATH_STAT_MRRETRY 1 /* multi-rate retry support */ 133#define ATH_STAT_MRRETRY 1 /* multi-rate retry support */
134#define ATH_STAT_PROMISC 2 134#define ATH_STAT_PROMISC 2
135#define ATH_STAT_LEDSOFT 3 /* enable LED gpio status */ 135#define ATH_STAT_LEDSOFT 3 /* enable LED gpio status */
136#define ATH_STAT_STARTED 4 /* opened & irqs enabled */
136 137
137 unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */ 138 unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
138 unsigned int curmode; /* current phy mode */ 139 unsigned int curmode; /* current phy mode */
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index 50904771f291..e0512e49d6d3 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -433,7 +433,7 @@ struct fw_info {
433const static struct fw_info orinoco_fw[] = { 433const static struct fw_info orinoco_fw[] = {
434 { "", "agere_sta_fw.bin", "agere_ap_fw.bin", 0x00390000, 1000 }, 434 { "", "agere_sta_fw.bin", "agere_ap_fw.bin", 0x00390000, 1000 },
435 { "", "prism_sta_fw.bin", "prism_ap_fw.bin", 0, 1024 }, 435 { "", "prism_sta_fw.bin", "prism_ap_fw.bin", 0, 1024 },
436 { "symbol_sp24t_prim_fw", "symbol_sp24t_sec_fw", "", 0x00003100, 0x100 } 436 { "symbol_sp24t_prim_fw", "symbol_sp24t_sec_fw", "", 0x00003100, 512 }
437}; 437};
438 438
439/* Structure used to access fields in FW 439/* Structure used to access fields in FW
@@ -458,7 +458,7 @@ orinoco_dl_firmware(struct orinoco_private *priv,
458 int ap) 458 int ap)
459{ 459{
460 /* Plug Data Area (PDA) */ 460 /* Plug Data Area (PDA) */
461 __le16 pda[512] = { 0 }; 461 __le16 *pda;
462 462
463 hermes_t *hw = &priv->hw; 463 hermes_t *hw = &priv->hw;
464 const struct firmware *fw_entry; 464 const struct firmware *fw_entry;
@@ -467,7 +467,11 @@ orinoco_dl_firmware(struct orinoco_private *priv,
467 const unsigned char *end; 467 const unsigned char *end;
468 const char *firmware; 468 const char *firmware;
469 struct net_device *dev = priv->ndev; 469 struct net_device *dev = priv->ndev;
470 int err; 470 int err = 0;
471
472 pda = kzalloc(fw->pda_size, GFP_KERNEL);
473 if (!pda)
474 return -ENOMEM;
471 475
472 if (ap) 476 if (ap)
473 firmware = fw->ap_fw; 477 firmware = fw->ap_fw;
@@ -478,17 +482,17 @@ orinoco_dl_firmware(struct orinoco_private *priv,
478 dev->name, firmware); 482 dev->name, firmware);
479 483
480 /* Read current plug data */ 484 /* Read current plug data */
481 err = hermes_read_pda(hw, pda, fw->pda_addr, 485 err = hermes_read_pda(hw, pda, fw->pda_addr, fw->pda_size, 0);
482 min_t(u16, fw->pda_size, sizeof(pda)), 0);
483 printk(KERN_DEBUG "%s: Read PDA returned %d\n", dev->name, err); 486 printk(KERN_DEBUG "%s: Read PDA returned %d\n", dev->name, err);
484 if (err) 487 if (err)
485 return err; 488 goto free;
486 489
487 err = request_firmware(&fw_entry, firmware, priv->dev); 490 err = request_firmware(&fw_entry, firmware, priv->dev);
488 if (err) { 491 if (err) {
489 printk(KERN_ERR "%s: Cannot find firmware %s\n", 492 printk(KERN_ERR "%s: Cannot find firmware %s\n",
490 dev->name, firmware); 493 dev->name, firmware);
491 return -ENOENT; 494 err = -ENOENT;
495 goto free;
492 } 496 }
493 497
494 hdr = (const struct orinoco_fw_header *) fw_entry->data; 498 hdr = (const struct orinoco_fw_header *) fw_entry->data;
@@ -532,6 +536,9 @@ orinoco_dl_firmware(struct orinoco_private *priv,
532 536
533abort: 537abort:
534 release_firmware(fw_entry); 538 release_firmware(fw_entry);
539
540free:
541 kfree(pda);
535 return err; 542 return err;
536} 543}
537 544
@@ -549,12 +556,12 @@ symbol_dl_image(struct orinoco_private *priv, const struct fw_info *fw,
549 int secondary) 556 int secondary)
550{ 557{
551 hermes_t *hw = &priv->hw; 558 hermes_t *hw = &priv->hw;
552 int ret; 559 int ret = 0;
553 const unsigned char *ptr; 560 const unsigned char *ptr;
554 const unsigned char *first_block; 561 const unsigned char *first_block;
555 562
556 /* Plug Data Area (PDA) */ 563 /* Plug Data Area (PDA) */
557 __le16 pda[256]; 564 __le16 *pda = NULL;
558 565
559 /* Binary block begins after the 0x1A marker */ 566 /* Binary block begins after the 0x1A marker */
560 ptr = image; 567 ptr = image;
@@ -563,28 +570,33 @@ symbol_dl_image(struct orinoco_private *priv, const struct fw_info *fw,
563 570
564 /* Read the PDA from EEPROM */ 571 /* Read the PDA from EEPROM */
565 if (secondary) { 572 if (secondary) {
566 ret = hermes_read_pda(hw, pda, fw->pda_addr, sizeof(pda), 1); 573 pda = kzalloc(fw->pda_size, GFP_KERNEL);
574 if (!pda)
575 return -ENOMEM;
576
577 ret = hermes_read_pda(hw, pda, fw->pda_addr, fw->pda_size, 1);
567 if (ret) 578 if (ret)
568 return ret; 579 goto free;
569 } 580 }
570 581
571 /* Stop the firmware, so that it can be safely rewritten */ 582 /* Stop the firmware, so that it can be safely rewritten */
572 if (priv->stop_fw) { 583 if (priv->stop_fw) {
573 ret = priv->stop_fw(priv, 1); 584 ret = priv->stop_fw(priv, 1);
574 if (ret) 585 if (ret)
575 return ret; 586 goto free;
576 } 587 }
577 588
578 /* Program the adapter with new firmware */ 589 /* Program the adapter with new firmware */
579 ret = hermes_program(hw, first_block, end); 590 ret = hermes_program(hw, first_block, end);
580 if (ret) 591 if (ret)
581 return ret; 592 goto free;
582 593
583 /* Write the PDA to the adapter */ 594 /* Write the PDA to the adapter */
584 if (secondary) { 595 if (secondary) {
585 size_t len = hermes_blocks_length(first_block); 596 size_t len = hermes_blocks_length(first_block);
586 ptr = first_block + len; 597 ptr = first_block + len;
587 ret = hermes_apply_pda(hw, ptr, pda); 598 ret = hermes_apply_pda(hw, ptr, pda);
599 kfree(pda);
588 if (ret) 600 if (ret)
589 return ret; 601 return ret;
590 } 602 }
@@ -608,6 +620,10 @@ symbol_dl_image(struct orinoco_private *priv, const struct fw_info *fw,
608 return -ENODEV; 620 return -ENODEV;
609 621
610 return 0; 622 return 0;
623
624free:
625 kfree(pda);
626 return ret;
611} 627}
612 628
613 629
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 117c7d3a52b0..2d022f83774c 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -306,8 +306,8 @@ static int p54_convert_rev1(struct ieee80211_hw *dev,
306 return 0; 306 return 0;
307} 307}
308 308
309static const char *p54_rf_chips[] = { "NULL", "Indigo?", "Duette", 309static const char *p54_rf_chips[] = { "NULL", "Duette3", "Duette2",
310 "Frisbee", "Xbow", "Longbow" }; 310 "Frisbee", "Xbow", "Longbow", "NULL", "NULL" };
311static int p54_init_xbow_synth(struct ieee80211_hw *dev); 311static int p54_init_xbow_synth(struct ieee80211_hw *dev);
312 312
313static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) 313static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
@@ -319,6 +319,7 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
319 void *tmp; 319 void *tmp;
320 int err; 320 int err;
321 u8 *end = (u8 *)eeprom + len; 321 u8 *end = (u8 *)eeprom + len;
322 u16 synth;
322 DECLARE_MAC_BUF(mac); 323 DECLARE_MAC_BUF(mac);
323 324
324 wrap = (struct eeprom_pda_wrap *) eeprom; 325 wrap = (struct eeprom_pda_wrap *) eeprom;
@@ -400,8 +401,8 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
400 tmp = entry->data; 401 tmp = entry->data;
401 while ((u8 *)tmp < entry->data + data_len) { 402 while ((u8 *)tmp < entry->data + data_len) {
402 struct bootrec_exp_if *exp_if = tmp; 403 struct bootrec_exp_if *exp_if = tmp;
403 if (le16_to_cpu(exp_if->if_id) == 0xF) 404 if (le16_to_cpu(exp_if->if_id) == 0xf)
404 priv->rxhw = le16_to_cpu(exp_if->variant) & 0x07; 405 synth = le16_to_cpu(exp_if->variant);
405 tmp += sizeof(struct bootrec_exp_if); 406 tmp += sizeof(struct bootrec_exp_if);
406 } 407 }
407 break; 408 break;
@@ -427,22 +428,13 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
427 goto err; 428 goto err;
428 } 429 }
429 430
430 switch (priv->rxhw) { 431 priv->rxhw = synth & 0x07;
431 case 4: /* XBow */ 432 if (priv->rxhw == 4)
432 p54_init_xbow_synth(dev); 433 p54_init_xbow_synth(dev);
433 case 1: /* Indigo? */ 434 if (!(synth & 0x40))
434 case 2: /* Duette */
435 dev->wiphy->bands[IEEE80211_BAND_5GHZ] = &band_5GHz;
436 case 3: /* Frisbee */
437 case 5: /* Longbow */
438 dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &band_2GHz; 435 dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &band_2GHz;
439 break; 436 if (!(synth & 0x80))
440 default: 437 dev->wiphy->bands[IEEE80211_BAND_5GHZ] = &band_5GHz;
441 printk(KERN_ERR "%s: unsupported RF-Chip\n",
442 wiphy_name(dev->wiphy));
443 err = -EINVAL;
444 goto err;
445 }
446 438
447 if (!is_valid_ether_addr(dev->wiphy->perm_addr)) { 439 if (!is_valid_ether_addr(dev->wiphy->perm_addr)) {
448 u8 perm_addr[ETH_ALEN]; 440 u8 perm_addr[ETH_ALEN];