Patchwork [v4,12/23] hw/nand.c: bug fix to erase operation

login
register
mail settings
Submitter Kuo-Jung Su
Date Feb. 26, 2013, 9:14 a.m.
Message ID <1361870054-18564-13-git-send-email-dantesu@gmail.com>
Download mbox | patch
Permalink /patch/223185/
State New
Headers show

Comments

Kuo-Jung Su - Feb. 26, 2013, 9:14 a.m.
From: Kuo-Jung Su <dantesu@faraday-tech.com>

The s->addr should be reset along with the s->addrlen,
or it might have the previous address shifted to MSB,
and causes problem to nand erase operation.

Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
---
 hw/nand.c |    1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/hw/nand.c b/hw/nand.c
index 7f40ebf..3cf91c5 100644
--- a/hw/nand.c
+++ b/hw/nand.c
@@ -511,6 +511,7 @@  void nand_setio(DeviceState *dev, uint32_t value)
             nand_command(s);
 
         if (s->cmd != NAND_CMD_RANDOMREAD2) {
+            s->addr = 0;
             s->addrlen = 0;
         }
     }