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 <raemae...@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


Reply via email to