From fbd48993395ad8c952aa94544fc4c22e825858ac Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 12 Jun 2023 15:22:20 +0100 Subject: [PATCH] Revert "brcmfmac: Read alternative firmware names from DT" This reverts commit 5dba6ec6f4f2ac9ed8556116481b107e50e15251. With careful use of qualified firmware names there is no need for the ability to override the device names based on Device Tree properties. Signed-off-by: Phil Elwell --- .../wireless/broadcom/brcm80211/brcmfmac/of.c | 36 ------------- .../wireless/broadcom/brcm80211/brcmfmac/of.h | 7 --- .../broadcom/brcm80211/brcmfmac/sdio.c | 52 ++----------------- 3 files changed, 4 insertions(+), 91 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c index 58fae3ac22b1bc..e406e11481a621 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c @@ -11,7 +11,6 @@ #include "debug.h" #include "core.h" #include "common.h" -#include "firmware.h" #include "of.h" static int brcmf_of_get_country_codes(struct device *dev, @@ -144,38 +143,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; -} diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h index 5b39a39812d0c9..10bf52253337e7 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h @@ -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 */ diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index feecc51ed9b8b7..6d979ab0a954c2 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -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) @@ -4417,9 +4416,7 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err, } static struct brcmf_fw_request * -brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus, - const struct brcmf_firmware_mapping *fwmap, - int fwmap_count) +brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus) { struct brcmf_fw_request *fwreq; struct brcmf_fw_name fwnames[] = { @@ -4429,7 +4426,8 @@ brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus, }; fwreq = brcmf_fw_alloc_request(bus->ci->chip, bus->ci->chiprev, - fwmap, fwmap_count, + brcmf_sdio_fwnames, + ARRAY_SIZE(brcmf_sdio_fwnames), fwnames, ARRAY_SIZE(fwnames)); if (!fwreq) return NULL; @@ -4443,44 +4441,12 @@ brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus, return fwreq; } -static void brcmf_sdio_of_firmware_callback(struct device *dev, int err, - struct brcmf_fw_request *fwreq) -{ - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_sdio_dev *sdiod = bus_if->bus_priv.sdio; - struct brcmf_sdio *bus = sdiod->bus; - - brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err); - - if (err) { - /* Try again with the standard firmware names */ - kfree(fwreq); - fwreq = brcmf_sdio_prepare_fw_request(bus, - brcmf_sdio_fwnames, - ARRAY_SIZE(brcmf_sdio_fwnames)); - if (!fwreq) { - err = -ENOMEM; - goto fail; - } - - err = brcmf_fw_get_firmwares(sdiod->dev, fwreq, - brcmf_sdio_firmware_callback); - if (!err) - return; - } - -fail: - brcmf_sdio_firmware_callback(dev, err, fwreq); -} - struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) { int ret; struct brcmf_sdio *bus; struct workqueue_struct *wq; struct brcmf_fw_request *fwreq; - struct brcmf_firmware_mapping *of_fwnames; - u32 of_fwcount; brcmf_dbg(TRACE, "Enter\n"); @@ -4563,23 +4529,13 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) brcmf_dbg(INFO, "completed!!\n"); - of_fwnames = brcmf_of_fwnames(sdiodev->dev, &of_fwcount); - - if (of_fwnames) - fwreq = brcmf_sdio_prepare_fw_request(bus, of_fwnames, - of_fwcount); - else - fwreq = brcmf_sdio_prepare_fw_request(bus, brcmf_sdio_fwnames, - ARRAY_SIZE(brcmf_sdio_fwnames)); - + fwreq = brcmf_sdio_prepare_fw_request(bus); if (!fwreq) { ret = -ENOMEM; goto fail; } ret = brcmf_fw_get_firmwares(sdiodev->dev, fwreq, - of_fwnames ? - brcmf_sdio_of_firmware_callback : brcmf_sdio_firmware_callback); if (ret != 0) { brcmf_err("async firmware request failed: %d\n", ret);