diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2009-02-09 02:57:12 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-13 13:45:05 -0500 |
commit | cbe61d8a41210600bc76b212edcd4dc0f55c014f (patch) | |
tree | d8bd8e43d3556c58d410f1bef0d2ca3bf7d75c92 /drivers/net/wireless/ath9k/hw.h | |
parent | ba52da58be0acf3b7775972b2b5234ce64388c79 (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.h | 134 |
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 | ||
420 | struct ath_hal { | 420 | struct 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 | ||
451 | struct 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 */ |
580 | const char *ath9k_hw_probe(u16 vendorid, u16 devid); | 571 | const char *ath9k_hw_probe(u16 vendorid, u16 devid); |
581 | void ath9k_hw_detach(struct ath_hal *ah); | 572 | void ath9k_hw_detach(struct ath_hw *ah); |
582 | struct ath_hal *ath9k_hw_attach(u16 devid, struct ath_softc *sc, | 573 | struct ath_hw *ath9k_hw_attach(u16 devid, struct ath_softc *sc, int *error); |
583 | void __iomem *mem, int *error); | 574 | void ath9k_hw_rfdetach(struct ath_hw *ah); |
584 | void ath9k_hw_rfdetach(struct ath_hal *ah); | 575 | int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, |
585 | int ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan, | ||
586 | bool bChannelChange); | 576 | bool bChannelChange); |
587 | bool ath9k_hw_fill_cap_info(struct ath_hal *ah); | 577 | bool ath9k_hw_fill_cap_info(struct ath_hw *ah); |
588 | bool ath9k_hw_getcapability(struct ath_hal *ah, enum ath9k_capability_type type, | 578 | bool ath9k_hw_getcapability(struct ath_hw *ah, enum ath9k_capability_type type, |
589 | u32 capability, u32 *result); | 579 | u32 capability, u32 *result); |
590 | bool ath9k_hw_setcapability(struct ath_hal *ah, enum ath9k_capability_type type, | 580 | bool 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 */ |
594 | bool ath9k_hw_keyreset(struct ath_hal *ah, u16 entry); | 584 | bool ath9k_hw_keyreset(struct ath_hw *ah, u16 entry); |
595 | bool ath9k_hw_keysetmac(struct ath_hal *ah, u16 entry, const u8 *mac); | 585 | bool ath9k_hw_keysetmac(struct ath_hw *ah, u16 entry, const u8 *mac); |
596 | bool ath9k_hw_set_keycache_entry(struct ath_hal *ah, u16 entry, | 586 | bool 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); |
599 | bool ath9k_hw_keyisvalid(struct ath_hal *ah, u16 entry); | 589 | bool ath9k_hw_keyisvalid(struct ath_hw *ah, u16 entry); |
600 | 590 | ||
601 | /* GPIO / RFKILL / Antennae */ | 591 | /* GPIO / RFKILL / Antennae */ |
602 | void ath9k_hw_cfg_gpio_input(struct ath_hal *ah, u32 gpio); | 592 | void ath9k_hw_cfg_gpio_input(struct ath_hw *ah, u32 gpio); |
603 | u32 ath9k_hw_gpio_get(struct ath_hal *ah, u32 gpio); | 593 | u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio); |
604 | void ath9k_hw_cfg_output(struct ath_hal *ah, u32 gpio, | 594 | void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio, |
605 | u32 ah_signal_type); | 595 | u32 ah_signal_type); |
606 | void ath9k_hw_set_gpio(struct ath_hal *ah, u32 gpio, u32 val); | 596 | void 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) |
608 | void ath9k_enable_rfkill(struct ath_hal *ah); | 598 | void ath9k_enable_rfkill(struct ath_hw *ah); |
609 | #endif | 599 | #endif |
610 | u32 ath9k_hw_getdefantenna(struct ath_hal *ah); | 600 | u32 ath9k_hw_getdefantenna(struct ath_hw *ah); |
611 | void ath9k_hw_setantenna(struct ath_hal *ah, u32 antenna); | 601 | void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna); |
612 | bool ath9k_hw_setantennaswitch(struct ath_hal *ah, | 602 | bool 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 */ |
619 | bool ath9k_hw_wait(struct ath_hal *ah, u32 reg, u32 mask, u32 val); | 609 | bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val); |
620 | u32 ath9k_hw_reverse_bits(u32 val, u32 n); | 610 | u32 ath9k_hw_reverse_bits(u32 val, u32 n); |
621 | bool ath9k_get_channel_edges(struct ath_hal *ah, u16 flags, u16 *low, u16 *high); | 611 | bool ath9k_get_channel_edges(struct ath_hw *ah, u16 flags, u16 *low, u16 *high); |
622 | u16 ath9k_hw_computetxtime(struct ath_hal *ah, struct ath_rate_table *rates, | 612 | u16 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); |
624 | void ath9k_hw_get_channel_centers(struct ath_hal *ah, | 614 | void 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); |
627 | u32 ath9k_hw_getrxfilter(struct ath_hal *ah); | 617 | u32 ath9k_hw_getrxfilter(struct ath_hw *ah); |
628 | void ath9k_hw_setrxfilter(struct ath_hal *ah, u32 bits); | 618 | void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits); |
629 | bool ath9k_hw_phy_disable(struct ath_hal *ah); | 619 | bool ath9k_hw_phy_disable(struct ath_hw *ah); |
630 | bool ath9k_hw_disable(struct ath_hal *ah); | 620 | bool ath9k_hw_disable(struct ath_hw *ah); |
631 | bool ath9k_hw_set_txpowerlimit(struct ath_hal *ah, u32 limit); | 621 | bool ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit); |
632 | void ath9k_hw_setmac(struct ath_hal *ah, const u8 *mac); | 622 | void ath9k_hw_setmac(struct ath_hw *ah, const u8 *mac); |
633 | void ath9k_hw_setopmode(struct ath_hal *ah); | 623 | void ath9k_hw_setopmode(struct ath_hw *ah); |
634 | void ath9k_hw_setmcastfilter(struct ath_hal *ah, u32 filter0, u32 filter1); | 624 | void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1); |
635 | void ath9k_hw_setbssidmask(struct ath_softc *sc); | 625 | void ath9k_hw_setbssidmask(struct ath_softc *sc); |
636 | void ath9k_hw_write_associd(struct ath_softc *sc); | 626 | void ath9k_hw_write_associd(struct ath_softc *sc); |
637 | u64 ath9k_hw_gettsf64(struct ath_hal *ah); | 627 | u64 ath9k_hw_gettsf64(struct ath_hw *ah); |
638 | void ath9k_hw_settsf64(struct ath_hal *ah, u64 tsf64); | 628 | void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64); |
639 | void ath9k_hw_reset_tsf(struct ath_hal *ah); | 629 | void ath9k_hw_reset_tsf(struct ath_hw *ah); |
640 | bool ath9k_hw_set_tsfadjust(struct ath_hal *ah, u32 setting); | 630 | bool ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting); |
641 | bool ath9k_hw_setslottime(struct ath_hal *ah, u32 us); | 631 | bool ath9k_hw_setslottime(struct ath_hw *ah, u32 us); |
642 | void ath9k_hw_set11nmac2040(struct ath_hal *ah, enum ath9k_ht_macmode mode); | 632 | void ath9k_hw_set11nmac2040(struct ath_hw *ah, enum ath9k_ht_macmode mode); |
643 | void ath9k_hw_beaconinit(struct ath_hal *ah, u32 next_beacon, u32 beacon_period); | 633 | void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); |
644 | void ath9k_hw_set_sta_beacon_timers(struct ath_hal *ah, | 634 | void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, |
645 | const struct ath9k_beacon_state *bs); | 635 | const struct ath9k_beacon_state *bs); |
646 | bool ath9k_hw_setpower(struct ath_hal *ah, | 636 | bool ath9k_hw_setpower(struct ath_hw *ah, |
647 | enum ath9k_power_mode mode); | 637 | enum ath9k_power_mode mode); |
648 | void ath9k_hw_configpcipowersave(struct ath_hal *ah, int restore); | 638 | void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore); |
649 | 639 | ||
650 | /* Interrupt Handling */ | 640 | /* Interrupt Handling */ |
651 | bool ath9k_hw_intrpend(struct ath_hal *ah); | 641 | bool ath9k_hw_intrpend(struct ath_hw *ah); |
652 | bool ath9k_hw_getisr(struct ath_hal *ah, enum ath9k_int *masked); | 642 | bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked); |
653 | enum ath9k_int ath9k_hw_intrget(struct ath_hal *ah); | 643 | enum ath9k_int ath9k_hw_intrget(struct ath_hw *ah); |
654 | enum ath9k_int ath9k_hw_set_interrupts(struct ath_hal *ah, enum ath9k_int ints); | 644 | enum ath9k_int ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints); |
655 | 645 | ||
656 | void ath9k_hw_btcoex_enable(struct ath_hal *ah); | 646 | void ath9k_hw_btcoex_enable(struct ath_hw *ah); |
657 | 647 | ||
658 | #endif | 648 | #endif |