All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: rawnand: fsl_elbc: Fix detection when nand_scan_ident() has not selected ecc.mode
@ 2022-05-11 18:24 Pali Rohár
  2022-06-20  7:08 ` Peng Fan (OSS)
  0 siblings, 1 reply; 4+ messages in thread
From: Pali Rohár @ 2022-05-11 18:24 UTC (permalink / raw)
  To: Priyanka Jain, Wolfgang Denk, Sinan Akman; +Cc: u-boot

ecc.mode is set to 0 (aliased to NAND_ECC_NONE) either when function
nand_scan_ident() has not selected ecc.mode or when it selected it to none
ecc mode.

Distinguish between these two states by checking of node property
"nand-ecc-mode" which function nand_scan_ident() uses for filling ecc.mode.

This change fixes usage of none ecc mode if it is specified in DTS file.

Fixes: c9ea9019c5aa ("mtd: rawnand: fsl_elbc: Use ECC configuration from device tree")
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/mtd/nand/raw/fsl_elbc_nand.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/fsl_elbc_nand.c b/drivers/mtd/nand/raw/fsl_elbc_nand.c
index b0e3eb607ed4..8e14739b3ee9 100644
--- a/drivers/mtd/nand/raw/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/raw/fsl_elbc_nand.c
@@ -745,7 +745,8 @@ static int fsl_elbc_chip_init(int devnum, u8 *addr, struct udevice *dev)
 		return ret;
 
 	/* If nand_scan_ident() has not selected ecc.mode, do it now */
-	if (nand->ecc.mode == NAND_ECC_NONE) {
+	if (nand->ecc.mode == 0 &&
+	    !ofnode_read_string(nand->flash_node, "nand-ecc-mode")) {
 		/* If CS Base Register selects full hardware ECC then use it */
 		if ((br & BR_DECC) == BR_DECC_CHK_GEN) {
 			nand->ecc.mode = NAND_ECC_HW;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: rawnand: fsl_elbc: Fix detection when nand_scan_ident() has not selected ecc.mode
  2022-05-11 18:24 [PATCH] mtd: rawnand: fsl_elbc: Fix detection when nand_scan_ident() has not selected ecc.mode Pali Rohár
@ 2022-06-20  7:08 ` Peng Fan (OSS)
  2022-06-20 11:02   ` Pali Rohár
  0 siblings, 1 reply; 4+ messages in thread
From: Peng Fan (OSS) @ 2022-06-20  7:08 UTC (permalink / raw)
  To: Pali Rohár, Priyanka Jain, Wolfgang Denk, Sinan Akman; +Cc: u-boot



在 2022/5/12 2:24, Pali Rohár 写道:
> ecc.mode is set to 0 (aliased to NAND_ECC_NONE) either when function
> nand_scan_ident() has not selected ecc.mode or when it selected it to none
> ecc mode.
>
> Distinguish between these two states by checking of node property
> "nand-ecc-mode" which function nand_scan_ident() uses for filling ecc.mode.
>
> This change fixes usage of none ecc mode if it is specified in DTS file.
>
> Fixes: c9ea9019c5aa ("mtd: rawnand: fsl_elbc: Use ECC configuration from device tree")
> Signed-off-by: Pali Rohár <pali@kernel.org>

    powerpc:  +   ids8313
+===================== WARNING ======================
+This board does not use CONFIG_WDT (Driver Model
+for DM watchdog). Please update the board to use
+CONFIG_WDT before the v2019.10 release. Failure to
+update by the deadline may result in board removal.
+See doc/develop/driver-model/migration.rst for more info.
+====================================================
+This board does not use CONFIG_DM_ETH (Driver Model
+for Ethernet drivers). Please update the board to use
+CONFIG_DM_ETH before the v2020.07 release. Failure to
+This board does not use CONFIG_DM_I2C (Driver Model
+for I2C drivers). Please update the board to use
+CONFIG_DM_I2C before the v2022.04 release. Failure to
+This board does not use CONFIG_DM_SERIAL (Driver Model
+for Serial drivers). Please update the board to use
+CONFIG_DM_SERIAL before the v2023.04 release. Failure to
+powerpc-linux-ld.bfd: drivers/mtd/nand/raw/fsl_elbc_nand.o: in function 
`fsl_elbc_chip_init':
+drivers/mtd/nand/raw/fsl_elbc_nand.c:749: undefined reference to 
`ofnode_read_string'
+make[1]: *** [Makefile:1813: u-boot] Error 1
+make: *** [Makefile:177: sub-make] Error 2

Build fail.

Regards,
Peng.

> ---
>   drivers/mtd/nand/raw/fsl_elbc_nand.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/raw/fsl_elbc_nand.c b/drivers/mtd/nand/raw/fsl_elbc_nand.c
> index b0e3eb607ed4..8e14739b3ee9 100644
> --- a/drivers/mtd/nand/raw/fsl_elbc_nand.c
> +++ b/drivers/mtd/nand/raw/fsl_elbc_nand.c
> @@ -745,7 +745,8 @@ static int fsl_elbc_chip_init(int devnum, u8 *addr, struct udevice *dev)
>   		return ret;
>   
>   	/* If nand_scan_ident() has not selected ecc.mode, do it now */
> -	if (nand->ecc.mode == NAND_ECC_NONE) {
> +	if (nand->ecc.mode == 0 &&
> +	    !ofnode_read_string(nand->flash_node, "nand-ecc-mode")) {
>   		/* If CS Base Register selects full hardware ECC then use it */
>   		if ((br & BR_DECC) == BR_DECC_CHK_GEN) {
>   			nand->ecc.mode = NAND_ECC_HW;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: rawnand: fsl_elbc: Fix detection when nand_scan_ident() has not selected ecc.mode
  2022-06-20  7:08 ` Peng Fan (OSS)
@ 2022-06-20 11:02   ` Pali Rohár
  2022-06-20 11:07     ` [PATCH v2] " Pali Rohár
  0 siblings, 1 reply; 4+ messages in thread
From: Pali Rohár @ 2022-06-20 11:02 UTC (permalink / raw)
  To: Peng Fan (OSS); +Cc: Priyanka Jain, Wolfgang Denk, Sinan Akman, u-boot

On Monday 20 June 2022 15:08:43 Peng Fan (OSS) wrote:
> 在 2022/5/12 2:24, Pali Rohár 写道:
> > ecc.mode is set to 0 (aliased to NAND_ECC_NONE) either when function
> > nand_scan_ident() has not selected ecc.mode or when it selected it to none
> > ecc mode.
> > 
> > Distinguish between these two states by checking of node property
> > "nand-ecc-mode" which function nand_scan_ident() uses for filling ecc.mode.
> > 
> > This change fixes usage of none ecc mode if it is specified in DTS file.
> > 
> > Fixes: c9ea9019c5aa ("mtd: rawnand: fsl_elbc: Use ECC configuration from device tree")
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> 
>    powerpc:  +   ids8313
> +===================== WARNING ======================
> +This board does not use CONFIG_WDT (Driver Model
> +for DM watchdog). Please update the board to use
> +CONFIG_WDT before the v2019.10 release. Failure to
> +update by the deadline may result in board removal.
> +See doc/develop/driver-model/migration.rst for more info.
> +====================================================
> +This board does not use CONFIG_DM_ETH (Driver Model
> +for Ethernet drivers). Please update the board to use
> +CONFIG_DM_ETH before the v2020.07 release. Failure to
> +This board does not use CONFIG_DM_I2C (Driver Model
> +for I2C drivers). Please update the board to use
> +CONFIG_DM_I2C before the v2022.04 release. Failure to
> +This board does not use CONFIG_DM_SERIAL (Driver Model
> +for Serial drivers). Please update the board to use
> +CONFIG_DM_SERIAL before the v2023.04 release. Failure to
> +powerpc-linux-ld.bfd: drivers/mtd/nand/raw/fsl_elbc_nand.o: in function
> `fsl_elbc_chip_init':
> +drivers/mtd/nand/raw/fsl_elbc_nand.c:749: undefined reference to
> `ofnode_read_string'

Uff... I see that other nand code guards ofnode_read_string() calls via
#if CONFIG_IS_ENABLED(OF_CONTROL). And seems that same preprocessor
guard is needed also here in fsl driver.

I will send v2 patch with this guard.

> +make[1]: *** [Makefile:1813: u-boot] Error 1
> +make: *** [Makefile:177: sub-make] Error 2
> 
> Build fail.
> 
> Regards,
> Peng.
> 
> > ---
> >   drivers/mtd/nand/raw/fsl_elbc_nand.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/mtd/nand/raw/fsl_elbc_nand.c b/drivers/mtd/nand/raw/fsl_elbc_nand.c
> > index b0e3eb607ed4..8e14739b3ee9 100644
> > --- a/drivers/mtd/nand/raw/fsl_elbc_nand.c
> > +++ b/drivers/mtd/nand/raw/fsl_elbc_nand.c
> > @@ -745,7 +745,8 @@ static int fsl_elbc_chip_init(int devnum, u8 *addr, struct udevice *dev)
> >   		return ret;
> >   	/* If nand_scan_ident() has not selected ecc.mode, do it now */
> > -	if (nand->ecc.mode == NAND_ECC_NONE) {
> > +	if (nand->ecc.mode == 0 &&
> > +	    !ofnode_read_string(nand->flash_node, "nand-ecc-mode")) {
> >   		/* If CS Base Register selects full hardware ECC then use it */
> >   		if ((br & BR_DECC) == BR_DECC_CHK_GEN) {
> >   			nand->ecc.mode = NAND_ECC_HW;
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] mtd: rawnand: fsl_elbc: Fix detection when nand_scan_ident() has not selected ecc.mode
  2022-06-20 11:02   ` Pali Rohár
@ 2022-06-20 11:07     ` Pali Rohár
  0 siblings, 0 replies; 4+ messages in thread
From: Pali Rohár @ 2022-06-20 11:07 UTC (permalink / raw)
  To: Peng Fan (OSS); +Cc: Priyanka Jain, Wolfgang Denk, Sinan Akman, u-boot

ecc.mode is set to 0 (aliased to NAND_ECC_NONE) either when function
nand_scan_ident() has not selected ecc.mode or when it selected it to none
ecc mode.

Distinguish between these two states by checking of node property
"nand-ecc-mode" which function nand_scan_ident() uses for filling ecc.mode.

This change fixes usage of none ecc mode if it is specified in DTS file.

Fixes: c9ea9019c5aa ("mtd: rawnand: fsl_elbc: Use ECC configuration from device tree")
Signed-off-by: Pali Rohár <pali@kernel.org>

---
Changes in v2:
* Add guard for ofnode_read_string()
---
 drivers/mtd/nand/raw/fsl_elbc_nand.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/fsl_elbc_nand.c b/drivers/mtd/nand/raw/fsl_elbc_nand.c
index e734139b5ea5..5d50302eefbe 100644
--- a/drivers/mtd/nand/raw/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/raw/fsl_elbc_nand.c
@@ -744,7 +744,11 @@ static int fsl_elbc_chip_init(int devnum, u8 *addr, ofnode flash_node)
 		return ret;
 
 	/* If nand_scan_ident() has not selected ecc.mode, do it now */
-	if (nand->ecc.mode == NAND_ECC_NONE) {
+	if (nand->ecc.mode == 0
+#if CONFIG_IS_ENABLED(OF_CONTROL)
+	    && !ofnode_read_string(nand->flash_node, "nand-ecc-mode")
+#endif
+	   ) {
 		/* If CS Base Register selects full hardware ECC then use it */
 		if ((br & BR_DECC) == BR_DECC_CHK_GEN) {
 			nand->ecc.mode = NAND_ECC_HW;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-20 11:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11 18:24 [PATCH] mtd: rawnand: fsl_elbc: Fix detection when nand_scan_ident() has not selected ecc.mode Pali Rohár
2022-06-20  7:08 ` Peng Fan (OSS)
2022-06-20 11:02   ` Pali Rohár
2022-06-20 11:07     ` [PATCH v2] " Pali Rohár

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.