devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Julius Werner <jwerner@chromium.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Cc: Dmitry Osipenko <digetx@gmail.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Julius Werner <jwerner@chromium.org>
Subject: [PATCH 2/3] memory: Update of_memory lpddr2 revision-id binding
Date: Wed, 23 Feb 2022 16:34:20 -0800	[thread overview]
Message-ID: <20220224003421.3440124-3-jwerner@chromium.org> (raw)
In-Reply-To: <20220224003421.3440124-1-jwerner@chromium.org>

This patch updates the code parsing the "jedec,lpddr2" device tree
binding to use the new `revision-id` property instead of the deprecated
`revision-id1` and `revision-id2` properties if available.

Signed-off-by: Julius Werner <jwerner@chromium.org>
---
 drivers/memory/of_memory.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/memory/of_memory.c b/drivers/memory/of_memory.c
index b94408954d85cc..454a0e6d544cac 100644
--- a/drivers/memory/of_memory.c
+++ b/drivers/memory/of_memory.c
@@ -316,14 +316,21 @@ const struct lpddr2_info
 	struct property *prop;
 	const char *cp;
 	int err;
-
-	err = of_property_read_u32(np, "revision-id1", &info.revision_id1);
-	if (err)
-		info.revision_id1 = -ENOENT;
-
-	err = of_property_read_u32(np, "revision-id2", &info.revision_id2);
-	if (err)
-		info.revision_id2 = -ENOENT;
+	u32 revision_id[2];
+
+	err = of_property_read_u32_array(np, "revision-id", revision_id, 2);
+	if (!err) {
+		info.revision_id1 = revision_id[0];
+		info.revision_id2 = revision_id[1];
+	} else {
+		err = of_property_read_u32(np, "revision-id1", &info.revision_id1);
+		if (err)
+			info.revision_id1 = -ENOENT;
+
+		err = of_property_read_u32(np, "revision-id2", &info.revision_id2);
+		if (err)
+			info.revision_id2 = -ENOENT;
+	}
 
 	err = of_property_read_u32(np, "io-width", &info.io_width);
 	if (err)
-- 
2.31.0


  parent reply	other threads:[~2022-02-24  0:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24  0:34 [PATCH 0/3] Update lpddr2 revision-id binding to match lpddr3 Julius Werner
2022-02-24  0:34 ` [PATCH v3 1/3] dt-bindings: memory: lpddr2: Adjust revision ID property " Julius Werner
2022-02-24 20:24   ` Rob Herring
2022-02-25 12:35   ` Krzysztof Kozlowski
2022-02-24  0:34 ` Julius Werner [this message]
2022-02-24  0:34 ` [PATCH 3/3] ARM: dts: Update jedec,lpddr2 revision-id binding Julius Werner
2022-02-24  7:29   ` Krzysztof Kozlowski
2022-02-24 12:38     ` Thierry Reding
2022-02-25  1:41       ` Julius Werner
2022-02-25  7:08         ` Krzysztof Kozlowski
2022-02-25 12:37 ` [PATCH 0/3] Update lpddr2 revision-id binding to match lpddr3 Krzysztof Kozlowski

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=20220224003421.3440124-3-jwerner@chromium.org \
    --to=jwerner@chromium.org \
    --cc=devicetree@vger.kernel.org \
    --cc=digetx@gmail.com \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).