[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/11] m25p80: Improve command handling for Jedec commands
From: |
Peter Maydell |
Subject: |
[PULL 08/11] m25p80: Improve command handling for Jedec commands |
Date: |
Tue, 17 Mar 2020 11:40:36 +0000 |
From: Guenter Roeck <address@hidden>
When requesting JEDEC data using the JEDEC_READ command, the Linux kernel
always requests 6 bytes. The current implementation only returns three
bytes, and interprets the remaining three bytes as new commands.
While this does not matter most of the time, it is at the very least
confusing. To avoid the problem, always report up to 6 bytes of JEDEC
data. Fill remaining data with 0.
Signed-off-by: Guenter Roeck <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Alistair Francis <address@hidden>
Reviewed-by: Cédric Le Goater <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>
---
hw/block/m25p80.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index 5ff8d270c4a..53bf63856f5 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -1040,8 +1040,11 @@ static void decode_new_cmd(Flash *s, uint32_t value)
for (i = 0; i < s->pi->id_len; i++) {
s->data[i] = s->pi->id[i];
}
+ for (; i < SPI_NOR_MAX_ID_LEN; i++) {
+ s->data[i] = 0;
+ }
- s->len = s->pi->id_len;
+ s->len = SPI_NOR_MAX_ID_LEN;
s->pos = 0;
s->state = STATE_READING_DATA;
break;
--
2.20.1
- [PULL 00/11] target-arm queue, Peter Maydell, 2020/03/17
- [PULL 02/11] hw/arm/fsl-imx6ul: Fix USB interrupt numbers, Peter Maydell, 2020/03/17
- [PULL 01/11] hw/usb: Add basic i.MX USB Phy support, Peter Maydell, 2020/03/17
- [PULL 03/11] hw/arm/fsl-imx6ul: Instantiate unimplemented pwm and can devices, Peter Maydell, 2020/03/17
- [PULL 04/11] hw/arm/fsl-imx6ul: Wire up USB controllers, Peter Maydell, 2020/03/17
- [PULL 05/11] hw/arm/fsl-imx6: Wire up USB controllers, Peter Maydell, 2020/03/17
- [PULL 06/11] hw/net/imx_fec: write TGSR and TCSR3 in imx_enet_write(), Peter Maydell, 2020/03/17
- [PULL 08/11] m25p80: Improve command handling for Jedec commands,
Peter Maydell <=
- [PULL 07/11] m25p80: Convert to support tracing, Peter Maydell, 2020/03/17
- [PULL 09/11] m25p80: Improve command handling for unsupported commands, Peter Maydell, 2020/03/17
- [PULL 11/11] hw/arm/pxa2xx: Do not wire up OHCI for PXA255, Peter Maydell, 2020/03/17
- [PULL 10/11] aspeed/smc: Fix number of dummy cycles for FAST_READ_4 command, Peter Maydell, 2020/03/17
- Re: [PULL 00/11] target-arm queue, Peter Maydell, 2020/03/17