Timothy Pearson (tpearson@raptorengineering.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16306
-gerrit
commit 04b8451f084d23a8b1237e0bba02ee6be9867ab4 Author: Timothy Pearson tpearson@raptorengineering.com Date: Tue Aug 23 15:41:05 2016 -0500
sb/amd/sb700: Increase SPI speed to 33MHz by default
Some SB700-based systems and ROMs support high speed (33MHz) SPI access instead of the power-on default 16.5MHz. Add an option to enable high speed SPI access in the bootblock, and set the default value to Disabled. This greatly decreases boot time on SB700-based systems, especiall when a large payload is in use.
Change-Id: Iadbd9bb611754262ef75a5e5a6ee4390a46e45cf Test: Booted KGPE-D16 with Linux payload --- src/southbridge/amd/sb700/Kconfig | 7 +++++++ src/southbridge/amd/sb700/bootblock.c | 25 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+)
diff --git a/src/southbridge/amd/sb700/Kconfig b/src/southbridge/amd/sb700/Kconfig index 9a988a9..5a7752f 100644 --- a/src/southbridge/amd/sb700/Kconfig +++ b/src/southbridge/amd/sb700/Kconfig @@ -25,6 +25,13 @@ config SOUTHBRIDGE_SPECIFIC_OPTIONS # dummy select HAVE_HARD_RESET select SMBUS_HAS_AUX_CHANNELS
+config SOUTHBRIDGE_AMD_SB700_HIGH_SPEED_SPI + bool "Enable high speed SPI clock" + default n + help + WHen set, the SPI clock will run at 33MHz instead + of the compatibility mode 16.5MHz. + # Set for southbridge SP5100 which also uses SB700 driver config SOUTHBRIDGE_AMD_SUBTYPE_SP5100 bool diff --git a/src/southbridge/amd/sb700/bootblock.c b/src/southbridge/amd/sb700/bootblock.c index 97e749c..e09b402 100644 --- a/src/southbridge/amd/sb700/bootblock.c +++ b/src/southbridge/amd/sb700/bootblock.c @@ -20,6 +20,10 @@
#define IO_MEM_PORT_DECODE_ENABLE_5 0x48 #define IO_MEM_PORT_DECODE_ENABLE_6 0x4a +#define SPI_BASE_ADDRESS 0xa0 + +#define SPI_CONTROL_1 0xc +#define TEMPORARY_SPI_BASE_ADDRESS 0xfec10000
/* * Enable 4MB (LPC) ROM access at 0xFFC00000 - 0xFFFFFFFF. @@ -90,6 +94,27 @@ static void sb700_enable_rom(void) reg8 = pci_io_read_config8(dev, IO_MEM_PORT_DECODE_ENABLE_6); reg8 |= (1 << 5); pci_io_write_config8(dev, IO_MEM_PORT_DECODE_ENABLE_6, reg8); + + if (IS_ENABLED(CONFIG_SOUTHBRIDGE_AMD_SB700_HIGH_SPEED_SPI)) { + uint32_t prev_spi_cfg; + volatile uint32_t *spi_mmio; + + /* Temporarily set up SPI access to change SPI speed */ + prev_spi_cfg = dword = pci_io_read_config32(dev, SPI_BASE_ADDRESS); + dword &= ~(0x7ffffff << 5); /* SPI_BaseAddr */ + dword |= TEMPORARY_SPI_BASE_ADDRESS & (0x7ffffff << 5); + dword |= (0x1 << 1); /* SpiRomEnable = 1 */ + pci_io_write_config32(dev, SPI_BASE_ADDRESS, dword); + + spi_mmio = (void *)(TEMPORARY_SPI_BASE_ADDRESS + SPI_CONTROL_1); + dword = *spi_mmio; + dword &= ~(0x3 << 12); /* NormSpeed = 0x1 */ + dword |= (0x1 << 12); + *spi_mmio = dword; + + /* Restore previous SPI access */ + pci_io_write_config32(dev, SPI_BASE_ADDRESS, prev_spi_cfg); + } }
static void bootblock_southbridge_init(void)