Message ID | 20240119053332.3145351-1-venkatesh.abbarapu@amd.com |
---|---|
State | Superseded |
Delegated to: | Dario Binacchi |
Headers | show |
Series | [v2] mtd: nand: arasan: Print warning for unsupported ecc modes | expand |
On 1/19/24 06:33, 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. > --- > drivers/mtd/nand/raw/arasan_nfc.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/mtd/nand/raw/arasan_nfc.c b/drivers/mtd/nand/raw/arasan_nfc.c > index 14766401bf..8e5eef0881 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,10 @@ 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); > + Better to simply not continue if sw ecc is asked. DT can be for Linux itself and U-Boot shouldn't really break data inside it. Printing information about it is IMHO good approach. Pretty much SW ECC is not available - skip driver probe or something like that is nice way how to describe it. Thanks, Michal
diff --git a/drivers/mtd/nand/raw/arasan_nfc.c b/drivers/mtd/nand/raw/arasan_nfc.c index 14766401bf..8e5eef0881 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,10 @@ 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); + nand_chip->ecc.mode = NAND_ECC_HW; nand_chip->ecc.hwctl = NULL; nand_chip->ecc.read_page = arasan_nand_read_page_hwecc;