mb/amd/crater: Move gpio configuration to early_gpio

Remove the gpio function calls from ec code and mode to early gpio file.

Change-Id: I941828808bdcdac00ab59d48907da1f70024d6e0
Signed-off-by: Ana Carolina Cabral <ana.cpmelo95@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87442
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Ana Carolina Cabral 2025-04-24 10:32:21 -03:00 committed by Felix Held
commit 430e34cd0f
3 changed files with 18 additions and 23 deletions

View file

@ -2,6 +2,7 @@
#include <gpio.h>
#include "gpio.h"
#include "ec.h"
/* GPIO pins used by coreboot should be initialized in bootblock */
@ -69,7 +70,24 @@ static const struct soc_amd_gpio gpio_set_stage_reset[] = {
PAD_NF(GPIO_20, I2C3_SDA, PULL_NONE),
};
static const struct soc_amd_gpio RevA_gpio_set_stage_ram[] = {
/* PCIE x8 SLOT*/
PAD_GPO(GPIO_4, HIGH),
};
static const struct soc_amd_gpio RevB_gpio_set_stage_ram[] = {
PAD_GPI(GPIO_4, PULL_UP),
PAD_GPO(GPIO_12, LOW),
};
void mainboard_program_early_gpios(void)
{
gpio_configure_pads(gpio_set_stage_reset, ARRAY_SIZE(gpio_set_stage_reset));
uint8_t board_rev = crater_ec_get_board_revision();
if (board_rev == CRATER_REVB)
gpio_configure_pads(RevB_gpio_set_stage_ram, ARRAY_SIZE(RevB_gpio_set_stage_ram));
else
gpio_configure_pads(RevA_gpio_set_stage_ram, ARRAY_SIZE(RevA_gpio_set_stage_ram));
}

View file

@ -185,31 +185,9 @@ static void configure_ec_gpio(void)
}
}
static const struct soc_amd_gpio RevA_gpio_set_stage_ram[] = {
/* PCIE x8 SLOT*/
PAD_GPO(GPIO_4, HIGH),
};
static const struct soc_amd_gpio RevB_gpio_set_stage_ram[] = {
PAD_GPI(GPIO_4, PULL_UP),
PAD_GPO(GPIO_12, LOW),
};
void crater_boardrevision(void)
{
uint8_t BoardRev;
BoardRev = ec_read(ECRAM_BOARDID_OFFSET + 0x3);
if (BoardRev == CRATER_REVB)
gpio_configure_pads(RevB_gpio_set_stage_ram, ARRAY_SIZE(RevB_gpio_set_stage_ram));
else
gpio_configure_pads(RevA_gpio_set_stage_ram, ARRAY_SIZE(RevA_gpio_set_stage_ram));
}
void crater_ec_init(void)
{
ec_set_ports(CRATER_EC_CMD, CRATER_EC_DATA);
crater_boardrevision();
configure_ec_gpio();
}

View file

@ -6,7 +6,6 @@
#define CRATER_REVB 0x42
void crater_ec_init(void);
void crater_boardrevision(void);
uint8_t crater_ec_get_board_revision(void);
void crater_ec_get_mac_addresses(uint64_t *xgbe_port0_mac, uint64_t *xgbe_port1_mac);