aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/pending-5.4/405-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/generic/pending-5.4/405-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch')
-rw-r--r--target/linux/generic/pending-5.4/405-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/target/linux/generic/pending-5.4/405-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch b/target/linux/generic/pending-5.4/405-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch
new file mode 100644
index 0000000000..25801e4686
--- /dev/null
+++ b/target/linux/generic/pending-5.4/405-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch
@@ -0,0 +1,38 @@
+From a5d83d6e2bc747b13f347962d4b335d70b23559b Mon Sep 17 00:00:00 2001
+From: Ansuel Smith <ansuelsmth@gmail.com>
+Date: Fri, 12 Mar 2021 07:28:19 +0100
+Subject: [PATCH] mtd: core: add nvmem-cells compatible to parse mtd as nvmem
+ cells
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Partitions that contains the nvmem-cells compatible will register
+their direct subonodes as nvmem cells and the node will be treated as a
+nvmem provider.
+
+Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
+Tested-by: Rafał Miłecki <rafal@milecki.pl>
+---
+ drivers/mtd/mtdcore.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/mtd/mtdcore.c
++++ b/drivers/mtd/mtdcore.c
+@@ -559,6 +559,7 @@ static int mtd_nvmem_reg_read(void *priv
+
+ static int mtd_nvmem_add(struct mtd_info *mtd)
+ {
++ struct device_node *node = mtd_get_of_node(mtd);
+ struct nvmem_config config = {};
+
+ config.id = -1;
+@@ -571,7 +572,7 @@ static int mtd_nvmem_add(struct mtd_info
+ config.stride = 1;
+ config.read_only = true;
+ config.root_only = true;
+- config.no_of_node = true;
++ config.no_of_node = !of_device_is_compatible(node, "nvmem-cells");
+ config.priv = mtd;
+
+ mtd->nvmem = nvmem_register(&config);