aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-10-27 12:59:33 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-30 16:49:18 -0400
commit2da4f01a0938b688f92f9ee380013cfb8653510f (patch)
tree35f48c5f1802806e785b7e8488011a3077de1baa /drivers/net/wireless/ath
parent8c8746f9db8b1f644695050703e2d38cd5964ba7 (diff)
ath9k_hw: move mac name and rf name helpers to hw code
These are shared between ath9k and the future ath9k_htc driver. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r--drivers/net/wireless/ath/ath9k/ahb.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c62
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c58
-rw-r--r--drivers/net/wireless/ath/ath9k/pci.c5
5 files changed, 71 insertions, 62 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c
index 25531f231b67..41422c449696 100644
--- a/drivers/net/wireless/ath/ath9k/ahb.c
+++ b/drivers/net/wireless/ath/ath9k/ahb.c
@@ -137,9 +137,10 @@ static int ath_ahb_probe(struct platform_device *pdev)
137 "%s: Atheros AR%s MAC/BB Rev:%x, " 137 "%s: Atheros AR%s MAC/BB Rev:%x, "
138 "AR%s RF Rev:%x, mem=0x%lx, irq=%d\n", 138 "AR%s RF Rev:%x, mem=0x%lx, irq=%d\n",
139 wiphy_name(hw->wiphy), 139 wiphy_name(hw->wiphy),
140 ath_mac_bb_name(ah->hw_version.macVersion), 140 ath9k_hw_mac_bb_name(ah->hw_version.macVersion),
141 ah->hw_version.macRev, 141 ah->hw_version.macRev,
142 ath_rf_name((ah->hw_version.analog5GhzRev & AR_RADIO_SREV_MAJOR)), 142 ath9k_hw_rf_name((ah->hw_version.analog5GhzRev &
143 AR_RADIO_SREV_MAJOR)),
143 ah->hw_version.phyRev, 144 ah->hw_version.phyRev,
144 (unsigned long)mem, irq); 145 (unsigned long)mem, irq);
145 146
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index cab17c6c8a37..bba923135b0e 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -4350,3 +4350,65 @@ void ath_gen_timer_isr(struct ath_hw *ah)
4350 } 4350 }
4351} 4351}
4352EXPORT_SYMBOL(ath_gen_timer_isr); 4352EXPORT_SYMBOL(ath_gen_timer_isr);
4353
4354static struct {
4355 u32 version;
4356 const char * name;
4357} ath_mac_bb_names[] = {
4358 /* Devices with external radios */
4359 { AR_SREV_VERSION_5416_PCI, "5416" },
4360 { AR_SREV_VERSION_5416_PCIE, "5418" },
4361 { AR_SREV_VERSION_9100, "9100" },
4362 { AR_SREV_VERSION_9160, "9160" },
4363 /* Single-chip solutions */
4364 { AR_SREV_VERSION_9280, "9280" },
4365 { AR_SREV_VERSION_9285, "9285" },
4366 { AR_SREV_VERSION_9287, "9287" }
4367};
4368
4369/* For devices with external radios */
4370static struct {
4371 u16 version;
4372 const char * name;
4373} ath_rf_names[] = {
4374 { 0, "5133" },
4375 { AR_RAD5133_SREV_MAJOR, "5133" },
4376 { AR_RAD5122_SREV_MAJOR, "5122" },
4377 { AR_RAD2133_SREV_MAJOR, "2133" },
4378 { AR_RAD2122_SREV_MAJOR, "2122" }
4379};
4380
4381/*
4382 * Return the MAC/BB name. "????" is returned if the MAC/BB is unknown.
4383 */
4384const char *ath9k_hw_mac_bb_name(u32 mac_bb_version)
4385{
4386 int i;
4387
4388 for (i=0; i<ARRAY_SIZE(ath_mac_bb_names); i++) {
4389 if (ath_mac_bb_names[i].version == mac_bb_version) {
4390 return ath_mac_bb_names[i].name;
4391 }
4392 }
4393
4394 return "????";
4395}
4396EXPORT_SYMBOL(ath9k_hw_mac_bb_name);
4397
4398/*
4399 * Return the RF name. "????" is returned if the RF is unknown.
4400 * Used for devices with external radios.
4401 */
4402const char *ath9k_hw_rf_name(u16 rf_version)
4403{
4404 int i;
4405
4406 for (i=0; i<ARRAY_SIZE(ath_rf_names); i++) {
4407 if (ath_rf_names[i].version == rf_version) {
4408 return ath_rf_names[i].name;
4409 }
4410 }
4411
4412 return "????";
4413}
4414EXPORT_SYMBOL(ath9k_hw_rf_name);
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index cdaec526db35..979a594f93d1 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -704,6 +704,9 @@ void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer);
704void ath_gen_timer_isr(struct ath_hw *hw); 704void ath_gen_timer_isr(struct ath_hw *hw);
705u32 ath9k_hw_gettsf32(struct ath_hw *ah); 705u32 ath9k_hw_gettsf32(struct ath_hw *ah);
706 706
707const char *ath9k_hw_mac_bb_name(u32 mac_bb_version);
708const char *ath9k_hw_rf_name(u16 rf_version);
709
707#define ATH_PCIE_CAP_LINK_CTRL 0x70 710#define ATH_PCIE_CAP_LINK_CTRL 0x70
708#define ATH_PCIE_CAP_LINK_L0S 1 711#define ATH_PCIE_CAP_LINK_L0S 1
709#define ATH_PCIE_CAP_LINK_L1 2 712#define ATH_PCIE_CAP_LINK_L1 2
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 69cf702b18c2..9fefc51aec17 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -3191,64 +3191,6 @@ struct ieee80211_ops ath9k_ops = {
3191 .rfkill_poll = ath9k_rfkill_poll_state, 3191 .rfkill_poll = ath9k_rfkill_poll_state,
3192}; 3192};
3193 3193
3194static struct {
3195 u32 version;
3196 const char * name;
3197} ath_mac_bb_names[] = {
3198 { AR_SREV_VERSION_5416_PCI, "5416" },
3199 { AR_SREV_VERSION_5416_PCIE, "5418" },
3200 { AR_SREV_VERSION_9100, "9100" },
3201 { AR_SREV_VERSION_9160, "9160" },
3202 { AR_SREV_VERSION_9280, "9280" },
3203 { AR_SREV_VERSION_9285, "9285" },
3204 { AR_SREV_VERSION_9287, "9287" }
3205};
3206
3207static struct {
3208 u16 version;
3209 const char * name;
3210} ath_rf_names[] = {
3211 { 0, "5133" },
3212 { AR_RAD5133_SREV_MAJOR, "5133" },
3213 { AR_RAD5122_SREV_MAJOR, "5122" },
3214 { AR_RAD2133_SREV_MAJOR, "2133" },
3215 { AR_RAD2122_SREV_MAJOR, "2122" }
3216};
3217
3218/*
3219 * Return the MAC/BB name. "????" is returned if the MAC/BB is unknown.
3220 */
3221const char *
3222ath_mac_bb_name(u32 mac_bb_version)
3223{
3224 int i;
3225
3226 for (i=0; i<ARRAY_SIZE(ath_mac_bb_names); i++) {
3227 if (ath_mac_bb_names[i].version == mac_bb_version) {
3228 return ath_mac_bb_names[i].name;
3229 }
3230 }
3231
3232 return "????";
3233}
3234
3235/*
3236 * Return the RF name. "????" is returned if the RF is unknown.
3237 */
3238const char *
3239ath_rf_name(u16 rf_version)
3240{
3241 int i;
3242
3243 for (i=0; i<ARRAY_SIZE(ath_rf_names); i++) {
3244 if (ath_rf_names[i].version == rf_version) {
3245 return ath_rf_names[i].name;
3246 }
3247 }
3248
3249 return "????";
3250}
3251
3252static int __init ath9k_init(void) 3194static int __init ath9k_init(void)
3253{ 3195{
3254 int error; 3196 int error;
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index 63059b6a90da..76f3890d0a9c 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -222,9 +222,10 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
222 "%s: Atheros AR%s MAC/BB Rev:%x " 222 "%s: Atheros AR%s MAC/BB Rev:%x "
223 "AR%s RF Rev:%x: mem=0x%lx, irq=%d\n", 223 "AR%s RF Rev:%x: mem=0x%lx, irq=%d\n",
224 wiphy_name(hw->wiphy), 224 wiphy_name(hw->wiphy),
225 ath_mac_bb_name(ah->hw_version.macVersion), 225 ath9k_hw_mac_bb_name(ah->hw_version.macVersion),
226 ah->hw_version.macRev, 226 ah->hw_version.macRev,
227 ath_rf_name((ah->hw_version.analog5GhzRev & AR_RADIO_SREV_MAJOR)), 227 ath9k_hw_rf_name((ah->hw_version.analog5GhzRev &
228 AR_RADIO_SREV_MAJOR)),
228 ah->hw_version.phyRev, 229 ah->hw_version.phyRev,
229 (unsigned long)mem, pdev->irq); 230 (unsigned long)mem, pdev->irq);
230 231