[PATCH] mtd: rawnand: omap_gpmc: fix BCH8 HW based correction

Leto, Enrico enrico.leto at siemens.com
Wed Nov 15 11:36:57 CET 2023


Patch is working by me.

> -----Original Message-----
> From: Heiko Schocher <hs at denx.de>
> Sent: Wednesday, November 15, 2023 6:41 AM
> To: U-Boot Mailing List <u-boot at lists.denx.de>; Leto, Enrico (SI BP R&D ZG FW
> CCP) <enrico.leto at siemens.com>
> Cc: Schocher, Heiko (EXT) (DENX Software Engineering GmbH) <hs at denx.de>;
> Dario Binacchi <dario.binacchi at amarulasolutions.com>; Michael Trimarchi
> <michael at amarulasolutions.com>
> Subject: [PATCH] mtd: rawnand: omap_gpmc: fix BCH8 HW based correction
>
> commit 04fcd2587321 ("mtd: rawnand: omap_gpmc: Fix BCH6/16 HW based
> correction")
>
> broke AM335x based boards booting from NAND with ECC BCH8 code.
>
> Use omap_enable_hwecc() instead of omap_enable_hwecc_bch() in SPL
> restores correct SPL nand_read_page functionality.
>
> Tested on draco thuban board.
>
> Signed-off-by: Heiko Schocher <hs at denx.de>
>
> ---
> fix NAND boot for BCH8 based TI AM335x boards
>
> Fix is based on series from Enrico:
>
> https://lists.d/
> enx.de%2Fpipermail%2Fu-boot%2F2023-
> November%2F536793.html&data=05%7C01%7Cenrico.leto%40siemens.com
> %7Cbd939f15167c49cc97b708dbe59d6e9e%7C38ae3bcd95794fd4addab4
> 2e1495d55a%7C1%7C0%7C638356236545245361%7CUnknown%7CTWFp
> bGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXV
> CI6Mn0%3D%7C3000%7C%7C%7C&sdata=IUqjryYUtp%2Fdm9GgCALPTl8f%
> 2BlcrO0ErXjkvoDwz7v4%3D&reserved=0
>
> and fixes NAND boot for the draco thuban board. But this patch apply also
> without the patches from above patchseries, see azure build:
>
> https://dev.a/
> zure.com%2Fhs0298%2Fhs%2F_build%2Fresults%3FbuildId%3D111%26vie
> w%3Dresults&data=05%7C01%7Cenrico.leto%40siemens.com%7Cbd939f15
> 167c49cc97b708dbe59d6e9e%7C38ae3bcd95794fd4addab42e1495d55a%
> 7C1%7C0%7C638356236545245361%7CUnknown%7CTWFpbGZsb3d8eyJ
> WIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D
> %7C3000%7C%7C%7C&sdata=S2itRHsR49lD9TlBexYw9J5waXiuFcS%2BhUp
> %2B7Yi60MA%3D&reserved=0
>
> which is clean.
>
> Above commit seems to change only U-Boot code and did not adapt
> am335x_spl_bch.c, which breaks nand_read_page in SPL code for AM335x
> based boards. So use in SPL "old" hw setup and reading page from NAND in
> SPL works again.
>
>
>  drivers/mtd/nand/raw/omap_gpmc.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/mtd/nand/raw/omap_gpmc.c
> b/drivers/mtd/nand/raw/omap_gpmc.c
> index 1a5ed0de31..c9b66dadbd 100644
> --- a/drivers/mtd/nand/raw/omap_gpmc.c
> +++ b/drivers/mtd/nand/raw/omap_gpmc.c
> @@ -983,7 +983,11 @@ static int omap_select_ecc_scheme(struct
> nand_chip *nand,
>               nand->ecc.strength      = 8;
>               nand->ecc.size          = SECTOR_BYTES;
>               nand->ecc.bytes         = 14;
> +#if defined(CONFIG_SPL_BUILD)
> +             nand->ecc.hwctl         = omap_enable_hwecc;
> +#else
>               nand->ecc.hwctl         = omap_enable_hwecc_bch;
> +#endif
>               nand->ecc.correct       = omap_correct_data_bch;
>               nand->ecc.calculate     = omap_calculate_ecc_bch;
>               nand->ecc.read_page     = omap_read_page_bch;
> --
> 2.37.3



More information about the U-Boot mailing list