X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=target%2Flinux%2Fbrcm47xx%2Fpatches-3.18%2F820-wgt634u-nvram-fix.patch;h=4738c223c4efb5b8787e76ab7949152df273fcbd;hb=99a468a9dd7ab7538cb22c972ad62f73646ca89b;hp=818641bcbe75fd4340e07b3def6de6ab2157a1a0;hpb=aefcd2b84c871644f4f74668dab88e568543c2e9;p=librecmc%2Flibrecmc.git diff --git a/target/linux/brcm47xx/patches-3.18/820-wgt634u-nvram-fix.patch b/target/linux/brcm47xx/patches-3.18/820-wgt634u-nvram-fix.patch index 818641bcbe..4738c223c4 100644 --- a/target/linux/brcm47xx/patches-3.18/820-wgt634u-nvram-fix.patch +++ b/target/linux/brcm47xx/patches-3.18/820-wgt634u-nvram-fix.patch @@ -243,16 +243,16 @@ out the configuration than the in kernel cfe config reader. + --- a/arch/mips/bcm47xx/nvram.c +++ b/arch/mips/bcm47xx/nvram.c -@@ -33,6 +33,8 @@ struct nvram_header { - +@@ -37,6 +37,8 @@ struct nvram_header { static char nvram_buf[NVRAM_SPACE]; + static size_t nvram_len; static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000}; +static int cfe_env; +extern char *cfe_env_get(char *nv_buf, const char *name); static u32 find_nvram_size(void __iomem *end) { -@@ -62,6 +64,26 @@ static int nvram_find_and_copy(void __io +@@ -66,6 +68,26 @@ static int nvram_find_and_copy(void __io return -EEXIST; } @@ -260,8 +260,8 @@ out the configuration than the in kernel cfe config reader. + + /* XXX: hack for supporting the CFE environment stuff on WGT634U */ + if (lim >= 8 * 1024 * 1024) { -+ src = (u32 *) iobase + 8 * 1024 * 1024 - 0x2000; -+ dst = (u32 *) nvram_buf; ++ src = (u32 *)(iobase + 8 * 1024 * 1024 - 0x2000); ++ dst = (u32 *)nvram_buf; + + if ((*src & 0xff00ff) == 0x000001) { + printk("early_nvram_init: WGT634U NVRAM found.\n"); @@ -279,9 +279,9 @@ out the configuration than the in kernel cfe config reader. /* TODO: when nvram is on nand flash check for bad blocks first. */ off = FLASH_MIN; while (off <= lim) { -@@ -189,6 +211,13 @@ int bcm47xx_nvram_getenv(const char *nam - return err; - } +@@ -180,6 +202,13 @@ int bcm47xx_nvram_getenv(const char *nam + if (!name) + return -EINVAL; + if (cfe_env) { + value = cfe_env_get(nvram_buf, name); @@ -290,6 +290,6 @@ out the configuration than the in kernel cfe config reader. + return snprintf(val, val_len, "%s", value); + } + - /* Look for name=value and return value */ - var = &nvram_buf[sizeof(struct nvram_header)]; - end = nvram_buf + sizeof(nvram_buf) - 2; + if (!nvram_len) { + err = nvram_init(); + if (err)