Received: from eggs.gnu.org ([140.186.70.92]:47902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qmp6N-0000GR-8y for qemu-devel@nongnu.org; Fri, 29 Jul 2011 11:35:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qmp6L-00026T-TH for qemu-devel@nongnu.org; Fri, 29 Jul 2011 11:35:51 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:36200) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qmp6L-0001zI-JO for qemu-devel@nongnu.org; Fri, 29 Jul 2011 11:35:49 -0400 From: Peter Maydell Date: Fri, 29 Jul 2011 16:35:22 +0100 Message-Id: <1311953728-29084-10-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1311953728-29084-1-git-send-email-peter.maydell@linaro.org> References: <1311953728-29084-1-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH 09/15] hw/nand: Support multiple reads following READ STATUS List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Anthony Liguori From: Juha Riihimäki 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 --- hw/nand.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hw/nand.c b/hw/nand.c index 2e98f25..e6c551d 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; } -- 1.7.1