Root/target/linux/brcm47xx/patches-3.3/006-MIPS-bcm47xx-refactor-fetching-board-data.patch

1--- a/arch/mips/bcm47xx/setup.c
2+++ b/arch/mips/bcm47xx/setup.c
3@@ -109,12 +109,7 @@ static int bcm47xx_get_invariants(struct
4     /* Fill boardinfo structure */
5     memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));
6 
7- if (nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0)
8- iv->boardinfo.vendor = (u16)simple_strtoul(buf, NULL, 0);
9- else
10- iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM;
11- if (nvram_getenv("boardtype", buf, sizeof(buf)) >= 0)
12- iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
13+ bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL);
14 
15     bcm47xx_fill_sprom(&iv->sprom, NULL);
16 
17--- a/arch/mips/bcm47xx/sprom.c
18+++ b/arch/mips/bcm47xx/sprom.c
19@@ -618,3 +618,15 @@ void bcm47xx_fill_sprom(struct ssb_sprom
20         bcm47xx_fill_sprom_r1(sprom, prefix);
21     }
22 }
23+
24+#ifdef CONFIG_BCM47XX_SSB
25+void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
26+ const char *prefix)
27+{
28+ nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0);
29+ if (!boardinfo->vendor)
30+ boardinfo->vendor = SSB_BOARDVENDOR_BCM;
31+
32+ nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0);
33+}
34+#endif
35--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
36+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
37@@ -47,4 +47,9 @@ extern enum bcm47xx_bus_type bcm47xx_bus
38 void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix);
39 void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix);
40 
41+#ifdef CONFIG_BCM47XX_SSB
42+void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
43+ const char *prefix);
44+#endif
45+
46 #endif /* __ASM_BCM47XX_H */
47

Archive Download this file



interactive