From 563b8694d247b718f6288b54f0d4055cefec40a8 Mon Sep 17 00:00:00 2001 From: Richard Spiegel Date: Tue, 3 Sep 2019 11:54:55 -0700 Subject: drivers/spi/spi_flash.c: Add SPI vendor IDs Currently SPI vendor IDs are magic numbers in spi_flash.c. These definitions are needed for AMD's fch_spi. So add the definitions to spi_generic.h and use it at spi_flash.c BUG=b:136595978 TEST=Build test of several platforms that don't use stoneyridge. Build and boot grunt (using stoneyridge new fch_spi). Change-Id: Ie39485d8c092151db8c9d88afaf02e19c507c93f Signed-off-by: Richard Spiegel Reviewed-on: https://review.coreboot.org/c/coreboot/+/35240 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held Reviewed-by: Martin Roth --- src/drivers/spi/spi_flash.c | 22 +++++++++++----------- src/include/spi-generic.h | 13 +++++++++++++ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c index e2485ab7a7..5dbe1f4d8e 100644 --- a/src/drivers/spi/spi_flash.c +++ b/src/drivers/spi/spi_flash.c @@ -282,38 +282,38 @@ static struct { } flashes[] = { /* Keep it sorted by define name */ #if CONFIG(SPI_FLASH_AMIC) - { 0, 0x37, spi_flash_probe_amic, }, + { 0, VENDOR_ID_AMIC, spi_flash_probe_amic, }, #endif #if CONFIG(SPI_FLASH_ATMEL) - { 0, 0x1f, spi_flash_probe_atmel, }, + { 0, VENDOR_ID_ATMEL, spi_flash_probe_atmel, }, #endif #if CONFIG(SPI_FLASH_EON) - { 0, 0x1c, spi_flash_probe_eon, }, + { 0, VENDOR_ID_EON, spi_flash_probe_eon, }, #endif #if CONFIG(SPI_FLASH_GIGADEVICE) - { 0, 0xc8, spi_flash_probe_gigadevice, }, + { 0, VENDOR_ID_GIGADEVICE, spi_flash_probe_gigadevice, }, #endif #if CONFIG(SPI_FLASH_MACRONIX) - { 0, 0xc2, spi_flash_probe_macronix, }, + { 0, VENDOR_ID_MACRONIX, spi_flash_probe_macronix, }, #endif #if CONFIG(SPI_FLASH_SPANSION) - { 0, 0x01, spi_flash_probe_spansion, }, + { 0, VENDOR_ID_SPANSION, spi_flash_probe_spansion, }, #endif #if CONFIG(SPI_FLASH_SST) - { 0, 0xbf, spi_flash_probe_sst, }, + { 0, VENDOR_ID_SST, spi_flash_probe_sst, }, #endif #if CONFIG(SPI_FLASH_STMICRO) - { 0, 0x20, spi_flash_probe_stmicro, }, + { 0, VENDOR_ID_STMICRO, spi_flash_probe_stmicro, }, #endif #if CONFIG(SPI_FLASH_WINBOND) - { 0, 0xef, spi_flash_probe_winbond, }, + { 0, VENDOR_ID_WINBOND, spi_flash_probe_winbond, }, #endif /* Keep it sorted by best detection */ #if CONFIG(SPI_FLASH_STMICRO) - { 0, 0xff, spi_flash_probe_stmicro, }, + { 0, VENDOR_ID_STMICRO_FF, spi_flash_probe_stmicro, }, #endif #if CONFIG(SPI_FLASH_ADESTO) - { 0, 0x1f, spi_flash_probe_adesto, }, + { 0, VENDOR_ID_ADESTO, spi_flash_probe_adesto, }, #endif }; #define IDCODE_LEN (IDCODE_CONT_LEN + IDCODE_PART_LEN) diff --git a/src/include/spi-generic.h b/src/include/spi-generic.h index ffd3d2d008..c8dbb6798a 100644 --- a/src/include/spi-generic.h +++ b/src/include/spi-generic.h @@ -28,6 +28,19 @@ #include #include +/* SPI vendor IDs */ +#define VENDOR_ID_ADESTO 0x1f +#define VENDOR_ID_AMIC 0x37 +#define VENDOR_ID_ATMEL 0x1f +#define VENDOR_ID_EON 0x1c +#define VENDOR_ID_GIGADEVICE 0xc8 +#define VENDOR_ID_MACRONIX 0xc2 +#define VENDOR_ID_SPANSION 0x01 +#define VENDOR_ID_SST 0xbf +#define VENDOR_ID_STMICRO 0x20 +#define VENDOR_ID_STMICRO_FF 0xff +#define VENDOR_ID_WINBOND 0xef + /* Controller-specific definitions: */ struct spi_ctrlr; -- cgit v1.2.3