Skip to content

Commit

Permalink
Revert "brcmfmac: Read alternative firmware names from DT"
Browse files Browse the repository at this point in the history
This reverts commit 5dba6ec.

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 <[email protected]>
  • Loading branch information
pelwell committed Nov 1, 2023
1 parent 0d142d6 commit fbd4899
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 91 deletions.
36 changes: 0 additions & 36 deletions drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
7 changes: 0 additions & 7 deletions drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
52 changes: 4 additions & 48 deletions drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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[] = {
Expand All @@ -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;
Expand All @@ -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");

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit fbd4899

Please sign in to comment.