Merge branch 'l7200' into devel
[sfrench/cifs-2.6.git] / arch / mips / bcm47xx / setup.c
index d442e11625fa6aa9c18d3ed31a3b283c2a73fd94..b1aee33efd11454e7f47c7d8beb7d0d50ed9ca2a 100644 (file)
@@ -1,8 +1,8 @@
 /*
  *  Copyright (C) 2004 Florian Schirmer <jolt@tuxbox.org>
- *  Copyright (C) 2005 Waldemar Brodkorb <wbx@openwrt.org>
  *  Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
  *  Copyright (C) 2006 Michael Buesch <mb@bu3sch.de>
+ *  Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org>
  *
  *  This program is free software; you can redistribute  it and/or modify it
  *  under  the terms of  the GNU General  Public License as published by the
@@ -33,6 +33,7 @@
 #include <asm/time.h>
 #include <bcm47xx.h>
 #include <asm/fw/cfe/cfe_api.h>
+#include <asm/mach-bcm47xx/nvram.h>
 
 struct ssb_bus ssb_bcm47xx;
 EXPORT_SYMBOL(ssb_bcm47xx);
@@ -81,28 +82,42 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
        /* Fill boardinfo structure */
        memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));
 
-       if (cfe_getenv("boardvendor", buf, sizeof(buf)) >= 0)
+       if (cfe_getenv("boardvendor", buf, sizeof(buf)) >= 0 ||
+           nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0)
                iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
-       if (cfe_getenv("boardtype", buf, sizeof(buf)) >= 0)
+       if (cfe_getenv("boardtype", buf, sizeof(buf)) >= 0 ||
+           nvram_getenv("boardtype", buf, sizeof(buf)) >= 0)
                iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
-       if (cfe_getenv("boardrev", buf, sizeof(buf)) >= 0)
+       if (cfe_getenv("boardrev", buf, sizeof(buf)) >= 0 ||
+           nvram_getenv("boardrev", buf, sizeof(buf)) >= 0)
                iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0);
 
        /* Fill sprom structure */
        memset(&(iv->sprom), 0, sizeof(struct ssb_sprom));
        iv->sprom.revision = 3;
 
-       if (cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
+       if (cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0 ||
+           nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
                str2eaddr(buf, iv->sprom.et0mac);
-       if (cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
+
+       if (cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0 ||
+           nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
                str2eaddr(buf, iv->sprom.et1mac);
-       if (cfe_getenv("et0phyaddr", buf, sizeof(buf)) >= 0)
-               iv->sprom.et0phyaddr = simple_strtoul(buf, NULL, 10);
-       if (cfe_getenv("et1phyaddr", buf, sizeof(buf)) >= 0)
-               iv->sprom.et1phyaddr = simple_strtoul(buf, NULL, 10);
-       if (cfe_getenv("et0mdcport", buf, sizeof(buf)) >= 0)
+
+       if (cfe_getenv("et0phyaddr", buf, sizeof(buf)) >= 0 ||
+           nvram_getenv("et0phyaddr", buf, sizeof(buf)) >= 0)
+               iv->sprom.et0phyaddr = simple_strtoul(buf, NULL, 0);
+
+       if (cfe_getenv("et1phyaddr", buf, sizeof(buf)) >= 0 ||
+           nvram_getenv("et1phyaddr", buf, sizeof(buf)) >= 0)
+               iv->sprom.et1phyaddr = simple_strtoul(buf, NULL, 0);
+
+       if (cfe_getenv("et0mdcport", buf, sizeof(buf)) >= 0 ||
+           nvram_getenv("et0mdcport", buf, sizeof(buf)) >= 0)
                iv->sprom.et0mdcport = simple_strtoul(buf, NULL, 10);
-       if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0)
+
+       if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0 ||
+           nvram_getenv("et1mdcport", buf, sizeof(buf)) >= 0)
                iv->sprom.et1mdcport = simple_strtoul(buf, NULL, 10);
 
        return 0;