From eb0660283d003f0fb999b8aad29997c8ddf98e87 Mon Sep 17 00:00:00 2001 From: Mary Ruthven Date: Tue, 26 Jul 2016 16:35:11 -0700 Subject: [PATCH] g: add wake pin info to pinmux command It is useful to be able to see which pins are set as wake pins and what type they are. This change adds prints to show_pinmux to describe the wake pins. BUG=none BRANCH=none TEST='pinmux' should show DIOA12 as a wake_low source. Change-Id: I2a0ccdbf9b07abb627c3d52c7dd28433a2beff3c Signed-off-by: Mary Ruthven Reviewed-on: https://chromium-review.googlesource.com/363494 Reviewed-by: Bill Richardson --- chip/g/gpio.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/chip/g/gpio.c b/chip/g/gpio.c index b03d951258..a6ec1bdcb9 100644 --- a/chip/g/gpio.c +++ b/chip/g/gpio.c @@ -335,9 +335,11 @@ static void show_pinmux(const char *name, int i, int ofs) { uint32_t sel = DIO_SEL_REG(i * 8 + ofs); uint32_t ctl = DIO_CTL_REG(i * 8 + ofs); + uint32_t bitmask = 1 << (i + ofs / 8); + uint32_t edge = GREG32(PINMUX, EXITEDGE0) & bitmask; /* skip empty ones (ignoring drive strength bits) */ - if (sel == 0 && (ctl & (0xf << 2)) == 0) + if (!sel && !(ctl & (0xf << 2)) && !(GREG32(PINMUX, EXITEN0) & bitmask)) return; ccprintf("%08x: %s%-2d %2d %s%s%s%s", @@ -349,13 +351,20 @@ static void show_pinmux(const char *name, int i, int ofs) (ctl & (1<<5)) ? " INV" : ""); if (sel >= 1 && sel <= 16) - ccprintf(" GPIO0_GPIO%d\n", sel - 1); + ccprintf(" GPIO0_GPIO%d", sel - 1); else if (sel >= 17 && sel <= 32) - ccprintf(" GPIO1_GPIO%d\n", sel - 17); + ccprintf(" GPIO1_GPIO%d", sel - 17); else if (sel >= 67 && sel <= 78) - ccprintf(" UART%s\n", uart_str[sel - 67]); - else - ccprintf("\n"); + ccprintf(" UART%s", uart_str[sel - 67]); + + if (GREG32(PINMUX, EXITEN0) & bitmask) { + ccprintf(" WAKE_"); + if (GREG32(PINMUX, EXITINV0) & bitmask) + ccprintf("%s", edge ? "FALLING" : "LOW"); + else + ccprintf("%s", edge ? "RISING" : "HIGH"); + } + ccprintf("\n"); } static void print_dio_str(uint32_t sel)