diff options
author | pekon gupta <pekon@ti.com> | 2014-05-19 03:54:40 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-05-20 20:52:14 -0400 |
commit | 2be589e4b28457f148640dc6addf6da24af64b7f (patch) | |
tree | 20a98917a2d4754f71ddce64387407701f5babf9 /drivers/mtd | |
parent | 27c9fd607587e6c3b517590df4cd35ac85f3d0bd (diff) |
mtd: nand: omap: add support for BCH16_ECC - ELM driver updates
ELM hardware engine is used to detect ECC errors for BCHx ecc-schemes
(like BCH4/BCH8/BCH16). This patch extends configuration of ELM registers
for adding support of BCH16_HW ecc-scheme.
Signed-off-by: Pekon Gupta <pekon@ti.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/devices/elm.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/mtd/devices/elm.c b/drivers/mtd/devices/elm.c index 0a037b15c11b..7df86948e6d4 100644 --- a/drivers/mtd/devices/elm.c +++ b/drivers/mtd/devices/elm.c | |||
@@ -213,6 +213,28 @@ static void elm_load_syndrome(struct elm_info *info, | |||
213 | val = cpu_to_be32(*(u32 *) &ecc[0]) >> 12; | 213 | val = cpu_to_be32(*(u32 *) &ecc[0]) >> 12; |
214 | elm_write_reg(info, offset, val); | 214 | elm_write_reg(info, offset, val); |
215 | break; | 215 | break; |
216 | case BCH16_ECC: | ||
217 | val = cpu_to_be32(*(u32 *) &ecc[22]); | ||
218 | elm_write_reg(info, offset, val); | ||
219 | offset += 4; | ||
220 | val = cpu_to_be32(*(u32 *) &ecc[18]); | ||
221 | elm_write_reg(info, offset, val); | ||
222 | offset += 4; | ||
223 | val = cpu_to_be32(*(u32 *) &ecc[14]); | ||
224 | elm_write_reg(info, offset, val); | ||
225 | offset += 4; | ||
226 | val = cpu_to_be32(*(u32 *) &ecc[10]); | ||
227 | elm_write_reg(info, offset, val); | ||
228 | offset += 4; | ||
229 | val = cpu_to_be32(*(u32 *) &ecc[6]); | ||
230 | elm_write_reg(info, offset, val); | ||
231 | offset += 4; | ||
232 | val = cpu_to_be32(*(u32 *) &ecc[2]); | ||
233 | elm_write_reg(info, offset, val); | ||
234 | offset += 4; | ||
235 | val = cpu_to_be32(*(u32 *) &ecc[0]) >> 16; | ||
236 | elm_write_reg(info, offset, val); | ||
237 | break; | ||
216 | default: | 238 | default: |
217 | pr_err("invalid config bch_type\n"); | 239 | pr_err("invalid config bch_type\n"); |
218 | } | 240 | } |
@@ -436,6 +458,13 @@ static int elm_context_save(struct elm_info *info) | |||
436 | for (i = 0; i < ERROR_VECTOR_MAX; i++) { | 458 | for (i = 0; i < ERROR_VECTOR_MAX; i++) { |
437 | offset = i * SYNDROME_FRAGMENT_REG_SIZE; | 459 | offset = i * SYNDROME_FRAGMENT_REG_SIZE; |
438 | switch (bch_type) { | 460 | switch (bch_type) { |
461 | case BCH16_ECC: | ||
462 | regs->elm_syndrome_fragment_6[i] = elm_read_reg(info, | ||
463 | ELM_SYNDROME_FRAGMENT_6 + offset); | ||
464 | regs->elm_syndrome_fragment_5[i] = elm_read_reg(info, | ||
465 | ELM_SYNDROME_FRAGMENT_5 + offset); | ||
466 | regs->elm_syndrome_fragment_4[i] = elm_read_reg(info, | ||
467 | ELM_SYNDROME_FRAGMENT_4 + offset); | ||
439 | case BCH8_ECC: | 468 | case BCH8_ECC: |
440 | regs->elm_syndrome_fragment_3[i] = elm_read_reg(info, | 469 | regs->elm_syndrome_fragment_3[i] = elm_read_reg(info, |
441 | ELM_SYNDROME_FRAGMENT_3 + offset); | 470 | ELM_SYNDROME_FRAGMENT_3 + offset); |
@@ -474,6 +503,13 @@ static int elm_context_restore(struct elm_info *info) | |||
474 | for (i = 0; i < ERROR_VECTOR_MAX; i++) { | 503 | for (i = 0; i < ERROR_VECTOR_MAX; i++) { |
475 | offset = i * SYNDROME_FRAGMENT_REG_SIZE; | 504 | offset = i * SYNDROME_FRAGMENT_REG_SIZE; |
476 | switch (bch_type) { | 505 | switch (bch_type) { |
506 | case BCH16_ECC: | ||
507 | elm_write_reg(info, ELM_SYNDROME_FRAGMENT_6 + offset, | ||
508 | regs->elm_syndrome_fragment_6[i]); | ||
509 | elm_write_reg(info, ELM_SYNDROME_FRAGMENT_5 + offset, | ||
510 | regs->elm_syndrome_fragment_5[i]); | ||
511 | elm_write_reg(info, ELM_SYNDROME_FRAGMENT_4 + offset, | ||
512 | regs->elm_syndrome_fragment_4[i]); | ||
477 | case BCH8_ECC: | 513 | case BCH8_ECC: |
478 | elm_write_reg(info, ELM_SYNDROME_FRAGMENT_3 + offset, | 514 | elm_write_reg(info, ELM_SYNDROME_FRAGMENT_3 + offset, |
479 | regs->elm_syndrome_fragment_3[i]); | 515 | regs->elm_syndrome_fragment_3[i]); |