brcmfmac: determine chip info when not provided by bus layer
authorArend van Spriel <arend@broadcom.com>
Sun, 25 Jan 2015 19:31:39 +0000 (20:31 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 29 Jan 2015 07:59:11 +0000 (09:59 +0200)
In some scenarios the chip number and revision may not be provided
by the bus layer. If the chip number is not filled, the common
layer will ask the firmware for this information.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@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/brcmfmac/fwil.h
drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h

index b8520c30af7c1a5cd2d4b6a2ef55427612c9eb3c..5f16a7e75d93de7ef2646c9c290918ef203b5b4b 100644 (file)
@@ -948,6 +948,7 @@ int brcmf_bus_start(struct device *dev)
        struct brcmf_pub *drvr = bus_if->drvr;
        struct brcmf_if *ifp;
        struct brcmf_if *p2p_ifp;
+       struct brcmf_rev_info_le revinfo;
 
        brcmf_dbg(TRACE, "\n");
 
@@ -971,6 +972,20 @@ int brcmf_bus_start(struct device *dev)
        if (ret < 0)
                goto fail;
 
+       /* assure we have chipid before feature attach */
+       if (!bus_if->chip) {
+               ret = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_REVINFO, &revinfo,
+                                            sizeof(revinfo));
+               if (ret < 0) {
+                       brcmf_err("no chipid determined - device may malfunction\n");
+               } else {
+                       bus_if->chip = le32_to_cpu(revinfo.chipnum);
+                       bus_if->chiprev = le32_to_cpu(revinfo.chiprev);
+                       brcmf_dbg(INFO, "firmware revinfo: chip %x (%d) rev %d\n",
+                                 bus_if->chip, bus_if->chip,
+                                 bus_if->chiprev);
+               }
+       }
        brcmf_feat_attach(drvr);
 
        ret = brcmf_fws_init(drvr);
index 37345e7b873d0a5f6377538d2332ee0805fcc559..5434dcf64f7d8012206975ed743fe96145b924fb 100644 (file)
@@ -59,6 +59,7 @@
 #define BRCMF_C_SET_COUNTRY                    84
 #define BRCMF_C_GET_PM                         85
 #define BRCMF_C_SET_PM                         86
+#define BRCMF_C_GET_REVINFO                    98
 #define BRCMF_C_GET_CURR_RATESET               114
 #define BRCMF_C_GET_AP                         117
 #define BRCMF_C_SET_AP                         118
index 619669bbdb83b602532b4c0bc8abf73c0588fd0f..3749209651088b0c21beef1bbff9d240a475775f 100644 (file)
@@ -539,4 +539,45 @@ struct brcmf_fil_country_le {
        char ccode[BRCMF_COUNTRY_BUF_SZ];
 };
 
+/**
+ * struct brcmf_rev_info_le - device revision info.
+ *
+ * @vendorid: PCI vendor id.
+ * @deviceid: device id of chip.
+ * @radiorev: radio revision.
+ * @chiprev: chip revision.
+ * @corerev: core revision.
+ * @boardid: board identifier (usu. PCI sub-device id).
+ * @boardvendor: board vendor (usu. PCI sub-vendor id).
+ * @boardrev: board revision.
+ * @driverrev: driver version.
+ * @ucoderev: microcode version.
+ * @bus: bus type.
+ * @chipnum: chip number.
+ * @phytype: phy type.
+ * @phyrev: phy revision.
+ * @anarev: anacore rev.
+ * @chippkg: chip package info.
+ * @nvramrev: nvram revision number.
+ */
+struct brcmf_rev_info_le {
+       __le32 vendorid;
+       __le32 deviceid;
+       __le32 radiorev;
+       __le32 chiprev;
+       __le32 corerev;
+       __le32 boardid;
+       __le32 boardvendor;
+       __le32 boardrev;
+       __le32 driverrev;
+       __le32 ucoderev;
+       __le32 bus;
+       __le32 chipnum;
+       __le32 phytype;
+       __le32 phyrev;
+       __le32 anarev;
+       __le32 chippkg;
+       __le32 nvramrev;
+};
+
 #endif /* FWIL_TYPES_H_ */