Skip to contentSkip to conversation

m25p80: Fix QIOR/DIOR handling for Winbond

PATCH Applied [email protected] 3 participants 6 messages Jul 7, 2016 – Jul 12, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 m25p80: Fix QIOR/DIOR handling for Winbond

From: Marcin Krzeminski <[email protected]>

Winbond also support continuous read mode, but as an opposite for other flash type read mode clock cycles are included to dummy cycles number. This path add proper handling of read mode byte and update needed dummy cycles. QPI mode and dummy cycles configuration are not supported.

---
 hw/block/m25p80.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
hw/block/m25p80.c +4 -2
index d9b2793..a349544 100644
@@ -149,6 +149,7 @@ typedef struct FlashPartInfo {
 */
 
 #define SPANSION_CONTINUOUS_READ_MODE_CMD_LEN 1
+#define WINBOND_CONTINUOUS_READ_MODE_CMD_LEN 1
 
 static const FlashPartInfo known_devices[] = {
     /* Atmel -- some are (confusingly) marketed as "DataFlash" */
@@ -775,7 +776,7 @@ static void decode_dio_read_cmd(Flash *s)
     /* Dummy cycles modeled with bytes writes instead of bits */
     switch (get_man(s)) {
     case MAN_WINBOND:
-        s->needed_bytes += 8;
+        s->needed_bytes += WINBOND_CONTINUOUS_READ_MODE_CMD_LEN;
         break;
     case MAN_SPANSION:
         s->needed_bytes += SPANSION_CONTINUOUS_READ_MODE_CMD_LEN;
@@ -814,7 +815,8 @@ static void decode_qio_read_cmd(Flash *s)
     /* Dummy cycles modeled with bytes writes instead of bits */
     switch (get_man(s)) {
     case MAN_WINBOND:
-        s->needed_bytes += 8;
+        s->needed_bytes += WINBOND_CONTINUOUS_READ_MODE_CMD_LEN;
+        s->needed_bytes += 4;
         break;
     case MAN_SPANSION:
         s->needed_bytes += SPANSION_CONTINUOUS_READ_MODE_CMD_LEN;
Signature · 1 line
2.7.4
#1 lore raw

Hello Marcin,

Quoted 17 lines · On 07/06/2016 02:43 PM, [email protected] wrote:

From: Marcin Krzeminski <[email protected]>

Winbond also support continuous read mode, but as an opposite for other flash type read mode clock cycles are included to dummy cycles number. This path add proper handling of read mode byte and update needed dummy cycles. QPI mode and dummy cycles configuration are not supported.

---
 hw/block/m25p80.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
hw/block/m25p80.c +0 -0
index d9b2793..a349544 100644

hw/block/m25p80.c typedef struct FlashPartInfo { · line 152

Quoted 4 lines
hw/block/m25p80.c +1 -0
@@ -149,6 +149,7 @@ typedef struct FlashPartInfo {
 */
 
 #define SPANSION_CONTINUOUS_READ_MODE_CMD_LEN 1
+#define WINBOND_CONTINUOUS_READ_MODE_CMD_LEN 1

I checked the W25Q256FV datasheet and

hw/block/m25p80.c static void decode_dio_read_cmd(Flash *s) · line 779

Quoted 8 lines
hw/block/m25p80.c +1 -1
 static const FlashPartInfo known_devices[] = {
     /* Atmel -- some are (confusingly) marketed as "DataFlash" */
@@ -775,7 +776,7 @@ static void decode_dio_read_cmd(Flash *s)
     /* Dummy cycles modeled with bytes writes instead of bits */
     switch (get_man(s)) {
     case MAN_WINBOND:
-        s->needed_bytes += 8;
+        s->needed_bytes += WINBOND_CONTINUOUS_READ_MODE_CMD_LEN;

this looks fine,

hw/block/m25p80.c static void decode_qio_read_cmd(Flash *s) · line 819

Quoted 10 lines
hw/block/m25p80.c +2 -1
         break;
     case MAN_SPANSION:
         s->needed_bytes += SPANSION_CONTINUOUS_READ_MODE_CMD_LEN;
@@ -814,7 +815,8 @@ static void decode_qio_read_cmd(Flash *s)
     /* Dummy cycles modeled with bytes writes instead of bits */
     switch (get_man(s)) {
     case MAN_WINBOND:
-        s->needed_bytes += 8;
+        s->needed_bytes += WINBOND_CONTINUOUS_READ_MODE_CMD_LEN;
+        s->needed_bytes += 4;

but I don't understand the above. I see the address + M7-0 + 2 dummies.

Thanks,

C.

Quoted 4 lines
hw/block/m25p80.c +0 -0
         break;
     case MAN_SPANSION:
         s->needed_bytes += SPANSION_CONTINUOUS_READ_MODE_CMD_LEN;
#2 lore raw
Quoted 62 lines

-----Original Message-----
From: Cédric Le Goater [mailto:[email protected]]
Sent: Thursday, July 07, 2016 2:57 PM
To: Krzeminski, Marcin (Nokia - PL/Wroclaw) <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] m25p80: Fix QIOR/DIOR handling for Winbond

Hello Marcin,

Quoted 4 lines · On 07/06/2016 02:43 PM, [email protected] wrote:

From: Marcin Krzeminski <[email protected]>

Winbond also support continuous read mode, but as an opposite for other flash type read mode clock cycles are included to dummy cycles

number.

Quoted 2 lines

This path add proper handling of read mode byte and update needed dummy cycles. QPI mode and dummy cycles configuration are not

supported.

Quoted 11 lines
---
 hw/block/m25p80.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
hw/block/m25p80.c index renamed from hw/block/m25p80.c +0 -0

d9b2793..a349544 100644

hw/block/m25p80.c typedef struct FlashPartInfo { */ · line 151

Quoted 3 lines
hw/block/m25p80.c +1 -0
@@ -149,6 +149,7 @@ typedef struct FlashPartInfo {  */
 
 #define SPANSION_CONTINUOUS_READ_MODE_CMD_LEN 1
+#define WINBOND_CONTINUOUS_READ_MODE_CMD_LEN 1

I checked the W25Q256FV datasheet and

hw/block/m25p80.c static void decode_dio_read_cmd(Flash *s)

Quoted 8 lines
hw/block/m25p80.c +1 -2
 static const FlashPartInfo known_devices[] = {
     /* Atmel -- some are (confusingly) marketed as "DataFlash" */ @@
-775,7 +776,7 @@ static void decode_dio_read_cmd(Flash *s)
     /* Dummy cycles modeled with bytes writes instead of bits */
     switch (get_man(s)) {
     case MAN_WINBOND:
-        s->needed_bytes += 8;
+        s->needed_bytes +=

WINBOND_CONTINUOUS_READ_MODE_CMD_LEN;

this looks fine,

Quoted 3 lines
         break;
     case MAN_SPANSION:
         s->needed_bytes +=

SPANSION_CONTINUOUS_READ_MODE_CMD_LEN;

hw/block/m25p80.c static void decode_qio_read_cmd(Flash *s) · line 818

Quoted 6 lines
hw/block/m25p80.c +1 -1
@@ -814,7 +815,8 @@ static void decode_qio_read_cmd(Flash *s)
     /* Dummy cycles modeled with bytes writes instead of bits */
     switch (get_man(s)) {
     case MAN_WINBOND:
-        s->needed_bytes += 8;
+        s->needed_bytes +=

WINBOND_CONTINUOUS_READ_MODE_CMD_LEN;

Quoted 4 lines

hw/block/m25p80.c static void decode_qio_read_cmd(Flash *s) · line 819

Quoted 1 line
hw/block/m25p80.c +1 -0
+        s->needed_bytes += 4;

but I don't understand the above. I see the address + M7-0 + 2 dummies.

Hello Cedric,

This is because the problematic interface in here. Generally you need to send 2 dummy bytes, but this is four clocks in this mode (Fig 24a). I want to send a proposal to change this dummy clock interface after 2.7 will be released, because now it is really confusing and unclear.

Thanks,
Marcin

Quoted 9 lines

Thanks,

C.

hw/block/m25p80.c static void decode_dio_read_cmd(Flash *s)

Quoted 3 lines
hw/block/m25p80.c +0 -0
         break;
     case MAN_SPANSION:
         s->needed_bytes +=

SPANSION_CONTINUOUS_READ_MODE_CMD_LEN;

Quoted 1 line
#3 lore raw
Quoted 20 lines · Marcin (Nokia - PL/Wroclaw)
Quoted 20 lines

-----Original Message-----
From: Cédric Le Goater [mailto:[email protected]]

Quoted 3 lines · On 07/06/2016 02:43 PM, [email protected] wrote:
         break;
     case MAN_SPANSION:
         s->needed_bytes +=

SPANSION_CONTINUOUS_READ_MODE_CMD_LEN;

hw/block/m25p80.c static void decode_qio_read_cmd(Flash *s) · line 818

Quoted 6 lines
hw/block/m25p80.c +1 -1
@@ -814,7 +815,8 @@ static void decode_qio_read_cmd(Flash *s)
     /* Dummy cycles modeled with bytes writes instead of bits */
     switch (get_man(s)) {
     case MAN_WINBOND:
-        s->needed_bytes += 8;
+        s->needed_bytes +=

WINBOND_CONTINUOUS_READ_MODE_CMD_LEN;

Quoted 1 line
hw/block/m25p80.c +1 -0
+        s->needed_bytes += 4;
Quoted 8 lines
Quoted 2 lines

but I don't understand the above. I see the address + M7-0 + 2 dummies.

Hello Cedric,

This is because the problematic interface in here. Generally you need to send 2 dummy bytes, but this is four clocks in this mode (Fig 24a). I want to send a proposal to change this dummy clock interface after 2.7 will be released, because now it is really confusing and unclear.

Cedric, could you let me know if you're happy with this patch now? If you are you can provide a reviewed-by tag and I can apply it to target-arm.next...

thanks
-- PMM

Reviewed-by
#4 lore raw

Hello Peter,

Quoted 26 lines · Peter Maydell
Quoted 24 lines · Marcin (Nokia - PL/Wroclaw)
Quoted 18 lines

-----Original Message-----
From: Cédric Le Goater [mailto:[email protected]]

Quoted 3 lines · On 07/06/2016 02:43 PM, [email protected] wrote:
         break;
     case MAN_SPANSION:
         s->needed_bytes +=

SPANSION_CONTINUOUS_READ_MODE_CMD_LEN;

hw/block/m25p80.c static void decode_qio_read_cmd(Flash *s) · line 818

Quoted 6 lines
hw/block/m25p80.c +1 -1
@@ -814,7 +815,8 @@ static void decode_qio_read_cmd(Flash *s)
     /* Dummy cycles modeled with bytes writes instead of bits */
     switch (get_man(s)) {
     case MAN_WINBOND:
-        s->needed_bytes += 8;
+        s->needed_bytes +=

WINBOND_CONTINUOUS_READ_MODE_CMD_LEN;

Quoted 4 lines

hw/block/m25p80.c static void decode_qio_read_cmd(Flash *s) · line 819

Quoted 1 line
hw/block/m25p80.c +1 -0
+        s->needed_bytes += 4;

but I don't understand the above. I see the address + M7-0 + 2 dummies.

Hello Cedric,

Quoted 8 lines
Quoted 4 lines

This is because the problematic interface in here. Generally you need to send 2 dummy bytes, but this is four clocks in this mode (Fig 24a). I want to send a proposal to change this dummy clock interface after 2.7 will be released, because now it is really confusing and unclear.

Cedric, could you let me know if you're happy with this patch now? If you are you can provide a reviewed-by tag and I can apply it to target-arm.next...

Yes. It should be fine and Marcin has plans for 2.8 to clarify all that. Let's move forward :

Thanks,

C.