aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-12-02 04:27:06 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-12-02 15:17:51 -0500
commite7aecd327d80b2f156b54769013aaccb2a20645a (patch)
tree6b0edda6058597dc290bf75dd72883a8480b8250 /drivers/net/wireless/ath
parent8efa5d7d6ad307ae2d220def37ca89594062c40d (diff)
ath5k: Add a function to read chipset's MAC revision
Add bus dependent revision read function which is used to determine chipset's MAC before hardware is initialized. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r--drivers/net/wireless/ath/ath5k/ath5k.h4
-rw-r--r--drivers/net/wireless/ath/ath5k/attach.c11
-rw-r--r--drivers/net/wireless/ath/ath5k/pci.c6
3 files changed, 16 insertions, 5 deletions
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index 5d9fdc2ccfaa..5e525eba61be 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -1046,6 +1046,7 @@ struct ath5k_hw {
1046 u32 ah_phy; 1046 u32 ah_phy;
1047 u32 ah_mac_srev; 1047 u32 ah_mac_srev;
1048 u16 ah_mac_version; 1048 u16 ah_mac_version;
1049 u16 ah_mac_revision;
1049 u16 ah_phy_revision; 1050 u16 ah_phy_revision;
1050 u16 ah_radio_5ghz_revision; 1051 u16 ah_radio_5ghz_revision;
1051 u16 ah_radio_2ghz_revision; 1052 u16 ah_radio_2ghz_revision;
@@ -1156,8 +1157,9 @@ void ath5k_hw_deinit(struct ath5k_hw *ah);
1156int ath5k_sysfs_register(struct ath5k_softc *sc); 1157int ath5k_sysfs_register(struct ath5k_softc *sc);
1157void ath5k_sysfs_unregister(struct ath5k_softc *sc); 1158void ath5k_sysfs_unregister(struct ath5k_softc *sc);
1158 1159
1159/*Chip id helper function */ 1160/*Chip id helper functions */
1160const char *ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val); 1161const char *ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val);
1162int ath5k_hw_read_srev(struct ath5k_hw *ah);
1161 1163
1162/* LED functions */ 1164/* LED functions */
1163int ath5k_init_leds(struct ath5k_softc *sc); 1165int ath5k_init_leds(struct ath5k_softc *sc);
diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c
index 86f6fec069e8..9dbc1fa81795 100644
--- a/drivers/net/wireless/ath/ath5k/attach.c
+++ b/drivers/net/wireless/ath/ath5k/attach.c
@@ -128,7 +128,8 @@ int ath5k_hw_init(struct ath5k_softc *sc)
128 /* 128 /*
129 * Find the mac version 129 * Find the mac version
130 */ 130 */
131 srev = ath5k_hw_reg_read(ah, AR5K_SREV); 131 ath5k_hw_read_srev(ah);
132 srev = ah->ah_mac_srev;
132 if (srev < AR5K_SREV_AR5311) 133 if (srev < AR5K_SREV_AR5311)
133 ah->ah_version = AR5K_AR5210; 134 ah->ah_version = AR5K_AR5210;
134 else if (srev < AR5K_SREV_AR5212) 135 else if (srev < AR5K_SREV_AR5212)
@@ -136,6 +137,10 @@ int ath5k_hw_init(struct ath5k_softc *sc)
136 else 137 else
137 ah->ah_version = AR5K_AR5212; 138 ah->ah_version = AR5K_AR5212;
138 139
140 /* Get the MAC revision */
141 ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER);
142 ah->ah_mac_revision = AR5K_REG_MS(srev, AR5K_SREV_REV);
143
139 /* Fill the ath5k_hw struct with the needed functions */ 144 /* Fill the ath5k_hw struct with the needed functions */
140 ret = ath5k_hw_init_desc_functions(ah); 145 ret = ath5k_hw_init_desc_functions(ah);
141 if (ret) 146 if (ret)
@@ -146,9 +151,7 @@ int ath5k_hw_init(struct ath5k_softc *sc)
146 if (ret) 151 if (ret)
147 goto err; 152 goto err;
148 153
149 /* Get MAC, PHY and RADIO revisions */ 154 /* Get PHY and RADIO revisions */
150 ah->ah_mac_srev = srev;
151 ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER);
152 ah->ah_phy_revision = ath5k_hw_reg_read(ah, AR5K_PHY_CHIP_ID) & 155 ah->ah_phy_revision = ath5k_hw_reg_read(ah, AR5K_PHY_CHIP_ID) &
153 0xffffffff; 156 0xffffffff;
154 ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah, 157 ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah,
diff --git a/drivers/net/wireless/ath/ath5k/pci.c b/drivers/net/wireless/ath/ath5k/pci.c
index 3f26cf200196..39f033128c5a 100644
--- a/drivers/net/wireless/ath/ath5k/pci.c
+++ b/drivers/net/wireless/ath/ath5k/pci.c
@@ -100,6 +100,12 @@ bool ath5k_pci_eeprom_read(struct ath_common *common, u32 offset, u16 *data)
100 return -ETIMEDOUT; 100 return -ETIMEDOUT;
101} 101}
102 102
103int ath5k_hw_read_srev(struct ath5k_hw *ah)
104{
105 ah->ah_mac_srev = ath5k_hw_reg_read(ah, AR5K_SREV);
106 return 0;
107}
108
103/* Common ath_bus_opts structure */ 109/* Common ath_bus_opts structure */
104static const struct ath_bus_ops ath_pci_bus_ops = { 110static const struct ath_bus_ops ath_pci_bus_ops = {
105 .ath_bus_type = ATH_PCI, 111 .ath_bus_type = ATH_PCI,