mb/google/mancomb: Configure early GPIOs in earliest stage
Configure early GPIOs in verstage if it is run in PSP otherwise configure them in bootblock. BUG=b:182211161 TEST=builds Signed-off-by: Eric Lai <ericr_lai@compal.corp-partner.google.com> Change-Id: Ic1faeea59462319c1652c69034b4dde01669e13b Reviewed-on: https://review.coreboot.org/c/coreboot/+/51493 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org> Reviewed-by: Mathew King <mathewk@chromium.org>
This commit is contained in:
parent
a906918ae0
commit
d807c806b3
5 changed files with 28 additions and 10 deletions
|
@ -7,6 +7,9 @@ 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)) {
|
||||||
|
gpios = variant_early_gpio_table(&num_gpios);
|
||||||
program_gpios(gpios, num_gpios);
|
program_gpios(gpios, num_gpios);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
bootblock-y += gpio.c
|
bootblock-y += gpio.c
|
||||||
|
|
||||||
ramstage-y += gpio.c
|
ramstage-y += gpio.c
|
||||||
|
|
||||||
|
verstage-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 */
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct soc_amd_gpio *__weak variant_base_gpio_table(size_t *size)
|
const struct soc_amd_gpio *__weak variant_base_gpio_table(size_t *size)
|
||||||
|
@ -179,8 +179,8 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ 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);
|
||||||
|
|
||||||
#endif /* __BASEBOARD_VARIANTS_H__ */
|
#endif /* __BASEBOARD_VARIANTS_H__ */
|
||||||
|
|
|
@ -1,9 +1,22 @@
|
||||||
/* 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