Skip to contentSkip to conversation

ath9k : Display MAC/BB and RF version at startup

PATCH In review Benoit PAPILLAULT 4 participants 9 messages Nov 3, 2008 – Nov 7, 2008 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath9k : Display MAC/BB and RF version at startup

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 3x3 11n device. It also makes the differences between AR5416 (PCI) and AR5418 (PCI Express). Both are named AR5416 in the register definitions.

(quoted diff) +0 -0

b/drivers/net/wireless/ath9k/hw.c
index ded9453..f2916a5 100644

drivers/net/wireless/ath9k/hw.c +2 -1
@@ -382,8 +382,9 @@ static const char *ath9k_hw_devname(u16 devid)
 {
 	switch (devid) {
 	case AR5416_DEVID_PCI:
-	case AR5416_DEVID_PCIE:
 		return "Atheros 5416";
+	case AR5416_DEVID_PCIE:
+		return "Atheros 5418";
 	case AR9160_DEVID_PCI:
 		return "Atheros 9160";
 	case AR9280_DEVID_PCI:
(quoted diff) +0 -0

b/drivers/net/wireless/ath9k/main.c
index c67dadc..7c53ea8 100644

drivers/net/wireless/ath9k/main.c +1 -0
@@ -18,6 +18,7 @@
 
 #include <linux/nl80211.h>
 #include "core.h"
+#include "reg.h"
 
 #define ATH_PCI_VERSION "0.1"
 
@@ -1524,10 +1525,11 @@ static int ath_pci_probe(struct pci_dev *pdev,

const struct pci_device_id *id)
void __iomem *mem;
struct ath_softc *sc;
struct ieee80211_hw *hw;
- const char *athname;
u8 csz;
u32 val;
int ret = 0;
+ struct ath_hal *ah;
+ u16 macVersion, rfVersion;

if (pci_enable_device(pdev))
return -EIO;
@@ -1614,11 +1616,26 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
goto bad4;
}

- athname = ath9k_hw_probe(id->vendor, id->device);
-
- printk(KERN_INFO "%s: %s: mem=0x%lx, irq=%d\n",
+ ah = sc->sc_ah;
+ macVersion = ah->ah_macVersion;
+ rfVersion = (ah->ah_analog5GhzRev & AR_RADIO_SREV_MAJOR);
+ printk(KERN_INFO
+ "%s: Atheros AR%s%s%s%s%s%s MAC/BB Rev:%x "
+ "AR%s%s%s%s%s RF Rev:%x: mem=0x%lx, irq=%d\n",
wiphy_name(hw->wiphy),

-	       athname ? athname : "Atheros ???",
+	       macVersion == AR_SREV_VERSION_5416_PCI  ? "5416" : "",
+	       macVersion == AR_SREV_VERSION_5416_PCIE ? "5418" : "",
+	       macVersion == AR_SREV_VERSION_9100      ? "9100" : "",
+	       macVersion == AR_SREV_VERSION_9160      ? "9160" : "",
+	       macVersion == AR_SREV_VERSION_9280      ? "9280" : "",
+	       macVersion == AR_SREV_VERSION_9285      ? "9285" : "",
+	       ah->ah_macRev,
+	       rfVersion  == 0                         ? "5133" : "",
+	       rfVersion  == AR_RAD5133_SREV_MAJOR     ? "5133" : "",
+	       rfVersion  == AR_RAD5122_SREV_MAJOR     ? "5122" : "",
+	       rfVersion  == AR_RAD2133_SREV_MAJOR     ? "2133" : "",
+	       rfVersion  == AR_RAD2122_SREV_MAJOR     ? "2122" : "",
+	       ah->ah_phyRev,

(unsigned long)mem, pdev->irq);

return 0;

#1 lore raw
Quoted 7 lines · Benoit PAPILLAULT

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 3x3 11n device. It also makes the differences between AR5416 (PCI) and AR5418 (PCI Express). Both are named AR5416 in the register definitions.

[...]

Quoted 12 lines
(quoted diff) +9 -2
-	printk(KERN_INFO "%s: %s: mem=0x%lx, irq=%d\n",
+	ah = sc->sc_ah;
+	macVersion = ah->ah_macVersion;
+	rfVersion  = (ah->ah_analog5GhzRev & AR_RADIO_SREV_MAJOR);
+	printk(KERN_INFO
+	       "%s: Atheros AR%s%s%s%s%s%s MAC/BB Rev:%x "
+	       "AR%s%s%s%s%s RF Rev:%x: mem=0x%lx, irq=%d\n",
 	       wiphy_name(hw->wiphy),
-	       athname ? athname : "Atheros ???",
+	       macVersion == AR_SREV_VERSION_5416_PCI  ? "5416" : "",
+	       macVersion == AR_SREV_VERSION_5416_PCIE ? "5418" : "",
+	       macVersion == AR_SREV_VERSION_9100      ? "9100" : "",

Review

Quoted 10 lines
(quoted diff) +10 -0
+	       macVersion == AR_SREV_VERSION_9160      ? "9160" : "",
+	       macVersion == AR_SREV_VERSION_9280      ? "9280" : "",
+	       macVersion == AR_SREV_VERSION_9285      ? "9285" : "",
+	       ah->ah_macRev,
+	       rfVersion  == 0                         ? "5133" : "",
+	       rfVersion  == AR_RAD5133_SREV_MAJOR     ? "5133" : "",
+	       rfVersion  == AR_RAD5122_SREV_MAJOR     ? "5122" : "",
+	       rfVersion  == AR_RAD2133_SREV_MAJOR     ? "2133" : "",
+	       rfVersion  == AR_RAD2122_SREV_MAJOR     ? "2122" : "",
+	       ah->ah_phyRev,

I recommend adding a separate function returning the string instead of this ugly "%s%s%s%s" trick. Much cleaner that way.

Signature · 1 line
Kalle Valo
#2 lore raw
Quoted 35 lines · Kalle Valo
Quoted 7 lines · Benoit PAPILLAULT

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 3x3 11n device. It also makes the differences between AR5416 (PCI) and AR5418 (PCI Express). Both are named AR5416 in the register definitions.

[...]

Quoted 12 lines
(quoted diff) +9 -2
-     printk(KERN_INFO "%s: %s: mem=0x%lx, irq=%d\n",
+     ah = sc->sc_ah;
+     macVersion = ah->ah_macVersion;
+     rfVersion  = (ah->ah_analog5GhzRev & AR_RADIO_SREV_MAJOR);
+     printk(KERN_INFO
+            "%s: Atheros AR%s%s%s%s%s%s MAC/BB Rev:%x "
+            "AR%s%s%s%s%s RF Rev:%x: mem=0x%lx, irq=%d\n",
             wiphy_name(hw->wiphy),
-            athname ? athname : "Atheros ???",
+            macVersion == AR_SREV_VERSION_5416_PCI  ? "5416" : "",
+            macVersion == AR_SREV_VERSION_5416_PCIE ? "5418" : "",
+            macVersion == AR_SREV_VERSION_9100      ? "9100" : "",

Review

Quoted 10 lines
(quoted diff) +10 -0
+            macVersion == AR_SREV_VERSION_9160      ? "9160" : "",
+            macVersion == AR_SREV_VERSION_9280      ? "9280" : "",
+            macVersion == AR_SREV_VERSION_9285      ? "9285" : "",
+            ah->ah_macRev,
+            rfVersion  == 0                         ? "5133" : "",
+            rfVersion  == AR_RAD5133_SREV_MAJOR     ? "5133" : "",
+            rfVersion  == AR_RAD5122_SREV_MAJOR     ? "5122" : "",
+            rfVersion  == AR_RAD2133_SREV_MAJOR     ? "2133" : "",
+            rfVersion  == AR_RAD2122_SREV_MAJOR     ? "2122" : "",
+            ah->ah_phyRev,
Quoted 2 lines

I recommend adding a separate function returning the string instead of this ugly "%s%s%s%s" trick. Much cleaner that way.

Agreed, also please remove 3x3 comment as we don't have support for those yet nor do I even have hardware for it. To be clear ath9k supports 2x2 right now. :)

Luis

#3 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Luis R. Rodriguez a =E9crit :

Quoted 1 line
Quoted 1 line

I recommend adding a separate function returning the string instead =

of

Quoted 1 line
Quoted 1 line

this ugly "%s%s%s%s" trick. Much cleaner that way.

I'm going to send an updated patch.

Quoted 3 lines

=20
Agreed, also please remove 3x3 comment as we don't have support for those yet nor do I even have hardware for it. To be clear ath9k suppo=

rts

Quoted 1 line

2x2 right now. :)

Hummm... This is what the Atheros web site says and I have 3 antennas (very nice connector from UBNT btw). Of course, i don't know if it is supported by the driver, but at least, I think, it's supported by the hardware.

Reference : http://www.atheros.com/pt/AR9001AP-3NX2.htm

Regards,
Benoit
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJEZw9OR6EySwP7oIRApusAKDnN+sBIl4hAR2YoAxMaTDkSvvn1QCgompH a6SODwjspKIGFe8JLT7TnHY=3D
=3DuiLr
-----END PGP SIGNATURE-----
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

PATCH 1/1 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.

(quoted diff) +0 -0

b/drivers/net/wireless/ath9k/hw.c
index ded9453..f2916a5 100644

drivers/net/wireless/ath9k/hw.c +2 -1
@@ -382,8 +382,9 @@ static const char *ath9k_hw_devname(u16 devid)
 {
 	switch (devid) {
 	case AR5416_DEVID_PCI:
-	case AR5416_DEVID_PCIE:
 		return "Atheros 5416";
+	case AR5416_DEVID_PCIE:
+		return "Atheros 5418";
 	case AR9160_DEVID_PCI:
 		return "Atheros 9160";
 	case AR9280_DEVID_PCI:
(quoted diff) +0 -0

b/drivers/net/wireless/ath9k/main.c
index c67dadc..2913c13 100644

drivers/net/wireless/ath9k/main.c +60 -0

70 lines not on this page · raw message

pci_device_id *id)
{
void __iomem *mem;
struct ath_softc *sc;
struct ieee80211_hw *hw;
- const char *athname;
u8 csz;
u32 val;
int ret = 0;
+ struct ath_hal *ah;

if (pci_enable_device(pdev))
return -EIO;
@@ -1614,11 +1674,15 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
goto bad4;
}

- athname = ath9k_hw_probe(id->vendor, id->device);
-
- printk(KERN_INFO "%s: %s: mem=0x%lx, irq=%d\n",
+ ah = sc->sc_ah;
+ printk(KERN_INFO
+ "%s: Atheros AR%s MAC/BB Rev:%x "
+ "AR%s RF Rev:%x: mem=0x%lx, irq=%d\n",
wiphy_name(hw->wiphy),

-	       athname ? athname : "Atheros ???",
+	       ath_mac_bb_name(ah->ah_macVersion),
+	       ah->ah_macRev,
+	       ath_rf_name((ah->ah_analog5GhzRev & AR_RADIO_SREV_MAJOR)),
+	       ah->ah_phyRev,

(unsigned long)mem, pdev->irq);

return 0;

#5 lore raw

PATCH 1/1 ath9k : Display MAC/BB and RF version at startup (v2)

Quoted 7 lines · Benoit PAPILLAULT

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.

thanks, I'm going to test it on our later hardware, but patch fails with git am (and therefore with patch itself):

mcgrof at mosca ~/wireless-testing (git::11dv3)$ patch -p1 < /home/mcgrof/name-ath9k.patch
patching file drivers/net/wireless/ath9k/hw.c patching file drivers/net/wireless/ath9k/main.c
patch: **** malformed patch@line 105: pci_device_id *id)

Luis

#6 lore raw

PATCH 1/1 ath9k : Display MAC/BB and RF version at startup (v2)

Quoted 10 lines · Luis Rodriguez
Quoted 7 lines · Benoit PAPILLAULT

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.

Quoted 8 lines

thanks, I'm going to test it on our later hardware, but patch fails with git am (and therefore with patch itself):

mcgrof at mosca ~/wireless-testing (git::11dv3)$ patch -p1 < /home/mcgrof/name-ath9k.patch
patching file drivers/net/wireless/ath9k/hw.c patching file drivers/net/wireless/ath9k/main.c
patch: **** malformed patch at line 105: pci_device_id *id)

After tinkering with it applies though, seems your > 80 columns get wrapped.

From: Benoit PAPILLAULT <[email protected]> PATCH] ath9k : Display MAC/BB and RF version at

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.

(quoted diff) +0 -0

b/drivers/net/wireless/ath9k/hw.c
index ded9453..f2916a5 100644

drivers/net/wireless/ath9k/hw.c +2 -1
@@ -382,8 +382,9 @@ static const char *ath9k_hw_devname(u16 devid)
 {
 	switch (devid) {
 	case AR5416_DEVID_PCI:
-	case AR5416_DEVID_PCIE:
 		return "Atheros 5416";
+	case AR5416_DEVID_PCIE:
+		return "Atheros 5418";
 	case AR9160_DEVID_PCI:
 		return "Atheros 9160";
 	case AR9280_DEVID_PCI:
(quoted diff) +0 -0

b/drivers/net/wireless/ath9k/main.c
index c67dadc..2913c13 100644

drivers/net/wireless/ath9k/main.c +69 -5

101 lines not on this page · raw message

#7 lore raw
In reply to Benoit PAPILLAULT

T24gV2VkLCBOb3YgNSwgMjAwOCBhdCA1OjE0IEFNLCBCZW5vaXQgUEFQSUxMQVVMVAo8YmVub2l0 LnBhcGlsbGF1bHRAZnJlZS5mcj4gd3JvdGU6Cj4gLS0tLS1CRUdJTiBQR1AgU0lHTkVEIE1FU1NB R0UtLS0tLQo+IEhhc2g6IFNIQTEKPgo+IEx1aXMgUi4gUm9kcmlndWV6IGEgw6ljcml0IDoKPj4+ IEkgcmVjb21tZW5kIGFkZGluZyBhIHNlcGFyYXRlIGZ1bmN0aW9uIHJldHVybmluZyB0aGUgc3Ry aW5nIGluc3RlYWQgb2YKPj4+IHRoaXMgdWdseSAiJXMlcyVzJXMiIHRyaWNrLiBNdWNoIGNsZWFu ZXIgdGhhdCB3YXkuCj4KPiBJJ20gZ29pbmcgdG8gc2VuZCBhbiB1cGRhdGVkIHBhdGNoLgo+Cj4+ Cj4+IEFncmVlZCwgYWxzbyBwbGVhc2UgcmVtb3ZlIDN4MyBjb21tZW50IGFzIHdlIGRvbid0IGhh dmUgc3VwcG9ydCBmb3IKPj4gdGhvc2UgeWV0IG5vciBkbyBJIGV2ZW4gaGF2ZSBoYXJkd2FyZSBm b3IgaXQuIFRvIGJlIGNsZWFyIGF0aDlrIHN1cHBvcnRzCj4+IDJ4MiByaWdodCBub3cuIDopCj4K PiBIdW1tbS4uLiBUaGlzIGlzIHdoYXQgdGhlIEF0aGV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