MIPS: BCM47xx: Fetch board info directly in callback function
Subsystems (2)
Rafał Miłecki
maintainerPATCH 1/1 MIPS: BCM47xx: Fetch board info directly in callback function
This drops another symbol dependency between setup.c and sprom.c which will allow us to make SPROM code a separated module (and share it with ARM).
Patch tested on Linksys WRT300N V1.
--- arch/mips/bcm47xx/setup.c | 11 ++++++++++- arch/mips/bcm47xx/sprom.c | 13 ------------- arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | 5 ----- 3 files changed, 10 insertions(+), 19 deletions(-)
arch/mips/bcm47xx/setup.c +10 -1
@@ -105,11 +105,20 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus, struct ssb_init_invariants *iv) {char buf[20 ]; +int len;/* Fill boardinfo structure */ memset (&iv->boardinfo,0 ,sizeof (struct ssb_boardinfo )); -bcm47xx_fill_ssb_boardinfo (&iv->boardinfo,NULL ); + len =bcm47xx_nvram_getenv ("boardvendor" , buf,sizeof (buf)); +if (len >0 ) +kstrtou16 (strim (buf),0 , &iv->boardinfo.vendor); +if (!iv->boardinfo.vendor) + iv->boardinfo.vendor =SSB_BOARDVENDOR_BCM ; + + len =bcm47xx_nvram_getenv ("boardtype" , buf,sizeof (buf)); +if (len >0 ) +kstrtou16 (strim (buf),0 , &iv->boardinfo.type);memset (&iv->sprom,0 ,sizeof (struct ssb_sprom ));bcm47xx_fill_sprom (&iv->sprom,NULL , false);
arch/mips/bcm47xx/sprom.c +0 -13
@@ -599,19 +599,6 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,bcm47xx_sprom_fill_auto (sprom, prefix, fallback); } -#ifdef CONFIG_BCM47XX_SSB -void bcm47xx_fill_ssb_boardinfo (struct ssb_boardinfo *boardinfo, -const char *prefix) -{ -nvram_read_u16 (prefix,NULL ,"boardvendor" , &boardinfo->vendor,0 , - true); -if (!boardinfo->vendor) - boardinfo->vendor =SSB_BOARDVENDOR_BCM ; - -nvram_read_u16 (prefix,NULL ,"boardtype" , &boardinfo->type,0 , true); -} -#endif -#if defined(CONFIG_BCM47XX_SSB )static int bcm47xx_get_sprom_ssb (struct ssb_bus *bus,struct ssb_sprom *out) {
arch/mips/include/asm/mach-bcm47xx/bcm47xx.h +0 -5
@@ -48,11 +48,6 @@ extern enum bcm47xx_bus_type bcm47xx_bus_type;void bcm47xx_fill_sprom (struct ssb_sprom *sprom,const char *prefix,bool fallback); -#ifdef CONFIG_BCM47XX_SSB -void bcm47xx_fill_ssb_boardinfo (struct ssb_boardinfo *boardinfo, -const char *prefix); -#endif -void bcm47xx_set_system_type (u16 chip_id);#endif /* __ASM_BCM47XX_H */
Signature · 1 line
1.8.4.5
Rafał Miłecki
maintainerPATCH v2 1/1 MIPS: BCM47xx: Fetch board info directly in callback function
This drops another symbol dependency between setup.c and sprom.c which will allow us to make SPROM code a separated module (and share it with ARM).
Patch tested on Linksys WRT300N V1.
---
V2: Fix:arch/mips/bcm47xx/setup.c: In function ‘bcm47xx_get_invariants’:arch/mips/bcm47xx/setup.c:115:12: error: ignoring return value of ‘kstrtou16’, declared with attribute warn_unused_result arch/mips/bcm47xx/setup.c:121:12: error: ignoring return value of ‘kstrtou16’, declared with attribute warn_unused_result
--- arch/mips/bcm47xx/setup.c | 19 ++++++++++++++++++- arch/mips/bcm47xx/sprom.c | 13 ------------- arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | 5 ----- 3 files changed, 18 insertions(+), 19 deletions(-)
arch/mips/bcm47xx/setup.c +18 -1
@@ -105,11 +105,28 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus, struct ssb_init_invariants *iv) {char buf[20 ]; +int len, err;/* Fill boardinfo structure */ memset (&iv->boardinfo,0 ,sizeof (struct ssb_boardinfo )); -bcm47xx_fill_ssb_boardinfo (&iv->boardinfo,NULL ); + len =bcm47xx_nvram_getenv ("boardvendor" , buf,sizeof (buf)); +if (len >0 ) { + err =kstrtou16 (strim (buf),0 , &iv->boardinfo.vendor); +if (err) +pr_warn ("Couldn't parse nvram board vendor entry with value \"%s\"\n" , + buf); + } +if (!iv->boardinfo.vendor) + iv->boardinfo.vendor =SSB_BOARDVENDOR_BCM ; + + len =bcm47xx_nvram_getenv ("boardtype" , buf,sizeof (buf)); +if (len >0 ) { + err =kstrtou16 (strim (buf),0 , &iv->boardinfo.type); +if (err) +pr_warn ("Couldn't parse nvram board type entry with value \"%s\"\n" , + buf); + }memset (&iv->sprom,0 ,sizeof (struct ssb_sprom ));bcm47xx_fill_sprom (&iv->sprom,NULL , false);
arch/mips/bcm47xx/sprom.c +0 -13
@@ -599,19 +599,6 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,bcm47xx_sprom_fill_auto (sprom, prefix, fallback); } -#ifdef CONFIG_BCM47XX_SSB -void bcm47xx_fill_ssb_boardinfo (struct ssb_boardinfo *boardinfo, -const char *prefix) -{ -nvram_read_u16 (prefix,NULL ,"boardvendor" , &boardinfo->vendor,0 , - true); -if (!boardinfo->vendor) - boardinfo->vendor =SSB_BOARDVENDOR_BCM ; - -nvram_read_u16 (prefix,NULL ,"boardtype" , &boardinfo->type,0 , true); -} -#endif -#if defined(CONFIG_BCM47XX_SSB )static int bcm47xx_get_sprom_ssb (struct ssb_bus *bus,struct ssb_sprom *out) {
arch/mips/include/asm/mach-bcm47xx/bcm47xx.h +0 -5
@@ -48,11 +48,6 @@ extern enum bcm47xx_bus_type bcm47xx_bus_type;void bcm47xx_fill_sprom (struct ssb_sprom *sprom,const char *prefix,bool fallback); -#ifdef CONFIG_BCM47XX_SSB -void bcm47xx_fill_ssb_boardinfo (struct ssb_boardinfo *boardinfo, -const char *prefix); -#endif -void bcm47xx_set_system_type (u16 chip_id);#endif /* __ASM_BCM47XX_H */
Signature · 1 line
1.8.4.5