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
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58117
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
This commit is contained in:
Karthikeyan Ramasubramanian 2021-10-05 14:20:14 -06:00 committed by Felix Held
parent 2526be8db3
commit 9eaaf0d309
3 changed files with 26 additions and 0 deletions

View File

@ -111,6 +111,22 @@ config NORMAL_READ_SPI_SPEED
config ALT_SPI_SPEED config ALT_SPI_SPEED
default 0 # 66MHz 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 endif # !EM100
config VARIANT_DIR config VARIANT_DIR

View File

@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
bootblock-y += bootblock.c bootblock-y += bootblock.c
bootblock-$(CONFIG_CHROMEOS) += chromeos.c
ifneq ($(wildcard $(MAINBOARD_BLOBS_DIR)/APCB_CZN_D4.bin),) ifneq ($(wildcard $(MAINBOARD_BLOBS_DIR)/APCB_CZN_D4.bin),)
$(info APCB sources present.) $(info APCB sources present.)

View File

@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */ /* SPDX-License-Identifier: GPL-2.0-or-later */
#include <amdblocks/spi.h>
#include <baseboard/gpio.h> #include <baseboard/gpio.h>
#include <boardid.h> #include <boardid.h>
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
@ -36,3 +37,11 @@ int get_ec_is_trusted(void)
/* EC is trusted if not in RW. */ /* EC is trusted if not in RW. */
return !gpio_get(GPIO_EC_IN_RW); return !gpio_get(GPIO_EC_IN_RW);
} }
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;
}