mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ladislav Michl <ladis@linux-mips.org>
To: barebox@lists.infradead.org
Subject: [PATCH 06/16] mtd: atmel_nand: Add per board ECC setup
Date: Sun, 28 Oct 2018 22:23:22 +0100	[thread overview]
Message-ID: <20181028212322.GG14788@lenoch> (raw)
In-Reply-To: <20181028211947.GA14788@lenoch>

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 arch/arm/mach-at91/include/mach/board.h | 2 ++
 drivers/mtd/nand/atmel_nand.c           | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index 5d76e00ae..b7adb173a 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -64,6 +64,8 @@ struct atmel_nand_data {
 	u8		cle;		/* address line number connected to CLE */
 	u8		bus_width_16;	/* buswidth is 16 bit */
 	u8		ecc_mode;	/* NAND_ECC_* */
+	u8		ecc_strength;	/* number of bits to correct per ECC step */
+	u8		ecc_size_shift;	/* data bytes covered by a single ECC step.*/
 	u8		on_flash_bbt;	/* Use flash based bbt */
 	u8		has_pmecc;	/* Use PMECC */
 	u8		bus_on_d0;
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 797cdc2ba..50c541122 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -1298,6 +1298,7 @@ static int atmel_hw_nand_init_params(struct device_d *dev,
 	nand_chip->ecc.hwctl = atmel_nand_hwctl;
 	nand_chip->ecc.read_page = atmel_nand_read_page;
 	nand_chip->ecc.bytes = 4;
+	nand_chip->ecc.strength = 1;
 
 	return 0;
 }
@@ -1388,6 +1389,8 @@ static int __init atmel_nand_probe(struct device_d *dev)
 	}
 
 	nand_chip->ecc.mode = pdata->ecc_mode;
+	nand_chip->ecc.strength = pdata->ecc_strength ? : 1;
+	nand_chip->ecc.size = 1 << pdata->ecc_size_shift ? : 512;
 
 	if (IS_ENABLED(CONFIG_NAND_ECC_HW) &&
 	    pdata->ecc_mode == NAND_ECC_HW) {
-- 
2.19.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2018-10-28 21:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-28 21:19 [PATCH 00/16] NAND update (1st step) Ladislav Michl
2018-10-28 21:21 ` [PATCH 01/16] mtd: nand: refactor chip->block_markbad interface Ladislav Michl
2018-10-28 21:21 ` [PATCH 02/16] mtd: nand: remove multiplied-by-2 block logic Ladislav Michl
2018-10-28 21:22 ` [PATCH 03/16] mtd: nand: hide in-memory BBT implementation details Ladislav Michl
2018-10-29 10:07   ` Ladislav Michl
2018-10-29 11:43     ` Ladislav Michl
2018-10-30  9:07       ` Sascha Hauer
2018-10-28 21:22 ` [PATCH 04/16] mtd: nand: remove NAND_BBT_SCANEMPTY Ladislav Michl
2018-10-28 21:22 ` [PATCH 05/16] mtd: nand: Request strength instead of bytes for soft BCH Ladislav Michl
2018-10-28 21:23 ` Ladislav Michl [this message]
2018-10-28 21:23 ` [PATCH 07/16] mtd: nand: simplify nand_bch_init() usage Ladislav Michl
2018-10-28 21:24 ` [PATCH 08/16] mtd: nand_bbt: kill NAND_BBT_SCANALLPAGES Ladislav Michl
2018-10-28 21:24 ` [PATCH 09/16] mtd: nand_bbt: handle error case for nand_create_badblock_pattern() Ladislav Michl
2018-10-28 21:25 ` [PATCH 10/16] mtd: nand_bbt: make nand_scan_bbt() static Ladislav Michl
2018-10-28 21:25 ` [PATCH 11/16] mtd: nand_bbt: unify/fix error handling in nand_scan_bbt() Ladislav Michl
2018-10-28 21:25 ` [PATCH 12/16] mtd: nand_bbt: Move BBT block selection logic out of write_bbt() Ladislav Michl
2018-10-28 21:26 ` [PATCH 13/16] mtd: nand_bbt: scan for next free bbt block if writing bbt fails Ladislav Michl
2018-10-28 21:26 ` [PATCH 14/16] mtd: nand: Kill the chip->scan_bbt() hook Ladislav Michl
2019-01-21  8:32   ` Sascha Hauer
2018-10-28 21:27 ` [PATCH 15/16] mtd: nand: Kill cellinfo Ladislav Michl
2018-10-28 21:27 ` [PATCH 16/16] mtd: nand: detect OOB size for Toshiba 24nm raw SLC Ladislav Michl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181028212322.GG14788@lenoch \
    --to=ladis@linux-mips.org \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox