From 32aea752f47f30c00878dcc323ac4debf0c9e645 Mon Sep 17 00:00:00 2001 From: Wendy Liang Date: Wed, 3 Apr 2013 15:33:08 +1000 Subject: hw/nand.c: Fix nand erase operation 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 Message-id: 1364967188-26711-1-git-send-email-peter.crosthwaite@xilinx.com Signed-off-by: Peter Maydell --- hw/nand.c | 1 + 1 file changed, 1 insertion(+) (limited to 'hw/nand.c') diff --git a/hw/nand.c b/hw/nand.c index de3e502596..63620938fb 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 -- cgit v1.2.3