Commit 7f52c81d authored by Arend van Spriel's avatar Arend van Spriel Committed by Kalle Valo

brcmfmac: store revinfo retrieval result

When revinfo retrieval fails we can not show the firmware version
in ethtool driver info. Store the result to be used when handling
ethtool driver info callback.
Reviewed-by: default avatarHante Meuleman <meuleman@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent e749c7d4
...@@ -57,10 +57,10 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) ...@@ -57,10 +57,10 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_REVINFO, err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_REVINFO,
&revinfo, sizeof(revinfo)); &revinfo, sizeof(revinfo));
ri = &ifp->drvr->revinfo;
if (err < 0) { if (err < 0) {
brcmf_err("retrieving revision info failed, %d\n", err); brcmf_err("retrieving revision info failed, %d\n", err);
} else { } else {
ri = &ifp->drvr->revinfo;
ri->vendorid = le32_to_cpu(revinfo.vendorid); ri->vendorid = le32_to_cpu(revinfo.vendorid);
ri->deviceid = le32_to_cpu(revinfo.deviceid); ri->deviceid = le32_to_cpu(revinfo.deviceid);
ri->radiorev = le32_to_cpu(revinfo.radiorev); ri->radiorev = le32_to_cpu(revinfo.radiorev);
...@@ -79,6 +79,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) ...@@ -79,6 +79,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
ri->chippkg = le32_to_cpu(revinfo.chippkg); ri->chippkg = le32_to_cpu(revinfo.chippkg);
ri->nvramrev = le32_to_cpu(revinfo.nvramrev); ri->nvramrev = le32_to_cpu(revinfo.nvramrev);
} }
ri->result = err;
/* query for 'ver' to get version info from firmware */ /* query for 'ver' to get version info from firmware */
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
......
...@@ -601,11 +601,12 @@ static void brcmf_ethtool_get_drvinfo(struct net_device *ndev, ...@@ -601,11 +601,12 @@ static void brcmf_ethtool_get_drvinfo(struct net_device *ndev,
{ {
struct brcmf_if *ifp = netdev_priv(ndev); struct brcmf_if *ifp = netdev_priv(ndev);
struct brcmf_pub *drvr = ifp->drvr; struct brcmf_pub *drvr = ifp->drvr;
char drev[BRCMU_DOTREV_LEN]; char drev[BRCMU_DOTREV_LEN] = "n/a";
if (drvr->revinfo.result == 0)
brcmu_dotrev_str(drvr->revinfo.driverrev, drev);
strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
strlcpy(info->version, brcmu_dotrev_str(drvr->revinfo.driverrev, drev), strlcpy(info->version, drev, sizeof(info->version));
sizeof(info->version));
strlcpy(info->fw_version, drvr->fwver, sizeof(info->fw_version)); strlcpy(info->fw_version, drvr->fwver, sizeof(info->fw_version));
strlcpy(info->bus_info, dev_name(drvr->bus_if->dev), strlcpy(info->bus_info, dev_name(drvr->bus_if->dev),
sizeof(info->bus_info)); sizeof(info->bus_info));
......
...@@ -71,8 +71,16 @@ struct brcmf_proto; /* device communication protocol info */ ...@@ -71,8 +71,16 @@ struct brcmf_proto; /* device communication protocol info */
struct brcmf_cfg80211_dev; /* cfg80211 device info */ struct brcmf_cfg80211_dev; /* cfg80211 device info */
struct brcmf_fws_info; /* firmware signalling info */ struct brcmf_fws_info; /* firmware signalling info */
/* see struct brcmf_rev_info_le in fwil_types.h */ /*
* struct brcmf_rev_info
*
* The result field stores the error code of the
* revision info request from firmware. For the
* other fields see struct brcmf_rev_info_le in
* fwil_types.h
*/
struct brcmf_rev_info { struct brcmf_rev_info {
int result;
u32 vendorid; u32 vendorid;
u32 deviceid; u32 deviceid;
u32 radiorev; u32 radiorev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment