broadcom-wl: add nvram stub to fix nas compile after the switch to unvram
[openwrt/staging/florian.git] / target / linux / brcm-2.4 / files / arch / mips / bcm947xx / nvram_linux.c
index 25104786d5c61dc2046c24cc3c53531fd07450a9..b04815d9023a06b2a72916690e82a24c86ff256c 100644 (file)
@@ -9,7 +9,6 @@
  * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
  * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
  *
- * $Id: nvram_linux.c,v 1.19 2006/04/08 07:12:42 honor Exp $
  */
 
 #include <linux/config.h>
@@ -33,7 +32,6 @@
 #include <osl.h>
 #include <bcmendian.h>
 #include <bcmnvram.h>
-#include <bcmutils.h>
 #include <sbconfig.h>
 #include <sbchipc.h>
 #include <sbutils.h>
@@ -53,6 +51,9 @@ static char nvram_buf[NVRAM_SPACE] __attribute__((aligned(PAGE_SIZE)));
 extern void *bcm947xx_sbh;
 extern spinlock_t bcm947xx_sbh_lock;
 
+static int cfe_env;
+extern char *cfe_env_get(char *nv_buf, const char *name);
+
 /* Convenience */
 #define sbh bcm947xx_sbh
 #define sbh_lock bcm947xx_sbh_lock
@@ -72,14 +73,14 @@ early_nvram_init(void)
 
        if ((cc = sb_setcore(sbh, SB_CC, 0)) != NULL) {
                base = KSEG1ADDR(SB_FLASH2);
-               switch (readl(&cc->capabilities) & CAP_FLASH_MASK) {
+               switch (readl(&cc->capabilities) & CC_CAP_FLASH_MASK) {
                case PFLASH:
                        lim = SB_FLASH2_SZ;
                        break;
 
                case SFLASH_ST:
                case SFLASH_AT:
-                       if ((info = sflash_init(cc)) == NULL)
+                       if ((info = sflash_init(sbh,cc)) == NULL)
                                return;
                        lim = info->size;
                        break;
@@ -105,6 +106,7 @@ early_nvram_init(void)
                                break;
                        *dst++ = *src++;
                }
+               cfe_env = 1;
                return;
        }
 
@@ -154,6 +156,9 @@ early_nvram_get(const char *name)
        if (!nvram_buf[0])
                early_nvram_init();
 
+       if (cfe_env)
+               return cfe_env_get(nvram_buf, name);
+
        /* Look for name=value and return value */
        var = &nvram_buf[sizeof(struct nvram_header)];
        end = nvram_buf + sizeof(nvram_buf) - 2;