aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/main.c
diff options
context:
space:
mode:
authorBenoit PAPILLAULT <benoit.papillault@free.fr>2008-11-06 16:26:49 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-11-21 11:06:06 -0500
commit392dff836f40370033bbe3b39e3b9bf4148d1435 (patch)
tree181144a134369dc41ebf273b890f85daaf7da946 /drivers/net/wireless/ath9k/main.c
parent4821277f36e008b531728e359fbbedb229117f4b (diff)
ath9k : Display MAC/BB and RF version at startup (v2)
This patch decodes the MAC/BB version (for instance: AR5416) and the RF part version (for instance: AR5133). It has been tested on AR5416/AR5133 which is a 2.4/5GHz 11n device. It also makes the differences between AR5416 (PCI) and AR5418 (PCI Express). Both are named AR5416 in the register definitions. Signed-off-by: Benoit Papillault <benoit.papillault@free.fr> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/main.c')
-rw-r--r--drivers/net/wireless/ath9k/main.c74
1 files changed, 69 insertions, 5 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index f830fe1e4adc..fbb2dd2373c8 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -18,6 +18,7 @@
18 18
19#include <linux/nl80211.h> 19#include <linux/nl80211.h>
20#include "core.h" 20#include "core.h"
21#include "reg.h"
21 22
22#define ATH_PCI_VERSION "0.1" 23#define ATH_PCI_VERSION "0.1"
23 24
@@ -1519,15 +1520,74 @@ static struct ieee80211_ops ath9k_ops = {
1519 .set_frag_threshold = ath9k_no_fragmentation, 1520 .set_frag_threshold = ath9k_no_fragmentation,
1520}; 1521};
1521 1522
1523static struct {
1524 u32 version;
1525 const char * name;
1526} ath_mac_bb_names[] = {
1527 { AR_SREV_VERSION_5416_PCI, "5416" },
1528 { AR_SREV_VERSION_5416_PCIE, "5418" },
1529 { AR_SREV_VERSION_9100, "9100" },
1530 { AR_SREV_VERSION_9160, "9160" },
1531 { AR_SREV_VERSION_9280, "9280" },
1532 { AR_SREV_VERSION_9285, "9285" }
1533};
1534
1535static struct {
1536 u16 version;
1537 const char * name;
1538} ath_rf_names[] = {
1539 { 0, "5133" },
1540 { AR_RAD5133_SREV_MAJOR, "5133" },
1541 { AR_RAD5122_SREV_MAJOR, "5122" },
1542 { AR_RAD2133_SREV_MAJOR, "2133" },
1543 { AR_RAD2122_SREV_MAJOR, "2122" }
1544};
1545
1546/*
1547 * Return the MAC/BB name. "????" is returned if the MAC/BB is unknown.
1548 */
1549
1550static const char *
1551ath_mac_bb_name(u32 mac_bb_version)
1552{
1553 int i;
1554
1555 for (i=0; i<ARRAY_SIZE(ath_mac_bb_names); i++) {
1556 if (ath_mac_bb_names[i].version == mac_bb_version) {
1557 return ath_mac_bb_names[i].name;
1558 }
1559 }
1560
1561 return "????";
1562}
1563
1564/*
1565 * Return the RF name. "????" is returned if the RF is unknown.
1566 */
1567
1568static const char *
1569ath_rf_name(u16 rf_version)
1570{
1571 int i;
1572
1573 for (i=0; i<ARRAY_SIZE(ath_rf_names); i++) {
1574 if (ath_rf_names[i].version == rf_version) {
1575 return ath_rf_names[i].name;
1576 }
1577 }
1578
1579 return "????";
1580}
1581
1522static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) 1582static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1523{ 1583{
1524 void __iomem *mem; 1584 void __iomem *mem;
1525 struct ath_softc *sc; 1585 struct ath_softc *sc;
1526 struct ieee80211_hw *hw; 1586 struct ieee80211_hw *hw;
1527 const char *athname;
1528 u8 csz; 1587 u8 csz;
1529 u32 val; 1588 u32 val;
1530 int ret = 0; 1589 int ret = 0;
1590 struct ath_hal *ah;
1531 1591
1532 if (pci_enable_device(pdev)) 1592 if (pci_enable_device(pdev))
1533 return -EIO; 1593 return -EIO;
@@ -1614,11 +1674,15 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1614 goto bad4; 1674 goto bad4;
1615 } 1675 }
1616 1676
1617 athname = ath9k_hw_probe(id->vendor, id->device); 1677 ah = sc->sc_ah;
1618 1678 printk(KERN_INFO
1619 printk(KERN_INFO "%s: %s: mem=0x%lx, irq=%d\n", 1679 "%s: Atheros AR%s MAC/BB Rev:%x "
1680 "AR%s RF Rev:%x: mem=0x%lx, irq=%d\n",
1620 wiphy_name(hw->wiphy), 1681 wiphy_name(hw->wiphy),
1621 athname ? athname : "Atheros ???", 1682 ath_mac_bb_name(ah->ah_macVersion),
1683 ah->ah_macRev,
1684 ath_rf_name((ah->ah_analog5GhzRev & AR_RADIO_SREV_MAJOR)),
1685 ah->ah_phyRev,
1622 (unsigned long)mem, pdev->irq); 1686 (unsigned long)mem, pdev->irq);
1623 1687
1624 return 0; 1688 return 0;