From 43aa527eecbf272e179a09b0c3313636b0e6e19c Mon Sep 17 00:00:00 2001 From: Raul E Rangel Date: Fri, 21 May 2021 17:04:28 -0600 Subject: [PATCH] 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 Change-Id: I20d12edf3efc6100096e24aa8d1aec76bbde264f Reviewed-on: https://review.coreboot.org/c/coreboot/+/54884 Tested-by: build bot (Jenkins) Reviewed-by: Rob Barnes --- src/soc/amd/common/block/lpc/espi_util.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/soc/amd/common/block/lpc/espi_util.c b/src/soc/amd/common/block/lpc/espi_util.c index e6ae2cb505..b724408022 100644 --- a/src/soc/amd/common/block/lpc/espi_util.c +++ b/src/soc/amd/common/block/lpc/espi_util.c @@ -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; }