qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: m25p80: fix dummy byte count read from spansion cfg register
@ 2022-11-08 17:06 Ramon Aerne
  0 siblings, 0 replies; only message in thread
From: Ramon Aerne @ 2022-11-08 17:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, alistair, kwolf, hreitz

Spansion nor-flash stores the dummy read count in bits in a config register.
This is currently read and used as the byte count which is wrong.

This patch fixes this bit to byte conversion without warning about
unsupported configurations (such as bits % 8 != 0)

Signed-off-by: Ramon Aerne <raemaerne@gmail.com>
---
 hw/block/m25p80.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index 02adc87..cf10b11 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -981,7 +981,7 @@ static void decode_fast_read_cmd(Flash *s)
         s->needed_bytes += extract32(s->spansion_cr2v,
                                     SPANSION_DUMMY_CLK_POS,
                                     SPANSION_DUMMY_CLK_LEN
-                                    );
+                                    ) / 8;
         break;
     case MAN_ISSI:
         /*
@@ -1017,7 +1017,7 @@ static void decode_dio_read_cmd(Flash *s)
         s->needed_bytes += extract32(s->spansion_cr2v,
                                     SPANSION_DUMMY_CLK_POS,
                                     SPANSION_DUMMY_CLK_LEN
-                                    );
+                                    ) / 8;
         break;
     case MAN_NUMONYX:
         s->needed_bytes += numonyx_extract_cfg_num_dummies(s);
@@ -1067,7 +1067,7 @@ static void decode_qio_read_cmd(Flash *s)
         s->needed_bytes += extract32(s->spansion_cr2v,
                                     SPANSION_DUMMY_CLK_POS,
                                     SPANSION_DUMMY_CLK_LEN
-                                    );
+                                    ) / 8;
         break;
     case MAN_NUMONYX:
         s->needed_bytes += numonyx_extract_cfg_num_dummies(s);
-- 
2.25.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-08 17:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-08 17:06 [PATCH] block: m25p80: fix dummy byte count read from spansion cfg register Ramon Aerne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).