[PATCH 4/7] mtd: rawnand: micron: allow forced on-die ECC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 18 Jul 2018 10:42:18 +0200
Boris Brezillon <boris.brezillon at bootlin.com> wrote:

> From: Chris Packham <chris.packham at alliedtelesis.co.nz>
> 
> Some Micron NAND chips have on-die ECC forceably enabled. Allow such
> chips to be used as long as the controller has set chip->ecc.mode to
> NAND_ECC_ON_DIE.
> 
> Signed-off-by: Chris Packham <chris.packham at alliedtelesis.co.nz>
> Reviewed-by: Boris Brezillon <boris.brezillon at bootlin.com>
> Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>

Missing

Signed-off-by: Boris Brezillon <boris.brezillon at bootlin.com>

> ---
>  drivers/mtd/nand/raw/nand_micron.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/nand_micron.c b/drivers/mtd/nand/raw/nand_micron.c
> index f8839c7f7464..fd3f68e0909f 100644
> --- a/drivers/mtd/nand/raw/nand_micron.c
> +++ b/drivers/mtd/nand/raw/nand_micron.c
> @@ -374,7 +374,8 @@ static int micron_nand_init(struct nand_chip *chip)
>  
>  	ondie = micron_supports_on_die_ecc(chip);
>  
> -	if (ondie == MICRON_ON_DIE_MANDATORY) {
> +	if (ondie == MICRON_ON_DIE_MANDATORY &&
> +	    chip->ecc.mode != NAND_ECC_ON_DIE) {
>  		pr_err("On-die ECC forcefully enabled, not supported\n");
>  		return -EINVAL;
>  	}
> @@ -398,8 +399,14 @@ static int micron_nand_init(struct nand_chip *chip)
>  		chip->ecc.algo = NAND_ECC_BCH;
>  		chip->ecc.read_page = micron_nand_read_page_on_die_ecc;
>  		chip->ecc.write_page = micron_nand_write_page_on_die_ecc;
> -		chip->ecc.read_page_raw = nand_read_page_raw;
> -		chip->ecc.write_page_raw = nand_write_page_raw;
> +
> +		if (ondie == MICRON_ON_DIE_MANDATORY) {
> +			chip->ecc.read_page_raw = nand_read_page_raw_notsupp;
> +			chip->ecc.write_page_raw = nand_write_page_raw_notsupp;
> +		} else {
> +			chip->ecc.read_page_raw = nand_read_page_raw;
> +			chip->ecc.write_page_raw = nand_write_page_raw;
> +		}
>  	}
>  
>  	return 0;




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux