summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew McRae <amcrae@google.com>2022-06-20 16:36:33 +1000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-22 01:16:25 +0000
commitba22e4d87558a0db0a3bae9e6351f6e46f6d0c83 (patch)
tree2d146e2eb11fa000e85a43b74843925e73171170
parente8108d90b640c1407e5c90489f0dbbbbb9d8e3dd (diff)
downloadchrome-ec-ba22e4d87558a0db0a3bae9e6351f6e46f6d0c83.tar.gz
ap_pwrseq: eSPI: Use eSPI channel ready callback
Use the eSPI channel ready callback to invalidate the virtual wire status. It appeared that the eSPI bus reset callbacks could not be guaranteed to arrive in the correct order. Also display whether a signal is invalid in the powerindebug output. BUG=b:236561037 TEST=zmake build nivviks; flash & run BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: I261b59884ecce71678ca825d9d29d37195ac9691 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3711518 Reviewed-by: Peter Marheine <pmarheine@chromium.org>
-rw-r--r--zephyr/subsys/ap_pwrseq/signal_vw.c18
-rw-r--r--zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_console.c8
2 files changed, 14 insertions, 12 deletions
diff --git a/zephyr/subsys/ap_pwrseq/signal_vw.c b/zephyr/subsys/ap_pwrseq/signal_vw.c
index de2756c137..53719a9c4f 100644
--- a/zephyr/subsys/ap_pwrseq/signal_vw.c
+++ b/zephyr/subsys/ap_pwrseq/signal_vw.c
@@ -40,9 +40,8 @@ DT_FOREACH_STATUS_OKAY(MY_COMPAT, INIT_ESPI_SIGNAL)
*/
static atomic_t signal_data;
/*
- * Mask of valid signals. If the bus is reset, this is cleared,
- * and when a signal is updated the associated bit is set to indicate
- * the signal is valid.
+ * Mask of valid signals. A signal is considered valid once an
+ * initial value has been received for it.
*/
static atomic_t signal_valid;
@@ -62,11 +61,12 @@ static void espi_handler(const struct device *dev,
event.evt_type);
break;
- case ESPI_BUS_RESET:
- /*
- * Clear the signal valid mask.
- */
- atomic_clear(&signal_valid);
+ case ESPI_BUS_EVENT_CHANNEL_READY:
+ /* Virtual wire channel is not ready, clear valid flag */
+ if (event.evt_details == ESPI_CHANNEL_VWIRE &&
+ !event.evt_data) {
+ atomic_clear(&signal_valid);
+ }
break;
case ESPI_BUS_EVENT_VWIRE_RECEIVED:
@@ -103,7 +103,7 @@ void power_signal_vw_init(void)
/* Configure handler for eSPI events */
espi_init_callback(&espi_cb, espi_handler,
- ESPI_BUS_RESET |
+ ESPI_BUS_EVENT_CHANNEL_READY |
ESPI_BUS_EVENT_VWIRE_RECEIVED);
espi_add_callback(espi_dev, &espi_cb);
/*
diff --git a/zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_console.c b/zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_console.c
index e671e46113..77f8134d10 100644
--- a/zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_console.c
+++ b/zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_console.c
@@ -42,17 +42,19 @@ static int powerindebug_handler(const struct shell *shell, size_t argc,
/* Print the mask */
current = power_get_signals();
- shell_fprintf(shell, SHELL_INFO, "power in: 0x%04x\n", current);
- shell_fprintf(shell, SHELL_INFO, "debug mask: 0x%04x\n",
+ shell_fprintf(shell, SHELL_INFO, "power in: 0x%05x\n", current);
+ shell_fprintf(shell, SHELL_INFO, "debug mask: 0x%05x\n",
power_get_debug());
/* Print the decode */
shell_fprintf(shell, SHELL_INFO, "bit meanings:\n");
for (i = 0; i < POWER_SIGNAL_COUNT; i++) {
power_signal_mask_t mask = POWER_SIGNAL_MASK(i);
+ bool valid = (power_signal_get(i) >= 0);
- shell_fprintf(shell, SHELL_INFO, " 0x%04x %d %s\n",
+ shell_fprintf(shell, SHELL_INFO, " 0x%05x %d%s %s\n",
mask, (current & mask) ? 1 : 0,
+ valid ? " " : "!",
power_signal_name(i));
}