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>
diff --git a/src/soc/amd/common/block/lpc/espi_util.c b/src/soc/amd/common/block/lpc/espi_util.c
index e6ae2cb..b724408 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 @@
 	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 @@
 		},
 		.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 @@
 		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;
 	}