brcmfmac: Set board_type used for nvram file selection to machine-compatible
authorHans de Goede <hdegoede@redhat.com>
Wed, 10 Oct 2018 11:01:01 +0000 (13:01 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 6 Nov 2018 16:50:16 +0000 (18:50 +0200)
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: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c

index a34642cb4d2fb2fdca00c7311cd85c5e5efe7b58..e63a273642e96e50943706e02c0f2591bb428304 100644 (file)
@@ -59,6 +59,7 @@ struct brcmf_mp_device {
        bool            iapp;
        bool            ignore_probe_fail;
        struct brcmfmac_pd_cc *country_codes;
+       const char      *board_type;
        union {
                struct brcmfmac_sdio_pd sdio;
        } bus;
index aee6e5937c41cd3afc763893b3a147e7097430e1..84e3373289ebc45818017c4fb2e1e3bfc6c0d153 100644 (file)
@@ -27,11 +27,20 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
                    struct brcmf_mp_device *settings)
 {
        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;
        u32 irqf;
        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 ||
            !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
                return;
index 5dea569d63ed84568b7b7a3f302fdc678dff92fc..956a8b236836f174990e4127a2fc9b6061768e4a 100644 (file)
@@ -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_NVRAM].type = BRCMF_FW_TYPE_NVRAM;
        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 */
        fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus) + 1;
        fwreq->bus_nr = devinfo->pdev->bus->number;
index b2e1ab5adb649523537b7d94edbeb16899b5fce3..22646a3b911e927c95b35141b8e5a5d13c2c5cfd 100644 (file)
@@ -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_NVRAM].type = BRCMF_FW_TYPE_NVRAM;
+       fwreq->board_type = bus->sdiodev->settings->board_type;
 
        return fwreq;
 }