aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/hw.h
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2009-02-09 02:57:12 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-13 13:45:05 -0500
commitcbe61d8a41210600bc76b212edcd4dc0f55c014f (patch)
treed8bd8e43d3556c58d410f1bef0d2ca3bf7d75c92 /drivers/net/wireless/ath9k/hw.h
parentba52da58be0acf3b7775972b2b5234ce64388c79 (diff)
ath9k: Merge ath_hal and ath_hal_5416 structures
Finally, merge these structures and have a single HW specific data structure. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/hw.h')
-rw-r--r--drivers/net/wireless/ath9k/hw.h134
1 files changed, 62 insertions, 72 deletions
diff --git a/drivers/net/wireless/ath9k/hw.h b/drivers/net/wireless/ath9k/hw.h
index f4bf70215744..84914e205892 100644
--- a/drivers/net/wireless/ath9k/hw.h
+++ b/drivers/net/wireless/ath9k/hw.h
@@ -42,8 +42,8 @@
42#define AR5416_MAGIC 0x19641014 42#define AR5416_MAGIC 0x19641014
43 43
44/* Register read/write primitives */ 44/* Register read/write primitives */
45#define REG_WRITE(_ah, _reg, _val) iowrite32(_val, _ah->ah_sh + _reg) 45#define REG_WRITE(_ah, _reg, _val) iowrite32(_val, _ah->ah_sc->mem + _reg)
46#define REG_READ(_ah, _reg) ioread32(_ah->ah_sh + _reg) 46#define REG_READ(_ah, _reg) ioread32(_ah->ah_sc->mem + _reg)
47 47
48#define SM(_v, _f) (((_v) << _f##_S) & _f) 48#define SM(_v, _f) (((_v) << _f##_S) & _f)
49#define MS(_v, _f) (((_v) & _f) >> _f##_S) 49#define MS(_v, _f) (((_v) & _f) >> _f##_S)
@@ -417,46 +417,38 @@ struct ath9k_hw_version {
417 u16 analog2GhzRev; 417 u16 analog2GhzRev;
418}; 418};
419 419
420struct ath_hal { 420struct ath_hw {
421 struct ath9k_hw_version hw_version;
422 void __iomem *ah_sh;
423 struct ath_softc *ah_sc; 421 struct ath_softc *ah_sc;
424 422 struct ath9k_hw_version hw_version;
425 enum nl80211_iftype ah_opmode;
426 struct ath9k_ops_config ah_config; 423 struct ath9k_ops_config ah_config;
427 struct ath9k_hw_capabilities ah_caps; 424 struct ath9k_hw_capabilities ah_caps;
428 struct ath9k_regulatory regulatory; 425 struct ath9k_regulatory regulatory;
429 u32 ah_flags;
430 u8 macaddr[ETH_ALEN];
431
432 enum ath9k_power_mode ah_power_mode;
433 enum ath9k_power_mode ah_restore_mode;
434
435 struct ath9k_channel ah_channels[38]; 426 struct ath9k_channel ah_channels[38];
436 struct ath9k_channel *ah_curchan; 427 struct ath9k_channel *ah_curchan;
437 428
429 union {
430 struct ar5416_eeprom_def def;
431 struct ar5416_eeprom_4k map4k;
432 } ah_eeprom;
433
434 bool sw_mgmt_crypto;
438 bool ah_isPciExpress; 435 bool ah_isPciExpress;
436 u8 macaddr[ETH_ALEN];
439 u16 ah_txTrigLevel; 437 u16 ah_txTrigLevel;
440 u16 ah_rfsilent; 438 u16 ah_rfsilent;
441 u32 ah_rfkill_gpio; 439 u32 ah_rfkill_gpio;
442 u32 ah_rfkill_polarity; 440 u32 ah_rfkill_polarity;
443 u32 ah_btactive_gpio; 441 u32 ah_btactive_gpio;
444 u32 ah_wlanactive_gpio; 442 u32 ah_wlanactive_gpio;
443 u32 ah_flags;
444 enum nl80211_iftype ah_opmode;
445 445
446 struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]; 446 enum ath9k_power_mode ah_power_mode;
447 447 enum ath9k_power_mode ah_restore_mode;
448 bool sw_mgmt_crypto;
449};
450 448
451struct ath_hal_5416 { 449 struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
452 struct ath_hal ah;
453 union {
454 struct ar5416_eeprom_def def;
455 struct ar5416_eeprom_4k map4k;
456 } ah_eeprom;
457 struct ar5416Stats ah_stats; 450 struct ar5416Stats ah_stats;
458 struct ath9k_tx_queue_info ah_txq[ATH9K_NUM_TX_QUEUES]; 451 struct ath9k_tx_queue_info ah_txq[ATH9K_NUM_TX_QUEUES];
459 void __iomem *ah_cal_mem;
460 452
461 int16_t ah_curchanRadIndex; 453 int16_t ah_curchanRadIndex;
462 u32 ah_maskReg; 454 u32 ah_maskReg;
@@ -574,85 +566,83 @@ struct ath_hal_5416 {
574 /* To indicate EEPROM mapping used */ 566 /* To indicate EEPROM mapping used */
575 enum hal_eep_map ah_eep_map; 567 enum hal_eep_map ah_eep_map;
576}; 568};
577#define AH5416(_ah) ((struct ath_hal_5416 *)(_ah))
578 569
579/* Attach, Detach, Reset */ 570/* Attach, Detach, Reset */
580const char *ath9k_hw_probe(u16 vendorid, u16 devid); 571const char *ath9k_hw_probe(u16 vendorid, u16 devid);
581void ath9k_hw_detach(struct ath_hal *ah); 572void ath9k_hw_detach(struct ath_hw *ah);
582struct ath_hal *ath9k_hw_attach(u16 devid, struct ath_softc *sc, 573struct ath_hw *ath9k_hw_attach(u16 devid, struct ath_softc *sc, int *error);
583 void __iomem *mem, int *error); 574void ath9k_hw_rfdetach(struct ath_hw *ah);
584void ath9k_hw_rfdetach(struct ath_hal *ah); 575int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
585int ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
586 bool bChannelChange); 576 bool bChannelChange);
587bool ath9k_hw_fill_cap_info(struct ath_hal *ah); 577bool ath9k_hw_fill_cap_info(struct ath_hw *ah);
588bool ath9k_hw_getcapability(struct ath_hal *ah, enum ath9k_capability_type type, 578bool ath9k_hw_getcapability(struct ath_hw *ah, enum ath9k_capability_type type,
589 u32 capability, u32 *result); 579 u32 capability, u32 *result);
590bool ath9k_hw_setcapability(struct ath_hal *ah, enum ath9k_capability_type type, 580bool ath9k_hw_setcapability(struct ath_hw *ah, enum ath9k_capability_type type,
591 u32 capability, u32 setting, int *status); 581 u32 capability, u32 setting, int *status);
592 582
593/* Key Cache Management */ 583/* Key Cache Management */
594bool ath9k_hw_keyreset(struct ath_hal *ah, u16 entry); 584bool ath9k_hw_keyreset(struct ath_hw *ah, u16 entry);
595bool ath9k_hw_keysetmac(struct ath_hal *ah, u16 entry, const u8 *mac); 585bool ath9k_hw_keysetmac(struct ath_hw *ah, u16 entry, const u8 *mac);
596bool ath9k_hw_set_keycache_entry(struct ath_hal *ah, u16 entry, 586bool ath9k_hw_set_keycache_entry(struct ath_hw *ah, u16 entry,
597 const struct ath9k_keyval *k, 587 const struct ath9k_keyval *k,
598 const u8 *mac, int xorKey); 588 const u8 *mac, int xorKey);
599bool ath9k_hw_keyisvalid(struct ath_hal *ah, u16 entry); 589bool ath9k_hw_keyisvalid(struct ath_hw *ah, u16 entry);
600 590
601/* GPIO / RFKILL / Antennae */ 591/* GPIO / RFKILL / Antennae */
602void ath9k_hw_cfg_gpio_input(struct ath_hal *ah, u32 gpio); 592void ath9k_hw_cfg_gpio_input(struct ath_hw *ah, u32 gpio);
603u32 ath9k_hw_gpio_get(struct ath_hal *ah, u32 gpio); 593u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio);
604void ath9k_hw_cfg_output(struct ath_hal *ah, u32 gpio, 594void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio,
605 u32 ah_signal_type); 595 u32 ah_signal_type);
606void ath9k_hw_set_gpio(struct ath_hal *ah, u32 gpio, u32 val); 596void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val);
607#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) 597#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
608void ath9k_enable_rfkill(struct ath_hal *ah); 598void ath9k_enable_rfkill(struct ath_hw *ah);
609#endif 599#endif
610u32 ath9k_hw_getdefantenna(struct ath_hal *ah); 600u32 ath9k_hw_getdefantenna(struct ath_hw *ah);
611void ath9k_hw_setantenna(struct ath_hal *ah, u32 antenna); 601void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna);
612bool ath9k_hw_setantennaswitch(struct ath_hal *ah, 602bool ath9k_hw_setantennaswitch(struct ath_hw *ah,
613 enum ath9k_ant_setting settings, 603 enum ath9k_ant_setting settings,
614 struct ath9k_channel *chan, 604 struct ath9k_channel *chan,
615 u8 *tx_chainmask, u8 *rx_chainmask, 605 u8 *tx_chainmask, u8 *rx_chainmask,
616 u8 *antenna_cfgd); 606 u8 *antenna_cfgd);
617 607
618/* General Operation */ 608/* General Operation */
619bool ath9k_hw_wait(struct ath_hal *ah, u32 reg, u32 mask, u32 val); 609bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val);
620u32 ath9k_hw_reverse_bits(u32 val, u32 n); 610u32 ath9k_hw_reverse_bits(u32 val, u32 n);
621bool ath9k_get_channel_edges(struct ath_hal *ah, u16 flags, u16 *low, u16 *high); 611bool ath9k_get_channel_edges(struct ath_hw *ah, u16 flags, u16 *low, u16 *high);
622u16 ath9k_hw_computetxtime(struct ath_hal *ah, struct ath_rate_table *rates, 612u16 ath9k_hw_computetxtime(struct ath_hw *ah, struct ath_rate_table *rates,
623 u32 frameLen, u16 rateix, bool shortPreamble); 613 u32 frameLen, u16 rateix, bool shortPreamble);
624void ath9k_hw_get_channel_centers(struct ath_hal *ah, 614void ath9k_hw_get_channel_centers(struct ath_hw *ah,
625 struct ath9k_channel *chan, 615 struct ath9k_channel *chan,
626 struct chan_centers *centers); 616 struct chan_centers *centers);
627u32 ath9k_hw_getrxfilter(struct ath_hal *ah); 617u32 ath9k_hw_getrxfilter(struct ath_hw *ah);
628void ath9k_hw_setrxfilter(struct ath_hal *ah, u32 bits); 618void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits);
629bool ath9k_hw_phy_disable(struct ath_hal *ah); 619bool ath9k_hw_phy_disable(struct ath_hw *ah);
630bool ath9k_hw_disable(struct ath_hal *ah); 620bool ath9k_hw_disable(struct ath_hw *ah);
631bool ath9k_hw_set_txpowerlimit(struct ath_hal *ah, u32 limit); 621bool ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit);
632void ath9k_hw_setmac(struct ath_hal *ah, const u8 *mac); 622void ath9k_hw_setmac(struct ath_hw *ah, const u8 *mac);
633void ath9k_hw_setopmode(struct ath_hal *ah); 623void ath9k_hw_setopmode(struct ath_hw *ah);
634void ath9k_hw_setmcastfilter(struct ath_hal *ah, u32 filter0, u32 filter1); 624void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1);
635void ath9k_hw_setbssidmask(struct ath_softc *sc); 625void ath9k_hw_setbssidmask(struct ath_softc *sc);
636void ath9k_hw_write_associd(struct ath_softc *sc); 626void ath9k_hw_write_associd(struct ath_softc *sc);
637u64 ath9k_hw_gettsf64(struct ath_hal *ah); 627u64 ath9k_hw_gettsf64(struct ath_hw *ah);
638void ath9k_hw_settsf64(struct ath_hal *ah, u64 tsf64); 628void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64);
639void ath9k_hw_reset_tsf(struct ath_hal *ah); 629void ath9k_hw_reset_tsf(struct ath_hw *ah);
640bool ath9k_hw_set_tsfadjust(struct ath_hal *ah, u32 setting); 630bool ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting);
641bool ath9k_hw_setslottime(struct ath_hal *ah, u32 us); 631bool ath9k_hw_setslottime(struct ath_hw *ah, u32 us);
642void ath9k_hw_set11nmac2040(struct ath_hal *ah, enum ath9k_ht_macmode mode); 632void ath9k_hw_set11nmac2040(struct ath_hw *ah, enum ath9k_ht_macmode mode);
643void ath9k_hw_beaconinit(struct ath_hal *ah, u32 next_beacon, u32 beacon_period); 633void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period);
644void ath9k_hw_set_sta_beacon_timers(struct ath_hal *ah, 634void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah,
645 const struct ath9k_beacon_state *bs); 635 const struct ath9k_beacon_state *bs);
646bool ath9k_hw_setpower(struct ath_hal *ah, 636bool ath9k_hw_setpower(struct ath_hw *ah,
647 enum ath9k_power_mode mode); 637 enum ath9k_power_mode mode);
648void ath9k_hw_configpcipowersave(struct ath_hal *ah, int restore); 638void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore);
649 639
650/* Interrupt Handling */ 640/* Interrupt Handling */
651bool ath9k_hw_intrpend(struct ath_hal *ah); 641bool ath9k_hw_intrpend(struct ath_hw *ah);
652bool ath9k_hw_getisr(struct ath_hal *ah, enum ath9k_int *masked); 642bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked);
653enum ath9k_int ath9k_hw_intrget(struct ath_hal *ah); 643enum ath9k_int ath9k_hw_intrget(struct ath_hw *ah);
654enum ath9k_int ath9k_hw_set_interrupts(struct ath_hal *ah, enum ath9k_int ints); 644enum ath9k_int ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints);
655 645
656void ath9k_hw_btcoex_enable(struct ath_hal *ah); 646void ath9k_hw_btcoex_enable(struct ath_hw *ah);
657 647
658#endif 648#endif