diff mbox

[1/4] MTD: add ecc_strength fields to mtd structs

Message ID 1331500873-9792-2-git-send-email-mikedunn@newsguy.com
State Accepted
Commit 1d0b95b0834087ba3653f69c24483d63a26d51a7
Headers show

Commit Message

Mike Dunn March 11, 2012, 9:21 p.m. UTC
This adds 'ecc_strength' to struct mtd_info.  This stores the maximum number of
bit errors that can be corrected in one writesize region.

For consistency with the nand code, 'strength' is similiarly added to struct
nand_ecc_ctrl.  This stores the maximum number of bit errors that can be
corrected in one ecc step.

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
---
 include/linux/mtd/mtd.h  |    3 +++
 include/linux/mtd/nand.h |    2 ++
 2 files changed, 5 insertions(+), 0 deletions(-)

Comments

Artem Bityutskiy March 13, 2012, 12:25 p.m. UTC | #1
On Sun, 2012-03-11 at 14:21 -0700, Mike Dunn wrote:
> This adds 'ecc_strength' to struct mtd_info.  This stores the maximum number of
> bit errors that can be corrected in one writesize region.
> 
> For consistency with the nand code, 'strength' is similiarly added to struct
> nand_ecc_ctrl.  This stores the maximum number of bit errors that can be
> corrected in one ecc step.
> 
> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>

If you expose 'bitflips_threshold' to user-space, I think you also
should expose the strength - otherwise how would users select the
correct value in a general manner? Would you please expose it in a
separate patch?

Pushed this one to l2-mtd.git, thanks!
diff mbox

Patch

diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 726c2d1..cf5ea8c 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -164,6 +164,9 @@  struct mtd_info {
 	/* ECC layout structure pointer - read only! */
 	struct nand_ecclayout *ecclayout;
 
+	/* max number of correctible bit errors per writesize */
+	unsigned int ecc_strength;
+
 	/* Data for variable erase regions. If numeraseregions is zero,
 	 * it means that the whole device has erasesize as given above.
 	 */
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 609868f..1482340 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -324,6 +324,7 @@  struct nand_hw_control {
  * @steps:	number of ECC steps per page
  * @size:	data bytes per ECC step
  * @bytes:	ECC bytes per step
+ * @strength:	max number of correctible bits per ECC step
  * @total:	total number of ECC bytes per page
  * @prepad:	padding information for syndrome based ECC generators
  * @postpad:	padding information for syndrome based ECC generators
@@ -351,6 +352,7 @@  struct nand_ecc_ctrl {
 	int size;
 	int bytes;
 	int total;
+	int strength;
 	int prepad;
 	int postpad;
 	struct nand_ecclayout	*layout;