Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1380208 > unrolled thread

[PATCH 04/12] mtd: nand: atmel: set ECC algorithm explicitly

Started byRafał Miłecki <zajec5@gmail.com>
First post2016-04-15 22:00 +0200
Last post2016-04-16 09:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 04/12] mtd: nand: atmel: set ECC algorithm explicitly Rafał Miłecki <zajec5@gmail.com> - 2016-04-15 22:00 +0200
    Re: [PATCH 04/12] mtd: nand: atmel: set ECC algorithm explicitly Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-04-16 09:50 +0200

#1380208 — [PATCH 04/12] mtd: nand: atmel: set ECC algorithm explicitly

FromRafał Miłecki <zajec5@gmail.com>
Date2016-04-15 22:00 +0200
Subject[PATCH 04/12] mtd: nand: atmel: set ECC algorithm explicitly
Message-ID<roi4i-8kL-17@gated-at.bofh.it>
Set it to value obtained from platform data with fallback to Hamming.
This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
enum nand_ecc_algo).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 drivers/mtd/nand/atmel_nand.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index eec8ca7..6aa82e4 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -1212,6 +1212,7 @@ static int atmel_pmecc_nand_init_params(struct platform_device *pdev,
 		dev_warn(host->dev,
 			"Can't get I/O resource regs for PMECC controller, rolling back on software ECC\n");
 		nand_chip->ecc.mode = NAND_ECC_SOFT;
+		nand_chip->ecc.algo = NAND_ECC_HAMMING;
 		return 0;
 	}
 
@@ -1295,6 +1296,7 @@ static int atmel_pmecc_nand_init_params(struct platform_device *pdev,
 		/* page size not handled by HW ECC */
 		/* switching back to soft ECC */
 		nand_chip->ecc.mode = NAND_ECC_SOFT;
+		nand_chip->ecc.algo = NAND_ECC_HAMMING;
 		return 0;
 	}
 
@@ -1613,6 +1615,7 @@ static int atmel_of_init_port(struct atmel_nand_host *host,
 	 * even if the nand-ecc-mode property is not defined.
 	 */
 	host->nand_chip.ecc.mode = NAND_ECC_SOFT;
+	host->nand_chip.ecc.algo = NAND_ECC_HAMMING;
 
 	return 0;
 }
@@ -1629,6 +1632,7 @@ static int atmel_hw_nand_init_params(struct platform_device *pdev,
 		dev_err(host->dev,
 			"Can't get I/O resource regs, use software ECC\n");
 		nand_chip->ecc.mode = NAND_ECC_SOFT;
+		nand_chip->ecc.algo = NAND_ECC_HAMMING;
 		return 0;
 	}
 
@@ -1661,6 +1665,7 @@ static int atmel_hw_nand_init_params(struct platform_device *pdev,
 		/* page size not handled by HW ECC */
 		/* switching back to soft ECC */
 		nand_chip->ecc.mode = NAND_ECC_SOFT;
+		nand_chip->ecc.algo = NAND_ECC_HAMMING;
 		return 0;
 	}
 
@@ -2159,6 +2164,7 @@ static int atmel_nand_probe(struct platform_device *pdev)
 		memcpy(&host->board, dev_get_platdata(&pdev->dev),
 		       sizeof(struct atmel_nand_data));
 		nand_chip->ecc.mode = host->board.ecc_mode;
+		nand_chip->ecc.algo = host->board.ecc_algo;
 
 		/* 16-bit bus width */
 		if (host->board.bus_width_16)
-- 
1.8.4.5

[toc] | [next] | [standalone]


#1380500

FromBoris Brezillon <boris.brezillon@free-electrons.com>
Date2016-04-16 09:50 +0200
Message-ID<rot9o-8pE-5@gated-at.bofh.it>
In reply to#1380208
On Fri, 15 Apr 2016 21:54:04 +0200
Rafał Miłecki <zajec5@gmail.com> wrote:

> Set it to value obtained from platform data with fallback to Hamming.
> This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
> enum nand_ecc_algo).
> 
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
>  drivers/mtd/nand/atmel_nand.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
> index eec8ca7..6aa82e4 100644
> --- a/drivers/mtd/nand/atmel_nand.c
> +++ b/drivers/mtd/nand/atmel_nand.c
> @@ -1212,6 +1212,7 @@ static int atmel_pmecc_nand_init_params(struct platform_device *pdev,
>  		dev_warn(host->dev,
>  			"Can't get I/O resource regs for PMECC controller, rolling back on software ECC\n");
>  		nand_chip->ecc.mode = NAND_ECC_SOFT;
> +		nand_chip->ecc.algo = NAND_ECC_HAMMING;
>  		return 0;
>  	}
>  
> @@ -1295,6 +1296,7 @@ static int atmel_pmecc_nand_init_params(struct platform_device *pdev,
>  		/* page size not handled by HW ECC */
>  		/* switching back to soft ECC */
>  		nand_chip->ecc.mode = NAND_ECC_SOFT;
> +		nand_chip->ecc.algo = NAND_ECC_HAMMING;
>  		return 0;
>  	}
>  
> @@ -1613,6 +1615,7 @@ static int atmel_of_init_port(struct atmel_nand_host *host,
>  	 * even if the nand-ecc-mode property is not defined.
>  	 */
>  	host->nand_chip.ecc.mode = NAND_ECC_SOFT;
> +	host->nand_chip.ecc.algo = NAND_ECC_HAMMING;
>  
>  	return 0;
>  }
> @@ -1629,6 +1632,7 @@ static int atmel_hw_nand_init_params(struct platform_device *pdev,
>  		dev_err(host->dev,
>  			"Can't get I/O resource regs, use software ECC\n");
>  		nand_chip->ecc.mode = NAND_ECC_SOFT;
> +		nand_chip->ecc.algo = NAND_ECC_HAMMING;
>  		return 0;
>  	}
>  
> @@ -1661,6 +1665,7 @@ static int atmel_hw_nand_init_params(struct platform_device *pdev,
>  		/* page size not handled by HW ECC */
>  		/* switching back to soft ECC */
>  		nand_chip->ecc.mode = NAND_ECC_SOFT;
> +		nand_chip->ecc.algo = NAND_ECC_HAMMING;
>  		return 0;
>  	}
>  
> @@ -2159,6 +2164,7 @@ static int atmel_nand_probe(struct platform_device *pdev)
>  		memcpy(&host->board, dev_get_platdata(&pdev->dev),
>  		       sizeof(struct atmel_nand_data));
>  		nand_chip->ecc.mode = host->board.ecc_mode;
> +		nand_chip->ecc.algo = host->board.ecc_algo;

If you follow my suggestion on patch 3, it should be:

		if (host->board.ecc_mode == NAND_ECC_SOFT)
			nand_chip->ecc.algo = NAND_ECC_HAMMING;

This way we avoid any dependency between the avr32 and nand tree.

>  
>  		/* 16-bit bus width */
>  		if (host->board.bus_width_16)



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web