9
0
Fork 0

mtd nand omap: use blocknum calculation to where it's used

Just some refactoring to make the next patches better readable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2011-11-07 17:09:21 +01:00
parent 6b8503baab
commit 4a0a5df356
1 changed files with 7 additions and 7 deletions

View File

@ -362,19 +362,13 @@ static int omap_correct_data(struct mtd_info *mtd, uint8_t *dat,
int ecc_type = OMAP_ECC_BCH8_CODE_HW;
int i, j, eccsize, eccflag, count;
unsigned int err_loc[8];
int blockCnt = 0;
int blocks = 0;
int select_4_8;
debug("mtd=%x dat=%x read_ecc=%x calc_ecc=%x", (unsigned int)mtd,
(unsigned int)dat, (unsigned int)read_ecc,
(unsigned int)calc_ecc);
if ((nand->ecc.mode == NAND_ECC_HW) &&
(nand->ecc.size == 2048))
blockCnt = 4;
else
blockCnt = 1;
switch (oinfo->ecc_mode) {
case OMAP_ECC_HAMMING_CODE_HW_ROMCODE:
if (read_ecc[0] == 0xff && read_ecc[1] == 0xff &&
@ -415,6 +409,12 @@ static int omap_correct_data(struct mtd_info *mtd, uint8_t *dat,
select_4_8 = 1;
/* fall through */
case OMAP_ECC_BCH4_CODE_HW:
if (nand->ecc.size == 2048)
blocks = 4;
else
blocks = 1;
if (ecc_type == OMAP_ECC_BCH4_CODE_HW) {
eccsize = 7;
select_4_8 = 0;