From 96839d183c0b7ab2e53cf468784a4937a107ec15 Mon Sep 17 00:00:00 2001 From: Raul E Rangel Date: Thu, 24 Mar 2022 16:55:44 -0600 Subject: mb/google/skyrim: Implement mb_set_up_early_espi This will setup the eSPI GPIOs in bootblock right before eSPI init. BUG=b:226635441 TEST=build skyrim Signed-off-by: Raul E Rangel Change-Id: I6ff32bf840aa4b757e98d876cbd4e2ba15a760da Reviewed-on: https://review.coreboot.org/c/coreboot/+/63094 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held --- src/mainboard/google/skyrim/bootblock.c | 10 ++++++++++ .../google/skyrim/variants/baseboard/gpio.c | 23 ++++++++++++++++++++++ .../baseboard/include/baseboard/variants.h | 3 +++ 3 files changed, 36 insertions(+) (limited to 'src') diff --git a/src/mainboard/google/skyrim/bootblock.c b/src/mainboard/google/skyrim/bootblock.c index 5a1c4daa9b..c332aed510 100644 --- a/src/mainboard/google/skyrim/bootblock.c +++ b/src/mainboard/google/skyrim/bootblock.c @@ -1,8 +1,18 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include #include #include +void mb_set_up_early_espi(void) +{ + size_t num_gpios; + const struct soc_amd_gpio *gpios; + + variant_espi_gpio_table(&gpios, &num_gpios); + gpio_configure_pads(gpios, num_gpios); +} + void bootblock_mainboard_early_init(void) { size_t num_gpios, override_num_gpios; diff --git a/src/mainboard/google/skyrim/variants/baseboard/gpio.c b/src/mainboard/google/skyrim/variants/baseboard/gpio.c index fd85b994bd..a262347fdc 100644 --- a/src/mainboard/google/skyrim/variants/baseboard/gpio.c +++ b/src/mainboard/google/skyrim/variants/baseboard/gpio.c @@ -141,6 +141,23 @@ static const struct soc_amd_gpio base_gpio_table[] = { PAD_NF(GPIO_148, I2C1_SDA, PULL_NONE), }; +static const struct soc_amd_gpio espi_gpio_table[] = { + /* ESPI_CS_L */ + PAD_NF(GPIO_30, ESPI_CS_L, PULL_NONE), + /* ESPI_CLK */ + PAD_NF(GPIO_77, SPI1_CLK, PULL_NONE), + /* ESPI1_DATA0 */ + PAD_NF(GPIO_81, SPI1_DAT0, PULL_NONE), + /* ESPI1_DATA1 */ + PAD_NF(GPIO_80, SPI1_DAT1, PULL_NONE), + /* ESPI1_DATA2 */ + PAD_NF(GPIO_68, SPI1_DAT2, PULL_NONE), + /* ESPI1_DATA3 */ + PAD_NF(GPIO_69, SPI1_DAT3, PULL_NONE), + /* ESPI_ALERT_L */ + PAD_NF(GPIO_22, ESPI_ALERT_D1, PULL_NONE), +}; + static const struct soc_amd_gpio tpm_gpio_table[] = { /* I2C3_SCL */ PAD_NF(GPIO_19, I2C3_SCL, PULL_NONE), @@ -222,6 +239,12 @@ __weak void variant_sleep_gpio_table(const struct soc_amd_gpio **gpio, size_t *s *gpio = sleep_gpio_table; } +__weak void variant_espi_gpio_table(const struct soc_amd_gpio **gpio, size_t *size) +{ + *size = ARRAY_SIZE(espi_gpio_table); + *gpio = espi_gpio_table; +} + __weak void variant_tpm_gpio_table(const struct soc_amd_gpio **gpio, size_t *size) { *size = ARRAY_SIZE(tpm_gpio_table); diff --git a/src/mainboard/google/skyrim/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/skyrim/variants/baseboard/include/baseboard/variants.h index 64a414bcd7..7289e10665 100644 --- a/src/mainboard/google/skyrim/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/skyrim/variants/baseboard/include/baseboard/variants.h @@ -37,6 +37,9 @@ void variant_early_override_gpio_table(const struct soc_amd_gpio **gpio, size_t /* This function provides GPIO settings before entering sleep. */ void variant_sleep_gpio_table(const struct soc_amd_gpio **gpio, size_t *size); +/* This function provides GPIO settings for eSPI bus. */ +void variant_espi_gpio_table(const struct soc_amd_gpio **gpio, size_t *size); + /* This function provides GPIO settings for TPM i2c bus. */ void variant_tpm_gpio_table(const struct soc_amd_gpio **gpio, size_t *size); -- cgit v1.2.3