summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2016-04-15 16:40:38 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-04-16 12:00:21 -0700
commit096dec1adba5928fdff6c0d0b47d51545580a268 (patch)
tree2f2f8dad84956d6e536fd08e8e10529ea9b6c4a9
parente4690f61524e4fc45fcec7ef8fb43cd0f6ccc373 (diff)
downloadchrome-ec-096dec1adba5928fdff6c0d0b47d51545580a268.tar.gz
Cr50: Change SYS_RST output to SYS_RST_L inout
This signal should be active low, not active high. In addition, not only can we pull it low but so can other components. If something else asserts it, we need to react. This changes the polarity and sets up the interrupt handler. A future CL will be needed to make the handler do something useful. BUG=chrome-os-partner:52366 BRANCH=none TEST=make buildall; test on Cr50 On the test board, short M0 to ground to trigger the interrupt. Watch the input value with gpioget You can drive the output (and trigger the interrupt) with gpioset SYS_RST_L_OUT 0 gpioset SYS_RST_L_OUT 1 Change-Id: I3556963859601f43f990fc83f26d2cea919383c6 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/339214 Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--board/cr50/board.c8
-rw-r--r--board/cr50/board.h3
-rw-r--r--board/cr50/gpio.inc17
3 files changed, 25 insertions, 3 deletions
diff --git a/board/cr50/board.c b/board/cr50/board.c
index acb30c94c5..139b550087 100644
--- a/board/cr50/board.c
+++ b/board/cr50/board.c
@@ -156,3 +156,11 @@ int flash_regions_to_enable(struct g_flash_region *regions,
return 1; /* One region is enough. */
}
+
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+
+void sys_rst_asserted(enum gpio_signal signal)
+{
+ /* TODO(crosbug.com/p/52366): Do something useful here. */
+ CPRINTS("%s(%d)", __func__, signal);
+}
diff --git a/board/cr50/board.h b/board/cr50/board.h
index 1b2c21b0df..685d511c1c 100644
--- a/board/cr50/board.h
+++ b/board/cr50/board.h
@@ -82,6 +82,9 @@ enum usb_strings {
USB_STR_COUNT
};
+/* Interrupt handler */
+void sys_rst_asserted(enum gpio_signal signal);
+
#endif /* !__ASSEMBLER__ */
/* USB interface indexes (use define rather than enum to expand them) */
diff --git a/board/cr50/gpio.inc b/board/cr50/gpio.inc
index ef4b5eb21b..eb19d733ad 100644
--- a/board/cr50/gpio.inc
+++ b/board/cr50/gpio.inc
@@ -7,6 +7,16 @@
/* Declare symbolic names for all the GPIOs that we care about.
* Note: Those with interrupt handlers must be declared first. */
+/*
+ * We can assert SYS_RST_L but so can the EC, so we need react if it's pulled
+ * low. The ARM core can't trigger an interrupt if it's driving it as an output
+ * so we attach two internal GPIOs to the same pad.
+ * TODO: Remove this internal pullup at some point. It's only here so that
+ * boards that don't have an external pullup don't trigger due to noise.
+ */
+GPIO_INT(SYS_RST_L_IN, PIN(1, 0), GPIO_INT_FALLING | GPIO_PULL_UP,
+ sys_rst_asserted)
+
/* Pull this low to interrupt the AP */
GPIO(INT_AP_L, PIN(0, 0), GPIO_INPUT)
@@ -18,8 +28,8 @@ GPIO(AP_FLASH_SELECT, PIN(0, 2), GPIO_OUT_LOW)
* As an output it can override EC_WP_L, although why would we? */
GPIO(AP_WP_L, PIN(0, 3), GPIO_INPUT)
-/* Drive high to reset the EC & AP */
-GPIO(SYS_RST, PIN(0, 4), GPIO_INPUT)
+/* Pull this low to reset the AP. (We reset the EC with the RBOX.) */
+GPIO(SYS_RST_L_OUT, PIN(0, 4), GPIO_OUT_HIGH)
/* Indicate to EC when CCD is enabled. EC can pull this down too, to tell us if
* it decided instead. The pullup is on the EC's side. */
@@ -47,7 +57,8 @@ PINMUX(GPIO(INT_AP_L), A5, DIO_INPUT) /* DIOB7 is p_digitial_od */
PINMUX(GPIO(EC_FLASH_SELECT), B2, DIO_INPUT)
PINMUX(GPIO(AP_FLASH_SELECT), B3, DIO_INPUT)
PINMUX(GPIO(AP_WP_L), M3, 0)
-PINMUX(GPIO(SYS_RST), M0, DIO_INPUT)
+PINMUX(GPIO(SYS_RST_L_IN), M0, 0)
+PINMUX(GPIO(SYS_RST_L_OUT), M0, DIO_INPUT)
PINMUX(GPIO(CCD_MODE_L), M1, DIO_INPUT)
PINMUX(GPIO(BATT_PRES), M2, 0)