aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorPekon Gupta <pekon@ti.com>2013-10-24 08:50:18 -0400
committerBrian Norris <computersforpeace@gmail.com>2013-11-07 02:33:07 -0500
commitc66d039197e42af8867e5d0d9b904daf0fb9e6bc (patch)
tree4c9cc9f008e73b0653f0835f7c3f45ad1d9afb98 /drivers/mtd
parentac65caf514ec3e55e8d3d510ee37f80dd97418fe (diff)
mtd: nand: omap: combine different flavours of 1-bit hamming ecc schemes
OMAP NAND driver currently supports multiple flavours of 1-bit Hamming ecc-scheme, like: - OMAP_ECC_HAMMING_CODE_DEFAULT 1-bit hamming ecc code using software library - OMAP_ECC_HAMMING_CODE_HW 1-bit hamming ecc-code using GPMC h/w engine - OMAP_ECC_HAMMING_CODE_HW_ROMCODE 1-bit hamming ecc-code using GPMC h/w engin with ecc-layout compatible to ROM code. This patch combines above multiple ecc-schemes into single implementation: - OMAP_ECC_HAM1_CODE_HW 1-bit hamming ecc-code using GPMC h/w engine with ROM-code compatible ecc-layout. Signed-off-by: Pekon Gupta <pekon@ti.com> Reviewed-by: Felipe Balbi <balbi@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/omap2.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 4ecf0e5fd484..8d521aa001c8 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -1993,10 +1993,7 @@ static int omap_nand_probe(struct platform_device *pdev)
1993 } 1993 }
1994 1994
1995 /* select the ecc type */ 1995 /* select the ecc type */
1996 if (pdata->ecc_opt == OMAP_ECC_HAMMING_CODE_DEFAULT) 1996 if (pdata->ecc_opt == OMAP_ECC_HAM1_CODE_HW) {
1997 info->nand.ecc.mode = NAND_ECC_SOFT;
1998 else if ((pdata->ecc_opt == OMAP_ECC_HAMMING_CODE_HW) ||
1999 (pdata->ecc_opt == OMAP_ECC_HAMMING_CODE_HW_ROMCODE)) {
2000 info->nand.ecc.bytes = 3; 1997 info->nand.ecc.bytes = 3;
2001 info->nand.ecc.size = 512; 1998 info->nand.ecc.size = 512;
2002 info->nand.ecc.strength = 1; 1999 info->nand.ecc.strength = 1;
@@ -2025,7 +2022,7 @@ static int omap_nand_probe(struct platform_device *pdev)
2025 } 2022 }
2026 2023
2027 /* rom code layout */ 2024 /* rom code layout */
2028 if (pdata->ecc_opt == OMAP_ECC_HAMMING_CODE_HW_ROMCODE) { 2025 if (pdata->ecc_opt == OMAP_ECC_HAM1_CODE_HW) {
2029 2026
2030 if (info->nand.options & NAND_BUSWIDTH_16) 2027 if (info->nand.options & NAND_BUSWIDTH_16)
2031 offset = 2; 2028 offset = 2;
@@ -2033,7 +2030,7 @@ static int omap_nand_probe(struct platform_device *pdev)
2033 offset = 1; 2030 offset = 1;
2034 info->nand.badblock_pattern = &bb_descrip_flashbased; 2031 info->nand.badblock_pattern = &bb_descrip_flashbased;
2035 } 2032 }
2036 omap_oobinfo.eccbytes = 3 * (info->mtd.oobsize/16); 2033 omap_oobinfo.eccbytes = 3 * (info->mtd.writesize / 512);
2037 for (i = 0; i < omap_oobinfo.eccbytes; i++) 2034 for (i = 0; i < omap_oobinfo.eccbytes; i++)
2038 omap_oobinfo.eccpos[i] = i+offset; 2035 omap_oobinfo.eccpos[i] = i+offset;
2039 2036