brcmfmac: show firmware release info in ethtool driver info
authorArend van Spriel <arend@broadcom.com>
Sun, 25 Jan 2015 19:31:41 +0000 (20:31 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 29 Jan 2015 07:59:14 +0000 (09:59 +0200)
The ethtool driver info already contained the unique firmware
identifier. This patch adds the firmware release version.

   $ ethtool -i wlan4
   driver: brcmfmac
   version: 6.10.224.22
   firmware-version: 01-32bd010f

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/brcm80211/brcmfmac/core.c
drivers/net/wireless/brcm80211/brcmutil/utils.c
drivers/net/wireless/brcm80211/include/brcmu_utils.h

index 6406f95af0d30812e29fdcba70e2f4aa6f7b7df8..8d03588b54bbc9892ee9ab43f07dac5a1870c9d3 100644 (file)
@@ -601,9 +601,11 @@ static void brcmf_ethtool_get_drvinfo(struct net_device *ndev,
 {
        struct brcmf_if *ifp = netdev_priv(ndev);
        struct brcmf_pub *drvr = ifp->drvr;
+       char drev[BRCMU_DOTREV_LEN];
 
        strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
-       snprintf(info->version, sizeof(info->version), "n/a");
+       strlcpy(info->version, brcmu_dotrev_str(drvr->revinfo.driverrev, drev),
+               sizeof(info->version));
        strlcpy(info->fw_version, drvr->fwver, sizeof(info->fw_version));
        strlcpy(info->bus_info, dev_name(drvr->bus_if->dev),
                sizeof(info->bus_info));
index 34937d8e13959f4298d199399fe810b6b3d1da84..0543607002fd934d8196ca570dcfea6c42157ee6 100644 (file)
@@ -277,6 +277,33 @@ char *brcmu_boardrev_str(u32 brev, char *buf)
 }
 EXPORT_SYMBOL(brcmu_boardrev_str);
 
+char *brcmu_dotrev_str(u32 dotrev, char *buf)
+{
+       u8 dotval[4];
+
+       if (!dotrev) {
+               snprintf(buf, BRCMU_DOTREV_LEN, "unknown");
+               return buf;
+       }
+       dotval[0] = (dotrev >> 24) & 0xFF;
+       dotval[1] = (dotrev >> 16) & 0xFF;
+       dotval[2] = (dotrev >> 8) & 0xFF;
+       dotval[3] = dotrev & 0xFF;
+
+       if (dotval[3])
+               snprintf(buf, BRCMU_DOTREV_LEN, "%d.%d.%d.%d", dotval[0],
+                       dotval[1], dotval[2], dotval[3]);
+       else if (dotval[2])
+               snprintf(buf, BRCMU_DOTREV_LEN, "%d.%d.%d", dotval[0],
+                       dotval[1], dotval[2]);
+       else
+               snprintf(buf, BRCMU_DOTREV_LEN, "%d.%d", dotval[0],
+                       dotval[1]);
+
+       return buf;
+}
+EXPORT_SYMBOL(brcmu_dotrev_str);
+
 #if defined(DEBUG)
 /* pretty hex print a pkt buffer chain */
 void brcmu_prpkt(const char *msg, struct sk_buff *p0)
index 197317b3fa70d9ba7e66db3a0a2be8919f1ae941..41969527b459c95377f29aa168c3e8aa0b1dd737 100644 (file)
@@ -219,7 +219,9 @@ void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...)
 #endif
 
 #define BRCMU_BOARDREV_LEN     8
+#define BRCMU_DOTREV_LEN       16
 
 char *brcmu_boardrev_str(u32 brev, char *buf);
+char *brcmu_dotrev_str(u32 dotrev, char *buf);
 
 #endif                         /* _BRCMU_UTILS_H_ */