diff options
author | Aaron Durbin <adurbin@chromium.org> | 2020-01-23 11:45:30 -0700 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2020-01-28 14:44:37 +0000 |
commit | fc7b953366b776aa3eaaf0539af06086facda14e (patch) | |
tree | 52ae47be248bed559c27128e97a51d24b8d3d3c6 | |
parent | 98eeb961353d187a26085a07889bd0414cdaa910 (diff) |
drivers/spi/spi_flash: remove spi flash names
The names of each spi flash cause quite a bit of bloat in the text
size of each stage/program. Remove the name entirely from spi flash
in order to reduce overhead. In order to pack space as closely as
possible the previous 32-bit id and mask were split into 2 16-bit
ids and masks.
On Chrome OS build of Aleena there's a savings of >2.21KiB in each
of verstage, romstage, and ramstage.
Change-Id: Ie98f7e1c7d116c5d7b4bf78605f62fee89dee0a5
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/38380
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r-- | src/drivers/spi/adesto.c | 50 | ||||
-rw-r--r-- | src/drivers/spi/amic.c | 38 | ||||
-rw-r--r-- | src/drivers/spi/atmel.c | 30 | ||||
-rw-r--r-- | src/drivers/spi/eon.c | 86 | ||||
-rw-r--r-- | src/drivers/spi/gigadevice.c | 54 | ||||
-rw-r--r-- | src/drivers/spi/macronix.c | 78 | ||||
-rw-r--r-- | src/drivers/spi/spansion.c | 65 | ||||
-rw-r--r-- | src/drivers/spi/spi_flash.c | 25 | ||||
-rw-r--r-- | src/drivers/spi/spi_flash_internal.h | 12 | ||||
-rw-r--r-- | src/drivers/spi/sst.c | 52 | ||||
-rw-r--r-- | src/drivers/spi/stmicro.c | 112 | ||||
-rw-r--r-- | src/drivers/spi/winbond.c | 82 | ||||
-rw-r--r-- | src/include/spi_flash.h | 1 | ||||
-rw-r--r-- | src/soc/intel/common/block/fast_spi/fast_spi_flash.c | 1 | ||||
-rw-r--r-- | src/soc/mediatek/mt8173/flash_controller.c | 1 | ||||
-rw-r--r-- | src/southbridge/intel/common/spi.c | 1 |
16 files changed, 349 insertions, 339 deletions
diff --git a/src/drivers/spi/adesto.c b/src/drivers/spi/adesto.c index 89e33f78ef..fe4106afd0 100644 --- a/src/drivers/spi/adesto.c +++ b/src/drivers/spi/adesto.c @@ -41,63 +41,63 @@ static const struct spi_flash_part_id flash_table[] = { { - .id = 0x4218, - .name = "AT25SL128A", + /* AT25SL128A */ + .id[0] = 0x4218, .nr_sectors_shift = 12, }, { - .id = 0x4501, - .name = "AT25DF081A", /* Yes, 81A id < 81 */ + /* AT25DF081A Yes, 81A id < 81 */ + .id[0] = 0x4501, .nr_sectors_shift = 8, }, { - .id = 0x4502, - .name = "AT25DF081", + /* AT25DF081 */ + .id[0] = 0x4502, .nr_sectors_shift = 8, }, { - .id = 0x4602, - .name = "AT25DF161", + /* AT25DF161 */ + .id[0] = 0x4602, .nr_sectors_shift = 9, }, { - .id = 0x4603, - .name = "AT25DL161", + /* AT25DL161 */ + .id[0] = 0x4603, .nr_sectors_shift = 9, }, { - .id = 0x4700, - .name = "AT25DF321", + /* AT25DF321 */ + .id[0] = 0x4700, .nr_sectors_shift = 10, }, { - .id = 0x4701, - .name = "AT25DF321A", + /* AT25DF321A */ + .id[0] = 0x4701, .nr_sectors_shift = 10, }, { - .id = 0x4800, - .name = "AT25DF641", + /* AT25DF641 */ + .id[0] = 0x4800, .nr_sectors_shift = 11, }, { - .id = 0x8501, - .name = "AT25SF081", + /* AT25SF081 */ + .id[0] = 0x8501, .nr_sectors_shift = 8, }, { - .id = 0x8600, - .name = "AT25DQ161", + /* AT25DQ161 */ + .id[0] = 0x8600, .nr_sectors_shift = 9, }, { - .id = 0x8601, - .name = "AT25SF161", + /* AT25SF161 */ + .id[0] = 0x8601, .nr_sectors_shift = 9, }, { - .id = 0x8700, - .name = "AT25DQ321", + /* AT25DQ321 */ + .id[0] = 0x8700, .nr_sectors_shift = 10, }, }; @@ -106,7 +106,7 @@ const struct spi_flash_vendor_info spi_flash_adesto_vi = { .id = VENDOR_ID_ADESTO, .page_size_shift = 8, .sector_size_kib_shift = 2, - .match_id_mask = 0xffff, + .match_id_mask[0] = 0xffff, .ids = flash_table, .nr_part_ids = ARRAY_SIZE(flash_table), .desc = &spi_flash_pp_0x20_sector_desc, diff --git a/src/drivers/spi/amic.c b/src/drivers/spi/amic.c index 8e25cd933c..cb4ada01ce 100644 --- a/src/drivers/spi/amic.c +++ b/src/drivers/spi/amic.c @@ -36,48 +36,48 @@ static const struct spi_flash_part_id flash_table[] = { { - .id = 0x2015, - .name = "A25L16PU", + /* A25L16PU */ + .id[0] = 0x2015, .nr_sectors_shift = 9, }, { - .id = 0x2025, - .name = "A25L16PT", + /* A25L16PT */ + .id[0] = 0x2025, .nr_sectors_shift = 9, }, { - .id = 0x3014, - .name = "A25L080", + /* A25L080 */ + .id[0] = 0x3014, .nr_sectors_shift = 8, }, { - .id = 0x3015, - .name = "A25L016", + /* A25L016 */ + .id[0] = 0x3015, .nr_sectors_shift = 9, }, { - .id = 0x3016, - .name = "A25L032", + /* A25L032 */ + .id[0] = 0x3016, .nr_sectors_shift = 10, }, { - .id = 0x4014, - .name = "A25LQ080", + /* A25LQ080 */ + .id[0] = 0x4014, .nr_sectors_shift = 8, }, { - .id = 0x4015, - .name = "A25LQ16", + /* A25LQ16 */ + .id[0] = 0x4015, .nr_sectors_shift = 9, }, { - .id = 0x4016, - .name = "A25LQ032", + /* A25LQ032 */ + .id[0] = 0x4016, .nr_sectors_shift = 10, }, { - .id = 0x4017, - .name = "A25LQ64", + /* A25LQ64 */ + .id[0] = 0x4017, .nr_sectors_shift = 11, }, }; @@ -86,7 +86,7 @@ const struct spi_flash_vendor_info spi_flash_amic_vi = { .id = VENDOR_ID_AMIC, .page_size_shift = 8, .sector_size_kib_shift = 2, - .match_id_mask = 0xffff, + .match_id_mask[0] = 0xffff, .ids = flash_table, .nr_part_ids = ARRAY_SIZE(flash_table), .desc = &spi_flash_pp_0x20_sector_desc, diff --git a/src/drivers/spi/atmel.c b/src/drivers/spi/atmel.c index ae282c323b..491a7ab04e 100644 --- a/src/drivers/spi/atmel.c +++ b/src/drivers/spi/atmel.c @@ -36,38 +36,38 @@ static const struct spi_flash_part_id flash_table[] = { { - .id = 0x3015, - .name = "AT25X16", + /* AT25X16 */ + .id[0] = 0x3015, .nr_sectors_shift = 9, }, { - .id = 0x47, - .name = "AT25DF32", + /* AT25DF32 */ + .id[0] = 0x47, .nr_sectors_shift = 10, }, { - .id = 0x3017, - .name = "AT25X64", + /* AT25X64 */ + .id[0] = 0x3017, .nr_sectors_shift = 11, }, { - .id = 0x4015, - .name = "AT25Q16", + /* AT25Q16 */ + .id[0] = 0x4015, .nr_sectors_shift = 9, }, { - .id = 0x4016, - .name = "AT25Q32", + /* AT25Q32 */ + .id[0] = 0x4016, .nr_sectors_shift = 10, }, { - .id = 0x4017, - .name = "AT25Q64", + /* AT25Q64 */ + .id[0] = 0x4017, .nr_sectors_shift = 11, }, { - .id = 0x4018, - .name = "AT25Q128", + /* AT25Q128 */ + .id[0] = 0x4018, .nr_sectors_shift = 12, }, }; @@ -76,7 +76,7 @@ const struct spi_flash_vendor_info spi_flash_atmel_vi = { .id = VENDOR_ID_ATMEL, .page_size_shift = 8, .sector_size_kib_shift = 2, - .match_id_mask = 0xffff, + .match_id_mask[0] = 0xffff, .ids = flash_table, .nr_part_ids = ARRAY_SIZE(flash_table), .desc = &spi_flash_pp_0x20_sector_desc, diff --git a/src/drivers/spi/eon.c b/src/drivers/spi/eon.c index 6d4833ce22..706115a18c 100644 --- a/src/drivers/spi/eon.c +++ b/src/drivers/spi/eon.c @@ -57,108 +57,108 @@ static const struct spi_flash_part_id flash_table[] = { { - .id = EON_ID_EN25B80, - .name = "EN25B80", + /* EN25B80 */ + .id[0] = EON_ID_EN25B80, .nr_sectors_shift = 8, }, { - .id = EON_ID_EN25B16, - .name = "EN25B16", + /* EN25B16 */ + .id[0] = EON_ID_EN25B16, .nr_sectors_shift = 9, }, { - .id = EON_ID_EN25B32, - .name = "EN25B32", + /* EN25B32 */ + .id[0] = EON_ID_EN25B32, .nr_sectors_shift = 10, }, { - .id = EON_ID_EN25B64, - .name = "EN25B64", + /* EN25B64 */ + .id[0] = EON_ID_EN25B64, .nr_sectors_shift = 11, }, { - .id = EON_ID_EN25F80, - .name = "EN25F80", + /* EN25F80 */ + .id[0] = EON_ID_EN25F80, .nr_sectors_shift = 8, }, { - .id = EON_ID_EN25F16, - .name = "EN25F16", + /* EN25F16 */ + .id[0] = EON_ID_EN25F16, .nr_sectors_shift = 9, }, { - .id = EON_ID_EN25F32, - .name = "EN25F32", + /* EN25F32 */ + .id[0] = EON_ID_EN25F32, .nr_sectors_shift = 10, }, { - .id = EON_ID_EN25F64, - .name = "EN25F64", + /* EN25F64 */ + .id[0] = EON_ID_EN25F64, .nr_sectors_shift = 11, }, { - .id = EON_ID_EN25Q80, - .name = "EN25Q80(A)", + /* EN25Q80(A) */ + .id[0] = EON_ID_EN25Q80, .nr_sectors_shift = 8, }, { - .id = EON_ID_EN25Q16, - .name = "EN25Q16(D16)", + /* EN25Q16(D16) */ + .id[0] = EON_ID_EN25Q16, .nr_sectors_shift = 9, }, { - .id = EON_ID_EN25Q32, - .name = "EN25Q32(A/B)", + /* EN25Q32(A/B) */ + .id[0] = EON_ID_EN25Q32, .nr_sectors_shift = 10, }, { - .id = EON_ID_EN25Q64, - .name = "EN25Q64", + /* EN25Q64 */ + .id[0] = EON_ID_EN25Q64, .nr_sectors_shift = 11, }, { - .id = EON_ID_EN25Q128, - .name = "EN25Q128", + /* EN25Q128 */ + .id[0] = EON_ID_EN25Q128, .nr_sectors_shift = 12, }, { - .id = EON_ID_EN25QH16, - .name = "EN25QH16", + /* EN25QH16 */ + .id[0] = EON_ID_EN25QH16, .nr_sectors_shift = 9, }, { - .id = EON_ID_EN25QH32, - .name = "EN25QH32", + /* EN25QH32 */ + .id[0] = EON_ID_EN25QH32, .nr_sectors_shift = 10, }, { - .id = EON_ID_EN25QH64, - .name = "EN25QH64", + /* EN25QH64 */ + .id[0] = EON_ID_EN25QH64, .nr_sectors_shift = 11, }, { - .id = EON_ID_EN25QH128, - .name = "EN25QH128", + /* EN25QH128 */ + .id[0] = EON_ID_EN25QH128, .nr_sectors_shift = 12, }, { - .id = EON_ID_EN25S80, - .name = "EN25S80", + /* EN25S80 */ + .id[0] = EON_ID_EN25S80, .nr_sectors_shift = 8, }, { - .id = EON_ID_EN25S16, - .name = "EN25S16", + /* EN25S16 */ + .id[0] = EON_ID_EN25S16, .nr_sectors_shift = 9, }, { - .id = EON_ID_EN25S32, - .name = "EN25S32", + /* EN25S32 */ + .id[0] = EON_ID_EN25S32, .nr_sectors_shift = 10, }, { - .id = EON_ID_EN25S64, - .name = "EN25S64", + /* EN25S64 */ + .id[0] = EON_ID_EN25S64, .nr_sectors_shift = 11, }, }; @@ -167,7 +167,7 @@ const struct spi_flash_vendor_info spi_flash_eon_vi = { .id = VENDOR_ID_EON, .page_size_shift = 8, .sector_size_kib_shift = 2, - .match_id_mask = 0xffff, + .match_id_mask[0] = 0xffff, .ids = flash_table, .nr_part_ids = ARRAY_SIZE(flash_table), .desc = &spi_flash_pp_0x20_sector_desc, diff --git a/src/drivers/spi/gigadevice.c b/src/drivers/spi/gigadevice.c index 64d9706551..717b01613f 100644 --- a/src/drivers/spi/gigadevice.c +++ b/src/drivers/spi/gigadevice.c @@ -36,79 +36,79 @@ static const struct spi_flash_part_id flash_table[] = { { - .id = 0x3114, - .name = "GD25T80", + /* GD25T80 */ + .id[0] = 0x3114, .nr_sectors_shift = 8, }, { - .id = 0x4014, - .name = "GD25Q80", + /* GD25Q80 */ + .id[0] = 0x4014, .nr_sectors_shift = 8, .fast_read_dual_output_support = 1, }, /* also GD25Q80B */ { - .id = 0x4015, - .name = "GD25Q16", + /* GD25Q16 */ + .id[0] = 0x4015, .nr_sectors_shift = 9, .fast_read_dual_output_support = 1, }, /* also GD25Q16B */ { - .id = 0x4016, - .name = "GD25Q32B", + /* GD25Q32B */ + .id[0] = 0x4016, .nr_sectors_shift = 10, .fast_read_dual_output_support = 1, }, /* also GD25Q32B */ { - .id = 0x4017, - .name = "GD25Q64", + /* GD25Q64 */ + .id[0] = 0x4017, .nr_sectors_shift = 11, .fast_read_dual_output_support = 1, }, /* also GD25Q64B, GD25B64C */ { - .id = 0x4018, - .name = "GD25Q128", + /* GD25Q128 */ + .id[0] = 0x4018, .nr_sectors_shift = 12, .fast_read_dual_output_support = 1, }, /* also GD25Q128B */ { - .id = 0x4214, - .name = "GD25VQ80C", + /* GD25VQ80C */ + .id[0] = 0x4214, .nr_sectors_shift = 8, .fast_read_dual_output_support = 1, }, { - .id = 0x4215, - .name = "GD25VQ16C", + /* GD25VQ16C */ + .id[0] = 0x4215, .nr_sectors_shift = 9, .fast_read_dual_output_support = 1, }, { - .id = 0x6014, - .name = "GD25LQ80", + /* GD25LQ80 */ + .id[0] = 0x6014, .nr_sectors_shift = 8, .fast_read_dual_output_support = 1, }, { - .id = 0x6015, - .name = "GD25LQ16", + /* GD25LQ16 */ + .id[0] = 0x6015, .nr_sectors_shift = 9, .fast_read_dual_output_support = 1, }, { - .id = 0x6016, - .name = "GD25LQ32", + /* GD25LQ32 */ + .id[0] = 0x6016, .nr_sectors_shift = 10, .fast_read_dual_output_support = 1, }, { - .id = 0x6017, - .name = "GD25LQ64C", + /* GD25LQ64C */ + .id[0] = 0x6017, .nr_sectors_shift = 11, .fast_read_dual_output_support = 1, }, /* also GD25LB64C */ { - .id = 0x6018, - .name = "GD25LQ128", + /* GD25LQ128 */ + .id[0] = 0x6018, .nr_sectors_shift = 12, .fast_read_dual_output_support = 1, }, @@ -118,7 +118,7 @@ const struct spi_flash_vendor_info spi_flash_gigadevice_vi = { .id = VENDOR_ID_GIGADEVICE, .page_size_shift = 8, .sector_size_kib_shift = 2, - .match_id_mask = 0xffff, + .match_id_mask[0] = 0xffff, .ids = flash_table, .nr_part_ids = ARRAY_SIZE(flash_table), .desc = &spi_flash_pp_0x20_sector_desc, diff --git a/src/drivers/spi/macronix.c b/src/drivers/spi/macronix.c index f23b421211..0c5bf14814 100644 --- a/src/drivers/spi/macronix.c +++ b/src/drivers/spi/macronix.c @@ -38,98 +38,98 @@ static const struct spi_flash_part_id flash_table[] = { { - .id = 0x2014, - .name = "MX25L8005", + /* MX25L8005 */ + .id[0] = 0x2014, .nr_sectors_shift = 8, }, { - .id = 0x2015, - .name = "MX25L1605D", + /* MX25L1605D */ + .id[0] = 0x2015, .nr_sectors_shift = 9, }, { - .id = 0x2016, - .name = "MX25L3205D", + /* MX25L3205D */ + .id[0] = 0x2016, .nr_sectors_shift = 10, }, { - .id = 0x2017, - .name = "MX25L6405D", + /* MX25L6405D */ + .id[0] = 0x2017, .nr_sectors_shift = 11, }, { - .id = 0x2018, - .name = "MX25L12805D", + /* MX25L12805D */ + .id[0] = 0x2018, .nr_sectors_shift = 12, }, { - .id = 0x2019, - .name = "MX25L25635F", + /* MX25L25635F */ + .id[0] = 0x2019, .nr_sectors_shift = 13, }, { - .id = 0x201a, - .name = "MX66L51235F", + /* MX66L51235F */ + .id[0] = 0x201a, .nr_sectors_shift = 14, }, { - .id = 0x2415, - .name = "MX25L1635D", + /* MX25L1635D */ + .id[0] = 0x2415, .nr_sectors_shift = 9, }, { - .id = 0x2515, - .name = "MX25L1635E", + /* MX25L1635E */ + .id[0] = 0x2515, .nr_sectors_shift = 9, }, { - .id = 0x2534, - .name = "MX25U8032E", + /* MX25U8032E */ + .id[0] = 0x2534, .nr_sectors_shift = 8, }, { - .id = 0x2535, - .name = "MX25U1635E", + /* MX25U1635E */ + .id[0] = 0x2535, .nr_sectors_shift = 9, }, { - .id = 0x2536, - .name = "MX25U3235E", + /* MX25U3235E */ + .id[0] = 0x2536, .nr_sectors_shift = 10, }, { - .id = 0x2537, - .name = "MX25U6435F", + /* MX25U6435F */ + .id[0] = 0x2537, .nr_sectors_shift = 11, }, { - .id = 0x2538, - .name = "MX25U12835F", + /* MX25U12835F */ + .id[0] = 0x2538, .nr_sectors_shift = 12, }, { - .id = 0x2539, - .name = "MX25U25635F", + /* MX25U25635F */ + .id[0] = 0x2539, .nr_sectors_shift = 13, }, { - .id = 0x253a, - .name = "MX25U51245G", + /* MX25U51245G */ + .id[0] = 0x253a, .nr_sectors_shift = 14, }, { - .id = 0x2618, - .name = "MX25L12855E", + /* MX25L12855E */ + .id[0] = 0x2618, .nr_sectors_shift = 12, }, { - .id = 0x5e16, - .name = "MX25L3235D", /* MX25L3225D/MX25L3236D/MX25L3237D */ + /* MX25L3235D/MX25L3225D/MX25L3236D/MX25L3237D */ + .id[0] = 0x5e16, .nr_sectors_shift = 10, }, { - .id = 0x9517, - .name = "MX25L6495F", + /* MX25L6495F */ + .id[0] = 0x9517, .nr_sectors_shift = 11, }, }; @@ -138,7 +138,7 @@ const struct spi_flash_vendor_info spi_flash_macronix_vi = { .id = VENDOR_ID_MACRONIX, .page_size_shift = 8, .sector_size_kib_shift = 2, - .match_id_mask = 0xffff, + .match_id_mask[0] = 0xffff, .ids = flash_table, .nr_part_ids = ARRAY_SIZE(flash_table), .desc = &spi_flash_pp_0x20_sector_desc, diff --git a/src/drivers/spi/spansion.c b/src/drivers/spi/spansion.c index c694f4517e..29b7027b65 100644 --- a/src/drivers/spi/spansion.c +++ b/src/drivers/spi/spansion.c @@ -51,74 +51,79 @@ static const struct spi_flash_part_id flash_table_ext[] = { { - .id = SPSN_ID_S25FL008A, - .name = "S25FL008A", + /* S25FL008A */ + .id[0] = SPSN_ID_S25FL008A, .nr_sectors_shift = 4, }, { - .id = SPSN_ID_S25FL016A, - .name = "S25FL016A", + /* S25FL016A */ + .id[0] = SPSN_ID_S25FL016A, .nr_sectors_shift = 5, }, { - .id = SPSN_ID_S25FL032A, - .name = "S25FL032A", + /* S25FL032A */ + .id[0] = SPSN_ID_S25FL032A, .nr_sectors_shift = 6, }, { - .id = SPSN_ID_S25FL064A, - .name = "S25FL064A", + /* S25FL064A */ + .id[0] = SPSN_ID_S25FL064A, .nr_sectors_shift = 7, }, { - .id = (SPSN_EXT_ID_S25FL128P_64KB << 16) | SPSN_ID_S25FL128P, - .name = "S25FL128P_64K", + /* S25FL128P_64K */ + .id[0] = SPSN_ID_S25FL128P, + .id[1] = SPSN_EXT_ID_S25FL128P_64KB, .nr_sectors_shift = 8, }, { - .id = (SPSN_EXT_ID_S25FLXXS_64KB << 16) | SPSN_ID_S25FL128S, - .name = "S25FL128S_256K", + /* S25FL128S_256K */ + .id[0] = SPSN_ID_S25FL128S, + .id[1] = SPSN_EXT_ID_S25FLXXS_64KB, .nr_sectors_shift = 9, }, { - .id = (SPSN_EXT_ID_S25FL032P << 16) | SPSN_ID_S25FL032A, - .name = "S25FL032P", + /* S25FL032P */ + .id[0] = SPSN_ID_S25FL032A, + .id[1] = SPSN_EXT_ID_S25FL032P, .nr_sectors_shift = 6, }, { - .id = (SPSN_EXT_ID_S25FLXXS_64KB << 16) | SPSN_ID_S25FL128P, - .name = "S25FS128S", + /* S25FS128S */ + .id[0] = SPSN_ID_S25FL128P, + .id[1] = SPSN_EXT_ID_S25FLXXS_64KB, .nr_sectors_shift = 8, }, }; static const struct spi_flash_part_id flash_table_256k_sector[] = { { - .id = (SPSN_EXT_ID_S25FL128P_256KB << 16) | SPSN_ID_S25FL128P, - .name = "S25FL128P_256K", + /* S25FL128P_256K */ + .id[0] = SPSN_ID_S25FL128P, + .id[1] = SPSN_EXT_ID_S25FL128P_256KB, .nr_sectors_shift = 6, }, }; static const struct spi_flash_part_id flash_table[] = { { - .id = SPSN_ID_S25FL208K, - .name = "S25FL208K", + /* S25FL208K */ + .id[0] = SPSN_ID_S25FL208K, .nr_sectors_shift = 4, }, { - .id = SPSN_ID_S25FL116K, - .name = "S25FL116K_16M", + /* S25FL116K_16M */ + .id[0] = SPSN_ID_S25FL116K, .nr_sectors_shift = 5, }, { - .id = SPSN_ID_S25FL132K, - .name = "S25FL132K", + /* S25FL132K */ + .id[0] = SPSN_ID_S25FL132K, .nr_sectors_shift = 6, }, { - .id = SPSN_ID_S25FL164K, - .name = "S25FL164K", + /* S25FL164K */ + .id[0] = SPSN_ID_S25FL164K, .nr_sectors_shift = 7, }, }; @@ -127,7 +132,8 @@ const struct spi_flash_vendor_info spi_flash_spansion_ext1_vi = { .id = VENDOR_ID_SPANSION, .page_size_shift = 8, .sector_size_kib_shift = 6, - .match_id_mask = 0xffffffff, + .match_id_mask[0] = 0xffff, + .match_id_mask[1] = 0xffff, .ids = flash_table_ext, .nr_part_ids = ARRAY_SIZE(flash_table_ext), .desc = &spi_flash_pp_0xd8_sector_desc, @@ -137,7 +143,8 @@ const struct spi_flash_vendor_info spi_flash_spansion_ext2_vi = { .id = VENDOR_ID_SPANSION, .page_size_shift = 8, .sector_size_kib_shift = 8, - .match_id_mask = 0xffffffff, + .match_id_mask[0] = 0xffff, + .match_id_mask[1] = 0xffff, .ids = flash_table_256k_sector, .nr_part_ids = ARRAY_SIZE(flash_table_256k_sector), .desc = &spi_flash_pp_0xd8_sector_desc, @@ -147,7 +154,7 @@ const struct spi_flash_vendor_info spi_flash_spansion_vi = { .id = VENDOR_ID_SPANSION, .page_size_shift = 8, .sector_size_kib_shift = 6, - .match_id_mask = 0xffff, + .match_id_mask[0] = 0xffff, .ids = flash_table, .nr_part_ids = ARRAY_SIZE(flash_table), .desc = &spi_flash_pp_0xd8_sector_desc, diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c index 90dd5877ff..51498296d6 100644 --- a/src/drivers/spi/spi_flash.c +++ b/src/drivers/spi/spi_flash.c @@ -355,8 +355,7 @@ static int fill_spi_flash(const struct spi_slave *spi, struct spi_flash *flash, { memcpy(&flash->spi, spi, sizeof(*spi)); flash->vendor = vi->id; - flash->model = part->id; - flash->name = part->name; + flash->model = part->id[0]; flash->page_size = 1U << vi->page_size_shift; flash->sector_size = (1U << vi->sector_size_kib_shift) * KiB; @@ -379,14 +378,19 @@ static int fill_spi_flash(const struct spi_slave *spi, struct spi_flash *flash, } static const struct spi_flash_part_id *find_part(const struct spi_flash_vendor_info *vi, - uint32_t id) + uint16_t id[2]) { size_t i; + const uint16_t lid[2] = { + [0] = id[0] & vi->match_id_mask[0], + [1] = id[1] & vi->match_id_mask[1], + }; + for (i = 0; i < vi->nr_part_ids; i++) { const struct spi_flash_part_id *part = &vi->ids[i]; - if (part->id == id) + if (part->id[0] == lid[0] && part->id[1] == lid[1]) return part; } @@ -394,7 +398,7 @@ static const struct spi_flash_part_id *find_part(const struct spi_flash_vendor_i } static int find_match(const struct spi_slave *spi, struct spi_flash *flash, - uint8_t manuf_id, uint32_t id) + uint8_t manuf_id, uint16_t id[2]) { int i; @@ -407,7 +411,7 @@ static int find_match(const struct spi_slave *spi, struct spi_flash *flash, if (manuf_id != vi->id) continue; - part = find_part(vi, id & vi->match_id_mask); + part = find_part(vi, id); if (part == NULL) continue; @@ -424,7 +428,7 @@ int spi_flash_generic_probe(const struct spi_slave *spi, int ret, i; u8 idcode[IDCODE_LEN]; u8 manuf_id; - u32 id; + u16 id[2]; /* Read the ID codes */ ret = spi_flash_cmd(spi, CMD_READ_ID, idcode, sizeof(idcode)); @@ -450,7 +454,8 @@ int spi_flash_generic_probe(const struct spi_slave *spi, manuf_id = idcode[0]; } - id = (idcode[3] << 24) | (idcode[4] << 16) | (idcode[1] << 8) | idcode[2]; + id[0] = (idcode[1] << 8) | idcode[2]; + id[1] = (idcode[3] << 8) | idcode[4]; return find_match(spi, flash, manuf_id, id); } @@ -483,8 +488,8 @@ int spi_flash_probe(unsigned int bus, unsigned int cs, struct spi_flash *flash) if (flash->flags.dual_spi && spi.ctrlr->xfer_dual) mode_string = " (Dual SPI mode)"; printk(BIOS_INFO, - "SF: Detected %s with sector size 0x%x, total 0x%x%s\n", - flash->name, flash->sector_size, flash->size, mode_string); + "SF: Detected %02x %04x with sector size 0x%x, total 0x%x%s\n", + flash->vendor, flash->model, flash->sector_size, flash->size, mode_string); if (bus == CONFIG_BOOT_DEVICE_SPI_FLASH_BUS && flash->size != CONFIG_ROM_SIZE) { printk(BIOS_ERR, "SF size 0x%x does not correspond to" diff --git a/src/drivers/spi/spi_flash_internal.h b/src/drivers/spi/spi_flash_internal.h index bd52d66075..0842961be7 100644 --- a/src/drivers/spi/spi_flash_internal.h +++ b/src/drivers/spi/spi_flash_internal.h @@ -73,10 +73,12 @@ int spi_flash_cmd_read(const struct spi_flash *flash, u32 offset, size_t len, vo int stmicro_release_deep_sleep_identify(const struct spi_slave *spi, u8 *idcode); struct spi_flash_part_id { - /* rdid command constructs a 32-bit id using the following method - * for matching: 31 | id[3] | id[4] | id[1] | id[2] | 0 */ - uint32_t id; - const char *name; + /* rdid command constructs 2x 16-bit id using the following method + * for matching after reading 5 bytes (1st byte is manuf id): + * id[0] = (id[1] << 8) | id[2] + * id[1] = (id[3] << 8) | id[4] + */ + uint16_t id[2]; /* Log based 2 total number of sectors. */ uint16_t nr_sectors_shift: 4; uint16_t fast_read_dual_output_support : 1; @@ -104,7 +106,7 @@ struct spi_flash_vendor_info { uint8_t sector_size_kib_shift : 4; uint16_t nr_part_ids; const struct spi_flash_part_id *ids; - uint32_t match_id_mask; /* matching bytes of the id for this set*/ + uint16_t match_id_mask[2]; /* matching bytes of the id for this set*/ const struct spi_flash_ops_descriptor *desc; const struct spi_flash_protection_ops *prot_ops; /* Returns 0 on success. !0 otherwise. */ diff --git a/src/drivers/spi/sst.c b/src/drivers/spi/sst.c index 559f30f022..4b25b902f1 100644 --- a/src/drivers/spi/sst.c +++ b/src/drivers/spi/sst.c @@ -46,56 +46,56 @@ static const struct spi_flash_part_id flash_table_ai[] = { { - .id = 0x8d, - .name = "SST25VF040B", + /* SST25VF040B */ + .id[0] = 0x8d, .nr_sectors_shift = 7, },{ - .id = 0x8e, - .name = "SST25VF080B", + /* SST25VF080B */ + .id[0] = 0x8e, .nr_sectors_shift = 8, },{ - .id = 0x80, - .name = "SST25VF080", + /* SST25VF080 */ + .id[0] = 0x80, .nr_sectors_shift = 8, },{ - .id = 0x41, - .name = "SST25VF016B", + /* SST25VF016B */ + .id[0] = 0x41, .nr_sectors_shift = 9, },{ - .id = 0x4a, - .name = "SST25VF032B", + /* SST25VF032B */ + .id[0] = 0x4a, .nr_sectors_shift = 10, },{ - .id = 0x01, - .name = "SST25WF512", + /* SST25WF512 */ + .id[0] = 0x01, .nr_sectors_shift = 4, },{ - .id = 0x02, - .name = "SST25WF010", + /* SST25WF010 */ + .id[0] = 0x02, .nr_sectors_shift = 5, },{ - .id = 0x03, - .name = "SST25WF020", + /* SST25WF020 */ + .id[0] = 0x03, .nr_sectors_shift = 6, },{ - .id = 0x04, - .name = "SST25WF040", + /* SST25WF040 */ + .id[0] = 0x04, .nr_sectors_shift = 7, },{ - .id = 0x05, - .name = "SST25WF080", + /* SST25WF080 */ + .id[0] = 0x05, .nr_sectors_shift = 8, },{ - .id = 0x14, - .name = "SST25WF080B", + /* SST25WF080B */ + .id[0] = 0x14, .nr_sectors_shift = 8, }, }; static const struct spi_flash_part_id flash_table_pp256[] = { { - .id = 0x4b, - .name = "SST25VF064C", + /* SST25VF064C */ + .id[0] = 0x4b, .nr_sectors_shift = 11, }, }; @@ -254,7 +254,7 @@ static const struct spi_flash_ops_descriptor descai = { const struct spi_flash_vendor_info spi_flash_sst_ai_vi = { .id = VENDOR_ID_SST, .sector_size_kib_shift = 2, - .match_id_mask = 0xff, + .match_id_mask[0] = 0xff, .ids = flash_table_ai, .nr_part_ids = ARRAY_SIZE(flash_table_ai), .desc = &descai, @@ -265,7 +265,7 @@ const struct spi_flash_vendor_info spi_flash_sst_vi = { .id = VENDOR_ID_SST, .page_size_shift = 8, .sector_size_kib_shift = 2, - .match_id_mask = 0xff, + .match_id_mask[0] = 0xff, .ids = flash_table_pp256, .nr_part_ids = ARRAY_SIZE(flash_table_pp256), .desc = &spi_flash_pp_0x20_sector_desc, diff --git a/src/drivers/spi/stmicro.c b/src/drivers/spi/stmicro.c index 62755f4a01..e867d71450 100644 --- a/src/drivers/spi/stmicro.c +++ b/src/drivers/spi/stmicro.c @@ -66,142 +66,142 @@ static const struct spi_flash_part_id flash_table_se32k[] = { { - .id = STM_ID_M25P10, - .name = "M25P10", + /* M25P10 */ + .id[0] = STM_ID_M25P10, .nr_sectors_shift = 2, }, }; static const struct spi_flash_part_id flash_table_se64k[] = { { - .id = STM_ID_M25P16, - .name = "M25P16", + /* M25P16 */ + .id[0] = STM_ID_M25P16, .nr_sectors_shift = 5, }, { - .id = STM_ID_M25P20, - .name = "M25P20", + /* M25P20 */ + .id[0] = STM_ID_M25P20, .nr_sectors_shift = 2, }, { - .id = STM_ID_M25P32, - .name = "M25P32", + /* M25P32 */ + .id[0] = STM_ID_M25P32, .nr_sectors_shift = 6, }, { - .id = STM_ID_M25P40, - .name = "M25P40", + /* M25P40 */ + .id[0] = STM_ID_M25P40, .nr_sectors_shift = 3, }, { - .id = STM_ID_M25P64, - .name = "M25P64", + /* M25P64 */ + .id[0] = STM_ID_M25P64, .nr_sectors_shift = 7, }, { - .id = STM_ID_M25P80, - .name = "M25P80", + /* M25P80 */ + .id[0] = STM_ID_M25P80, .nr_sectors_shift = 4, }, { - .id = STM_ID_M25PX80, - .name = "M25PX80", + /* M25PX80 */ + .id[0] = STM_ID_M25PX80, .nr_sectors_shift = 4, }, { - .id = STM_ID_M25PX16, - .name = "M25PX16", + /* M25PX16 */ + .id[0] = STM_ID_M25PX16, .nr_sectors_shift = 5, }, { - .id = STM_ID_M25PX32, - .name = "M25PX32", + /* M25PX32 */ + .id[0] = STM_ID_M25PX32, .nr_sectors_shift = 6, }, { - .id = STM_ID_M25PX64, - .name = "M25PX64", + /* M25PX64 */ + .id[0] = STM_ID_M25PX64, .nr_sectors_shift = 7, }, { - .id = STM_ID_M25PE80, - .name = "M25PE80", + /* M25PE80 */ + .id[0] = STM_ID_M25PE80, .nr_sectors_shift = 4, }, { - .id = STM_ID_M25PE16, - .name = "M25PE16", + /* M25PE16 */ + .id[0] = STM_ID_M25PE16, .nr_sectors_shift = 5, }, { - .id = STM_ID_M25PE32, - .name = "M25PE32", + /* M25PE32 */ + .id[0] = STM_ID_M25PE32, .nr_sectors_shift = 6, }, { - .id = STM_ID_M25PE64, - .name = "M25PE64", + /* M25PE64 */ + .id[0] = STM_ID_M25PE64, .nr_sectors_shift = 7, }, }; static const struct spi_flash_part_id flash_table_se256k[] = { { - .id = STM_ID_M25P128, - .name = "M25P128", + /* M25P128 */ + .id[0] = STM_ID_M25P128, .nr_sectors_shift = 6, }, }; static const struct spi_flash_part_id flash_table_sse[] = { { - .id = STM_ID_N25Q016__3E, - .name = "N25Q016..3E", + /* N25Q016..3E */ + .id[0] = STM_ID_N25Q016__3E, .nr_sectors_shift = 9, }, { - .id = STM_ID_N25Q032__3E, - .name = "N25Q032..3E", + /* N25Q032..3E */ + .id[0] = STM_ID_N25Q032__3E, .nr_sectors_shift = 10, }, { - .id = STM_ID_N25Q064__3E, - .name = "N25Q064..3E", + /* N25Q064..3E */ + .id[0] = STM_ID_N25Q064__3E, .nr_sectors_shift = 11, }, { - .id = STM_ID_N25Q128__3E, - .name = "N25Q128..3E", + /* N25Q128..3E */ + .id[0] = STM_ID_N25Q128__3E, .nr_sectors_shift = 12, }, { - .id = STM_ID_N25Q256__3E, - .name = "N25Q256..3E", + /* N25Q256..3E */ + .id[0] = STM_ID_N25Q256__3E, .nr_sectors_shift = 13, }, { - .id = STM_ID_N25Q016__1E, - .name = "N25Q016..1E", + /* N25Q016..1E */ + .id[0] = STM_ID_N25Q016__1E, .nr_sectors_shift = 9, }, { - .id = STM_ID_N25Q032__1E, - .name = "N25Q032..1E", + /* N25Q032..1E */ + .id[0] = STM_ID_N25Q032__1E, .nr_sectors_shift = 10, }, { - .id = STM_ID_N25Q064__1E, - .name = "N25Q064..1E", + /* N25Q064..1E */ + .id[0] = STM_ID_N25Q064__1E, .nr_sectors_shift = 11, }, { - .id = STM_ID_N25Q128__1E, - .name = "N25Q128..1E", + /* N25Q128..1E */ + .id[0] = STM_ID_N25Q128__1E, .nr_sectors_shift = 12, }, { - .id = STM_ID_N25Q256__1E, - .name = "N25Q256..1E", + /* N25Q256..1E */ + .id[0] = STM_ID_N25Q256__1E, .nr_sectors_shift = 13, }, }; @@ -228,7 +228,7 @@ const struct spi_flash_vendor_info spi_flash_stmicro1_vi = { .id = VENDOR_ID_STMICRO, .page_size_shift = 8, .sector_size_kib_shift = 5, - .match_id_mask = 0xffff, + .match_id_mask[0] = 0xffff, .ids = flash_table_se32k, .nr_part_ids = ARRAY_SIZE(flash_table_se32k), .desc = &spi_flash_pp_0xd8_sector_desc, @@ -238,7 +238,7 @@ const struct spi_flash_vendor_info spi_flash_stmicro2_vi = { .id = VENDOR_ID_STMICRO, .page_size_shift = 8, .sector_size_kib_shift = 6, - .match_id_mask = 0xffff, + .match_id_mask[0] = 0xffff, .ids = flash_table_se64k, .nr_part_ids = ARRAY_SIZE(flash_table_se64k), .desc = &spi_flash_pp_0xd8_sector_desc, @@ -248,7 +248,7 @@ const struct spi_flash_vendor_info spi_flash_stmicro3_vi = { .id = VENDOR_ID_STMICRO, .page_size_shift = 8, .sector_size_kib_shift = 8, - .match_id_mask = 0xffff, + .match_id_mask[0] = 0xffff, .ids = flash_table_se256k, .nr_part_ids = ARRAY_SIZE(flash_table_se256k), .desc = &spi_flash_pp_0xd8_sector_desc, @@ -258,7 +258,7 @@ const struct spi_flash_vendor_info spi_flash_stmicro4_vi = { .id = VENDOR_ID_STMICRO, .page_size_shift = 8, .sector_size_kib_shift = 2, - .match_id_mask = 0xffff, + .match_id_mask[0] = 0xffff, .ids = flash_table_sse, .nr_part_ids = ARRAY_SIZE(flash_table_sse), .desc = &spi_flash_pp_0x20_sector_desc, diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c index e85f59db03..f1aa1c4186 100644 --- a/src/drivers/spi/winbond.c +++ b/src/drivers/spi/winbond.c @@ -81,141 +81,141 @@ struct status_regs { static const struct spi_flash_part_id flash_table[] = { { - .id = 0x2014, - .name = "W25P80", + /* W25P80 */ + .id[0] = 0x2014, .nr_sectors_shift = 8, }, { - .id = 0x2015, - .name = "W25P16", + /* W25P16 */ + .id[0] = 0x2015, .nr_sectors_shift = 9, }, { - .id = 0x2016, - .name = "W25P32", + /* W25P32 */ + .id[0] = 0x2016, .nr_sectors_shift = 10, }, { - .id = 0x3014, - .name = "W25X80", + /* W25X80 */ + .id[0] = 0x3014, .nr_sectors_shift = 8, .fast_read_dual_output_support = 1, }, { - .id = 0x3015, - .name = "W25X16", + /* W25X16 */ + .id[0] = 0x3015, .nr_sectors_shift = 9, .fast_read_dual_output_support = 1, }, { - .id = 0x3016, - .name = "W25X32", + /* W25X32 */ + .id[0] = 0x3016, .nr_sectors_shift = 10, .fast_read_dual_output_support = 1, }, { - .id = 0x3017, - .name = "W25X64", + /* W25X64 */ + .id[0] = 0x3017, .nr_sectors_shift = 11, .fast_read_dual_output_support = 1, }, { - .id = 0x4014, - .name = "W25Q80_V", + /* W25Q80_V */ + .id[0] = 0x4014, .nr_sectors_shift = 8, .fast_read_dual_output_support = 1, }, { - .id = 0x4015, - .name = "W25Q16_V", + /* W25Q16_V */ + .id[0] = 0x4015, .nr_sectors_shift = 9, .fast_read_dual_output_support = 1, .protection_granularity_shift = 16, .bp_bits = 3, }, { - .id = 0x6015, - .name = "W25Q16DW", + /* W25Q16DW */ + .id[0] = 0x6015, .nr_sectors_shift = 9, .fast_read_dual_output_support = 1, .protection_granularity_shift = 16, .bp_bits = 3, }, { - .id = 0x4016, - .name = "W25Q32_V", + /* W25Q32_V */ + .id[0] = 0x4016, .nr_sectors_shift = 10, .fast_read_dual_output_support = 1, .protection_granularity_shift = 16, .bp_bits = 3, }, { - .id = 0x6016, - .name = "W25Q32DW", + /* W25Q32DW */ + .id[0] = 0x6016, .nr_sectors_shift = 10, .fast_read_dual_output_support = 1, .protection_granularity_shift = 16, .bp_bits = 3, }, { - .id = 0x4017, - .name = "W25Q64_V", + /* W25Q64_V */ + .id[0] = 0x4017, .nr_sectors_shift = 11, .fast_read_dual_output_support = 1, .protection_granularity_shift = 17, .bp_bits = 3, }, { - .id = 0x6017, - .name = "W25Q64DW", + /* W25Q64DW */ + .id[0] = 0x6017, .nr_sectors_shift = 11, .fast_read_dual_output_support = 1, .protection_granularity_shift = 17, .bp_bits = 3, }, { - .id = 0x4018, - .name = "W25Q128_V", + /* W25Q128_V */ + .id[0] = 0x4018, .nr_sectors_shift = 12, .fast_read_dual_output_support = 1, .protection_granularity_shift = 18, .bp_bits = 3, }, { - .id = 0x6018, - .name = "W25Q128FW", + /* W25Q128FW */ + .id[0] = 0x6018, .nr_sectors_shift = 12, .fast_read_dual_output_support = 1, .protection_granularity_shift = 18, .bp_bits = 3, }, { - .id = 0x7018, - .name = "W25Q128J", + /* W25Q128J */ + .id[0] = 0x7018, .nr_sectors_shift = 12, .fast_read_dual_output_support = 1, .protection_granularity_shift = 18, .bp_bits = 3, }, { - .id = 0x8018, - .name = "W25Q128JW", + /* W25Q128JW */ + .id[0] = 0x8018, .nr_sectors_shift = 12, .fast_read_dual_output_support = 1, .protection_granularity_shift = 18, .bp_bits = 3, }, { - .id = 0x4019, - .name = "W25Q256_V", + /* W25Q256_V */ + .id[0] = 0x4019, .nr_sectors_shift = 13, .fast_read_dual_output_support = 1, .protection_granularity_shift = 16, .bp_bits = 4, }, { - .id = 0x7019, - .name = "W25Q256J", + /* W25Q256J */ + .id[0] = 0x7019, .nr_sectors_shift = 13, .fast_read_dual_output_support = 1, .protection_granularity_shift = 16, @@ -551,7 +551,7 @@ const struct spi_flash_vendor_info spi_flash_winbond_vi = { .id = VENDOR_ID_WINBOND, .page_size_shift = 8, .sector_size_kib_shift = 2, - .match_id_mask = 0xffff, + .match_id_mask[0] = 0xffff, .ids = flash_table, .nr_part_ids = ARRAY_SIZE(flash_table), .desc = &spi_flash_pp_0x20_sector_desc, diff --git a/src/include/spi_flash.h b/src/include/spi_flash.h index 9acff3b104..c74ceaeed4 100644 --- a/src/include/spi_flash.h +++ b/src/include/spi_flash.h @@ -104,7 +104,6 @@ struct spi_flash { }; } flags; u16 model; - const char *name; u32 size; u32 sector_size; u32 page_size; diff --git a/src/soc/intel/common/block/fast_spi/fast_spi_flash.c b/src/soc/intel/common/block/fast_spi/fast_spi_flash.c index f887b3c800..f3f4d4fd70 100644 --- a/src/soc/intel/common/block/fast_spi/fast_spi_flash.c +++ b/src/soc/intel/common/block/fast_spi/fast_spi_flash.c @@ -301,7 +301,6 @@ static int fast_spi_flash_probe(const struct spi_slave *dev, flash->size = (flash_bits >> 3) + 1; memcpy(&flash->spi, dev, sizeof(*dev)); - flash->name = "FAST_SPI Hardware Sequencer"; /* Can erase both 4 KiB and 64 KiB chunks. Declare the smaller size. */ flash->sector_size = 4 * KiB; diff --git a/src/soc/mediatek/mt8173/flash_controller.c b/src/soc/mediatek/mt8173/flash_controller.c index b491a41efd..9e459834f5 100644 --- a/src/soc/mediatek/mt8173/flash_controller.c +++ b/src/soc/mediatek/mt8173/flash_controller.c @@ -240,7 +240,6 @@ int mtk_spi_flash_probe(const struct spi_slave *spi, write32(&mt8173_nor->wrprot, SFLASH_COMMAND_ENABLE); memcpy(&flash->spi, spi, sizeof(*spi)); - flash->name = "mt8173 flash controller"; flash->sector_size = 0x1000; flash->erase_cmd = SECTOR_ERASE_CMD; flash->size = CONFIG_ROM_SIZE; diff --git a/src/southbridge/intel/common/spi.c b/src/southbridge/intel/common/spi.c index 924fdcc810..828520095c 100644 --- a/src/southbridge/intel/common/spi.c +++ b/src/southbridge/intel/common/spi.c @@ -932,7 +932,6 @@ static int spi_flash_programmer_probe(const struct spi_slave *spi, return 0; memcpy(&flash->spi, spi, sizeof(*spi)); - flash->name = "Opaque HW-sequencing"; ich_hwseq_set_addr(0); switch ((cntlr.hsfs >> 3) & 3) { |