| Date: | 2010-06-28 00:06:10 (13 years 5 months ago) |
|---|---|
| Author: | Lars C. |
| Commit: | 87577b6d4b915699143120cce6c55ef4d8487ad3 |
| Message: | MTD: NAND: jz4740: Add custom nand read/write callbacks The default read/write callbacks only support 64 ecc bytes, but we need to support more. |
| Files: |
drivers/mtd/nand/jz4740_nand.c (2 diffs) |
Change Details
| drivers/mtd/nand/jz4740_nand.c | ||
|---|---|---|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | |
| 244 | /* Copy paste of nand_read_page_hwecc_oob_first except for different eccpos | |
| 245 | * handling. The ecc area is for 4k chips 72 bytes long and thus does not fit | |
| 246 | * into the eccpos array. */ | |
| 247 | static int jz_nand_read_page_hwecc_oob_first(struct mtd_info *mtd, | |
| 248 | struct nand_chip *chip, uint8_t *buf, int page) | |
| 249 | { | |
| 250 | int i, eccsize = chip->ecc.size; | |
| 251 | int eccbytes = chip->ecc.bytes; | |
| 252 | int eccsteps = chip->ecc.steps; | |
| 253 | uint8_t *p = buf; | |
| 254 | unsigned int ecc_offset = chip->page_shift; | |
| 255 | ||
| 256 | /* Read the OOB area first */ | |
| 257 | chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); | |
| 258 | chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); | |
| 259 | chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page); | |
| 260 | ||
| 261 | for (i = ecc_offset; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { | |
| 262 | int stat; | |
| 263 | ||
| 264 | chip->ecc.hwctl(mtd, NAND_ECC_READ); | |
| 265 | chip->read_buf(mtd, p, eccsize); | |
| 266 | ||
| 267 | stat = chip->ecc.correct(mtd, p, &chip->oob_poi[i], NULL); | |
| 268 | if (stat < 0) | |
| 269 | mtd->ecc_stats.failed++; | |
| 270 | else | |
| 271 | mtd->ecc_stats.corrected += stat; | |
| 272 | } | |
| 273 | return 0; | |
| 274 | } | |
| 275 | ||
| 276 | /* Copy-and-paste of nand_write_page_hwecc with different eccpos handling. */ | |
| 277 | static void jz_nand_write_page_hwecc(struct mtd_info *mtd, | |
| 278 | struct nand_chip *chip, const uint8_t *buf) | |
| 279 | { | |
| 280 | int i, eccsize = chip->ecc.size; | |
| 281 | int eccbytes = chip->ecc.bytes; | |
| 282 | int eccsteps = chip->ecc.steps; | |
| 283 | const uint8_t *p = buf; | |
| 284 | unsigned int ecc_offset = chip->page_shift; | |
| 285 | ||
| 286 | for (i = ecc_offset; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { | |
| 287 | chip->ecc.hwctl(mtd, NAND_ECC_WRITE); | |
| 288 | chip->write_buf(mtd, p, eccsize); | |
| 289 | chip->ecc.calculate(mtd, p, &chip->oob_poi[i]); | |
| 290 | } | |
| 291 | ||
| 292 | chip->write_buf(mtd, chip->oob_poi, mtd->oobsize); | |
| 293 | } | |
| 244 | 294 | |
| 245 | 295 | #ifdef CONFIG_MTD_CMDLINE_PARTS |
| 246 | 296 | static const char *part_probes[] = {"cmdline", NULL}; |
| ... | ... | |
| 308 | 358 | chip->ecc.mode = NAND_ECC_HW_OOB_FIRST; |
| 309 | 359 | chip->ecc.size = 512; |
| 310 | 360 | chip->ecc.bytes = 9; |
| 361 | ||
| 362 | chip->ecc.read_page = jz_nand_read_page_hwecc_oob_first; | |
| 363 | chip->ecc.write_page = jz_nand_write_page_hwecc; | |
| 364 | ||
| 311 | 365 | if (pdata) |
| 312 | 366 | chip->ecc.layout = pdata->ecc_layout; |
| 313 | 367 | |
Branches:
ben-wpan
ben-wpan-stefan
5396a9238205f20f811ea57898980d3ca82df0b6
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9
