Received: from eggs.gnu.org ([208.118.235.92]:41326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNGKa-00075O-0i for qemu-devel@nongnu.org; Wed, 03 Apr 2013 01:33:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNGKZ-0006fp-3j for qemu-devel@nongnu.org; Wed, 03 Apr 2013 01:33:55 -0400 Received: from mail-da0-x232.google.com ([2607:f8b0:400e:c00::232]:61220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNGKY-0006fi-TN for qemu-devel@nongnu.org; Wed, 03 Apr 2013 01:33:55 -0400 Received: by mail-da0-f50.google.com with SMTP id t1so509432dae.9 for ; Tue, 02 Apr 2013 22:33:54 -0700 (PDT) Sender: Peter Crosthwaite From: Peter Crosthwaite Date: Wed, 3 Apr 2013 15:33:08 +1000 Message-Id: <1364967188-26711-1-git-send-email-peter.crosthwaite@xilinx.com> Subject: [Qemu-devel] [PATCH] hw/nand.c: Fix nand erase operation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Peter Crosthwaite , Wendy Liang , Wendy Liang , dantesu@faraday-tech.com, edgar.iglesias@gmail.com From: Wendy Liang Usually, nand erase operation has only 2 or 3 address cycles. We need to mask s->addr to zero unset stale high-order bytes in the nand address before using it as the erase address. This fixes the NAND erase operation in Linux. [PC: Generalised to work for any number of address cycles rather than just 3] Signed-off-by: Wendy Liang Signed-off-by: Peter Crosthwaite --- hw/nand.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/hw/nand.c b/hw/nand.c index de3e502..6362093 100644 --- a/hw/nand.c +++ b/hw/nand.c @@ -297,6 +297,7 @@ static void nand_command(NANDFlashState *s) break; case NAND_CMD_BLOCKERASE2: + s->addr &= (1ull << s->addrlen * 8) - 1; if (nand_flash_ids[s->chip_id].options & NAND_SAMSUNG_LP) s->addr <<= 16; else -- 1.7.0.4