[openwrt/openwrt] bcm53xx: add the latest fix version of brcm_nvram
LEDE Commits
lede-commits at lists.infradead.org
Thu Nov 2 01:23:54 PDT 2023
rmilecki pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/943bd3c9f6244c928cd168302d638a6a218fd4e6
commit 943bd3c9f6244c928cd168302d638a6a218fd4e6
Author: Rafał Miłecki <rafal at milecki.pl>
AuthorDate: Thu Nov 2 09:08:54 2023 +0100
bcm53xx: add the latest fix version of brcm_nvram
It was just sent for upstream.
Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
...brcm_nvram-store-a-copy-of-NVRAM-content.patch} | 23 +++++++++++++---------
...brcm_nvram-store-a-copy-of-NVRAM-content.patch} | 23 +++++++++++++---------
2 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/target/linux/bcm53xx/patches-5.15/800-nvmem-brcm_nvram-store-a-copy-of-NVRAM-content.patch b/target/linux/bcm53xx/patches-5.15/181-nvmem-brcm_nvram-store-a-copy-of-NVRAM-content.patch
similarity index 91%
rename from target/linux/bcm53xx/patches-5.15/800-nvmem-brcm_nvram-store-a-copy-of-NVRAM-content.patch
rename to target/linux/bcm53xx/patches-5.15/181-nvmem-brcm_nvram-store-a-copy-of-NVRAM-content.patch
index 2aae713b64..cceb3635ac 100644
--- a/target/linux/bcm53xx/patches-5.15/800-nvmem-brcm_nvram-store-a-copy-of-NVRAM-content.patch
+++ b/target/linux/bcm53xx/patches-5.15/181-nvmem-brcm_nvram-store-a-copy-of-NVRAM-content.patch
@@ -25,23 +25,27 @@ Cc: Arınç ÜNAL <arinc.unal at arinc9.com>
Cc: Florian Fainelli <florian.fainelli at broadcom.com>
Cc: Scott Branden <scott.branden at broadcom.com>
Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
+Acked-by: Arınç ÜNAL <arinc.unal at arinc9.com>
---
- drivers/nvmem/brcm_nvram.c | 130 +++++++++++++++++++++++++------------
- 1 file changed, 90 insertions(+), 40 deletions(-)
+ drivers/nvmem/brcm_nvram.c | 134 ++++++++++++++++++++++++++-----------
+ 1 file changed, 94 insertions(+), 40 deletions(-)
--- a/drivers/nvmem/brcm_nvram.c
+++ b/drivers/nvmem/brcm_nvram.c
-@@ -17,9 +17,20 @@
+@@ -17,9 +17,23 @@
#define NVRAM_MAGIC "FLSH"
+/**
+ * struct brcm_nvram - driver state internal struct
+ *
++ * @dev: NVMEM device pointer
+ * @nvmem_size: Size of the whole space available for NVRAM
+ * @data: NVRAM data copy stored to avoid poking underlaying flash controller
+ * @data_len: NVRAM data size
+ * @padding_byte: Padding value used to fill remaining space
++ * @cells: Array of discovered NVMEM cells
++ * @ncells: Number of elements in cells
+ */
struct brcm_nvram {
struct device *dev;
@@ -53,7 +57,7 @@ Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
struct nvmem_cell_info *cells;
int ncells;
};
-@@ -36,10 +47,47 @@ static int brcm_nvram_read(void *context
+@@ -36,10 +50,47 @@ static int brcm_nvram_read(void *context
size_t bytes)
{
struct brcm_nvram *priv = context;
@@ -104,7 +108,7 @@ Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
return 0;
}
-@@ -67,8 +115,13 @@ static int brcm_nvram_add_cells(struct b
+@@ -67,8 +118,13 @@ static int brcm_nvram_add_cells(struct b
size_t len)
{
struct device *dev = priv->dev;
@@ -119,7 +123,7 @@ Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
priv->ncells = 0;
for (var = data + sizeof(struct brcm_nvram_header);
-@@ -78,67 +131,67 @@ static int brcm_nvram_add_cells(struct b
+@@ -78,67 +134,68 @@ static int brcm_nvram_add_cells(struct b
}
priv->cells = devm_kcalloc(dev, priv->ncells, sizeof(*priv->cells), GFP_KERNEL);
@@ -204,7 +208,8 @@ Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
- return err;
+ len = le32_to_cpu(header->len);
+ if (len > priv->nvmem_size) {
-+ dev_err(dev, "NVRAM length (%zd) exceeds mapped size (%zd)\n", len, priv->nvmem_size);
++ dev_err(dev, "NVRAM length (%zd) exceeds mapped size (%zd)\n", len,
++ priv->nvmem_size);
+ return -EINVAL;
}
@@ -215,7 +220,7 @@ Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
return 0;
}
-@@ -150,7 +203,6 @@ static int brcm_nvram_probe(struct platf
+@@ -150,7 +207,6 @@ static int brcm_nvram_probe(struct platf
.reg_read = brcm_nvram_read,
};
struct device *dev = &pdev->dev;
@@ -223,7 +228,7 @@ Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
struct brcm_nvram *priv;
int err;
-@@ -159,21 +211,19 @@ static int brcm_nvram_probe(struct platf
+@@ -159,21 +215,19 @@ static int brcm_nvram_probe(struct platf
return -ENOMEM;
priv->dev = dev;
diff --git a/target/linux/bcm53xx/patches-6.1/800-nvmem-brcm_nvram-store-a-copy-of-NVRAM-content.patch b/target/linux/bcm53xx/patches-6.1/181-nvmem-brcm_nvram-store-a-copy-of-NVRAM-content.patch
similarity index 91%
rename from target/linux/bcm53xx/patches-6.1/800-nvmem-brcm_nvram-store-a-copy-of-NVRAM-content.patch
rename to target/linux/bcm53xx/patches-6.1/181-nvmem-brcm_nvram-store-a-copy-of-NVRAM-content.patch
index 2aae713b64..cceb3635ac 100644
--- a/target/linux/bcm53xx/patches-6.1/800-nvmem-brcm_nvram-store-a-copy-of-NVRAM-content.patch
+++ b/target/linux/bcm53xx/patches-6.1/181-nvmem-brcm_nvram-store-a-copy-of-NVRAM-content.patch
@@ -25,23 +25,27 @@ Cc: Arınç ÜNAL <arinc.unal at arinc9.com>
Cc: Florian Fainelli <florian.fainelli at broadcom.com>
Cc: Scott Branden <scott.branden at broadcom.com>
Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
+Acked-by: Arınç ÜNAL <arinc.unal at arinc9.com>
---
- drivers/nvmem/brcm_nvram.c | 130 +++++++++++++++++++++++++------------
- 1 file changed, 90 insertions(+), 40 deletions(-)
+ drivers/nvmem/brcm_nvram.c | 134 ++++++++++++++++++++++++++-----------
+ 1 file changed, 94 insertions(+), 40 deletions(-)
--- a/drivers/nvmem/brcm_nvram.c
+++ b/drivers/nvmem/brcm_nvram.c
-@@ -17,9 +17,20 @@
+@@ -17,9 +17,23 @@
#define NVRAM_MAGIC "FLSH"
+/**
+ * struct brcm_nvram - driver state internal struct
+ *
++ * @dev: NVMEM device pointer
+ * @nvmem_size: Size of the whole space available for NVRAM
+ * @data: NVRAM data copy stored to avoid poking underlaying flash controller
+ * @data_len: NVRAM data size
+ * @padding_byte: Padding value used to fill remaining space
++ * @cells: Array of discovered NVMEM cells
++ * @ncells: Number of elements in cells
+ */
struct brcm_nvram {
struct device *dev;
@@ -53,7 +57,7 @@ Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
struct nvmem_cell_info *cells;
int ncells;
};
-@@ -36,10 +47,47 @@ static int brcm_nvram_read(void *context
+@@ -36,10 +50,47 @@ static int brcm_nvram_read(void *context
size_t bytes)
{
struct brcm_nvram *priv = context;
@@ -104,7 +108,7 @@ Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
return 0;
}
-@@ -67,8 +115,13 @@ static int brcm_nvram_add_cells(struct b
+@@ -67,8 +118,13 @@ static int brcm_nvram_add_cells(struct b
size_t len)
{
struct device *dev = priv->dev;
@@ -119,7 +123,7 @@ Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
priv->ncells = 0;
for (var = data + sizeof(struct brcm_nvram_header);
-@@ -78,67 +131,67 @@ static int brcm_nvram_add_cells(struct b
+@@ -78,67 +134,68 @@ static int brcm_nvram_add_cells(struct b
}
priv->cells = devm_kcalloc(dev, priv->ncells, sizeof(*priv->cells), GFP_KERNEL);
@@ -204,7 +208,8 @@ Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
- return err;
+ len = le32_to_cpu(header->len);
+ if (len > priv->nvmem_size) {
-+ dev_err(dev, "NVRAM length (%zd) exceeds mapped size (%zd)\n", len, priv->nvmem_size);
++ dev_err(dev, "NVRAM length (%zd) exceeds mapped size (%zd)\n", len,
++ priv->nvmem_size);
+ return -EINVAL;
}
@@ -215,7 +220,7 @@ Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
return 0;
}
-@@ -150,7 +203,6 @@ static int brcm_nvram_probe(struct platf
+@@ -150,7 +207,6 @@ static int brcm_nvram_probe(struct platf
.reg_read = brcm_nvram_read,
};
struct device *dev = &pdev->dev;
@@ -223,7 +228,7 @@ Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
struct brcm_nvram *priv;
int err;
-@@ -159,21 +211,19 @@ static int brcm_nvram_probe(struct platf
+@@ -159,21 +215,19 @@ static int brcm_nvram_probe(struct platf
return -ENOMEM;
priv->dev = dev;
More information about the lede-commits
mailing list