mtd: devices: elm: configure parallel channels based on ecc_steps
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Sat Apr 5 02:59:06 EDT 2014
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=79f013518d435e238e6bddd0073de631bbefb556
Commit: 79f013518d435e238e6bddd0073de631bbefb556
Parent: ea0760244d235688b5fae4e5cdd9412c1fb1c2fe
Author: Pekon Gupta <pekon at ti.com>
AuthorDate: Thu Mar 20 18:48:36 2014 +0530
Committer: Brian Norris <computersforpeace at gmail.com>
CommitDate: Tue Mar 25 23:09:02 2014 -0700
mtd: devices: elm: configure parallel channels based on ecc_steps
ELM hardware can process up to maximum of 8 hannels in parallel for
ECC error detection. Currently the number of channels getting configured for
processing is static determined by macro ERROR_VECTOR_MAX. However, the actual
number of channels that need to be processed is the ECC step number.
This patch just avoids configuring extra unused channels.
Signed-off-by: Pekon Gupta <pekon at ti.com>
Reviewed-by: Ezequiel Garcia <ezequiel.garcia at free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
drivers/mtd/devices/elm.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/devices/elm.c b/drivers/mtd/devices/elm.c
index 4fbfaf6..26df41f 100644
--- a/drivers/mtd/devices/elm.c
+++ b/drivers/mtd/devices/elm.c
@@ -84,6 +84,7 @@ struct elm_info {
struct list_head list;
enum bch_ecc bch_type;
struct elm_registers elm_regs;
+ int ecc_steps;
int ecc_syndrome_size;
};
@@ -128,6 +129,7 @@ int elm_config(struct device *dev, enum bch_ecc bch_type,
reg_val = (bch_type & ECC_BCH_LEVEL_MASK) | (ELM_ECC_SIZE << 16);
elm_write_reg(info, ELM_LOCATION_CONFIG, reg_val);
info->bch_type = bch_type;
+ info->ecc_steps = ecc_steps;
info->ecc_syndrome_size = ecc_syndrome_size;
return 0;
@@ -170,7 +172,7 @@ static void elm_load_syndrome(struct elm_info *info,
int i, offset;
u32 val;
- for (i = 0; i < ERROR_VECTOR_MAX; i++) {
+ for (i = 0; i < info->ecc_steps; i++) {
/* Check error reported */
if (err_vec[i].error_reported) {
@@ -238,7 +240,7 @@ static void elm_start_processing(struct elm_info *info,
* Set syndrome vector valid, so that ELM module
* will process it for vectors error is reported
*/
- for (i = 0; i < ERROR_VECTOR_MAX; i++) {
+ for (i = 0; i < info->ecc_steps; i++) {
if (err_vec[i].error_reported) {
offset = ELM_SYNDROME_FRAGMENT_6 +
SYNDROME_FRAGMENT_REG_SIZE * i;
@@ -267,7 +269,7 @@ static void elm_error_correction(struct elm_info *info,
int offset;
u32 reg_val;
- for (i = 0; i < ERROR_VECTOR_MAX; i++) {
+ for (i = 0; i < info->ecc_steps; i++) {
/* Check error reported */
if (err_vec[i].error_reported) {
More information about the linux-mtd-cvs
mailing list