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 <richard.spiegel@silverbackltd.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/35240
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Richard Spiegel 2019-09-03 11:54:55 -07:00 committed by Martin Roth
parent 28086f0d2c
commit 563b8694d2
2 changed files with 24 additions and 11 deletions

View File

@ -282,38 +282,38 @@ static struct {
} flashes[] = { } flashes[] = {
/* Keep it sorted by define name */ /* Keep it sorted by define name */
#if CONFIG(SPI_FLASH_AMIC) #if CONFIG(SPI_FLASH_AMIC)
{ 0, 0x37, spi_flash_probe_amic, }, { 0, VENDOR_ID_AMIC, spi_flash_probe_amic, },
#endif #endif
#if CONFIG(SPI_FLASH_ATMEL) #if CONFIG(SPI_FLASH_ATMEL)
{ 0, 0x1f, spi_flash_probe_atmel, }, { 0, VENDOR_ID_ATMEL, spi_flash_probe_atmel, },
#endif #endif
#if CONFIG(SPI_FLASH_EON) #if CONFIG(SPI_FLASH_EON)
{ 0, 0x1c, spi_flash_probe_eon, }, { 0, VENDOR_ID_EON, spi_flash_probe_eon, },
#endif #endif
#if CONFIG(SPI_FLASH_GIGADEVICE) #if CONFIG(SPI_FLASH_GIGADEVICE)
{ 0, 0xc8, spi_flash_probe_gigadevice, }, { 0, VENDOR_ID_GIGADEVICE, spi_flash_probe_gigadevice, },
#endif #endif
#if CONFIG(SPI_FLASH_MACRONIX) #if CONFIG(SPI_FLASH_MACRONIX)
{ 0, 0xc2, spi_flash_probe_macronix, }, { 0, VENDOR_ID_MACRONIX, spi_flash_probe_macronix, },
#endif #endif
#if CONFIG(SPI_FLASH_SPANSION) #if CONFIG(SPI_FLASH_SPANSION)
{ 0, 0x01, spi_flash_probe_spansion, }, { 0, VENDOR_ID_SPANSION, spi_flash_probe_spansion, },
#endif #endif
#if CONFIG(SPI_FLASH_SST) #if CONFIG(SPI_FLASH_SST)
{ 0, 0xbf, spi_flash_probe_sst, }, { 0, VENDOR_ID_SST, spi_flash_probe_sst, },
#endif #endif
#if CONFIG(SPI_FLASH_STMICRO) #if CONFIG(SPI_FLASH_STMICRO)
{ 0, 0x20, spi_flash_probe_stmicro, }, { 0, VENDOR_ID_STMICRO, spi_flash_probe_stmicro, },
#endif #endif
#if CONFIG(SPI_FLASH_WINBOND) #if CONFIG(SPI_FLASH_WINBOND)
{ 0, 0xef, spi_flash_probe_winbond, }, { 0, VENDOR_ID_WINBOND, spi_flash_probe_winbond, },
#endif #endif
/* Keep it sorted by best detection */ /* Keep it sorted by best detection */
#if CONFIG(SPI_FLASH_STMICRO) #if CONFIG(SPI_FLASH_STMICRO)
{ 0, 0xff, spi_flash_probe_stmicro, }, { 0, VENDOR_ID_STMICRO_FF, spi_flash_probe_stmicro, },
#endif #endif
#if CONFIG(SPI_FLASH_ADESTO) #if CONFIG(SPI_FLASH_ADESTO)
{ 0, 0x1f, spi_flash_probe_adesto, }, { 0, VENDOR_ID_ADESTO, spi_flash_probe_adesto, },
#endif #endif
}; };
#define IDCODE_LEN (IDCODE_CONT_LEN + IDCODE_PART_LEN) #define IDCODE_LEN (IDCODE_CONT_LEN + IDCODE_PART_LEN)

View File

@ -28,6 +28,19 @@
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
/* 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: */ /* Controller-specific definitions: */
struct spi_ctrlr; struct spi_ctrlr;