From: Barry Song Date: Thu, 5 Aug 2010 15:07:38 +0000 (-0400) Subject: mtd: Blackfin NFC: fix nand busy detection X-Git-Tag: upstream/snapshot3+hdmi~13517^2~34 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d2350c2ab51df7088d3db73a4c85ad73ded37a01;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git mtd: Blackfin NFC: fix nand busy detection The IRQSTAT register is a W1C register used by the interrupt handler and may have its BUSY bit changed. This makes it somewhat unreliable for the polling devready function. So switch it over to use the BUSY bit in the STAT register that always reflects the current state of the hardware. This fixes driver hangs seen when the NAND flash is under heavy system load (like I/O benchmarks). Signed-off-by: Barry Song Signed-off-by: Mike Frysinger Signed-off-by: David Woodhouse --- diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c index 3784f41..a382e3d 100644 --- a/drivers/mtd/nand/bf5xx_nand.c +++ b/drivers/mtd/nand/bf5xx_nand.c @@ -215,9 +215,9 @@ static void bf5xx_nand_hwcontrol(struct mtd_info *mtd, int cmd, */ static int bf5xx_nand_devready(struct mtd_info *mtd) { - unsigned short val = bfin_read_NFC_IRQSTAT(); + unsigned short val = bfin_read_NFC_STAT(); - if ((val & NBUSYIRQ) == NBUSYIRQ) + if ((val & NBUSY) == NBUSY) return 1; else return 0;