Skip to contentSkip to conversation

nand: lpc32xx: add ECC layout for small page NAND

PATCH New slemieux.tyco at gmail.com 2 participants 2 messages Aug 13, 2015 – Aug 18, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v7 3/5 nand: lpc32xx: add ECC layout for small page NAND

From: Sylvain Lemieux <[email protected]>

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 Linux Kernel driver.

---
Changes from v6 to v7:
* No changes; patch context updated.

Changes from v5 to v6:
* Updated comment regarding default OOB layout.

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 | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/mtd/nand/lpc32xx_nand_slc.c +17 -1
index dbb95d9..2e5f139 100644
@@ -75,6 +75,19 @@ struct lpc32xx_nand_slc_regs {
 #define TAC_R_HOLD(n)		(max_t(uint32_t, (n), 0xF) << 4)
 #define TAC_R_SETUP(n)		(max_t(uint32_t, (n), 0xF) << 0)
 
+/* 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)
 #define ECCSTEPS	(CONFIG_SYS_NAND_PAGE_SIZE / CONFIG_SYS_NAND_ECCSIZE)
 
@@ -563,13 +576,16 @@ int board_nand_init(struct nand_chip *lpc32xx_chip)
 #endif
 
 	/*
-	 * Use default ECC layout, but these values are predefined
+	 * These values are predefined
 	 * for both small and large page NAND flash devices.
 	 */
 	lpc32xx_chip->ecc.size     = CONFIG_SYS_NAND_ECCSIZE;
 	lpc32xx_chip->ecc.bytes    = CONFIG_SYS_NAND_ECCBYTES;
 	lpc32xx_chip->ecc.strength = 1;
 
+	if (CONFIG_SYS_NAND_PAGE_SIZE != 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
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v7 3/5 nand: lpc32xx: add ECC layout for small page NAND

Quoted 9 lines · slemieux.tyco at gmail.com

From: Sylvain Lemieux <[email protected]>

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 Linux Kernel driver.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150818/ce4f6d29/attachment.sig>