diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2010-04-27 09:24:01 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-07-26 08:17:52 -0400 |
commit | 5ea32021c173c0c97482a1342a9069733032b647 (patch) | |
tree | 5ecf2451861422270319dcbd2ccde0af4d5e7eb4 /drivers/mtd | |
parent | d2195d52aa5c638be74b396da00624a32d1c5a86 (diff) |
mxc_nand: Fix OOB handling
The OOB handling in the mxc_nand driver is broken for v1 type
controllers (i.MX27/31) with 512 byte page size. This perhaps
did not show up because ubi does not use OOB.
Update the driver to always read/write a whole page even if
only OOB is requested. With this patch the driver passes the
mtd_oobtest on i.MX27 with 512 byte page size. Also tested
with 2048 byte page size and on i.MX35 (v2 type controller)
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Wolfram Sang <w.sang@pengutronix.de>
Tested-by: Baruch Siach <baruch@tkos.co.il>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/mxc_nand.c | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index 82e94389824e..6e8aa34e4dfc 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c | |||
@@ -623,8 +623,7 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command, | |||
623 | else | 623 | else |
624 | host->buf_start = column + mtd->writesize; | 624 | host->buf_start = column + mtd->writesize; |
625 | 625 | ||
626 | if (mtd->writesize > 512) | 626 | command = NAND_CMD_READ0; /* only READ0 is valid */ |
627 | command = NAND_CMD_READ0; /* only READ0 is valid */ | ||
628 | 627 | ||
629 | send_cmd(host, command, false); | 628 | send_cmd(host, command, false); |
630 | mxc_do_addr_cycle(mtd, column, page_addr); | 629 | mxc_do_addr_cycle(mtd, column, page_addr); |
@@ -639,31 +638,11 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command, | |||
639 | break; | 638 | break; |
640 | 639 | ||
641 | case NAND_CMD_SEQIN: | 640 | case NAND_CMD_SEQIN: |
642 | if (column >= mtd->writesize) { | 641 | if (column >= mtd->writesize) |
643 | /* | 642 | /* call ourself to read a page */ |
644 | * FIXME: before send SEQIN command for write OOB, | 643 | mxc_nand_command(mtd, NAND_CMD_READ0, 0, page_addr); |
645 | * We must read one page out. | ||
646 | * For K9F1GXX has no READ1 command to set current HW | ||
647 | * pointer to spare area, we must write the whole page | ||
648 | * including OOB together. | ||
649 | */ | ||
650 | if (mtd->writesize > 512) | ||
651 | /* call ourself to read a page */ | ||
652 | mxc_nand_command(mtd, NAND_CMD_READ0, 0, | ||
653 | page_addr); | ||
654 | |||
655 | host->buf_start = column; | ||
656 | |||
657 | /* Set program pointer to spare region */ | ||
658 | if (mtd->writesize == 512) | ||
659 | send_cmd(host, NAND_CMD_READOOB, false); | ||
660 | } else { | ||
661 | host->buf_start = column; | ||
662 | 644 | ||
663 | /* Set program pointer to page start */ | 645 | host->buf_start = column; |
664 | if (mtd->writesize == 512) | ||
665 | send_cmd(host, NAND_CMD_READ0, false); | ||
666 | } | ||
667 | 646 | ||
668 | send_cmd(host, command, false); | 647 | send_cmd(host, command, false); |
669 | mxc_do_addr_cycle(mtd, column, page_addr); | 648 | mxc_do_addr_cycle(mtd, column, page_addr); |