The current implementation uses width = 4 and device-width = 2 for the flash configuration. When using u-boot or Linux, the flash is detected as 32 x 16 bit, thus the sector size is doubled to 512 KB. When u-boot sends a sector erase, only the first 256 KB are erased because the QEMU flash implementation uses the configured sector size of 256 KB and ignores the width and device-width ratio.

This patch will change device-width to 4, thus the width and device-width are equal and u-boot detects the flash as 32 x 32 bit with the correct sector size of 256 KB.

- David

diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 58760f4..85ec347 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -526,7 +526,7 @@ static pflash_t *ve_pflash_cfi01_register(hwaddr base, const char *name,
                          VEXPRESS_FLASH_SIZE / VEXPRESS_FLASH_SECT_SIZE);
     qdev_prop_set_uint64(dev, "sector-length", VEXPRESS_FLASH_SECT_SIZE);
     qdev_prop_set_uint8(dev, "width", 4);
-    qdev_prop_set_uint8(dev, "device-width", 2);
+    qdev_prop_set_uint8(dev, "device-width", 4);
     qdev_prop_set_bit(dev, "big-endian", false);
     qdev_prop_set_uint16(dev, "id0", 0x89);
     qdev_prop_set_uint16(dev, "id1", 0x18);

Reply via email to