Date:2009-12-01 07:54:57 (10 years 6 months ago)
Author:xiangfu
Commit:d15ef47a9ccd5d6a001af4dfaa2a50f57e514853
Message:050-nand.patch

Files: drivers/mtd/nand/Kconfig (1 diff)
drivers/mtd/nand/Makefile (1 diff)
drivers/mtd/nand/nand_base.c (2 diffs)

Change Details

drivers/mtd/nand/Kconfig
452452    help
453453      Enables support for NAND Flash chips wired onto Socrates board.
454454
455config MTD_NAND_JZ4740
456    tristate "Support NAND Flash device on Jz4740 board"
457    depends on SOC_JZ4740
458    help
459    Support NAND Flash device on Jz4740 board
460
455461endif # MTD_NAND
drivers/mtd/nand/Makefile
4040obj-$(CONFIG_MTD_NAND_MXC) += mxc_nand.o
4141obj-$(CONFIG_MTD_NAND_SOCRATES) += socrates_nand.o
4242obj-$(CONFIG_MTD_NAND_TXX9NDFMC) += txx9ndfmc.o
43obj-$(CONFIG_MTD_NAND_JZ4740) += jz4740_nand.o
4344
4445nand-objs := nand_base.o nand_bbt.o
drivers/mtd/nand/nand_base.c
953953    uint8_t *ecc_calc = chip->buffers->ecccalc;
954954    uint8_t *ecc_code = chip->buffers->ecccode;
955955    uint32_t *eccpos = chip->ecc.layout->eccpos;
956
957    for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
958        chip->ecc.hwctl(mtd, NAND_ECC_READ);
959        chip->read_buf(mtd, p, eccsize);
960        chip->ecc.calculate(mtd, p, &ecc_calc[i]);
961    }
962    chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
956    int stat;
963957
964958    for (i = 0; i < chip->ecc.total; i++)
965959        ecc_code[i] = chip->oob_poi[eccpos[i]];
966960
967    eccsteps = chip->ecc.steps;
968    p = buf;
969
970    for (i = 0 ; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
971        int stat;
972961
962    for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
963        chip->ecc.hwctl(mtd, NAND_ECC_READ);
964        chip->read_buf(mtd, p, eccsize);
973965        stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]);
974966        if (stat < 0)
975967            mtd->ecc_stats.failed++;
976968        else
977969            mtd->ecc_stats.corrected += stat;
978970    }
971
979972    return 0;
980973}
981974
...... 
11251118            bufpoi = aligned ? buf : chip->buffers->databuf;
11261119
11271120            if (likely(sndcmd)) {
1121                chip->cmdfunc(mtd, NAND_CMD_READOOB, 0x00, page);
1122                chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
11281123                chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
11291124                sndcmd = 0;
11301125            }

Archive Download the corresponding diff file



interactive