1 From 0ad4b55b2f29784f93875e6231bf57cd233624a2 Mon Sep 17 00:00:00 2001
2 From: Hans de Goede <hdegoede@redhat.com>
3 Date: Wed, 10 Oct 2018 13:01:01 +0200
4 Subject: [PATCH] brcmfmac: Set board_type used for nvram file selection to
7 For of/devicetree using machines, set the board_type used for nvram file
8 selection to the first string listed in the top-level's node compatible
9 string, aka the machine-compatible as used by of_machine_is_compatible().
11 The board_type setting is used to load the board-specific nvram file with
12 a board-specific name so that we can ship files for each supported board
15 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
16 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
18 drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h | 1 +
19 drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 11 ++++++++++-
20 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 1 +
21 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 +
22 4 files changed, 13 insertions(+), 1 deletion(-)
24 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
25 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
26 @@ -59,6 +59,7 @@ struct brcmf_mp_device {
28 bool ignore_probe_fail;
29 struct brcmfmac_pd_cc *country_codes;
30 + const char *board_type;
32 struct brcmfmac_sdio_pd sdio;
34 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
35 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
36 @@ -27,11 +27,20 @@ void brcmf_of_probe(struct device *dev,
37 struct brcmf_mp_device *settings)
39 struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio;
40 - struct device_node *np = dev->of_node;
41 + struct device_node *root, *np = dev->of_node;
42 + struct property *prop;
47 + /* Set board-type to the first string of the machine compatible prop */
48 + root = of_find_node_by_path("/");
50 + prop = of_find_property(root, "compatible", NULL);
51 + settings->board_type = of_prop_next_string(prop, NULL);
55 if (!np || bus_type != BRCMF_BUSTYPE_SDIO ||
56 !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
58 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
59 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
60 @@ -1785,6 +1785,7 @@ brcmf_pcie_prepare_fw_request(struct brc
61 fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY;
62 fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM;
63 fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL;
64 + fwreq->board_type = devinfo->settings->board_type;
65 /* NVRAM reserves PCI domain 0 for Broadcom's SDK faked bus */
66 fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus) + 1;
67 fwreq->bus_nr = devinfo->pdev->bus->number;
68 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
69 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
70 @@ -4213,6 +4213,7 @@ brcmf_sdio_prepare_fw_request(struct brc
72 fwreq->items[BRCMF_SDIO_FW_CODE].type = BRCMF_FW_TYPE_BINARY;
73 fwreq->items[BRCMF_SDIO_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM;
74 + fwreq->board_type = bus->sdiodev->settings->board_type;