diff options
author | Aseda Aboagye <aaboagye@google.com> | 2017-09-15 17:21:16 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-09-23 11:27:29 -0700 |
commit | 1914a56ebc4ff72e75a10f8891aa85b4138c689b (patch) | |
tree | 564463d0fa67d674f78a6aa06180fb666fd96eb6 /board | |
parent | cbfb59f118bd7ee49872c31177d4f96155dc75a3 (diff) | |
download | chrome-ec-1914a56ebc4ff72e75a10f8891aa85b4138c689b.tar.gz |
zoombini: Enable TCPC interrupts.
The TCPC interrupts were setup, but they weren't enabled yet. This
commit enables the interrupts.
Additionally, a "tcpcdump" debug command is added. This can be removed
later or expanded upon to be more generic.
BUG=None
BRANCH=None
TEST=Flash zoombini; Verify that we respond to TCPC alerts.
Change-Id: Iba9523cbfb96a570b76e7bdc0ba21dd782854f24
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/670063
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/zoombini/board.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/board/zoombini/board.c b/board/zoombini/board.c index 2a3bba6ea0..303e379ca5 100644 --- a/board/zoombini/board.c +++ b/board/zoombini/board.c @@ -187,6 +187,15 @@ int board_get_ramp_current_limit(int supplier, int sup_curr) return 500; } +static void board_init(void) +{ + /* Enable TCPC interrupts. */ + gpio_enable_interrupt(GPIO_USB_C0_PD_INT_L); + gpio_enable_interrupt(GPIO_USB_C1_PD_INT_L); + gpio_enable_interrupt(GPIO_USB_C2_PD_INT_L); +} +DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); + int board_is_ramp_allowed(int supplier) { /* Don't allow ramping in RO when write protected. */ @@ -275,3 +284,41 @@ uint16_t tcpc_get_alert_status(void) return status; } + +/* TODO(aaboagye): Remove if not needed later. */ +static int command_tcpc_dump_reg(int argc, char **argv) +{ + int port; + int regval; + int reg; + int rv; + + if (argc < 2) + return EC_ERROR_PARAM_COUNT; + + port = atoi(argv[1]); + + if (port < 0 || port > 2) + return EC_ERROR_PARAM1; + + /* Dump the regs for the queried TCPC port. */ + regval = 0; + + cflush(); + ccprintf("TCPC %d reg dump:\n", port); + + for (reg = 0; reg <= 0xff; reg++) { + regval = 0; + ccprintf("[0x%02x] = ", reg); + rv = tcpc_read(port, reg, ®val); + if (!rv) + ccprintf("0x%02x\n", regval); + else + ccprintf("ERR (%d)\n", rv); + cflush(); + } + + return EC_SUCCESS; +} +DECLARE_CONSOLE_COMMAND(tcpcdump, command_tcpc_dump_reg, "<port>", + "Dumps TCPCI regs 0-ff"); |