aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPekon Gupta <pekon@ti.com>2014-03-20 09:18:36 -0400
committerBrian Norris <computersforpeace@gmail.com>2014-03-26 02:09:02 -0400
commit79f013518d435e238e6bddd0073de631bbefb556 (patch)
tree725d64591ed30edb913828c6b92511eecc1e087d
parentea0760244d235688b5fae4e5cdd9412c1fb1c2fe (diff)
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@ti.com> Reviewed-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-rw-r--r--drivers/mtd/devices/elm.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mtd/devices/elm.c b/drivers/mtd/devices/elm.c
index 4fbfaf65fabd..26df41f20c1f 100644
--- a/drivers/mtd/devices/elm.c
+++ b/drivers/mtd/devices/elm.c
@@ -84,6 +84,7 @@ struct elm_info {
84 struct list_head list; 84 struct list_head list;
85 enum bch_ecc bch_type; 85 enum bch_ecc bch_type;
86 struct elm_registers elm_regs; 86 struct elm_registers elm_regs;
87 int ecc_steps;
87 int ecc_syndrome_size; 88 int ecc_syndrome_size;
88}; 89};
89 90
@@ -128,6 +129,7 @@ int elm_config(struct device *dev, enum bch_ecc bch_type,
128 reg_val = (bch_type & ECC_BCH_LEVEL_MASK) | (ELM_ECC_SIZE << 16); 129 reg_val = (bch_type & ECC_BCH_LEVEL_MASK) | (ELM_ECC_SIZE << 16);
129 elm_write_reg(info, ELM_LOCATION_CONFIG, reg_val); 130 elm_write_reg(info, ELM_LOCATION_CONFIG, reg_val);
130 info->bch_type = bch_type; 131 info->bch_type = bch_type;
132 info->ecc_steps = ecc_steps;
131 info->ecc_syndrome_size = ecc_syndrome_size; 133 info->ecc_syndrome_size = ecc_syndrome_size;
132 134
133 return 0; 135 return 0;
@@ -170,7 +172,7 @@ static void elm_load_syndrome(struct elm_info *info,
170 int i, offset; 172 int i, offset;
171 u32 val; 173 u32 val;
172 174
173 for (i = 0; i < ERROR_VECTOR_MAX; i++) { 175 for (i = 0; i < info->ecc_steps; i++) {
174 176
175 /* Check error reported */ 177 /* Check error reported */
176 if (err_vec[i].error_reported) { 178 if (err_vec[i].error_reported) {
@@ -238,7 +240,7 @@ static void elm_start_processing(struct elm_info *info,
238 * Set syndrome vector valid, so that ELM module 240 * Set syndrome vector valid, so that ELM module
239 * will process it for vectors error is reported 241 * will process it for vectors error is reported
240 */ 242 */
241 for (i = 0; i < ERROR_VECTOR_MAX; i++) { 243 for (i = 0; i < info->ecc_steps; i++) {
242 if (err_vec[i].error_reported) { 244 if (err_vec[i].error_reported) {
243 offset = ELM_SYNDROME_FRAGMENT_6 + 245 offset = ELM_SYNDROME_FRAGMENT_6 +
244 SYNDROME_FRAGMENT_REG_SIZE * i; 246 SYNDROME_FRAGMENT_REG_SIZE * i;
@@ -267,7 +269,7 @@ static void elm_error_correction(struct elm_info *info,
267 int offset; 269 int offset;
268 u32 reg_val; 270 u32 reg_val;
269 271
270 for (i = 0; i < ERROR_VECTOR_MAX; i++) { 272 for (i = 0; i < info->ecc_steps; i++) {
271 273
272 /* Check error reported */ 274 /* Check error reported */
273 if (err_vec[i].error_reported) { 275 if (err_vec[i].error_reported) {