aboutsummaryrefslogtreecommitdiff
path: root/hw/pflash_cfi01.c
diff options
context:
space:
mode:
authorMichael Walle <michael@walle.cc>2010-05-01 19:34:06 +0200
committerAurelien Jarno <aurelien@aurel32.net>2010-05-21 11:52:08 +0200
commit0b2ec6fcfdad1dd9ce74c50e2d752afbb627b0d0 (patch)
tree67770a56a521aa9279d39222c381bf0cea0ac630 /hw/pflash_cfi01.c
parent81a204e44356a4e147ee4bcfded3d25793c5a2ad (diff)
pflash_cfi01: add device ID read command
Add support to read manufacturer and device ID. For everything else (eg. lock bits) 0 is returned. Signed-off-by: Michael Walle <michael@walle.cc> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'hw/pflash_cfi01.c')
-rw-r--r--hw/pflash_cfi01.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/hw/pflash_cfi01.c b/hw/pflash_cfi01.c
index 20fe93d63c..19e13d632d 100644
--- a/hw/pflash_cfi01.c
+++ b/hw/pflash_cfi01.c
@@ -166,6 +166,22 @@ static uint32_t pflash_read (pflash_t *pfl, target_phys_addr_t offset,
ret = pfl->status;
DPRINTF("%s: status %x\n", __func__, ret);
break;
+ case 0x90:
+ switch (boff) {
+ case 0:
+ ret = pfl->ident[0] << 8 | pfl->ident[1];
+ DPRINTF("%s: Manufacturer Code %04x\n", __func__, ret);
+ break;
+ case 1:
+ ret = pfl->ident[2] << 8 | pfl->ident[3];
+ DPRINTF("%s: Device ID Code %04x\n", __func__, ret);
+ break;
+ default:
+ DPRINTF("%s: Read Device Information boff=%x\n", __func__, boff);
+ ret = 0;
+ break;
+ }
+ break;
case 0x98: /* Query mode */
if (boff > pfl->cfi_len)
ret = 0;
@@ -283,6 +299,10 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset,
DPRINTF("%s: Read status register\n", __func__);
pfl->cmd = cmd;
return;
+ case 0x90: /* Read Device ID */
+ DPRINTF("%s: Read Device information\n", __func__);
+ pfl->cmd = cmd;
+ return;
case 0x98: /* CFI query */
DPRINTF("%s: CFI query\n", __func__);
break;