Commit c941b77adc40f344215e367b3d1fc638addff870
Committed by
Scott Wood
1 parent
01f03bda5b
Exists in
master
and in
54 other branches
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>
Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff
drivers/mtd/nand/bfin_nand.c
... | ... | @@ -75,7 +75,7 @@ |
75 | 75 | int bfin_nfc_devready(struct mtd_info *mtd) |
76 | 76 | { |
77 | 77 | pr_stamp(); |
78 | - return (bfin_read_NFC_STAT() & NBUSY ? 1 : 0); | |
78 | + return (bfin_read_NFC_STAT() & NBUSY) ? 1 : 0; | |
79 | 79 | } |
80 | 80 | |
81 | 81 | /* |
... | ... | @@ -132,6 +132,11 @@ |
132 | 132 | |
133 | 133 | bfin_write_NFC_DATA_WR(buf[i]); |
134 | 134 | } |
135 | + | |
136 | + /* Wait for the buffer to drain before we return */ | |
137 | + while (!(bfin_read_NFC_STAT() & WB_EMPTY)) | |
138 | + if (ctrlc()) | |
139 | + return; | |
135 | 140 | } |
136 | 141 | |
137 | 142 | /* |