[PATCH v2 5/5] mtd: rawnand: meson: rename node for chip select

From: Arseniy Krasnov
Date: Wed Apr 26 2023 - 03:41:49 EST


This renames node with values for chip select from "reg" to "cs". It is
needed because when OTP access is enabled on the attached storage, MTD
subsystem registers this storage in the NVMEM subsystem. NVMEM in turn
tries to use "reg" node in its own manner, supposes that it has another
layout. All of this leads to device initialization failure.

Example:

[...] nvmem mtd0-user-otp: nvmem: invalid reg on /soc/bus@ffe00000/...
[...] mtd mtd0: Failed to register OTP NVMEM device
[...] meson-nand ffe07800.nfc: failed to register MTD device: -22
[...] meson-nand ffe07800.nfc: failed to init NAND chips
[...] meson-nand: probe of ffe07800.nfc failed with error -22

Signed-off-by: Arseniy Krasnov <AVKrasnov@xxxxxxxxxxxxxx>
---
drivers/mtd/nand/raw/meson_nand.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
index 3737024c33d6..4ff3a3e50c4b 100644
--- a/drivers/mtd/nand/raw/meson_nand.c
+++ b/drivers/mtd/nand/raw/meson_nand.c
@@ -1537,7 +1537,7 @@ meson_nfc_nand_chip_init(struct device *dev,
int ret, i;
u32 tmp, nsels;

- nsels = of_property_count_elems_of_size(np, "reg", sizeof(u32));
+ nsels = of_property_count_elems_of_size(np, "cs", sizeof(u32));
if (!nsels || nsels > MAX_CE_NUM) {
dev_err(dev, "invalid register property size\n");
return -EINVAL;
@@ -1551,7 +1551,7 @@ meson_nfc_nand_chip_init(struct device *dev,
meson_chip->nsels = nsels;

for (i = 0; i < nsels; i++) {
- ret = of_property_read_u32_index(np, "reg", i, &tmp);
+ ret = of_property_read_u32_index(np, "cs", i, &tmp);
if (ret) {
dev_err(dev, "could not retrieve register property: %d\n",
ret);
--
2.35.0