All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v5 3/5] nand: lpc32xx: add ECC layout for small page NAND
@ 2015-08-05 18:31 slemieux.tyco at gmail.com
  0 siblings, 0 replies; only message in thread
From: slemieux.tyco at gmail.com @ 2015-08-05 18:31 UTC (permalink / raw)
  To: u-boot

From: Sylvain Lemieux <slemieux@tycoint.com>

Incorporate ECC layout for small page NAND from legacy
LPCLinux NXP BSP.
The code taken from the legacy patch is:
- lpc32xx SLC NAND driver (ECC layout for small page)

This layout is matching the lpc32xx NAND SLC Kernel driver:
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/mtd/nand/lpc32xx_slc.c?id=refs/tags/v4.1.3

Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
---
Changes from v4 to v5:
* No changes; patch context updated.

Changes from v3 to v4:
* No changes.

Changes from v2 to v3:
* No changes; patch context updated.

Changes from v1 to v2:
* Move ECC layout for small page NAND into a separate patch.

The legacy BSP patch (u-boot-2009.03_lpc32x0-v1.07.patch.tar.bz2)
was downloaded from the LPCLinux Web site.

 drivers/mtd/nand/lpc32xx_nand_slc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/mtd/nand/lpc32xx_nand_slc.c b/drivers/mtd/nand/lpc32xx_nand_slc.c
index 715152d..206c030 100644
--- a/drivers/mtd/nand/lpc32xx_nand_slc.c
+++ b/drivers/mtd/nand/lpc32xx_nand_slc.c
@@ -120,6 +120,19 @@ struct lpc32xx_nand_slc_regs {
 #define NAND_LARGE_BLOCK_PAGE_SIZE	2048
 #define NAND_SMALL_BLOCK_PAGE_SIZE	512
 
+/* NAND ECC Layout for small page NAND devices
+ * Note: For large page devices, the default layouts are used. */
+static struct nand_ecclayout lpc32xx_nand_oob_16 = {
+	.eccbytes = 6,
+	.eccpos = {10, 11, 12, 13, 14, 15},
+	.oobfree = {
+		{.offset = 0,
+		 . length = 4},
+		{.offset = 6,
+		 . length = 4}
+		}
+};
+
 #if defined(CONFIG_DMA_LPC32XX)
 /*
  * DMA Descriptors
@@ -542,6 +555,9 @@ int board_nand_init(struct nand_chip *lpc32xx_chip)
 	lpc32xx_chip->ecc.strength = 1;
 #endif
 
+	if (CONFIG_SYS_NAND_ECCSIZE != NAND_LARGE_BLOCK_PAGE_SIZE)
+		lpc32xx_chip->ecc.layout = &lpc32xx_nand_oob_16;
+
 #if defined(CONFIG_SYS_NAND_USE_FLASH_BBT)
 	lpc32xx_chip->bbt_options |= NAND_BBT_USE_FLASH;
 #endif
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-08-05 18:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-05 18:31 [U-Boot] [PATCH v5 3/5] nand: lpc32xx: add ECC layout for small page NAND slemieux.tyco at gmail.com

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.