hw/nand.c: Fix nand erase operation
PATCH 1/1 hw/nand.c: Fix nand erase operation
From: Wendy Liang <[email protected]>
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]
--- hw/nand.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
hw/nand.c +1 -0
@@ -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
Signature · 1 line
1.7.0.4
Peter Maydell
AppliedQuoted 6 lines · Peter Crosthwaite
From: Wendy Liang <[email protected]>
Usually, nand erase operation has only 2 or 3 address cycles.
We need to masks->addrto zero unset stale high-order bytes in the nand address before using it as the erase address.
Quoted 6 lines
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 <[email protected]>Signed-off-by Peter Crosthwaite <[email protected]>
I kind of feel like in the long term this is making this code even more confusing, but at least it fixes the bug and doesn't mess anything else up.
Applied to arm-devs.next.
thanks
-- PMM