Felix Held has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/83773?usp=email )
Change subject: soc/amd/common/include/spi: add and use SPI_MISC_CNTRL defines ......................................................................
soc/amd/common/include/spi: add and use SPI_MISC_CNTRL defines
This register is currently used by the SPI DMA code that sets an undocumented bit. A following patch will use the SPI_SEMAPHORE_DRIVER_LOCKED bit definition. Since that one won't affect the hardware it's marked as reserved in the PPR, but is used as a semaphore for arbitration of the SPI controller access between SMM code and non-SMM code like OS drivers in the AGESA reference code.
Signed-off-by: Felix Held felix-coreboot@felixheld.de Change-Id: I48447dcfb3cee07619a9b42434731f0b21458021 --- M src/soc/amd/common/block/include/amdblocks/spi.h M src/soc/amd/common/block/lpc/spi_dma.c 2 files changed, 7 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/73/83773/1
diff --git a/src/soc/amd/common/block/include/amdblocks/spi.h b/src/soc/amd/common/block/include/amdblocks/spi.h index cf91814..d6f35f8 100644 --- a/src/soc/amd/common/block/include/amdblocks/spi.h +++ b/src/soc/amd/common/block/include/amdblocks/spi.h @@ -76,6 +76,11 @@ #define SPI_FIFO_LAST_BYTE 0xc6 /* 0xc7 for Cezanne */ #define SPI_FIFO_DEPTH (SPI_FIFO_LAST_BYTE - SPI_FIFO + 1)
+#define SPI_MISC_CNTRL 0xfc +/* Re-purpose unused SPI controller register bit for semaphore to synchronize + SPI access between SMM and non-SMM software/OS driver. */ +#define SPI_SEMAPHORE_DRIVER_LOCKED BIT(4) + struct spi_config { /* * Default values if not overridden by mainboard: diff --git a/src/soc/amd/common/block/lpc/spi_dma.c b/src/soc/amd/common/block/lpc/spi_dma.c index 701b61a..9ff9b0e 100644 --- a/src/soc/amd/common/block/lpc/spi_dma.c +++ b/src/soc/amd/common/block/lpc/spi_dma.c @@ -277,9 +277,9 @@ static void spi_dma_fix(void) { /* Internal only registers */ - uint8_t val = spi_read8(0xfc); + uint8_t val = spi_read8(SPI_MISC_CNTRL); val |= BIT(6); - spi_write8(0xfc, val); + spi_write8(SPI_MISC_CNTRL, val); }
void boot_device_init(void)