From: Francesco Dolcini <francesco@dolcini.it>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
linux-mtd@lists.infradead.org, Marek Vasut <marex@denx.de>
Cc: Francesco Dolcini <francesco.dolcini@toradex.com>,
Shawn Guo <shawnguo@kernel.org>,
linux-arm-kernel@lists.infradead.org, stable@vger.kernel.org
Subject: [PATCH v1] mtd: parsers: ofpart: Fix parsing when size-cells is 0
Date: Fri, 2 Dec 2022 08:19:00 +0100 [thread overview]
Message-ID: <20221202071900.1143950-1-francesco@dolcini.it> (raw)
From: Francesco Dolcini <francesco.dolcini@toradex.com>
Add a fallback mechanism to handle the case in which #size-cells is set
to <0>. According to the DT binding the nand controller node should have
set it to 0 and this is not compatible with the legacy way of
specifying partitions directly as child nodes of the nand-controller node.
This fixes a boot failure on colibri-imx7 and potentially other boards.
Cc: stable@vger.kernel.org
Fixes: 753395ea1e45 ("ARM: dts: imx7: Fix NAND controller size-cells")
Link: https://lore.kernel.org/all/Y4dgBTGNWpM6SQXI@francesco-nb.int.toradex.com/
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
drivers/mtd/parsers/ofpart_core.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/mtd/parsers/ofpart_core.c b/drivers/mtd/parsers/ofpart_core.c
index 192190c42fc8..aa3b7fa61e50 100644
--- a/drivers/mtd/parsers/ofpart_core.c
+++ b/drivers/mtd/parsers/ofpart_core.c
@@ -122,6 +122,17 @@ static int parse_fixed_partitions(struct mtd_info *master,
a_cells = of_n_addr_cells(pp);
s_cells = of_n_size_cells(pp);
+ if (s_cells == 0) {
+ /*
+ * Use #size-cells = <1> for backward compatibility
+ * in case #size-cells is set to <0> and firmware adds
+ * OF partitions without setting it.
+ */
+ pr_warn_once("%s: ofpart partition %pOF (%pOF) #size-cells is <0>, using <1> for backward compatibility.\n",
+ master->name, pp,
+ mtd_node);
+ s_cells = 1;
+ }
if (len / 4 != a_cells + s_cells) {
pr_debug("%s: ofpart partition %pOF (%pOF) error parsing reg property.\n",
master->name, pp,
--
2.25.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next reply other threads:[~2022-12-02 7:20 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-02 7:19 Francesco Dolcini [this message]
2022-12-02 9:14 ` [PATCH v1] mtd: parsers: ofpart: Fix parsing when size-cells is 0 Miquel Raynal
2022-12-02 10:12 ` Francesco Dolcini
2022-12-02 10:24 ` Francesco Dolcini
2022-12-02 10:53 ` Miquel Raynal
2022-12-02 11:23 ` Francesco Dolcini
2022-12-02 14:05 ` Miquel Raynal
2022-12-02 14:31 ` Marek Vasut
2022-12-02 15:00 ` Miquel Raynal
2022-12-02 15:23 ` Marek Vasut
2022-12-02 15:49 ` Miquel Raynal
2022-12-02 16:01 ` Miquel Raynal
2022-12-02 16:17 ` Marek Vasut
2022-12-02 16:42 ` Miquel Raynal
2022-12-02 16:52 ` Marek Vasut
2022-12-02 16:57 ` Miquel Raynal
2022-12-02 17:08 ` Marek Vasut
2022-12-05 11:26 ` Francesco Dolcini
2022-12-05 13:49 ` Miquel Raynal
2022-12-05 16:25 ` Marek Vasut
2022-12-15 7:16 ` Miquel Raynal
2022-12-15 7:45 ` Marek Vasut
2022-12-15 8:04 ` Miquel Raynal
2022-12-16 0:36 ` Marek Vasut
2022-12-16 7:52 ` Francesco Dolcini
2022-12-16 7:45 ` Francesco Dolcini
2022-12-16 10:46 ` Marek Vasut
2022-12-16 11:01 ` Miquel Raynal
2022-12-16 12:37 ` Francesco Dolcini
2022-12-16 13:37 ` Miquel Raynal
2022-12-16 14:32 ` Marek Vasut
2022-12-16 15:35 ` Miquel Raynal
2022-12-16 16:30 ` Francesco Dolcini
2023-01-02 9:40 ` Miquel Raynal
2023-01-05 11:33 ` Miquel Raynal
2023-01-05 12:47 ` Francesco Dolcini
2023-01-05 14:51 ` Marek Vasut
2023-01-05 15:03 ` Miquel Raynal
2022-12-02 17:20 ` Francesco Dolcini
2022-12-05 11:30 ` Francesco Dolcini
2022-12-05 15:28 ` Miquel Raynal
2022-12-02 16:45 ` Francesco Dolcini
2022-12-02 17:05 ` Miquel Raynal
2022-12-02 15:56 ` Thorsten Leemhuis
2022-12-04 12:50 ` Marek Vasut
2022-12-04 12:59 ` Thorsten Leemhuis
2022-12-04 15:50 ` Marek Vasut
2022-12-02 12:43 ` Greg KH
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=20221202071900.1143950-1-francesco@dolcini.it \
--to=francesco@dolcini.it \
--cc=francesco.dolcini@toradex.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marex@denx.de \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=shawnguo@kernel.org \
--cc=stable@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox