Revert "brcmfmac: Read alternative firmware names from DT"
authorPhil Elwell <phil@raspberrypi.com>
Tue, 2 Nov 2021 12:08:49 +0000 (12:08 +0000)
committerPhil Elwell <phil@raspberrypi.com>
Tue, 2 Nov 2021 12:08:49 +0000 (12:08 +0000)
This reverts commit cb02a9793d53ccfcc3368be3a278637955d81f75.

drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c

index db4ac19..a755426 100644 (file)
@@ -10,7 +10,6 @@
 #include "debug.h"
 #include "core.h"
 #include "common.h"
-#include "firmware.h"
 #include "of.h"
 
 void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
@@ -66,38 +65,3 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
        sdio->oob_irq_nr = irq;
        sdio->oob_irq_flags = irqf;
 }
-
-struct brcmf_firmware_mapping *
-brcmf_of_fwnames(struct device *dev, u32 *fwname_count)
-{
-       struct device_node *np = dev->of_node;
-       struct brcmf_firmware_mapping *fwnames;
-       struct device_node *map_np, *fw_np;
-       int of_count;
-       int count = 0;
-
-       map_np = of_get_child_by_name(np, "firmwares");
-       of_count = of_get_child_count(map_np);
-       if (!of_count)
-               return NULL;
-
-       fwnames = devm_kcalloc(dev, of_count,
-                              sizeof(struct brcmf_firmware_mapping),
-                              GFP_KERNEL);
-
-       for_each_child_of_node(map_np, fw_np)
-       {
-               struct brcmf_firmware_mapping *cur = &fwnames[count];
-
-               if (of_property_read_u32(fw_np, "chipid", &cur->chipid) ||
-                   of_property_read_u32(fw_np, "revmask", &cur->revmask))
-                       continue;
-               cur->fw_base = of_get_property(fw_np, "fw_base", NULL);
-               if (cur->fw_base)
-                       count++;
-       }
-
-       *fwname_count = count;
-
-       return count ? fwnames : NULL;
-}
index 5b39a39..10bf522 100644 (file)
@@ -5,16 +5,9 @@
 #ifdef CONFIG_OF
 void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
                    struct brcmf_mp_device *settings);
-struct brcmf_firmware_mapping *
-brcmf_of_fwnames(struct device *dev, u32 *map_count);
 #else
 static void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
                           struct brcmf_mp_device *settings)
 {
 }
-static struct brcmf_firmware_mapping *
-brcmf_of_fwnames(struct device *dev, u32 *map_count)
-{
-       return NULL;
-}
 #endif /* CONFIG_OF */
index e22699b..f6c5168 100644 (file)
@@ -35,7 +35,6 @@
 #include "core.h"
 #include "common.h"
 #include "bcdc.h"
-#include "of.h"
 
 #define DCMD_RESP_TIMEOUT      msecs_to_jiffies(2500)
 #define CTL_DONE_TIMEOUT       msecs_to_jiffies(2500)
@@ -627,7 +626,7 @@ BRCMF_FW_DEF(4359, "brcmfmac4359-sdio");
 BRCMF_FW_DEF(4373, "brcmfmac4373-sdio");
 BRCMF_FW_DEF(43012, "brcmfmac43012-sdio");
 
-static const struct brcmf_firmware_mapping sdio_fwnames[] = {
+static const struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = {
        BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143),
        BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0),
        BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4),
@@ -651,9 +650,6 @@ static const struct brcmf_firmware_mapping sdio_fwnames[] = {
        BRCMF_FW_ENTRY(CY_CC_43012_CHIP_ID, 0xFFFFFFFF, 43012)
 };
 
-static const struct brcmf_firmware_mapping *brcmf_sdio_fwnames = sdio_fwnames;
-static u32 brcmf_sdio_fwnames_count = ARRAY_SIZE(sdio_fwnames);
-
 #define TXCTL_CREDITS  2
 
 static void pkt_align(struct sk_buff *p, int len, int align)
@@ -4139,7 +4135,7 @@ int brcmf_sdio_get_fwname(struct device *dev, const char *ext, u8 *fw_name,
        }
        fwreq = brcmf_fw_alloc_request(bus_if->chip, bus_if->chiprev,
                                       brcmf_sdio_fwnames,
-                                      brcmf_sdio_fwnames_count,
+                                      ARRAY_SIZE(brcmf_sdio_fwnames),
                                       fwnames, ARRAY_SIZE(fwnames));
        if (!fwreq)
                return -ENOMEM;
@@ -4195,9 +4191,6 @@ static const struct brcmf_bus_ops brcmf_sdio_bus_ops = {
 #define BRCMF_SDIO_FW_CODE     0
 #define BRCMF_SDIO_FW_NVRAM    1
 
-static struct brcmf_fw_request *
-brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus);
-
 static void brcmf_sdio_firmware_callback(struct device *dev, int err,
                                         struct brcmf_fw_request *fwreq)
 {
@@ -4213,22 +4206,6 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err,
 
        brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err);
 
-       if (err && brcmf_sdio_fwnames != sdio_fwnames) {
-               /* Try again with the standard firmware names */
-               brcmf_sdio_fwnames = sdio_fwnames;
-               brcmf_sdio_fwnames_count = ARRAY_SIZE(sdio_fwnames);
-               kfree(fwreq);
-               fwreq = brcmf_sdio_prepare_fw_request(bus);
-               if (!fwreq) {
-                       err = -ENOMEM;
-                       goto fail;
-               }
-               err = brcmf_fw_get_firmwares(dev, fwreq,
-                                            brcmf_sdio_firmware_callback);
-               if (!err)
-                       return;
-       }
-
        if (err)
                goto fail;
 
@@ -4436,7 +4413,7 @@ brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus)
 
        fwreq = brcmf_fw_alloc_request(bus->ci->chip, bus->ci->chiprev,
                                       brcmf_sdio_fwnames,
-                                      brcmf_sdio_fwnames_count,
+                                      ARRAY_SIZE(brcmf_sdio_fwnames),
                                       fwnames, ARRAY_SIZE(fwnames));
        if (!fwreq)
                return NULL;
@@ -4454,9 +4431,6 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
        struct brcmf_sdio *bus;
        struct workqueue_struct *wq;
        struct brcmf_fw_request *fwreq;
-       struct brcmf_firmware_mapping *of_fwnames, *fwnames;
-       const int fwname_size = sizeof(struct brcmf_firmware_mapping);
-       u32 of_fw_count;
 
        brcmf_dbg(TRACE, "Enter\n");
 
@@ -4539,21 +4513,6 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
 
        brcmf_dbg(INFO, "completed!!\n");
 
-       of_fwnames = brcmf_of_fwnames(sdiodev->dev, &of_fw_count);
-       if (of_fwnames)
-               fwnames = devm_kcalloc(sdiodev->dev,
-                                      of_fw_count + brcmf_sdio_fwnames_count,
-                                      fwname_size, GFP_KERNEL);
-
-       if (fwnames) {
-               /* The array is scanned in order, so overrides come first */
-               memcpy(fwnames, of_fwnames, of_fw_count * fwname_size);
-               memcpy(fwnames + of_fw_count, sdio_fwnames,
-                      brcmf_sdio_fwnames_count * fwname_size);
-               brcmf_sdio_fwnames = fwnames;
-               brcmf_sdio_fwnames_count += of_fw_count;
-       }
-
        fwreq = brcmf_sdio_prepare_fw_request(bus);
        if (!fwreq) {
                ret = -ENOMEM;