mac80211: move (& update) upstream accepted brcmfmac patches
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / 840-brcmfmac-make-brcmf_of_probe-more-generic.patch
1 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
2 Date: Sat, 7 Jan 2017 23:43:45 +0100
3 Subject: [PATCH] brcmfmac: make brcmf_of_probe more generic
4 MIME-Version: 1.0
5 Content-Type: text/plain; charset=UTF-8
6 Content-Transfer-Encoding: 8bit
7
8 We may want to use Open Firmware for other devices than just SDIO ones.
9 In future we may want to support more Broadcom properties so there is
10 really no reason for such limitation.
11
12 Call brcmf_of_probe for all kind of devices & move extra conditions to
13 the body of that funcion.
14
15 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
16 ---
17
18 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
19 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
20 @@ -299,11 +299,9 @@ struct brcmf_mp_device *brcmf_get_module
21 }
22 }
23 }
24 - if ((bus_type == BRCMF_BUSTYPE_SDIO) && (!found)) {
25 - /* No platform data for this device. In case of SDIO try OF
26 - * (Open Firwmare) Device Tree.
27 - */
28 - brcmf_of_probe(dev, &settings->bus.sdio);
29 + if (!found) {
30 + /* No platform data for this device, try OF (Open Firwmare) */
31 + brcmf_of_probe(dev, bus_type, settings);
32 }
33 return settings;
34 }
35 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
36 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
37 @@ -23,14 +23,17 @@
38 #include "common.h"
39 #include "of.h"
40
41 -void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd *sdio)
42 +void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
43 + struct brcmf_mp_device *settings)
44 {
45 + struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio;
46 struct device_node *np = dev->of_node;
47 int irq;
48 u32 irqf;
49 u32 val;
50
51 - if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
52 + if (!np || bus_type != BRCMF_BUSTYPE_SDIO ||
53 + !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
54 return;
55
56 if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
57 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
58 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
59 @@ -14,9 +14,11 @@
60 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
61 */
62 #ifdef CONFIG_OF
63 -void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd *sdio);
64 +void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
65 + struct brcmf_mp_device *settings);
66 #else
67 -static void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd *sdio)
68 +static void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
69 + struct brcmf_mp_device *settings)
70 {
71 }
72 #endif /* CONFIG_OF */