mb/google/guybrush: Configure early GPIOs in earliest stage
Configure early GPIOs in verstage if it is run in PSP otherwise configure them in bootblock. BUG=b:181961514, b:180721208 TEST=builds Signed-off-by: Mathew King <mathewk@chromium.org> Change-Id: Ib9410089592776ffe198901f2de914fd04bdbade Reviewed-on: https://review.coreboot.org/c/coreboot/+/51348 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
parent
7a8108deb9
commit
d490afbe04
5 changed files with 28 additions and 10 deletions
|
@ -11,8 +11,10 @@ void bootblock_mainboard_early_init(void)
|
||||||
size_t num_gpios;
|
size_t num_gpios;
|
||||||
const struct soc_amd_gpio *gpios;
|
const struct soc_amd_gpio *gpios;
|
||||||
|
|
||||||
gpios = variant_bootblock_gpio_table(&num_gpios);
|
if (!CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK)) {
|
||||||
program_gpios(gpios, num_gpios);
|
gpios = variant_early_gpio_table(&num_gpios);
|
||||||
|
program_gpios(gpios, num_gpios);
|
||||||
|
}
|
||||||
|
|
||||||
if (CONFIG(GPIO_SIGN_OF_LIFE)) {
|
if (CONFIG(GPIO_SIGN_OF_LIFE)) {
|
||||||
for (int x = 0; x < 20; x++) {
|
for (int x = 0; x < 20; x++) {
|
||||||
|
|
|
@ -2,4 +2,6 @@ bootblock-y += gpio.c
|
||||||
|
|
||||||
ramstage-y += gpio.c
|
ramstage-y += gpio.c
|
||||||
|
|
||||||
|
verstage-y += gpio.c
|
||||||
|
|
||||||
smm-y += gpio.c
|
smm-y += gpio.c
|
||||||
|
|
|
@ -163,9 +163,9 @@ static const struct soc_amd_gpio base_gpio_table[] = {
|
||||||
PAD_NF(GPIO_148, I2C1_SDA, PULL_NONE),
|
PAD_NF(GPIO_148, I2C1_SDA, PULL_NONE),
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Early GPIO configuration in bootblock */
|
/* Early GPIO configuration */
|
||||||
static const struct soc_amd_gpio bootblock_gpio_table[] = {
|
static const struct soc_amd_gpio early_gpio_table[] = {
|
||||||
/* TODO: Fill bootblock gpio configuration */
|
/* TODO: Fill early gpio configuration */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* GPIO configuration for sleep */
|
/* GPIO configuration for sleep */
|
||||||
|
@ -184,10 +184,10 @@ const struct soc_amd_gpio *__weak variant_override_gpio_table(size_t *size)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct soc_amd_gpio *__weak variant_bootblock_gpio_table(size_t *size)
|
const struct soc_amd_gpio *__weak variant_early_gpio_table(size_t *size)
|
||||||
{
|
{
|
||||||
*size = ARRAY_SIZE(bootblock_gpio_table);
|
*size = ARRAY_SIZE(early_gpio_table);
|
||||||
return bootblock_gpio_table;
|
return early_gpio_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
const __weak struct soc_amd_gpio *variant_sleep_gpio_table(size_t *size)
|
const __weak struct soc_amd_gpio *variant_sleep_gpio_table(size_t *size)
|
||||||
|
|
|
@ -18,8 +18,8 @@ const struct soc_amd_gpio *variant_base_gpio_table(size_t *size);
|
||||||
*/
|
*/
|
||||||
const struct soc_amd_gpio *variant_override_gpio_table(size_t *size);
|
const struct soc_amd_gpio *variant_override_gpio_table(size_t *size);
|
||||||
|
|
||||||
/* This function provides GPIO init in bootblock. */
|
/* This function provides early GPIO init in bootblock or psp. */
|
||||||
const struct soc_amd_gpio *variant_bootblock_gpio_table(size_t *size);
|
const struct soc_amd_gpio *variant_early_gpio_table(size_t *size);
|
||||||
|
|
||||||
/* This function provides GPIO settings before entering sleep. */
|
/* This function provides GPIO settings before entering sleep. */
|
||||||
const struct soc_amd_gpio *variant_sleep_gpio_table(size_t *size);
|
const struct soc_amd_gpio *variant_sleep_gpio_table(size_t *size);
|
||||||
|
|
|
@ -1,9 +1,23 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||||
|
|
||||||
|
#include <amdblocks/gpio_banks.h>
|
||||||
|
#include <baseboard/variants.h>
|
||||||
#include <security/vboot/vboot_common.h>
|
#include <security/vboot/vboot_common.h>
|
||||||
|
|
||||||
|
static void setup_gpio(void)
|
||||||
|
{
|
||||||
|
const struct soc_amd_gpio *gpios;
|
||||||
|
size_t num_gpios;
|
||||||
|
|
||||||
|
if (CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK)) {
|
||||||
|
gpios = variant_early_gpio_table(&num_gpios);
|
||||||
|
program_gpios(gpios, num_gpios);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void verstage_mainboard_early_init(void)
|
void verstage_mainboard_early_init(void)
|
||||||
{
|
{
|
||||||
|
setup_gpio();
|
||||||
}
|
}
|
||||||
|
|
||||||
void verstage_mainboard_init(void)
|
void verstage_mainboard_init(void)
|
||||||
|
|
Loading…
Reference in a new issue