diff mbox series

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

Message ID 20240301111254.3588162-1-venkatesh.abbarapu@amd.com
State Superseded
Delegated to: Dario Binacchi
Headers show
Series [v3] mtd: nand: arasan: Print warning for unsupported ecc modes | expand

Commit Message

Venkatesh Yadav Abbarapu March 1, 2024, 11:12 a.m. UTC
Currently only hw ecc is supported in U-Boot. If any other ecc mode is
given in DT, it simply ignores and switches to hw ecc. 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.
---
 drivers/mtd/nand/raw/arasan_nfc.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Michal Simek March 1, 2024, 11:25 a.m. UTC | #1
On 3/1/24 12:12, Venkatesh Yadav Abbarapu wrote:
> Currently only hw ecc is supported in U-Boot. If any other ecc mode is
> given in DT, it simply ignores and switches to hw ecc. 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.
> ---
>   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..426160c384 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 (strcmp(str, "hw")) {
> +		printf("%s ecc is not supported, switch to hw ecc\n", str);

you are returning below. It means switch to HW ecc is not happening right?

M
Dan Carpenter March 1, 2024, 11:32 a.m. UTC | #2
On Fri, Mar 01, 2024 at 04:42:54PM +0530, Venkatesh Yadav Abbarapu wrote:
> @@ -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 (strcmp(str, "hw")) {
> +		printf("%s ecc is not supported, switch to hw ecc\n", str);

I'm a newbie to device trees, but the two other callers assume that it's
possible for ofnode_read_string(nand->flash_node, "nand-ecc-mode") to
return NULL so probably we should add a NULL check here too.

	if (!str || strcmp(str, "hw") != 0) {

regards,
dan carpenter
Venkatesh Yadav Abbarapu March 1, 2024, 11:53 a.m. UTC | #3
Hi Michal,

> -----Original Message-----
> From: Simek, Michal <michal.simek@amd.com>
> Sent: Friday, March 1, 2024 4:55 PM
> To: Abbarapu, Venkatesh <venkatesh.abbarapu@amd.com>; u-
> boot@lists.denx.de
> Cc: dario.binacchi@amarulasolutions.com; michael@amarulasolutions.com;
> git (AMD-Xilinx) <git@amd.com>; Ashok Reddy Soma
> <ashok.reddy.soma@amd.com>
> Subject: Re: [UBOOT PATCH v3] mtd: nand: arasan: Print warning for
> unsupported ecc modes
> 
> 
> 
> On 3/1/24 12:12, Venkatesh Yadav Abbarapu wrote:
> > Currently only hw ecc is supported in U-Boot. If any other ecc mode is
> > given in DT, it simply ignores and switches to hw ecc. 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.
> > ---
> >   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..426160c384 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 (strcmp(str, "hw")) {
> > +		printf("%s ecc is not supported, switch to hw ecc\n", str);
> 
> you are returning below. It means switch to HW ecc is not happening right?
<Venkatesh> Yes. We are not switching to HW ecc, just returning from the probe if it is other that HW ecc.

Thanks
Venkatesh
> 
> 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..426160c384 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 (strcmp(str, "hw")) {
+		printf("%s ecc is not supported, switch to hw ecc\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;