diff mbox series

[v4] mtd: nand: arasan: Print warning for unsupported ecc modes

Message ID 20240306032703.17508-1-venkatesh.abbarapu@amd.com
State Accepted
Commit 602b879efd44eefba5a3b7e956a9dd3df339f82e
Delegated to: Dario Binacchi
Headers show
Series [v4] mtd: nand: arasan: Print warning for unsupported ecc modes | expand

Commit Message

Venkatesh Yadav Abbarapu March 6, 2024, 3:27 a.m. UTC
Currently only hw ecc is supported in U-Boot. If any other ecc mode is
given in DT, it simply through an error. So better print
what is being done.

Revert this patch once soft ecc support is fixed in future.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
---
Changes in v2:
- Added the ecc mode check in the arasan driver itself.
Changes in v3:
- Skip the driver probe when sw-ecc mode is present in the device tree.
Changes in v4:
- Updated the commit description to through an error if other
than hw ecc mentioned in the DT.
- Added the NULL check.
---
 drivers/mtd/nand/raw/arasan_nfc.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Michal Simek March 12, 2024, 3:07 p.m. UTC | #1
On 3/6/24 04:27, Venkatesh Yadav Abbarapu wrote:
> Currently only hw ecc is supported in U-Boot. If any other ecc mode is
> given in DT, it simply through an error. So better print
> what is being done.
> 
> Revert this patch once soft ecc support is fixed in future.
> 
> Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
> Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
> ---
> Changes in v2:
> - Added the ecc mode check in the arasan driver itself.
> Changes in v3:
> - Skip the driver probe when sw-ecc mode is present in the device tree.
> Changes in v4:
> - Updated the commit description to through an error if other
> than hw ecc mentioned in the DT.
> - Added the NULL check.
> ---
>   drivers/mtd/nand/raw/arasan_nfc.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/mtd/nand/raw/arasan_nfc.c b/drivers/mtd/nand/raw/arasan_nfc.c
> index 14766401bf..0b1b91f771 100644
> --- a/drivers/mtd/nand/raw/arasan_nfc.c
> +++ b/drivers/mtd/nand/raw/arasan_nfc.c
> @@ -1233,6 +1233,7 @@ static int arasan_probe(struct udevice *dev)
>   	struct mtd_info *mtd;
>   	ofnode child;
>   	int err = -1;
> +	const char *str;
>   
>   	info->reg = dev_read_addr_ptr(dev);
>   	mtd = nand_to_mtd(nand_chip);
> @@ -1263,6 +1264,12 @@ static int arasan_probe(struct udevice *dev)
>   		goto fail;
>   	}
>   
> +	str = ofnode_read_string(nand_chip->flash_node, "nand-ecc-mode");
> +	if (!str || strcmp(str, "hw") != 0) {
> +		printf("%s ecc mode is not supported\n", str);
> +		return -EINVAL;
> +	}
> +
>   	nand_chip->ecc.mode = NAND_ECC_HW;
>   	nand_chip->ecc.hwctl = NULL;
>   	nand_chip->ecc.read_page = arasan_nand_read_page_hwecc;

Applied.
M
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/arasan_nfc.c b/drivers/mtd/nand/raw/arasan_nfc.c
index 14766401bf..0b1b91f771 100644
--- a/drivers/mtd/nand/raw/arasan_nfc.c
+++ b/drivers/mtd/nand/raw/arasan_nfc.c
@@ -1233,6 +1233,7 @@  static int arasan_probe(struct udevice *dev)
 	struct mtd_info *mtd;
 	ofnode child;
 	int err = -1;
+	const char *str;
 
 	info->reg = dev_read_addr_ptr(dev);
 	mtd = nand_to_mtd(nand_chip);
@@ -1263,6 +1264,12 @@  static int arasan_probe(struct udevice *dev)
 		goto fail;
 	}
 
+	str = ofnode_read_string(nand_chip->flash_node, "nand-ecc-mode");
+	if (!str || strcmp(str, "hw") != 0) {
+		printf("%s ecc mode is not supported\n", str);
+		return -EINVAL;
+	}
+
 	nand_chip->ecc.mode = NAND_ECC_HW;
 	nand_chip->ecc.hwctl = NULL;
 	nand_chip->ecc.read_page = arasan_nand_read_page_hwecc;