MIPS: bcm47xx: refactor fetching board data
authorHauke Mehrtens <hauke@hauke-m.de>
Sun, 29 Apr 2012 00:04:07 +0000 (02:04 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 16 May 2012 16:45:20 +0000 (12:45 -0400)
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>
arch/mips/bcm47xx/setup.c
arch/mips/bcm47xx/sprom.c
arch/mips/include/asm/mach-bcm47xx/bcm47xx.h

index d9278a82e003bdb98f2f00d2d5af3dedc4c089c1..53cdb72442447de41c5610a45747629fee01748d 100644 (file)
@@ -109,12 +109,7 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
        /* Fill boardinfo structure */
        memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));
 
-       if (nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0)
-               iv->boardinfo.vendor = (u16)simple_strtoul(buf, NULL, 0);
-       else
-               iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM;
-       if (nvram_getenv("boardtype", buf, sizeof(buf)) >= 0)
-               iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
+       bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL);
 
        bcm47xx_fill_sprom(&iv->sprom, NULL);
 
index 5c8dcd2a8a93e443facdd50d99edd043af1997ac..279991a3583b1dc717dacee2ebc41a8fdb81a6ee 100644 (file)
@@ -618,3 +618,15 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
                bcm47xx_fill_sprom_r1(sprom, prefix);
        }
 }
+
+#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);
+       if (!boardinfo->vendor)
+               boardinfo->vendor = SSB_BOARDVENDOR_BCM;
+
+       nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0);
+}
+#endif
index 5ecaf47b34d2c965dac18d212497dcaf1c71a562..42887c66ade22c3d3022b1de854465e634a27ab7 100644 (file)
@@ -47,4 +47,9 @@ extern enum bcm47xx_bus_type bcm47xx_bus_type;
 void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix);
 void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix);
 
+#ifdef CONFIG_BCM47XX_SSB
+void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
+                               const char *prefix);
+#endif
+
 #endif /* __ASM_BCM47XX_H */