diff mbox

brcmsmac: export firmware version to ethtool

Message ID 1361720494-27131-1-git-send-email-hauke@hauke-m.de (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Hauke Mehrtens Feb. 24, 2013, 3:41 p.m. UTC
This exports the firmware version in use to userspace through ethtool.

root@OpenWrt:/# ethtool -i wlan0
firmware-version: 610.812

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/wireless/brcm80211/brcmsmac/main.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Arend van Spriel Feb. 25, 2013, 2:18 p.m. UTC | #1
On 02/24/13 16:41, Hauke Mehrtens wrote:
> This exports the firmware version in use to userspace through ethtool.
>
> root@OpenWrt:/# ethtool -i wlan0
> firmware-version: 610.812

This info is already available under debugfs although I prefer your 
formatting :-) :

$ sudo cat hardware
board vendor: 1028
board type: e
board revision: 2203
board flags: 200
board flags2: 1000
firmware revision: 262032c

Gr. AvS

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hauke Mehrtens Feb. 25, 2013, 7:05 p.m. UTC | #2
On 02/25/2013 03:18 PM, Arend van Spriel wrote:
> On 02/24/13 16:41, Hauke Mehrtens wrote:
>> This exports the firmware version in use to userspace through ethtool.
>>
>> root@OpenWrt:/# ethtool -i wlan0
>> firmware-version: 610.812
> 
> This info is already available under debugfs although I prefer your
> formatting :-) :

I used the same formating b43 uses, I do not know what's the official
formating for this firmware version number.

Writing the firmware version to wiphy->fw_version is the official way to
do this and many drivers already are exporting their firmware version in
this way.

I would prefer export the firmware version this way and also add it to
the hardware info in debugfs, where it already is.

Hauke
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index d723e15..abd6eab 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -7957,9 +7957,14 @@  void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx)
 
 	/* read the ucode version if we have not yet done so */
 	if (wlc->ucode_rev == 0) {
-		wlc->ucode_rev =
-		    brcms_b_read_shm(wlc->hw, M_BOM_REV_MAJOR) << NBITS(u16);
-		wlc->ucode_rev |= brcms_b_read_shm(wlc->hw, M_BOM_REV_MINOR);
+		u16 rev;
+		u16 patch;
+
+		rev = brcms_b_read_shm(wlc->hw, M_BOM_REV_MAJOR);
+		patch = brcms_b_read_shm(wlc->hw, M_BOM_REV_MINOR);
+		wlc->ucode_rev = (rev << NBITS(u16)) | patch;
+		snprintf(wlc->wiphy->fw_version,
+			 sizeof(wlc->wiphy->fw_version), "%u.%u", rev, patch);
 	}
 
 	/* ..now really unleash hell (allow the MAC out of suspend) */