Duncan Laurie has uploaded a new change for review. (
https://chromium-review.googlesource.com/400035
Change subject: npcx: espi: Fix pltrst handler for chipset reset hook
......................................................................
npcx: espi: Fix pltrst handler for chipset reset hook
Enable the chipset_reset_hook by adding interrupt trigger on
pltrst assertion and fix the compilation when built with
CONFIG_CHIPSET_RESET_HOOK enabled.
BUG=chrome-os-partner:58666
BRANCH=none
TEST=build with CONFIG_ESPI and CONFIG_CHIPSET_RESET_HOOK
Change-Id: I64eb7a1acc58c07beba0d28f94d95ef33d7220fb
Signed-off-by: Duncan Laurie <
dla...@chromium.org>
---
M chip/npcx/espi.c
1 file changed, 28 insertions(+), 14 deletions(-)
diff --git a/chip/npcx/espi.c b/chip/npcx/espi.c
index 7d84136..41d6148 100644
--- a/chip/npcx/espi.c
+++ b/chip/npcx/espi.c
@@ -14,6 +14,8 @@
#include "power.h"
#include "espi.h"
#include "lpc_chip.h"
+#include "hooks.h"
+#include "timer.h"
/* Console output macros */
#if !(DEBUG_ESPI)
@@ -91,7 +93,7 @@
/* SLP_S5 */
{MIWU_TABLE_2, MIWU_GROUP_1, 2, MIWU_EDGE_ANYING},
/* VW_WIRE_PLTRST */
- {MIWU_TABLE_2, MIWU_GROUP_1, 5, MIWU_EDGE_RISING},
+ {MIWU_TABLE_2, MIWU_GROUP_1, 5, MIWU_EDGE_ANYING},
/* VW_WIRE_OOB_RST_WARN */
{MIWU_TABLE_2, MIWU_GROUP_1, 6, MIWU_EDGE_ANYING},
/* VW_WIRE_HOST_RST_WARN */
@@ -382,28 +384,40 @@
/*****************************************************************************/
/* VW event handlers */
+#ifdef CONFIG_CHIPSET_RESET_HOOK
+static void espi_chipset_reset(void)
+{
+ hook_notify(HOOK_CHIPSET_RESET);
+}
+DECLARE_DEFERRED(espi_chipset_reset);
+#endif
+
/* PLTRST# event handler */
void espi_vw_evt_pltrst(void)
{
- CPRINTS("VW PLTRST: %d", espi_vw_get_wire(VW_PLTRST_L));
+ int pltrst = espi_vw_get_wire(VW_PLTRST_L);
- /* Disable eSPI peripheral channel support first */
- CLEAR_BIT(NPCX_ESPICFG, NPCX_ESPICFG_PCCHN_SUPP);
+ CPRINTS("VW PLTRST: %d", pltrst);
- /* Enable eSPI peripheral channel */
- SET_BIT(NPCX_ESPICFG, NPCX_ESPICFG_PCHANEN);
- /* Initialize host settings */
- host_register_init();
+ if (pltrst) {
+ /* PLTRST# deasserted */
+ /* Disable eSPI peripheral channel support first */
+ CLEAR_BIT(NPCX_ESPICFG, NPCX_ESPICFG_PCCHN_SUPP);
- /* Re-enable eSPI peripheral channel support */
- SET_BIT(NPCX_ESPICFG, NPCX_ESPICFG_PCCHN_SUPP);
+ /* Enable eSPI peripheral channel */
+ SET_BIT(NPCX_ESPICFG, NPCX_ESPICFG_PCHANEN);
+ /* Initialize host settings */
+ host_register_init();
+
+ /* Re-enable eSPI peripheral channel support */
+ SET_BIT(NPCX_ESPICFG, NPCX_ESPICFG_PCCHN_SUPP);
+ } else {
+ /* PLTRST# asserted */
#ifdef CONFIG_CHIPSET_RESET_HOOK
- if (lpc_get_pltrst_asserted()) {
- /* Notify HOOK_CHIPSET_RESET */
- hook_call_deferred(lpc_chipset_reset, MSEC);
- }
+ hook_call_deferred(&espi_chipset_reset_data, MSEC);
#endif
+ }
}
/* SLP_Sx event handler */
--
To view, visit
https://chromium-review.googlesource.com/400035
To unsubscribe, visit
https://chromium-review.googlesource.com/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I64eb7a1acc58c07beba0d28f94d95ef33d7220fb
Gerrit-PatchSet: 1
Gerrit-Project: chromiumos/platform/ec
Gerrit-Branch: master
Gerrit-Owner: Duncan Laurie <
dla...@chromium.org>