[U-Boot] [PATCH 13/19] mtd: nand: pxa3xx: Fix READOOB implementation

Stefan Roese sr at denx.de
Wed Sep 19 12:35:26 UTC 2018


On 29.08.2018 10:56, kostap at marvell.com wrote:
> From: Boris Brezillon <boris.brezillon at free-electrons.com>
> 
> In the current driver, OOB bytes are accessed in raw mode, and when a
> page access is done with NDCR_SPARE_EN set and NDCR_ECC_EN cleared, the
> driver must read the whole spare area (64 bytes in case of a 2k page,
> 16 bytes for a 512 page). The driver was only reading the free OOB
> bytes, which was leaving some unread data in the FIFO and was somehow
> leading to a timeout.
> 
> We could patch the driver to read ->spare_size + ->ecc_size instead of
> just ->spare_size when READOOB is requested, but we'd better make
> in-band and OOB accesses consistent.
> Since the driver is always accessing in-band data in non-raw mode (with
> the ECC engine enabled), we should also access OOB data in this mode.
> That's particularly useful when using the BCH engine because in this
> mode the free OOB bytes are also ECC protected.
> 
> Fixes: 43bcfd2bb24a ("mtd: nand: pxa3xx: Add driver-specific ECC BCH support")
> Cc: stable at vger.kernel.org
> Reported-by: Sean Nyekjær <sean.nyekjaer at prevas.dk>
> Tested-by: Willy Tarreau <w at 1wt.eu>
> Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
> Acked-by: Ezequiel Garcia <ezequiel at vanguardiasur.com.ar>
> Tested-by: Sean Nyekjaer <sean.nyekjaer at prevas.dk>
> Acked-by: Robert Jarzmik <robert.jarzmik at free.fr>
> Signed-off-by: Richard Weinberger <richard at nod.at>
> Signed-off-by: Ofer Heifetz <oferh at marvell.com>
> Reviewed-by: Igal Liberman <igall at marvell.com>
> Cc: Stefan Roese <sr at denx.de>
> Cc: Simon Glass <sjg at chromium.org>
> ---
>   drivers/mtd/nand/pxa3xx_nand.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
> index b64dd0d..c1f7d61 100644
> --- a/drivers/mtd/nand/pxa3xx_nand.c
> +++ b/drivers/mtd/nand/pxa3xx_nand.c
> @@ -750,6 +750,7 @@ static void prepare_start_command(struct pxa3xx_nand_info *info, int command)
>   
>   	switch (command) {
>   	case NAND_CMD_READ0:
> +	case NAND_CMD_READOOB:
>   	case NAND_CMD_PAGEPROG:
>   		info->use_ecc = 1;
>   		break;
> 

Applied to u-boot-marvell/master

Thanks,
Stefan


More information about the U-Boot mailing list