mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: srini@kernel.org
To: gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org,
	Loic Poulain <loic.poulain@oss.qualcomm.com>,
	Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
	Srinivas Kandagatla <srini@kernel.org>
Subject: [PATCH 5/9] nvmem: layouts: Support fixed-layout as the nvmem device node itself
Date: Fri,  2 Oct 2026 11:13:48 +0100	[thread overview]
Message-ID: <20261002101352.1084447-6-srini@kernel.org> (raw)
In-Reply-To: <20261002101352.1084447-1-srini@kernel.org>

From: Loic Poulain <loic.poulain@oss.qualcomm.com>

of_nvmem_layout_get_container() only looks for a child node named
"nvmem-layout" to locate the cell definitions. This does not cover
providers whose device tree node is itself the fixed-layout container,
such as an eMMC boot partition block device whose fwnode points directly
at a "fixed-layout" compatible partitions node.

When no "nvmem-layout" child is present, fall back to returning the nvmem
device node itself if it is compatible with "fixed-layout", so that its
cells are parsed by nvmem_add_cells_from_fixed_layout().

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
 drivers/nvmem/layouts.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/nvmem/layouts.c b/drivers/nvmem/layouts.c
index 07a34be9669c..409909e3244f 100644
--- a/drivers/nvmem/layouts.c
+++ b/drivers/nvmem/layouts.c
@@ -156,7 +156,18 @@ static int nvmem_layout_bus_populate(struct nvmem_device *nvmem,
 
 struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem)
 {
-	return of_get_child_by_name(nvmem->dev.of_node, "nvmem-layout");
+	struct device_node *np;
+
+	/* Search for nvmem-layout child */
+	np = of_get_child_by_name(nvmem->dev.of_node, "nvmem-layout");
+	if (np)
+		return np;
+
+	/* The nvmem of_node is itself a fixed-layout node */
+	if (of_device_is_compatible(nvmem->dev.of_node, "fixed-layout"))
+		return of_node_get(nvmem->dev.of_node);
+
+	return NULL;
 }
 EXPORT_SYMBOL_GPL(of_nvmem_layout_get_container);
 
-- 
2.53.0


  parent reply	other threads:[~2026-10-02 10:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 10:13 [PATCH 0/9] nvmem: patches for 7.4 srini
2026-10-02 10:13 ` [PATCH 1/9] dt-bindings: nvmem: qfprom: Add compatible for Qualcomm Maili srini
2026-10-02 10:13 ` [PATCH 2/9] dt-bindings: nvmem: uniphier-efuse: Add ti,am62p-efuse compatible srini
2026-10-02 10:13 ` [PATCH 3/9] nvmem: uniphier-efuse: Enable for K3 SoCs srini
2026-10-02 10:13 ` [PATCH 4/9] nvmem: core: Add const to pattrs allocation type srini
2026-10-02 10:13 ` srini [this message]
2026-10-02 10:13 ` [PATCH 6/9] dt-bindings: mfd: mediatek: mt6397: add mt6323 PMIC EFUSE srini
2026-10-02 10:13 ` [PATCH 7/9] nvmem: add mt6323 PMIC EFUSE driver srini
2026-10-02 10:13 ` [PATCH 8/9] nvmem: remove duplicated reference counting srini
2026-10-02 10:13 ` [PATCH 9/9] nvmem: protect nvmem_device::ops with SRCU srini

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=20261002101352.1084447-6-srini@kernel.org \
    --to=srini@kernel.org \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loic.poulain@oss.qualcomm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®