diff options
author | Sylvain Lemieux <slemieux@tycoint.com> | 2015-08-13 19:40:21 (GMT) |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-08-18 17:45:56 (GMT) |
commit | 30cb3bf4a961dcd59a8f72f714e900cbfe7991dd (patch) | |
tree | 0de1658e4a71953298307a73e2ce049071f7ba15 /drivers/mtd/nand/lpc32xx_nand_slc.c | |
parent | 5f63bf3ec8ccbef09dfb9fc76063fc0ba20fa712 (diff) | |
download | u-boot-30cb3bf4a961dcd59a8f72f714e900cbfe7991dd.tar.xz |
nand: lpc32xx: add ECC layout for small page NAND
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.
Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
Diffstat (limited to 'drivers/mtd/nand/lpc32xx_nand_slc.c')
-rw-r--r-- | drivers/mtd/nand/lpc32xx_nand_slc.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/mtd/nand/lpc32xx_nand_slc.c b/drivers/mtd/nand/lpc32xx_nand_slc.c index dbb95d9..2e5f139 100644 --- a/drivers/mtd/nand/lpc32xx_nand_slc.c +++ b/drivers/mtd/nand/lpc32xx_nand_slc.c @@ -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 |