aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm47xx
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2021-03-12 21:08:24 +0100
committerRafał Miłecki <rafal@milecki.pl>2021-03-17 23:38:46 +0100
commit761df5c4cff9b0e31d591e544f8f7a6805c49b76 (patch)
tree56dd72dcf10c62e051ad8f0a417e2f091d91be3f /target/linux/bcm47xx
parent20fe0e66f3c243b9c196b6811d7abc47fa2b92db (diff)
downloadupstream-761df5c4cff9b0e31d591e544f8f7a6805c49b76.tar.gz
upstream-761df5c4cff9b0e31d591e544f8f7a6805c49b76.tar.bz2
upstream-761df5c4cff9b0e31d591e544f8f7a6805c49b76.zip
bcm47xx: make WGT634U NVRAM patch apply again
Fixes: 1c48eee5b2bc ("kernel: backport Broadcom NVRAM driver cleanups") Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 9530b9bb78845910de711d425f1e4b1c7d539b13)
Diffstat (limited to 'target/linux/bcm47xx')
-rw-r--r--target/linux/bcm47xx/patches-5.4/820-wgt634u-nvram-fix.patch28
1 files changed, 9 insertions, 19 deletions
diff --git a/target/linux/bcm47xx/patches-5.4/820-wgt634u-nvram-fix.patch b/target/linux/bcm47xx/patches-5.4/820-wgt634u-nvram-fix.patch
index 6d58c1b042..5f4af85df2 100644
--- a/target/linux/bcm47xx/patches-5.4/820-wgt634u-nvram-fix.patch
+++ b/target/linux/bcm47xx/patches-5.4/820-wgt634u-nvram-fix.patch
@@ -250,28 +250,18 @@ out the configuration than the in kernel cfe config reader.
+static int cfe_env;
+extern char *cfe_env_get(char *nv_buf, const char *name);
- static u32 find_nvram_size(void __iomem *end)
- {
-@@ -52,7 +54,9 @@ static u32 find_nvram_size(void __iomem
- static int nvram_find_and_copy(void __iomem *iobase, u32 lim)
- {
- struct nvram_header __iomem *header;
-+ int i;
- u32 off;
-+ u32 *src, *dst;
- u32 size;
-
- if (nvram_len) {
-@@ -60,6 +64,26 @@ static int nvram_find_and_copy(void __io
+ /**
+ * bcm47xx_nvram_is_valid - check for a valid NVRAM at specified memory
+@@ -80,6 +82,26 @@ static int bcm47xx_nvram_find_and_copy(v
return -EEXIST;
}
+ cfe_env = 0;
+
+ /* 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;
++ if (res_size >= 8 * 1024 * 1024) {
++ u32 *src = (u32 *)(flash_start + 8 * 1024 * 1024 - 0x2000);
++ u32 *dst = (u32 *)nvram_buf;
+
+ if ((*src & 0xff00ff) == 0x000001) {
+ printk("early_nvram_init: WGT634U NVRAM found.\n");
@@ -287,9 +277,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) {
-@@ -170,6 +194,13 @@ int bcm47xx_nvram_getenv(const char *nam
+
+ /* Try every possible flash size and check for NVRAM at its end */
+@@ -172,6 +194,13 @@ int bcm47xx_nvram_getenv(const char *nam
if (!name)
return -EINVAL;