Skip to contentSkip to conversation

pflash_cfi01: add device ID read command

PATCH In review Michael Walle 3 participants 5 messages Apr 30, 2010 – May 21, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pflash_cfi01: add device ID read command

Add support to read manufacturer and device ID. For everything else (eg. lock bits) 0 is returned.

---
 hw/pflash_cfi01.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
hw/pflash_cfi01.c +0 -0
index dfdced9..2d30968 100644
@@ -165,6 +165,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;
@@ -290,6 +306,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;
#1 lore raw

Am 01.05.2010 00:19, schrieb Michael Walle:

Quoted 3 lines

Add support to read manufacturer and device ID. For everything else (eg. lock bits) 0 is returned.

Signed-off-by is missing.

hw/pflash_cfi01.c static uint32_t pflash_read (pflash_t *pfl, · line 166

Quoted 11 lines
---
  hw/pflash_cfi01.c |   20 ++++++++++++++++++++
  1 files changed, 20 insertions(+), 0 deletions(-)
hw/pflash_cfi01.c +0 -0
index dfdced9..2d30968 100644
@@ -165,6 +165,22 @@ static uint32_t pflash_read (pflash_t *pfl,
 target_phys_addr_t offset,
 

The patch is damaged here. Use "git send-email" to send your patch.

Quoted 23 lines
hw/pflash_cfi01.c +16 -0
          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;

hw/pflash_cfi01.c static void pflash_write(pflash_t *pfl, · line 307

Quoted 2 lines
hw/pflash_cfi01.c +0 -0
@@ -290,6 +306,10 @@ static void pflash_write(pflash_t *pfl,
 target_phys_addr_t offset,
 

The patch is damaged here.

Quoted 11 lines
hw/pflash_cfi01.c +4 -0
              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;

Regards,
Stefan

#2 lore raw

PATCH 1/1 pflash_cfi01: add device ID read command

Add support to read manufacturer and device ID. For everything else (eg. lock bits) 0 is returned.

---
 hw/pflash_cfi01.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
hw/pflash_cfi01.c +20 -0
index 6b2adba..bc901e6 100644
@@ -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;
Signature · 1 line
1.5.6.5
#3 lore raw

Ping for this patch. Anything wrong with it?

Am Saturday 01 May 2010 19:34:06 schrieb Michael Walle:

Quoted 46 lines

Add support to read manufacturer and device ID. For everything else (eg. lock bits) 0 is returned.

---
 hw/pflash_cfi01.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
hw/pflash_cfi01.c +19 -0
index 6b2adba..bc901e6 100644
@@ -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;
Signature · 1 line
wkr michael
#4 lore raw
In reply to Michael Walle
Quoted 4 lines · Michael Walle

Add support to read manufacturer and device ID. For everything else (eg. lock bits) 0 is returned.

Thanks, applied.

Quoted 48 lines
---
 hw/pflash_cfi01.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
hw/pflash_cfi01.c +20 -0
index 6b2adba..bc901e6 100644
@@ -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;
Signature · 1 line
1.5.6.5
Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net