Commit 0ad4b55b authored by Hans de Goede's avatar Hans de Goede Committed by Kalle Valo

brcmfmac: Set board_type used for nvram file selection to machine-compatible

For of/devicetree using machines, set the board_type used for nvram file
selection to the first string listed in the top-level's node compatible
string, aka the machine-compatible as used by of_machine_is_compatible().

The board_type setting is used to load the board-specific nvram file with
a board-specific name so that we can ship files for each supported board
in linux-firmware.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent eae8e506
...@@ -59,6 +59,7 @@ struct brcmf_mp_device { ...@@ -59,6 +59,7 @@ struct brcmf_mp_device {
bool iapp; bool iapp;
bool ignore_probe_fail; bool ignore_probe_fail;
struct brcmfmac_pd_cc *country_codes; struct brcmfmac_pd_cc *country_codes;
const char *board_type;
union { union {
struct brcmfmac_sdio_pd sdio; struct brcmfmac_sdio_pd sdio;
} bus; } bus;
......
...@@ -27,11 +27,20 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, ...@@ -27,11 +27,20 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
struct brcmf_mp_device *settings) struct brcmf_mp_device *settings)
{ {
struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio; struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio;
struct device_node *np = dev->of_node; struct device_node *root, *np = dev->of_node;
struct property *prop;
int irq; int irq;
u32 irqf; u32 irqf;
u32 val; u32 val;
/* Set board-type to the first string of the machine compatible prop */
root = of_find_node_by_path("/");
if (root) {
prop = of_find_property(root, "compatible", NULL);
settings->board_type = of_prop_next_string(prop, NULL);
of_node_put(root);
}
if (!np || bus_type != BRCMF_BUSTYPE_SDIO || if (!np || bus_type != BRCMF_BUSTYPE_SDIO ||
!of_device_is_compatible(np, "brcm,bcm4329-fmac")) !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
return; return;
......
...@@ -1785,6 +1785,7 @@ brcmf_pcie_prepare_fw_request(struct brcmf_pciedev_info *devinfo) ...@@ -1785,6 +1785,7 @@ brcmf_pcie_prepare_fw_request(struct brcmf_pciedev_info *devinfo)
fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY; fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY;
fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM;
fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL; fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL;
fwreq->board_type = devinfo->settings->board_type;
/* NVRAM reserves PCI domain 0 for Broadcom's SDK faked bus */ /* NVRAM reserves PCI domain 0 for Broadcom's SDK faked bus */
fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus) + 1; fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus) + 1;
fwreq->bus_nr = devinfo->pdev->bus->number; fwreq->bus_nr = devinfo->pdev->bus->number;
......
...@@ -4174,6 +4174,7 @@ brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus) ...@@ -4174,6 +4174,7 @@ brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus)
fwreq->items[BRCMF_SDIO_FW_CODE].type = BRCMF_FW_TYPE_BINARY; fwreq->items[BRCMF_SDIO_FW_CODE].type = BRCMF_FW_TYPE_BINARY;
fwreq->items[BRCMF_SDIO_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; fwreq->items[BRCMF_SDIO_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM;
fwreq->board_type = bus->sdiodev->settings->board_type;
return fwreq; return fwreq;
} }
......
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