aboutsummaryrefslogtreecommitdiff
path: root/hw/nand.c
diff options
context:
space:
mode:
authorWendy Liang <wendy.liang@xilinx.com>2013-04-03 15:33:08 +1000
committerPeter Maydell <peter.maydell@linaro.org>2013-04-05 17:08:54 +0100
commit32aea752f47f30c00878dcc323ac4debf0c9e645 (patch)
tree191d8cfe86a4e12d9e45ce8967ddf74d10d249fb /hw/nand.c
parent1db8b5efe0c2b5000e50691eea61264a615f43de (diff)
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 <jliang@xilinx.com> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Message-id: 1364967188-26711-1-git-send-email-peter.crosthwaite@xilinx.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/nand.c')
-rw-r--r--hw/nand.c1
1 files changed, 1 insertions, 0 deletions
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