diff options
author | Pekon Gupta <pekon@ti.com> | 2013-10-24 08:50:18 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2013-11-07 02:33:07 -0500 |
commit | c66d039197e42af8867e5d0d9b904daf0fb9e6bc (patch) | |
tree | 4c9cc9f008e73b0653f0835f7c3f45ad1d9afb98 | |
parent | ac65caf514ec3e55e8d3d510ee37f80dd97418fe (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>
-rw-r--r-- | Documentation/devicetree/bindings/mtd/gpmc-nand.txt | 8 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-flash.c | 2 | ||||
-rw-r--r-- | drivers/mtd/nand/omap2.c | 9 | ||||
-rw-r--r-- | include/linux/platform_data/mtd-nand-omap2.h | 7 |
4 files changed, 9 insertions, 17 deletions
diff --git a/Documentation/devicetree/bindings/mtd/gpmc-nand.txt b/Documentation/devicetree/bindings/mtd/gpmc-nand.txt index bfe07e152738..5e1f31b5ff70 100644 --- a/Documentation/devicetree/bindings/mtd/gpmc-nand.txt +++ b/Documentation/devicetree/bindings/mtd/gpmc-nand.txt | |||
@@ -22,10 +22,10 @@ Optional properties: | |||
22 | width of 8 is assumed. | 22 | width of 8 is assumed. |
23 | 23 | ||
24 | - ti,nand-ecc-opt: A string setting the ECC layout to use. One of: | 24 | - ti,nand-ecc-opt: A string setting the ECC layout to use. One of: |
25 | 25 | "sw" <deprecated> use "ham1" instead | |
26 | "sw" Software method (default) | 26 | "hw" <deprecated> use "ham1" instead |
27 | "hw" Hardware method | 27 | "hw-romcode" <deprecated> use "ham1" instead |
28 | "hw-romcode" gpmc hamming mode method & romcode layout | 28 | "ham1" 1-bit Hamming ecc code |
29 | "bch4" 4-bit BCH ecc code | 29 | "bch4" 4-bit BCH ecc code |
30 | "bch8" 8-bit BCH ecc code | 30 | "bch8" 8-bit BCH ecc code |
31 | 31 | ||
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c index fc20a61f6b2a..ac82512b9c8c 100644 --- a/arch/arm/mach-omap2/board-flash.c +++ b/arch/arm/mach-omap2/board-flash.c | |||
@@ -142,7 +142,7 @@ __init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs, | |||
142 | board_nand_data.nr_parts = nr_parts; | 142 | board_nand_data.nr_parts = nr_parts; |
143 | board_nand_data.devsize = nand_type; | 143 | board_nand_data.devsize = nand_type; |
144 | 144 | ||
145 | board_nand_data.ecc_opt = OMAP_ECC_HAMMING_CODE_DEFAULT; | 145 | board_nand_data.ecc_opt = OMAP_ECC_BCH8_CODE_HW; |
146 | gpmc_nand_init(&board_nand_data, gpmc_t); | 146 | gpmc_nand_init(&board_nand_data, gpmc_t); |
147 | } | 147 | } |
148 | #endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ | 148 | #endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ |
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 | ||
diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h index e4128f1510bf..4da5bfa2147f 100644 --- a/include/linux/platform_data/mtd-nand-omap2.h +++ b/include/linux/platform_data/mtd-nand-omap2.h | |||
@@ -23,13 +23,8 @@ enum nand_io { | |||
23 | }; | 23 | }; |
24 | 24 | ||
25 | enum omap_ecc { | 25 | enum omap_ecc { |
26 | /* 1-bit ecc: stored at end of spare area */ | ||
27 | OMAP_ECC_HAMMING_CODE_DEFAULT = 0, /* Default, s/w method */ | ||
28 | OMAP_ECC_HAMMING_CODE_HW, /* gpmc to detect the error */ | ||
29 | /* 1-bit ecc: stored at beginning of spare area as romcode */ | ||
30 | OMAP_ECC_HAMMING_CODE_HW_ROMCODE, /* gpmc method & romcode layout */ | ||
31 | /* 1-bit ECC calculation by GPMC, Error detection by Software */ | 26 | /* 1-bit ECC calculation by GPMC, Error detection by Software */ |
32 | OMAP_ECC_HAM1_CODE_HW, | 27 | OMAP_ECC_HAM1_CODE_HW = 0, |
33 | /* 4-bit ECC calculation by GPMC, Error detection by Software */ | 28 | /* 4-bit ECC calculation by GPMC, Error detection by Software */ |
34 | OMAP_ECC_BCH4_CODE_HW_DETECTION_SW, | 29 | OMAP_ECC_BCH4_CODE_HW_DETECTION_SW, |
35 | /* 4-bit ECC calculation by GPMC, Error detection by ELM */ | 30 | /* 4-bit ECC calculation by GPMC, Error detection by ELM */ |