Skip to content

Commit a9bba18

Browse files
haukelinvjw
authored andcommitted
MIPS: bcm47xx: refactor fetching board data
Now the fetching of board data also uses nvram_read_u16 and not simple_strtoul any more. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Acked-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 5a20ef3 commit a9bba18

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

‎arch/mips/bcm47xx/setup.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,7 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
109109
/* Fill boardinfo structure */
110110
memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));
111111

112-
if (nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0)
113-
iv->boardinfo.vendor = (u16)simple_strtoul(buf, NULL, 0);
114-
else
115-
iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM;
116-
if (nvram_getenv("boardtype", buf, sizeof(buf)) >= 0)
117-
iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
112+
bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL);
118113

119114
bcm47xx_fill_sprom(&iv->sprom, NULL);
120115

‎arch/mips/bcm47xx/sprom.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,3 +618,15 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
618618
bcm47xx_fill_sprom_r1(sprom, prefix);
619619
}
620620
}
621+
622+
#ifdef CONFIG_BCM47XX_SSB
623+
void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
624+
const char *prefix)
625+
{
626+
nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0);
627+
if (!boardinfo->vendor)
628+
boardinfo->vendor = SSB_BOARDVENDOR_BCM;
629+
630+
nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0);
631+
}
632+
#endif

‎arch/mips/include/asm/mach-bcm47xx/bcm47xx.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,9 @@ extern enum bcm47xx_bus_type bcm47xx_bus_type;
4747
void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix);
4848
void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix);
4949

50+
#ifdef CONFIG_BCM47XX_SSB
51+
void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
52+
const char *prefix);
53+
#endif
54+
5055
#endif /* __ASM_BCM47XX_H */

0 commit comments

Comments
 (0)