diff options
author | Andrew Caldwell <Andrew.Caldwell@analog.com> | 2010-05-07 15:10:07 -0400 |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2010-05-26 17:59:13 -0500 |
commit | c941b77adc40f344215e367b3d1fc638addff870 (patch) | |
tree | 915f8d635c114f064a0fe24cd554506f875fe99f | |
parent | 01f03bda5b22e5aeae5f02fd537da97a41485c73 (diff) | |
download | u-boot-imx-c941b77adc40f344215e367b3d1fc638addff870.zip u-boot-imx-c941b77adc40f344215e367b3d1fc638addff870.tar.gz u-boot-imx-c941b77adc40f344215e367b3d1fc638addff870.tar.bz2 |
Blackfin: nand: drain the write buffer before returning
The current Blackfin nand write function fills up the write buffer but
returns before it has had a chance to drain. On faster systems, this
isn't a problem as the operation finishes before the ECC registers are
read, but on slower systems the ECC may be incomplete when the core tries
to read it.
So wait for the buffer to drain once we're done writing to it.
Signed-off-by: Andrew Caldwell <Andrew.Caldwell@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | drivers/mtd/nand/bfin_nand.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/mtd/nand/bfin_nand.c b/drivers/mtd/nand/bfin_nand.c index f134ef1..6d3d450 100644 --- a/drivers/mtd/nand/bfin_nand.c +++ b/drivers/mtd/nand/bfin_nand.c @@ -75,7 +75,7 @@ static void bfin_nfc_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) int bfin_nfc_devready(struct mtd_info *mtd) { pr_stamp(); - return (bfin_read_NFC_STAT() & NBUSY ? 1 : 0); + return (bfin_read_NFC_STAT() & NBUSY) ? 1 : 0; } /* @@ -132,6 +132,11 @@ static void bfin_nfc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len bfin_write_NFC_DATA_WR(buf[i]); } + + /* Wait for the buffer to drain before we return */ + while (!(bfin_read_NFC_STAT() & WB_EMPTY)) + if (ctrlc()) + return; } /* |