summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorpekon gupta <pekon@ti.com>2014-04-11 12:55:32 +0530
committerTom Rini <trini@ti.com>2014-06-06 17:45:51 -0400
commitd21e77ff84019b17e180b27267b23f51e6d609fa (patch)
treef7967f5b97adad1416fc0a958d542fd7c44c05fa /drivers
parent0439d752c5ad6cb95b1c8e1f922d74eee73d79a9 (diff)
downloadu-boot-imx-d21e77ff84019b17e180b27267b23f51e6d609fa.zip
u-boot-imx-d21e77ff84019b17e180b27267b23f51e6d609fa.tar.gz
u-boot-imx-d21e77ff84019b17e180b27267b23f51e6d609fa.tar.bz2
mtd: nand: omap_gpmc: remove unused members of 'struct nand_bch_priv'
This patch prepares to refactor 'struct nand_bch_priv' -> 'struct omap_nand_info' And thus performs following clean-ups: - remove nand_bch_priv.type: use nand_bch_priv.ecc_scheme instead - remove nand_bch_priv.mode: <unused> Signed-off-by: Pekon Gupta <pekon@ti.com> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/nand/omap_gpmc.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c
index e84bc7b..1972b0e 100644
--- a/drivers/mtd/nand/omap_gpmc.c
+++ b/drivers/mtd/nand/omap_gpmc.c
@@ -151,17 +151,10 @@ static int __maybe_unused omap_correct_data(struct mtd_info *mtd, uint8_t *dat,
* Generic BCH interface
*/
struct nand_bch_priv {
- uint8_t mode;
- uint8_t type;
struct bch_control *control;
enum omap_ecc ecc_scheme;
};
-/* bch types */
-#define ECC_BCH4 0
-#define ECC_BCH8 1
-#define ECC_BCH16 2
-
/*
* This can be a single instance cause all current users have only one NAND
* with nearly the same setup (BCH8, some with ELM and others with sw BCH
@@ -169,7 +162,6 @@ struct nand_bch_priv {
* When some users with other BCH strength will exists this have to change!
*/
static __maybe_unused struct nand_bch_priv bch_priv = {
- .type = ECC_BCH8,
.control = NULL
};
@@ -342,6 +334,7 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat,
uint32_t eccbytes = chip->ecc.bytes;
uint32_t error_count = 0, error_max;
uint32_t error_loc[8];
+ enum bch_level bch_type;
uint32_t i, ecc_flag = 0;
uint8_t count, err = 0;
uint32_t byte_pos, bit_pos;
@@ -369,22 +362,22 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat,
*/
switch (bch->ecc_scheme) {
case OMAP_ECC_BCH8_CODE_HW:
+ bch_type = BCH_8_BIT;
omap_reverse_list(calc_ecc, eccbytes - 1);
break;
default:
return -EINVAL;
}
/* use elm module to check for errors */
- elm_config((enum bch_level)(bch->type));
- if (elm_check_error(calc_ecc, (enum bch_level)bch->type,
- &error_count, error_loc)) {
+ elm_config(bch_type);
+ if (elm_check_error(calc_ecc, bch_type, &error_count, error_loc)) {
printf("nand: error: uncorrectable ECC errors\n");
return -EINVAL;
}
/* correct bch error */
for (count = 0; count < error_count; count++) {
- switch (bch->type) {
- case ECC_BCH8:
+ switch (bch->ecc_scheme) {
+ case OMAP_ECC_BCH8_CODE_HW:
/* 14th byte in ECC is reserved to match ROM layout */
error_max = SECTOR_BYTES + (eccbytes - 1);
break;
@@ -562,7 +555,6 @@ static int omap_select_ecc_scheme(struct nand_chip *nand,
/* For this ecc-scheme, ecc.bytes, ecc.layout, ... are
* initialized in nand_scan_tail(), so just set ecc.mode */
bch_priv.control = NULL;
- bch_priv.type = 0;
nand->ecc.mode = NAND_ECC_SOFT;
nand->ecc.layout = NULL;
nand->ecc.size = 0;
@@ -578,7 +570,6 @@ static int omap_select_ecc_scheme(struct nand_chip *nand,
return -EINVAL;
}
bch_priv.control = NULL;
- bch_priv.type = 0;
/* populate ecc specific fields */
memset(&nand->ecc, 0, sizeof(struct nand_ecc_ctrl));
nand->ecc.mode = NAND_ECC_HW;
@@ -617,7 +608,6 @@ static int omap_select_ecc_scheme(struct nand_chip *nand,
printf("nand: error: could not init_bch()\n");
return -ENODEV;
}
- bch_priv.type = ECC_BCH8;
/* populate ecc specific fields */
memset(&nand->ecc, 0, sizeof(struct nand_ecc_ctrl));
nand->ecc.mode = NAND_ECC_HW;
@@ -659,7 +649,6 @@ static int omap_select_ecc_scheme(struct nand_chip *nand,
}
/* intialize ELM for ECC error detection */
elm_init();
- bch_priv.type = ECC_BCH8;
/* populate ecc specific fields */
memset(&nand->ecc, 0, sizeof(struct nand_ecc_ctrl));
nand->ecc.mode = NAND_ECC_HW;