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
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
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
13 Patch tested on Linksys WRT300N V1.
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>
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(-)
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)
36 /* Fill boardinfo structure */
37 memset(&iv->boardinfo, 0 , sizeof(struct ssb_boardinfo));
39 - bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL);
40 + len = bcm47xx_nvram_getenv("boardvendor", buf, sizeof(buf));
42 + err = kstrtou16(strim(buf), 0, &iv->boardinfo.vendor);
44 + pr_warn("Couldn't parse nvram board vendor entry with value \"%s\"\n",
47 + if (!iv->boardinfo.vendor)
48 + iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM;
50 + len = bcm47xx_nvram_getenv("boardtype", buf, sizeof(buf));
52 + err = kstrtou16(strim(buf), 0, &iv->boardinfo.type);
54 + pr_warn("Couldn't parse nvram board type entry with value \"%s\"\n",
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);
68 -#ifdef CONFIG_BCM47XX_SSB
69 -void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
72 - nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0,
74 - if (!boardinfo->vendor)
75 - boardinfo->vendor = SSB_BOARDVENDOR_BCM;
77 - nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0, true);
81 #if defined(CONFIG_BCM47XX_SSB)
82 static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out)
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,
92 -#ifdef CONFIG_BCM47XX_SSB
93 -void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
94 - const char *prefix);
97 void bcm47xx_set_system_type(u16 chip_id);
99 #endif /* __ASM_BCM47XX_H */