soc/amd/common/block/espi: Explicitly assert PLTRST#

PLTRST# is currently asserted and latched when eSPI_RST# gets asserted.
If eSPI_RST# isn't used on a platform or it doesn't properly assert
in all cases, then PLTRST# will never be asserted. This could result in
the AP and EC being out of sync.

BUG=b:188188172, b:188935533
TEST=Warm reset guybrush with partial #22 rework. Verify that peripheral
channel is correctly reset.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I20d12edf3efc6100096e24aa8d1aec76bbde264f
Reviewed-on: https://review.coreboot.org/c/coreboot/+/54884
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Rob Barnes <robbarnes@google.com>
This commit is contained in:
Raul E Rangel 2021-05-21 17:04:28 -06:00 committed by Patrick Georgi
parent 203698a4cb
commit 43aa527eec
1 changed files with 11 additions and 4 deletions

View File

@ -563,7 +563,7 @@ static int espi_send_reset(void)
return espi_send_command(&cmd);
}
static int espi_send_pltrst_deassert(const struct espi_config *mb_cfg)
static int espi_send_pltrst(const struct espi_config *mb_cfg, bool assert)
{
struct espi_cmd cmd = {
.hdr0 = {
@ -573,7 +573,8 @@ static int espi_send_pltrst_deassert(const struct espi_config *mb_cfg)
},
.data = {
.byte0 = ESPI_VW_INDEX_SYSTEM_EVENT_3,
.byte1 = ESPI_VW_SIGNAL_HIGH(ESPI_VW_PLTRST),
.byte1 = assert ? ESPI_VW_SIGNAL_LOW(ESPI_VW_PLTRST)
: ESPI_VW_SIGNAL_HIGH(ESPI_VW_PLTRST),
},
};
@ -1006,9 +1007,15 @@ int espi_setup(void)
return -1;
}
/* Assert PLTRST# if VW channel is enabled by mainboard. */
if (espi_send_pltrst(cfg, true) == -1) {
printk(BIOS_ERR, "Error: PLTRST# assertion failed!\n");
return -1;
}
/* De-assert PLTRST# if VW channel is enabled by mainboard. */
if (espi_send_pltrst_deassert(cfg) == -1) {
printk(BIOS_ERR, "Error: PLTRST deassertion failed!\n");
if (espi_send_pltrst(cfg, false) == -1) {
printk(BIOS_ERR, "Error: PLTRST# deassertion failed!\n");
return -1;
}