Karthik Ramasubramanian has uploaded this change for review.

View Change

mb/google/guybrush: Override SPI Fast speeds

Add support to override SPI fast speeds based on board version from both
bootblock and verstage. Overrides apply for Guybrush only and SPI speed
is overridden from 66 MHz to 100 MHz starting board version 4. This will
help to improve the boot time on board version by ~60 ms and still allow
the old boards to boot with 66 MHz.

BUG=b:199779306
TEST=Build and boot to OS in Guybrush. Perform S5->S0, G3->S0, warm
reset and suspend/resume cycles for 50 iterations each.

Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Change-Id: I5bf03ab8772f27aca346589e9c5662caf014d0d2
---
M src/mainboard/google/guybrush/Kconfig
M src/mainboard/google/guybrush/bootblock.c
M src/mainboard/google/guybrush/verstage.c
3 files changed, 38 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/17/58117/1
diff --git a/src/mainboard/google/guybrush/Kconfig b/src/mainboard/google/guybrush/Kconfig
index c259d25..e5f1382 100644
--- a/src/mainboard/google/guybrush/Kconfig
+++ b/src/mainboard/google/guybrush/Kconfig
@@ -111,6 +111,22 @@
config ALT_SPI_SPEED
default 0 # 66MHz

+config OVERRIDE_EFS_SPI_SPEED
+ int
+ default 3 if EM100
+ default 4 # 100MHz
+ help
+ Override EFS SPI Speed Configuration to be applied based on certain
+ board version.
+
+config OVERRIDE_EFS_SPI_SPEED_MIN_BOARD
+ hex
+ default 0x4 if BOARD_GOOGLE_GUYBRUSH
+ default 0xffffffff
+ help
+ Minimum board version starting which the Override EFS SPI Speed
+ configuration has to be applied.
+
endif # !EM100

config VARIANT_DIR
diff --git a/src/mainboard/google/guybrush/bootblock.c b/src/mainboard/google/guybrush/bootblock.c
index cd27632..f4fff1f 100644
--- a/src/mainboard/google/guybrush/bootblock.c
+++ b/src/mainboard/google/guybrush/bootblock.c
@@ -2,8 +2,10 @@

#include <amdblocks/acpimmio.h>
#include <amdblocks/espi.h>
+#include <amdblocks/spi.h>
#include <bootblock_common.h>
#include <baseboard/variants.h>
+#include <boardid.h>
#include <console/console.h>
#include <delay.h>
#include <device/pci_ops.h>
@@ -92,3 +94,12 @@
if (variant_has_fpmcu())
variant_fpmcu_reset();
}
+
+
+void mainboard_spi_fast_speed_override(uint8_t *fast_speed)
+{
+ uint32_t board_ver = board_id();
+
+ if (board_ver >= CONFIG_OVERRIDE_EFS_SPI_SPEED_MIN_BOARD)
+ *fast_speed = CONFIG_OVERRIDE_EFS_SPI_SPEED;
+}
diff --git a/src/mainboard/google/guybrush/verstage.c b/src/mainboard/google/guybrush/verstage.c
index aaaaf03..afc2a10 100644
--- a/src/mainboard/google/guybrush/verstage.c
+++ b/src/mainboard/google/guybrush/verstage.c
@@ -2,8 +2,10 @@

#include <amdblocks/acpimmio.h>
#include <amdblocks/gpio.h>
+#include <amdblocks/spi.h>
#include <arch/io.h>
#include <baseboard/variants.h>
+#include <boardid.h>
#include <security/vboot/vboot_common.h>

static void setup_gpio(void)
@@ -38,3 +40,12 @@
pm_io_write32(0x74, dword);
}
}
+
+void mainboard_spi_fast_speed_override(uint8_t *fast_speed)
+{
+ uint32_t board_ver = board_id();
+
+ if (CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK) &&
+ board_ver >= CONFIG_OVERRIDE_EFS_SPI_SPEED_MIN_BOARD)
+ *fast_speed = CONFIG_OVERRIDE_EFS_SPI_SPEED;
+}

To view, visit change 58117. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I5bf03ab8772f27aca346589e9c5662caf014d0d2
Gerrit-Change-Number: 58117
Gerrit-PatchSet: 1
Gerrit-Owner: Karthik Ramasubramanian <kramasub@google.com>
Gerrit-MessageType: newchange