m25p80: Add SFDP support
Subsystems (2)
v4 cover m25p80: Add SFDP support
Hello,
This patchset adds support for JEDEC STANDARD JESD216 Serial Flash Discovery Parameters (SFDP). SFDP describes the features of a serial flash device using a set of internal parameter tables. Support in Linux has been added some time ago and the spi-nor driver is using it more often to detect the flash settings and even flash models.
Thanks,
C.
Changes in v4:
- fixed definition of mx25l25635e
- removed extern
- new patches from Patrick
Changes in v3:
- refresh after 2 years
Cédric Le Goater (9):
m25p80: Add basic support for the SFDP command
m25p80: Add the n25q256a SFDP table
m25p80: Add erase size for mx25l25635e
m25p80: Add the mx25l25635e SFPD table
m25p80: Add the mx25l25635f SFPD table
m25p80: Add the mx66l1g45g SFDP table
m25p80: Add the w25q256 SFPD table
m25p80: Add the w25q512jv SFPD table
arm/aspeed: Replace mx25l25635e chip model
Patrick Williams (1):
m25p80: Add the w25q01jvq SFPD table
hw/block/m25p80_sfdp.h | 29 ++++ hw/arm/aspeed.c | 6 +- hw/block/m25p80.c | 52 ++++++- hw/block/m25p80_sfdp.c | 332 +++++++++++++++++++++++++++++++++++++++++ MAINTAINERS | 2 +- hw/block/meson.build | 1 + hw/block/trace-events | 1 + 7 files changed, 411 insertions(+), 12 deletions(-) create mode 100644 hw/block/m25p80_sfdp.h create mode 100644 hw/block/m25p80_sfdp.c
Signature · 1 line
2.37.3
PATCH v4 1/10 m25p80: Add basic support for the SFDP command
JEDEC STANDARD JESD216 for Serial Flash Discovery Parameters (SFDP) provides a mean to describe the features of a serial flash device using a set of internal parameter tables.
This is the initial framework for the RDSFDP command giving access to a private SFDP area under the flash. This area now needs to be populated with the flash device characteristics, using a new 'sfdp_read' handler under FlashPartInfo.
Message-Id: <[email protected]>
--- hw/block/m25p80_sfdp.h | 18 ++++++++++++++++++ hw/block/m25p80.c | 27 +++++++++++++++++++++++++++ MAINTAINERS | 2 +- hw/block/trace-events | 1 + 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 hw/block/m25p80_sfdp.h
hw/block/m25p80_sfdp.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* M25P80 SFDP +* +* Copyright (c) 2020, IBM Corporation. +* +* This code is licensed under the GPL version 2 or later. See the +* COPYING file in the top-level directory. +*/ + +#ifndef HW_M25P80_SFDP_H +#define HW_M25P80_SFDP_H + +/* +* SFDP area has a 3 bytes address space. +*/ +#define M25P80_SFDP_MAX_SIZE (1 << 24) + +#endif
hw/block/m25p80.c +27 -0
@@ -35,6 +35,7 @@#include "qapi/error.h" #include "trace.h" #include "qom/object.h" +#include "m25p80_sfdp.h" /* 16 MiB max in 3 byte address mode */ #define MAX_3BYTES_SIZE 0x1000000
@@ -72,6 +73,7 @@ typedef struct FlashPartInfo {* This field inform how many die is in the chip. */ uint8_t die_cnt; +uint8_t (*sfdp_read)(uint32_t sfdp_addr); } FlashPartInfo;/* adapted from linux */
@@ -355,6 +357,7 @@ typedef enum {BULK_ERASE =0xc7 ,READ_FSR =0x70 ,RDCR =0x15 , +RDSFDP =0x5a ,READ =0x03 , READ4 = 0x13,
@@ -421,6 +424,7 @@ typedef enum {STATE_COLLECTING_DATA ,STATE_COLLECTING_VAR_LEN_DATA ,STATE_READING_DATA , +STATE_READING_SFDP , } CMDState; typedef enum {
@@ -679,6 +683,8 @@ static inline int get_addr_length(Flash *s) }switch (s->cmd_in_progress) { +case RDSFDP : +return 3 ;case PP4 :case PP4_4 :case QPP_4 :
@@ -823,6 +829,11 @@ static void complete_collecting_data(Flash *s) " by device\n"); }break ; + +case RDSFDP : + s->state =STATE_READING_SFDP ; +break ; +default :break ; }
@@ -1431,6 +1442,16 @@ static void decode_new_cmd(Flash *s, uint32_t value)qemu_log_mask (LOG_GUEST_ERROR ,"M25P80: Unknown cmd %x\n" , value); }break ; +case RDSFDP : +if (s->pi->sfdp_read) { + s->needed_bytes =get_addr_length (s) +1 ;/* SFDP addr + dummy */ + s->pos =0 ; + s->len =0 ; + s->state =STATE_COLLECTING_DATA ; +break ; + } +/* Fallthrough */ +default : s->pos =0 ; s->len =1 ;
@@ -1538,6 +1559,12 @@ static uint32_t m25p80_transfer8(SSIPeripheral *ss, uint32_t tx) } }break ; +case STATE_READING_SFDP : +assert (s->pi->sfdp_read); + r = s->pi->sfdp_read (s->cur_addr); +trace_m25p80_read_sfdp (s, s->cur_addr, (uint8_t )r); + s->cur_addr = (s->cur_addr +1 ) & (M25P80_SFDP_MAX_SIZE -1 ); +break ;default :case STATE_IDLE :
MAINTAINERS +1 -1
@@ -1915,7 +1915,7 @@ SSI M: Alistair Francis <[email protected]> S: Maintained F: hw/ssi/* -F: hw/block/m25p80.c +F: hw/block/m25p80* F: include/hw/ssi/ssi.h X: hw/ssi/xilinx_* F: tests/qtest/m25p80-test.c
hw/block/trace-events +1 -0
@@ -80,5 +80,6 @@ m25p80_page_program(void *s, uint32_t addr, uint8_t tx) "[%p] page program cur_a m25p80_transfer(void *s, uint8_t state, uint32_t len, uint8_t needed, uint32_t pos, uint32_t cur_addr, uint8_t t) "[%p] Transfer state 0x%"PRIx8" len 0x%"PRIx32" needed 0x%"PRIx8" pos 0x%"PRIx32" addr 0x%"PRIx32" tx 0x%"PRIx8 m25p80_read_byte(void *s, uint32_t addr, uint8_t v) "[%p] Read byte 0x%"PRIx32"=0x%"PRIx8 m25p80_read_data(void *s, uint32_t pos, uint8_t v) "[%p] Read data 0x%"PRIx32"=0x%"PRIx8 +m25p80_read_sfdp(void *s, uint32_t addr, uint8_t v) "[%p] Read SFDP 0x%"PRIx32"=0x%"PRIx8 m25p80_binding(void *s) "[%p] Binding to IF_MTD drive" m25p80_binding_no_bdrv(void *s) "[%p] No BDRV - binding to RAM"
Signature · 1 line
2.37.3
PATCH v4 2/10 m25p80: Add the n25q256a SFDP table
In reply to Cédric Le GoaterThe same values were collected on 4 differents OpenPower systems, palmettos, romulus and tacoma.
The SFDP table size is defined as being 0x100 bytes but it could be bigger. Only the mandatory table for basic features is available at byte 0x30.
Message-Id: <[email protected]>
--- hw/block/m25p80_sfdp.h | 2 ++ hw/block/m25p80.c | 8 +++--- hw/block/m25p80_sfdp.c | 58 ++++++++++++++++++++++++++++++++++++++++++ hw/block/meson.build | 1 + 4 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 hw/block/m25p80_sfdp.c
hw/block/m25p80_sfdp.h +2 -0
@@ -15,4 +15,6 @@*/ #define M25P80_SFDP_MAX_SIZE (1 << 24) +uint8_t m25p80_sfdp_n25q256a (uint32_t addr); +#endif
hw/block/m25p80.c +5 -3
@@ -247,13 +247,15 @@ static const FlashPartInfo known_devices[] = { { INFO("n25q128a11", 0x20bb18, 0, 64 << 10, 256, ER_4K) }, { INFO("n25q128a13", 0x20ba18, 0, 64 << 10, 256, ER_4K) }, { INFO("n25q256a11", 0x20bb19, 0, 64 << 10, 512, ER_4K) }, - { INFO("n25q256a13", 0x20ba19, 0, 64 << 10, 512, ER_4K) }, + { INFO("n25q256a13", 0x20ba19, 0, 64 << 10, 512, ER_4K), + .sfdp_read = m25p80_sfdp_n25q256a }, { INFO("n25q512a11", 0x20bb20, 0, 64 << 10, 1024, ER_4K) }, { INFO("n25q512a13", 0x20ba20, 0, 64 << 10, 1024, ER_4K) }, { INFO("n25q128", 0x20ba18, 0, 64 << 10, 256, 0) }, { INFO("n25q256a", 0x20ba19, 0, 64 << 10, 512, - ER_4K | HAS_SR_BP3_BIT6 | HAS_SR_TB) }, - { INFO("n25q512a", 0x20ba20, 0, 64 << 10, 1024, ER_4K) }, +ER_4K |HAS_SR_BP3_BIT6 |HAS_SR_TB ), + .sfdp_read = m25p80_sfdp_n25q256a }, + { INFO("n25q512a", 0x20ba20, 0, 64 << 10, 1024, ER_4K) }, { INFO("n25q512ax3", 0x20ba20, 0x1000, 64 << 10, 1024, ER_4K) }, { INFO("mt25ql512ab", 0x20ba20, 0x1044, 64 << 10, 1024, ER_4K | ER_32K) }, { INFO_STACKED("mt35xu01g", 0x2c5b1b, 0x104100, 128 << 10, 1024,
hw/block/m25p80_sfdp.c new file +58 -0
58 lines not on this page · raw message
hw/block/meson.build +1 -0
@@ -12,6 +12,7 @@ softmmu_ss.add(when: 'CONFIG_ONENAND', if_true: files('onenand.c')) softmmu_ss.add(when: 'CONFIG_PFLASH_CFI01', if_true: files('pflash_cfi01.c')) softmmu_ss.add(when: 'CONFIG_PFLASH_CFI02', if_true: files('pflash_cfi02.c')) softmmu_ss.add(when: 'CONFIG_SSI_M25P80', if_true: files('m25p80.c')) +softmmu_ss.add(when: 'CONFIG_SSI_M25P80', if_true: files('m25p80_sfdp.c')) softmmu_ss.add(when: 'CONFIG_SWIM', if_true: files('swim.c')) softmmu_ss.add(when: 'CONFIG_XEN', if_true: files('xen-block.c')) softmmu_ss.add(when: 'CONFIG_TC58128', if_true: files('tc58128.c'))
Signature · 1 line
2.37.3
PATCH v4 3/10 m25p80: Add erase size for mx25l25635e
In reply to Cédric Le Goater--- hw/block/m25p80.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/block/m25p80.c +2 -1
@@ -232,7 +232,8 @@ static const FlashPartInfo known_devices[] = { { INFO("mx25l6405d", 0xc22017, 0, 64 << 10, 128, 0) }, { INFO("mx25l12805d", 0xc22018, 0, 64 << 10, 256, 0) }, { INFO("mx25l12855e", 0xc22618, 0, 64 << 10, 256, 0) }, - { INFO6("mx25l25635e", 0xc22019, 0xc22019, 64 << 10, 512, 0) }, + { INFO6("mx25l25635e", 0xc22019, 0xc22019, 64 << 10, 512, + ER_4K | ER_32K) }, { INFO("mx25l25655e", 0xc22619, 0, 64 << 10, 512, 0) }, { INFO("mx66l51235f", 0xc2201a, 0, 64 << 10, 1024, ER_4K | ER_32K) }, { INFO("mx66u51235f", 0xc2253a, 0, 64 << 10, 1024, ER_4K | ER_32K) },
Signature · 1 line
2.37.3
Re: [PATCH v4 03/10] m25p80: Add erase size for mx25l25635e
Quoted 1 line · Cédric Le Goater
Signed-off-by Cédric Le Goater <[email protected]>
Quoted 21 lines
--- hw/block/m25p80.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/block/m25p80.c +2
-1@@ -232,7 +232,8 @@ static const FlashPartInfo known_devices[] = { { INFO("mx25l6405d", 0xc22017, 0, 64 << 10, 128, 0) }, { INFO("mx25l12805d", 0xc22018, 0, 64 << 10, 256, 0) }, { INFO("mx25l12855e", 0xc22618, 0, 64 << 10, 256, 0) }, - { INFO6("mx25l25635e", 0xc22019, 0xc22019, 64 << 10, 512, 0) }, + { INFO6("mx25l25635e", 0xc22019, 0xc22019, 64 << 10, 512, + ER_4K | ER_32K) }, { INFO("mx25l25655e", 0xc22619, 0, 64 << 10, 512, 0) }, { INFO("mx66l51235f", 0xc2201a, 0, 64 << 10, 1024, ER_4K | ER_32K) }, { INFO("mx66u51235f", 0xc2253a, 0, 64 << 10, 1024, ER_4K | ER_32K) },Signature · 1 line
2.37.3
PATCH v4 4/10 m25p80: Add the mx25l25635e SFPD table
In reply to Cédric Le GoaterThe SFDP table is 0x80 bytes long. The mandatory table for basic features is available at byte 0x30 and an extra Macronix specific table is available at 0x60.
4B opcodes are not supported.
Message-Id: <[email protected]>
--- hw/block/m25p80_sfdp.h | 3 +++ hw/block/m25p80.c | 2 +- hw/block/m25p80_sfdp.c | 26 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-)
hw/block/m25p80_sfdp.h +3 -0
@@ -17,4 +17,7 @@uint8_t m25p80_sfdp_n25q256a (uint32_t addr); +uint8_t m25p80_sfdp_mx25l25635e (uint32_t addr); + +#endif
hw/block/m25p80.c +1 -1
@@ -233,7 +233,7 @@ static const FlashPartInfo known_devices[] = { { INFO("mx25l12805d", 0xc22018, 0, 64 << 10, 256, 0) }, { INFO("mx25l12855e", 0xc22618, 0, 64 << 10, 256, 0) }, { INFO6("mx25l25635e", 0xc22019, 0xc22019, 64 << 10, 512, - ER_4K | ER_32K) }, + ER_4K | ER_32K), .sfdp_read = m25p80_sfdp_mx25l25635e }, { INFO("mx25l25655e", 0xc22619, 0, 64 << 10, 512, 0) }, { INFO("mx66l51235f", 0xc2201a, 0, 64 << 10, 1024, ER_4K | ER_32K) }, { INFO("mx66u51235f", 0xc2253a, 0, 64 << 10, 1024, ER_4K | ER_32K) },
hw/block/m25p80_sfdp.c +26 -0
@@ -56,3 +56,29 @@ static const uint8_t sfdp_n25q256a[] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , };define_sfdp_read (n25q256a); + + +/* +* Matronix +*/ + +/* mx25l25635e. No 4B opcodes */ +static const uint8_t sfdp_mx25l25635e[] = { +0x53 ,0x46 ,0x44 ,0x50 ,0x00 ,0x01 ,0x01 ,0xff , +0x00 ,0x00 ,0x01 ,0x09 ,0x30 ,0x00 ,0x00 ,0xff , +0xc2 ,0x00 ,0x01 ,0x04 ,0x60 ,0x00 ,0x00 ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xe5 ,0x20 ,0xf3 ,0xff ,0xff ,0xff ,0xff ,0x0f , +0x44 ,0xeb ,0x08 ,0x6b ,0x08 ,0x3b ,0x04 ,0xbb , +0xee ,0xff ,0xff ,0xff ,0xff ,0xff ,0x00 ,0xff , +0xff ,0xff ,0x00 ,0xff ,0x0c ,0x20 ,0x0f ,0x52 , +0x10 ,0xd8 ,0x00 ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0x00 ,0x36 ,0x00 ,0x27 ,0xf7 ,0x4f ,0xff ,0xff , +0xd9 ,0xc8 ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +}; +define_sfdp_read (mx25l25635e)
Signature · 1 line
2.37.3
PATCH v4 5/10 m25p80: Add the mx25l25635f SFPD table
In reply to Cédric Le GoaterThe mx25l25635e and mx25l25635f chips have the same JEDEC id but the mx25l25635f has more capabilities reported in the SFDP table. Support for 4B opcodes is of interest because it is exploited by the Linux kernel.
The SFDP table size is 0x200 bytes long. The mandatory table for basic features is available at byte 0x30 and an extra Macronix specific table is available at 0x60.
Message-Id: <[email protected]>
--- hw/block/m25p80_sfdp.h | 1 + hw/block/m25p80.c | 2 ++ hw/block/m25p80_sfdp.c | 68 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+)
hw/block/m25p80_sfdp.h +1 -0
@@ -18,6 +18,7 @@uint8_t m25p80_sfdp_n25q256a (uint32_t addr);uint8_t m25p80_sfdp_mx25l25635e (uint32_t addr); +uint8_t m25p80_sfdp_mx25l25635f (uint32_t addr);#endif
hw/block/m25p80.c +2 -0
@@ -234,6 +234,8 @@ static const FlashPartInfo known_devices[] = { { INFO("mx25l12855e", 0xc22618, 0, 64 << 10, 256, 0) }, { INFO6("mx25l25635e", 0xc22019, 0xc22019, 64 << 10, 512, ER_4K | ER_32K), .sfdp_read = m25p80_sfdp_mx25l25635e }, + { INFO6("mx25l25635f", 0xc22019, 0xc22019, 64 << 10, 512, + ER_4K | ER_32K), .sfdp_read = m25p80_sfdp_mx25l25635f }, { INFO("mx25l25655e", 0xc22619, 0, 64 << 10, 512, 0) }, { INFO("mx66l51235f", 0xc2201a, 0, 64 << 10, 1024, ER_4K | ER_32K) }, { INFO("mx66u51235f", 0xc2253a, 0, 64 << 10, 1024, ER_4K | ER_32K) },
hw/block/m25p80_sfdp.c +68 -0
71 lines not on this page · raw message
Signature · 1 line
2.37.3
PATCH v4 6/10 m25p80: Add the mx66l1g45g SFDP table
In reply to Cédric Le GoaterThe SFDP table size is 0x200 bytes long. The mandatory table for basic features is available at byte 0x30 plus some more Macronix specific tables.
Message-Id: <[email protected]>
--- hw/block/m25p80_sfdp.h | 2 +- hw/block/m25p80.c | 3 +- hw/block/m25p80_sfdp.c | 68 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 2 deletions(-)
hw/block/m25p80_sfdp.h +1 -1
@@ -19,6 +19,6 @@ uint8_t m25p80_sfdp_n25q256a(uint32_t addr);uint8_t m25p80_sfdp_mx25l25635e (uint32_t addr);uint8_t m25p80_sfdp_mx25l25635f (uint32_t addr); - +uint8_t m25p80_sfdp_mx66l1g45g (uint32_t addr);#endif
hw/block/m25p80.c +2 -1
@@ -240,7 +240,8 @@ static const FlashPartInfo known_devices[] = { { INFO("mx66l51235f", 0xc2201a, 0, 64 << 10, 1024, ER_4K | ER_32K) }, { INFO("mx66u51235f", 0xc2253a, 0, 64 << 10, 1024, ER_4K | ER_32K) }, { INFO("mx66u1g45g", 0xc2253b, 0, 64 << 10, 2048, ER_4K | ER_32K) }, - { INFO("mx66l1g45g", 0xc2201b, 0, 64 << 10, 2048, ER_4K | ER_32K) }, + { INFO("mx66l1g45g", 0xc2201b, 0, 64 << 10, 2048, ER_4K | ER_32K), + .sfdp_read = m25p80_sfdp_mx66l1g45g },/* Micron */ { INFO("n25q032a11", 0x20bb16, 0, 64 << 10, 64, ER_4K) },
hw/block/m25p80_sfdp.c +68 -0
71 lines not on this page · raw message
Signature · 1 line
2.37.3
PATCH v4 7/10 m25p80: Add the w25q256 SFPD table
In reply to Cédric Le GoaterThe SFDP table size is 0x100 bytes long. Only the mandatory table for basic features is available at byte 0x80.
Message-Id: <[email protected]>
--- hw/block/m25p80_sfdp.h | 2 ++ hw/block/m25p80.c | 3 ++- hw/block/m25p80_sfdp.c | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-)
hw/block/m25p80_sfdp.h +2 -0
@@ -21,4 +21,6 @@ uint8_t m25p80_sfdp_mx25l25635e(uint32_t addr);uint8_t m25p80_sfdp_mx25l25635f (uint32_t addr);uint8_t m25p80_sfdp_mx66l1g45g (uint32_t addr); +uint8_t m25p80_sfdp_w25q256 (uint32_t addr); +#endif
hw/block/m25p80.c +2 -1
@@ -345,7 +345,8 @@ static const FlashPartInfo known_devices[] = { { INFO("w25q64", 0xef4017, 0, 64 << 10, 128, ER_4K) }, { INFO("w25q80", 0xef5014, 0, 64 << 10, 16, ER_4K) }, { INFO("w25q80bl", 0xef4014, 0, 64 << 10, 16, ER_4K) }, - { INFO("w25q256", 0xef4019, 0, 64 << 10, 512, ER_4K) }, + { INFO("w25q256", 0xef4019, 0, 64 << 10, 512, ER_4K), + .sfdp_read = m25p80_sfdp_w25q256 }, { INFO("w25q512jv", 0xef4020, 0, 64 << 10, 1024, ER_4K) }, { INFO("w25q01jvq", 0xef4021, 0, 64 << 10, 2048, ER_4K) }, };
hw/block/m25p80_sfdp.c +40 -0
@@ -218,3 +218,43 @@ static const uint8_t sfdp_mx66l1g45g[] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , };define_sfdp_read (mx66l1g45g); + +/* +* Windbond +*/ + +static const uint8_t sfdp_w25q256[] = { +0x53 ,0x46 ,0x44 ,0x50 ,0x00 ,0x01 ,0x00 ,0xff , +0x00 ,0x00 ,0x01 ,0x09 ,0x80 ,0x00 ,0x00 ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xe5 ,0x20 ,0xf3 ,0xff ,0xff ,0xff ,0xff ,0x0f , +0x44 ,0xeb ,0x08 ,0x6b ,0x08 ,0x3b ,0x42 ,0xbb , +0xfe ,0xff ,0xff ,0xff ,0xff ,0xff ,0x00 ,0x00 , +0xff ,0xff ,0x21 ,0xeb ,0x0c ,0x20 ,0x0f ,0x52 , +0x10 ,0xd8 ,0x00 ,0x00 ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +}; +define_sfdp_read (w25q256);
Signature · 1 line
2.37.3
PATCH v4 8/10 m25p80: Add the w25q512jv SFPD table
In reply to Cédric Le GoaterThe SFDP table size is 0x100 bytes long. The mandatory table for basic features is available at byte 0x80 and two extra Winbond specifics table are available at 0xC0 and 0xF0.
Message-Id: <[email protected]>
--- hw/block/m25p80_sfdp.h | 1 + hw/block/m25p80.c | 3 ++- hw/block/m25p80_sfdp.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-)
hw/block/m25p80_sfdp.h +1 -0
@@ -22,5 +22,6 @@ uint8_t m25p80_sfdp_mx25l25635f(uint32_t addr);uint8_t m25p80_sfdp_mx66l1g45g (uint32_t addr);uint8_t m25p80_sfdp_w25q256 (uint32_t addr); +uint8_t m25p80_sfdp_w25q512jv (uint32_t addr);#endif
hw/block/m25p80.c +2 -1
@@ -347,7 +347,8 @@ static const FlashPartInfo known_devices[] = { { INFO("w25q80bl", 0xef4014, 0, 64 << 10, 16, ER_4K) }, { INFO("w25q256", 0xef4019, 0, 64 << 10, 512, ER_4K), .sfdp_read = m25p80_sfdp_w25q256 }, - { INFO("w25q512jv", 0xef4020, 0, 64 << 10, 1024, ER_4K) }, + { INFO("w25q512jv", 0xef4020, 0, 64 << 10, 1024, ER_4K), + .sfdp_read = m25p80_sfdp_w25q512jv }, { INFO("w25q01jvq", 0xef4021, 0, 64 << 10, 2048, ER_4K) }, };
hw/block/m25p80_sfdp.c +36 -0
@@ -258,3 +258,39 @@ static const uint8_t sfdp_w25q256[] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , };define_sfdp_read (w25q256); + +static const uint8_t sfdp_w25q512jv[] = { +0x53 ,0x46 ,0x44 ,0x50 ,0x06 ,0x01 ,0x01 ,0xff , +0x00 ,0x06 ,0x01 ,0x10 ,0x80 ,0x00 ,0x00 ,0xff , +0x84 ,0x00 ,0x01 ,0x02 ,0xd0 ,0x00 ,0x00 ,0xff , +0x03 ,0x00 ,0x01 ,0x02 ,0xf0 ,0x00 ,0x00 ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xe5 ,0x20 ,0xfb ,0xff ,0xff ,0xff ,0xff ,0x1f , +0x44 ,0xeb ,0x08 ,0x6b ,0x08 ,0x3b ,0x42 ,0xbb , +0xfe ,0xff ,0xff ,0xff ,0xff ,0xff ,0x00 ,0x00 , +0xff ,0xff ,0x40 ,0xeb ,0x0c ,0x20 ,0x0f ,0x52 , +0x10 ,0xd8 ,0x00 ,0x00 ,0x36 ,0x02 ,0xa6 ,0x00 , +0x82 ,0xea ,0x14 ,0xe2 ,0xe9 ,0x63 ,0x76 ,0x33 , +0x7a ,0x75 ,0x7a ,0x75 ,0xf7 ,0xa2 ,0xd5 ,0x5c , +0x19 ,0xf7 ,0x4d ,0xff ,0xe9 ,0x70 ,0xf9 ,0xa5 , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0x0a ,0xf0 ,0xff ,0x21 ,0xff ,0xdc ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +}; +define_sfdp_read (w25q512jv);
Signature · 1 line
2.37.3
PATCH v4 9/10 m25p80: Add the w25q01jvq SFPD table
In reply to Cédric Le GoaterFrom: Patrick Williams <[email protected]>
Generated from hardware using the following command and then padding with 0xff to fill out a power-of-2:
hexdump -v -e '8/1 "0x%02x, " "\n"' sfdp`
Message-Id: <[email protected]>
--- hw/block/m25p80_sfdp.h | 2 ++ hw/block/m25p80.c | 3 ++- hw/block/m25p80_sfdp.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-)
hw/block/m25p80_sfdp.h +2 -0
@@ -24,4 +24,6 @@ uint8_t m25p80_sfdp_mx66l1g45g(uint32_t addr);uint8_t m25p80_sfdp_w25q256 (uint32_t addr);uint8_t m25p80_sfdp_w25q512jv (uint32_t addr); +uint8_t m25p80_sfdp_w25q01jvq (uint32_t addr); +#endif
hw/block/m25p80.c +2 -1
@@ -349,7 +349,8 @@ static const FlashPartInfo known_devices[] = { .sfdp_read = m25p80_sfdp_w25q256 }, { INFO("w25q512jv", 0xef4020, 0, 64 << 10, 1024, ER_4K), .sfdp_read = m25p80_sfdp_w25q512jv }, - { INFO("w25q01jvq", 0xef4021, 0, 64 << 10, 2048, ER_4K) }, + { INFO("w25q01jvq", 0xef4021, 0, 64 << 10, 2048, ER_4K), + .sfdp_read = m25p80_sfdp_w25q01jvq }, }; typedef enum {
hw/block/m25p80_sfdp.c +36 -0
@@ -294,3 +294,39 @@ static const uint8_t sfdp_w25q512jv[] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , };define_sfdp_read (w25q512jv); + +static const uint8_t sfdp_w25q01jvq[] = { +0x53 ,0x46 ,0x44 ,0x50 ,0x06 ,0x01 ,0x01 ,0xff , +0x00 ,0x06 ,0x01 ,0x10 ,0x80 ,0x00 ,0x00 ,0xff , +0x84 ,0x00 ,0x01 ,0x02 ,0xd0 ,0x00 ,0x00 ,0xff , +0x03 ,0x00 ,0x01 ,0x02 ,0xf0 ,0x00 ,0x00 ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xe5 ,0x20 ,0xfb ,0xff ,0xff ,0xff ,0xff ,0x3f , +0x44 ,0xeb ,0x08 ,0x6b ,0x08 ,0x3b ,0x42 ,0xbb , +0xfe ,0xff ,0xff ,0xff ,0xff ,0xff ,0x00 ,0x00 , +0xff ,0xff ,0x40 ,0xeb ,0x0c ,0x20 ,0x0f ,0x52 , +0x10 ,0xd8 ,0x00 ,0x00 ,0x36 ,0x02 ,0xa6 ,0x00 , +0x82 ,0xea ,0x14 ,0xe2 ,0xe9 ,0x63 ,0x76 ,0x33 , +0x7a ,0x75 ,0x7a ,0x75 ,0xf7 ,0xa2 ,0xd5 ,0x5c , +0x19 ,0xf7 ,0x4d ,0xff ,0xe9 ,0x70 ,0xf9 ,0xa5 , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0x0a ,0xf0 ,0xff ,0x21 ,0xff ,0xdc ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +}; +define_sfdp_read (w25q01jvq);
Signature · 1 line
2.37.3
PATCH v4 10/10 arm/aspeed: Replace mx25l25635e chip model
In reply to Cédric Le GoaterA mx25l25635f chip model is generally found on these machines. It's newer and uses 4B opcodes which is better to exercise the support in the Linux kernel.
Message-Id: <[email protected]>
--- hw/arm/aspeed.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
hw/arm/aspeed.c +3 -3
@@ -1099,7 +1099,7 @@ static void aspeed_machine_palmetto_class_init(ObjectClass *oc, void *data) amc->soc_name ="ast2400-a1" ; amc->hw_strap1 =PALMETTO_BMC_HW_STRAP1 ; amc->fmc_model ="n25q256a" ; - amc->spi_model ="mx25l25635e" ; + amc->spi_model ="mx25l25635f" ; amc->num_cs =1 ; amc->i2c_init = palmetto_bmc_i2c_init; mc->default_ram_size =256 * MiB;
@@ -1150,7 +1150,7 @@ static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc, void *data) amc->soc_name ="ast2500-a1" ; amc->hw_strap1 =AST2500_EVB_HW_STRAP1 ; amc->fmc_model ="mx25l25635e" ; - amc->spi_model ="mx25l25635e" ; + amc->spi_model ="mx25l25635f" ; amc->num_cs =1 ; amc->i2c_init = ast2500_evb_i2c_init; mc->default_ram_size =512 * MiB;
@@ -1200,7 +1200,7 @@ static void aspeed_machine_witherspoon_class_init(ObjectClass *oc, void *data) mc->desc ="OpenPOWER Witherspoon BMC (ARM1176)" ; amc->soc_name ="ast2500-a1" ; amc->hw_strap1 =WITHERSPOON_BMC_HW_STRAP1 ; - amc->fmc_model ="mx25l25635e" ; + amc->fmc_model ="mx25l25635f" ; amc->spi_model ="mx66l1g45g" ; amc->num_cs =2 ; amc->i2c_init = witherspoon_bmc_i2c_init;
Signature · 1 line
2.37.3
Quoted 8 lines · Cédric Le Goater
Hello,
This patchset adds support for JEDEC STANDARD JESD216 Serial Flash Discovery Parameters (SFDP). SFDP describes the features of a serial flash device using a set of internal parameter tables. Support in Linux has been added some time ago and the spi-nor driver is using it more often to detect the flash settings and even flash models.
Thanks Cédric!