All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ansuel Smith <ansuelsmth@gmail.com>
To: Richard Weinberger <richard@nod.at>
Cc: Ansuel Smith <ansuelsmth@gmail.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Rob Herring <robh+dt@kernel.org>,
	Boris Brezillon <bbrezillon@kernel.org>,
	linux-mtd@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/3] mtd: core: add nvmem-partitions compatible to parse mtd as nvmem cells
Date: Tue, 16 Feb 2021 22:26:27 +0100	[thread overview]
Message-ID: <20210216212638.28382-3-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20210216212638.28382-1-ansuelsmth@gmail.com>

Partitions that contains the nvmem-partitions 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>
---
 drivers/mtd/mtdcore.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 2d6423d89a17..29d257678a86 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -531,6 +531,7 @@ static int mtd_nvmem_reg_read(void *priv, unsigned int offset,
 
 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;
@@ -543,7 +544,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
 	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-partitions");
 	config.priv = mtd;
 
 	mtd->nvmem = nvmem_register(&config);
-- 
2.30.0


WARNING: multiple messages have this Message-ID (diff)
From: Ansuel Smith <ansuelsmth@gmail.com>
To: Richard Weinberger <richard@nod.at>
Cc: devicetree@vger.kernel.org, Vignesh Raghavendra <vigneshr@ti.com>,
	Boris Brezillon <bbrezillon@kernel.org>,
	linux-kernel@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
	linux-mtd@lists.infradead.org,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Ansuel Smith <ansuelsmth@gmail.com>
Subject: [PATCH v2 2/3] mtd: core: add nvmem-partitions compatible to parse mtd as nvmem cells
Date: Tue, 16 Feb 2021 22:26:27 +0100	[thread overview]
Message-ID: <20210216212638.28382-3-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20210216212638.28382-1-ansuelsmth@gmail.com>

Partitions that contains the nvmem-partitions 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>
---
 drivers/mtd/mtdcore.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 2d6423d89a17..29d257678a86 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -531,6 +531,7 @@ static int mtd_nvmem_reg_read(void *priv, unsigned int offset,
 
 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;
@@ -543,7 +544,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
 	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-partitions");
 	config.priv = mtd;
 
 	mtd->nvmem = nvmem_register(&config);
-- 
2.30.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  parent reply	other threads:[~2021-02-16 21:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 21:26 [PATCH v2 0/3] Implement nvmem support for mtd Ansuel Smith
2021-02-16 21:26 ` Ansuel Smith
2021-02-16 21:26 ` [PATCH v2 1/3] mtd: partitions: ofpart: skip subnodes parse with compatible Ansuel Smith
2021-02-16 21:26   ` Ansuel Smith
2021-03-02 16:53   ` Rafał Miłecki
2021-03-02 16:53     ` Rafał Miłecki
2021-03-02  4:50     ` Ansuel Smith
2021-03-02  4:50       ` Ansuel Smith
2021-02-16 21:26 ` Ansuel Smith [this message]
2021-02-16 21:26   ` [PATCH v2 2/3] mtd: core: add nvmem-partitions compatible to parse mtd as nvmem cells Ansuel Smith
2021-03-03  8:01   ` Rafał Miłecki
2021-03-03  8:01     ` Rafał Miłecki
2021-02-16 21:26 ` [PATCH v2 3/3] dt-bindings: mtd: Document use of nvmem-partitions compatible Ansuel Smith
2021-02-16 21:26   ` Ansuel Smith
2021-03-03 10:01   ` Rafał Miłecki
2021-03-03 10:01     ` Rafał Miłecki
2021-03-05 22:23     ` Rob Herring
2021-03-05 22:23       ` Rob Herring
2021-03-08  9:45       ` Rafał Miłecki
2021-03-08  9:45         ` Rafał Miłecki
2021-03-08  9:48   ` Rafał Miłecki
2021-03-08  9:48     ` Rafał Miłecki
2021-03-07 17:04     ` Ansuel Smith
2021-03-07 17:04       ` Ansuel Smith
2021-03-08 13:28       ` Rafał Miłecki
2021-03-08 13:28         ` Rafał Miłecki
2021-03-08 13:32       ` Rafał Miłecki
2021-03-08 13:32         ` Rafał Miłecki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210216212638.28382-3-ansuelsmth@gmail.com \
    --to=ansuelsmth@gmail.com \
    --cc=bbrezillon@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=robh+dt@kernel.org \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.