mac80211: install new firmware for ath9k-htc on target
[openwrt/staging/lynxis/omap.git] / target / linux / brcm47xx / patches-4.1 / 033-03-MIPS-BCM47xx-Fetch-board-info-directly-in-callback-f.patch
1 From d8cfb5037bfc875e6dc8e09e4caceb443c04ff6a Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Mon, 26 Oct 2015 11:13:16 +0100
4 Subject: [PATCH 3/3] MIPS: BCM47xx: Fetch board info directly in callback
5 function
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 This drops another symbol dependency between setup.c and sprom.c which
11 will allow us to make SPROM code a separated module (and share it with
12 ARM).
13 Patch tested on Linksys WRT300N V1.
14
15 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
16 Cc: Hauke Mehrtens <hauke@hauke-m.de>
17 Cc: linux-mips@linux-mips.org
18 Patchwork: https://patchwork.linux-mips.org/patch/11360/
19 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
20 ---
21 arch/mips/bcm47xx/setup.c | 19 ++++++++++++++++++-
22 arch/mips/bcm47xx/sprom.c | 13 -------------
23 arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | 5 -----
24 3 files changed, 18 insertions(+), 19 deletions(-)
25
26 diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
27 index 17503a0..6d38948 100644
28 --- a/arch/mips/bcm47xx/setup.c
29 +++ b/arch/mips/bcm47xx/setup.c
30 @@ -105,11 +105,28 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
31 struct ssb_init_invariants *iv)
32 {
33 char buf[20];
34 + int len, err;
35
36 /* Fill boardinfo structure */
37 memset(&iv->boardinfo, 0 , sizeof(struct ssb_boardinfo));
38
39 - bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL);
40 + len = bcm47xx_nvram_getenv("boardvendor", buf, sizeof(buf));
41 + if (len > 0) {
42 + err = kstrtou16(strim(buf), 0, &iv->boardinfo.vendor);
43 + if (err)
44 + pr_warn("Couldn't parse nvram board vendor entry with value \"%s\"\n",
45 + buf);
46 + }
47 + if (!iv->boardinfo.vendor)
48 + iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM;
49 +
50 + len = bcm47xx_nvram_getenv("boardtype", buf, sizeof(buf));
51 + if (len > 0) {
52 + err = kstrtou16(strim(buf), 0, &iv->boardinfo.type);
53 + if (err)
54 + pr_warn("Couldn't parse nvram board type entry with value \"%s\"\n",
55 + buf);
56 + }
57
58 memset(&iv->sprom, 0, sizeof(struct ssb_sprom));
59 bcm47xx_fill_sprom(&iv->sprom, NULL, false);
60 diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
61 index 43353db..a7e569c 100644
62 --- a/arch/mips/bcm47xx/sprom.c
63 +++ b/arch/mips/bcm47xx/sprom.c
64 @@ -599,19 +599,6 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,
65 bcm47xx_sprom_fill_auto(sprom, prefix, fallback);
66 }
67
68 -#ifdef CONFIG_BCM47XX_SSB
69 -void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
70 - const char *prefix)
71 -{
72 - nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0,
73 - true);
74 - if (!boardinfo->vendor)
75 - boardinfo->vendor = SSB_BOARDVENDOR_BCM;
76 -
77 - nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0, true);
78 -}
79 -#endif
80 -
81 #if defined(CONFIG_BCM47XX_SSB)
82 static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out)
83 {
84 diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
85 index 1461c10..71e4096 100644
86 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
87 +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
88 @@ -48,11 +48,6 @@ extern enum bcm47xx_bus_type bcm47xx_bus_type;
89 void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,
90 bool fallback);
91
92 -#ifdef CONFIG_BCM47XX_SSB
93 -void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
94 - const char *prefix);
95 -#endif
96 -
97 void bcm47xx_set_system_type(u16 chip_id);
98
99 #endif /* __ASM_BCM47XX_H */
100 --
101 1.8.4.5
102