mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 15:32:33 +00:00
39 lines
1.2 KiB
Diff
39 lines
1.2 KiB
Diff
|
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);
|