From d72245fbcf3391bfb61ec447dc1888919b3d148b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juha=20Riihim=C3=A4ki?= Date: Fri, 29 Jul 2011 16:35:22 +0100 Subject: [PATCH] hw/nand: Support multiple reads following READ STATUS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After receiving READ STATUS command all subsequent IO reads should return the status register value until another command is issued. Signed-off-by: Juha Riihimäki [Riku Voipio: Fixes and restructuring patchset] Signed-off-by: Riku Voipio [Peter Maydell: More fixes and cleanups for upstream submission] Signed-off-by: Peter Maydell Signed-off-by: Andrzej Zaborowski --- hw/nand.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hw/nand.c b/hw/nand.c index 4d1dff1664..1eefe28c56 100644 --- a/hw/nand.c +++ b/hw/nand.c @@ -496,9 +496,14 @@ uint32_t nand_getio(NANDFlashState *s) for (offset = s->buswidth; offset--;) { x |= s->ioaddr[offset] << (offset << 3); } - s->addr += s->buswidth; - s->ioaddr += s->buswidth; - s->iolen -= s->buswidth; + /* after receiving READ STATUS command all subsequent reads will + * return the status register value until another command is issued + */ + if (s->cmd != NAND_CMD_READSTATUS) { + s->addr += s->buswidth; + s->ioaddr += s->buswidth; + s->iolen -= s->buswidth; + } return x; }