diff options
| -rw-r--r-- | drivers/mtd/nand/ams-delta.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/nand/au1550nd.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/nand/autcpu12.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/nand/cs553x_nand.c | 12 | ||||
| -rw-r--r-- | drivers/mtd/nand/diskonchip.c | 10 | ||||
| -rw-r--r-- | drivers/mtd/nand/h1910.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/nand/nand_base.c | 146 | ||||
| -rw-r--r-- | drivers/mtd/nand/nandsim.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/nand/ndfc.c | 10 | ||||
| -rw-r--r-- | drivers/mtd/nand/ppchameleonevb.c | 4 | ||||
| -rw-r--r-- | drivers/mtd/nand/rtc_from4.c | 12 | ||||
| -rw-r--r-- | drivers/mtd/nand/s3c2410.c | 16 | ||||
| -rw-r--r-- | drivers/mtd/nand/sharpsl.c | 10 | ||||
| -rw-r--r-- | drivers/mtd/nand/toto.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/nand/ts7250.c | 2 | ||||
| -rw-r--r-- | include/linux/mtd/nand.h | 63 |
16 files changed, 131 insertions, 166 deletions
diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c index 5a349eb316..aeaf2dece0 100644 --- a/drivers/mtd/nand/ams-delta.c +++ b/drivers/mtd/nand/ams-delta.c | |||
| @@ -192,7 +192,7 @@ static int __init ams_delta_init(void) | |||
| 192 | } | 192 | } |
| 193 | /* 25 us command delay time */ | 193 | /* 25 us command delay time */ |
| 194 | this->chip_delay = 30; | 194 | this->chip_delay = 30; |
| 195 | this->eccmode = NAND_ECC_SOFT; | 195 | this->ecc.mode = NAND_ECC_SOFT; |
| 196 | 196 | ||
| 197 | /* Set chip enabled, but */ | 197 | /* Set chip enabled, but */ |
| 198 | ams_delta_latch2_write(NAND_MASK, AMS_DELTA_LATCH2_NAND_NRE | | 198 | ams_delta_latch2_write(NAND_MASK, AMS_DELTA_LATCH2_NAND_NRE | |
diff --git a/drivers/mtd/nand/au1550nd.c b/drivers/mtd/nand/au1550nd.c index d9a0143e1d..d7f04abfe1 100644 --- a/drivers/mtd/nand/au1550nd.c +++ b/drivers/mtd/nand/au1550nd.c | |||
| @@ -578,7 +578,7 @@ static int __init au1xxx_nand_init(void) | |||
| 578 | 578 | ||
| 579 | /* 30 us command delay time */ | 579 | /* 30 us command delay time */ |
| 580 | this->chip_delay = 30; | 580 | this->chip_delay = 30; |
| 581 | this->eccmode = NAND_ECC_SOFT; | 581 | this->ecc.mode = NAND_ECC_SOFT; |
| 582 | 582 | ||
| 583 | this->options = NAND_NO_AUTOINCR; | 583 | this->options = NAND_NO_AUTOINCR; |
| 584 | 584 | ||
diff --git a/drivers/mtd/nand/autcpu12.c b/drivers/mtd/nand/autcpu12.c index 43b296040d..dbb1b6267a 100644 --- a/drivers/mtd/nand/autcpu12.c +++ b/drivers/mtd/nand/autcpu12.c | |||
| @@ -163,7 +163,7 @@ static int __init autcpu12_init(void) | |||
| 163 | this->dev_ready = autcpu12_device_ready; | 163 | this->dev_ready = autcpu12_device_ready; |
| 164 | /* 20 us command delay time */ | 164 | /* 20 us command delay time */ |
| 165 | this->chip_delay = 20; | 165 | this->chip_delay = 20; |
| 166 | this->eccmode = NAND_ECC_SOFT; | 166 | this->ecc.mode = NAND_ECC_SOFT; |
| 167 | 167 | ||
| 168 | /* Enable the following for a flash based bad block table */ | 168 | /* Enable the following for a flash based bad block table */ |
| 169 | /* | 169 | /* |
diff --git a/drivers/mtd/nand/cs553x_nand.c b/drivers/mtd/nand/cs553x_nand.c index bf251253ea..064f3feadf 100644 --- a/drivers/mtd/nand/cs553x_nand.c +++ b/drivers/mtd/nand/cs553x_nand.c | |||
| @@ -242,11 +242,13 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr) | |||
| 242 | 242 | ||
| 243 | this->chip_delay = 0; | 243 | this->chip_delay = 0; |
| 244 | 244 | ||
| 245 | this->eccmode = NAND_ECC_HW3_256; | 245 | this->ecc.mode = NAND_ECC_HW; |
| 246 | this->enable_hwecc = cs_enable_hwecc; | 246 | this->ecc.size = 256; |
| 247 | this->calculate_ecc = cs_calculate_ecc; | 247 | this->ecc.bytes = 3; |
| 248 | this->correct_data = nand_correct_data; | 248 | this->ecc.hwctl = cs_enable_hwecc; |
| 249 | 249 | this->ecc.calculate = cs_calculate_ecc; | |
| 250 | this->ecc.correct = nand_correct_data; | ||
| 251 | |||
| 250 | /* Enable the following for a flash based bad block table */ | 252 | /* Enable the following for a flash based bad block table */ |
| 251 | this->options = NAND_USE_FLASH_BBT | NAND_NO_AUTOINCR; | 253 | this->options = NAND_USE_FLASH_BBT | NAND_NO_AUTOINCR; |
| 252 | 254 | ||
diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c index a2391c66a6..128c937af3 100644 --- a/drivers/mtd/nand/diskonchip.c +++ b/drivers/mtd/nand/diskonchip.c | |||
| @@ -1674,12 +1674,14 @@ static int __init doc_probe(unsigned long physadr) | |||
| 1674 | nand->dev_ready = doc200x_dev_ready; | 1674 | nand->dev_ready = doc200x_dev_ready; |
| 1675 | nand->waitfunc = doc200x_wait; | 1675 | nand->waitfunc = doc200x_wait; |
| 1676 | nand->block_bad = doc200x_block_bad; | 1676 | nand->block_bad = doc200x_block_bad; |
| 1677 | nand->enable_hwecc = doc200x_enable_hwecc; | 1677 | nand->ecc.hwctl = doc200x_enable_hwecc; |
| 1678 | nand->calculate_ecc = doc200x_calculate_ecc; | 1678 | nand->ecc.calculate = doc200x_calculate_ecc; |
| 1679 | nand->correct_data = doc200x_correct_data; | 1679 | nand->ecc.correct = doc200x_correct_data; |
| 1680 | 1680 | ||
| 1681 | nand->autooob = &doc200x_oobinfo; | 1681 | nand->autooob = &doc200x_oobinfo; |
| 1682 | nand->eccmode = NAND_ECC_HW6_512; | 1682 | nand->ecc.mode = NAND_ECC_HW_SYNDROME; |
| 1683 | nand->ecc.size = 512; | ||
| 1684 | nand->ecc.bytes = 6; | ||
| 1683 | nand->options = NAND_USE_FLASH_BBT | NAND_HWECC_SYNDROME; | 1685 | nand->options = NAND_USE_FLASH_BBT | NAND_HWECC_SYNDROME; |
| 1684 | 1686 | ||
| 1685 | doc->physadr = physadr; | 1687 | doc->physadr = physadr; |
diff --git a/drivers/mtd/nand/h1910.c b/drivers/mtd/nand/h1910.c index 9848eb09b8..06e91fa11b 100644 --- a/drivers/mtd/nand/h1910.c +++ b/drivers/mtd/nand/h1910.c | |||
| @@ -149,7 +149,7 @@ static int __init h1910_init(void) | |||
| 149 | this->dev_ready = NULL; /* unknown whether that was correct or not so we will just do it like this */ | 149 | this->dev_ready = NULL; /* unknown whether that was correct or not so we will just do it like this */ |
| 150 | /* 15 us command delay time */ | 150 | /* 15 us command delay time */ |
| 151 | this->chip_delay = 50; | 151 | this->chip_delay = 50; |
| 152 | this->eccmode = NAND_ECC_SOFT; | 152 | this->ecc.mode = NAND_ECC_SOFT; |
| 153 | this->options = NAND_NO_AUTOINCR; | 153 | this->options = NAND_NO_AUTOINCR; |
| 154 | 154 | ||
| 155 | /* Scan to find existence of the device */ | 155 | /* Scan to find existence of the device */ |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 37db98a58c..98792ec4c2 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
| @@ -879,9 +879,9 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *this, int pag | |||
| 879 | { | 879 | { |
| 880 | int i, status; | 880 | int i, status; |
| 881 | uint8_t ecc_code[32]; | 881 | uint8_t ecc_code[32]; |
| 882 | int eccmode = oobsel->useecc ? this->eccmode : NAND_ECC_NONE; | 882 | int eccmode = oobsel->useecc ? this->ecc.mode : NAND_ECC_NONE; |
| 883 | int *oob_config = oobsel->eccpos; | 883 | int *oob_config = oobsel->eccpos; |
| 884 | int datidx = 0, eccidx = 0, eccsteps = this->eccsteps; | 884 | int datidx = 0, eccidx = 0, eccsteps = this->ecc.steps; |
| 885 | int eccbytes = 0; | 885 | int eccbytes = 0; |
| 886 | 886 | ||
| 887 | /* FIXME: Enable cached programming */ | 887 | /* FIXME: Enable cached programming */ |
| @@ -901,20 +901,20 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *this, int pag | |||
| 901 | /* Software ecc 3/256, write all */ | 901 | /* Software ecc 3/256, write all */ |
| 902 | case NAND_ECC_SOFT: | 902 | case NAND_ECC_SOFT: |
| 903 | for (; eccsteps; eccsteps--) { | 903 | for (; eccsteps; eccsteps--) { |
| 904 | this->calculate_ecc(mtd, &this->data_poi[datidx], ecc_code); | 904 | this->ecc.calculate(mtd, &this->data_poi[datidx], ecc_code); |
| 905 | for (i = 0; i < 3; i++, eccidx++) | 905 | for (i = 0; i < 3; i++, eccidx++) |
| 906 | oob_buf[oob_config[eccidx]] = ecc_code[i]; | 906 | oob_buf[oob_config[eccidx]] = ecc_code[i]; |
| 907 | datidx += this->eccsize; | 907 | datidx += this->ecc.size; |
| 908 | } | 908 | } |
| 909 | this->write_buf(mtd, this->data_poi, mtd->oobblock); | 909 | this->write_buf(mtd, this->data_poi, mtd->oobblock); |
| 910 | break; | 910 | break; |
| 911 | default: | 911 | default: |
| 912 | eccbytes = this->eccbytes; | 912 | eccbytes = this->ecc.bytes; |
| 913 | for (; eccsteps; eccsteps--) { | 913 | for (; eccsteps; eccsteps--) { |
| 914 | /* enable hardware ecc logic for write */ | 914 | /* enable hardware ecc logic for write */ |
| 915 | this->enable_hwecc(mtd, NAND_ECC_WRITE); | 915 | this->ecc.hwctl(mtd, NAND_ECC_WRITE); |
| 916 | this->write_buf(mtd, &this->data_poi[datidx], this->eccsize); | 916 | this->write_buf(mtd, &this->data_poi[datidx], this->ecc.size); |
| 917 | this->calculate_ecc(mtd, &this->data_poi[datidx], ecc_code); | 917 | this->ecc.calculate(mtd, &this->data_poi[datidx], ecc_code); |
| 918 | for (i = 0; i < eccbytes; i++, eccidx++) | 918 | for (i = 0; i < eccbytes; i++, eccidx++) |
| 919 | oob_buf[oob_config[eccidx]] = ecc_code[i]; | 919 | oob_buf[oob_config[eccidx]] = ecc_code[i]; |
| 920 | /* If the hardware ecc provides syndromes then | 920 | /* If the hardware ecc provides syndromes then |
| @@ -922,7 +922,7 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *this, int pag | |||
| 922 | * the data bytes (words) */ | 922 | * the data bytes (words) */ |
| 923 | if (this->options & NAND_HWECC_SYNDROME) | 923 | if (this->options & NAND_HWECC_SYNDROME) |
| 924 | this->write_buf(mtd, ecc_code, eccbytes); | 924 | this->write_buf(mtd, ecc_code, eccbytes); |
| 925 | datidx += this->eccsize; | 925 | datidx += this->ecc.size; |
| 926 | } | 926 | } |
| 927 | break; | 927 | break; |
| 928 | } | 928 | } |
| @@ -1155,7 +1155,7 @@ int nand_do_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
| 1155 | if (oobsel->useecc == MTD_NANDECC_AUTOPLACE) | 1155 | if (oobsel->useecc == MTD_NANDECC_AUTOPLACE) |
| 1156 | oobsel = this->autooob; | 1156 | oobsel = this->autooob; |
| 1157 | 1157 | ||
| 1158 | eccmode = oobsel->useecc ? this->eccmode : NAND_ECC_NONE; | 1158 | eccmode = oobsel->useecc ? this->ecc.mode : NAND_ECC_NONE; |
| 1159 | oob_config = oobsel->eccpos; | 1159 | oob_config = oobsel->eccpos; |
| 1160 | 1160 | ||
| 1161 | /* Select the NAND device */ | 1161 | /* Select the NAND device */ |
| @@ -1170,8 +1170,8 @@ int nand_do_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
| 1170 | col = from & (mtd->oobblock - 1); | 1170 | col = from & (mtd->oobblock - 1); |
| 1171 | 1171 | ||
| 1172 | end = mtd->oobblock; | 1172 | end = mtd->oobblock; |
| 1173 | ecc = this->eccsize; | 1173 | ecc = this->ecc.size; |
| 1174 | eccbytes = this->eccbytes; | 1174 | eccbytes = this->ecc.bytes; |
| 1175 | 1175 | ||
| 1176 | if ((eccmode == NAND_ECC_NONE) || (this->options & NAND_HWECC_SYNDROME)) | 1176 | if ((eccmode == NAND_ECC_NONE) || (this->options & NAND_HWECC_SYNDROME)) |
| 1177 | compareecc = 0; | 1177 | compareecc = 0; |
| @@ -1216,7 +1216,7 @@ int nand_do_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
| 1216 | oobsel->useecc == MTD_NANDECC_AUTOPL_USR) | 1216 | oobsel->useecc == MTD_NANDECC_AUTOPL_USR) |
| 1217 | oob_data = &this->data_buf[end]; | ||
