From e3fc75fbc5c28379be5b7da0516ecfa92a1968f3 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Mon, 30 Jan 2017 14:51:14 -0800 Subject: [PATCH] cr50: improve straps reading debug information This patch makes it clear what state each of the straps is in, the information is printed on the console at startup time. BRANCH=none BUG=chrome-os-partner:59833 TEST=tried the new code on the dev board, observed the following in the console output at startup: strap pin readings: a1:3 a9:1 a6:1 a12:3 which is consistent with expectations give the dev board schematics and mode of operation. Change-Id: Ie7b2511e0da84b8c9e3462d3f88365e6f2227bfe Signed-off-by: Vadim Bendebury Reviewed-on: https://chromium-review.googlesource.com/434938 Reviewed-by: Mary Ruthven --- board/cr50/board.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/board/cr50/board.c b/board/cr50/board.c index e3ce3609f5..d47cb41729 100644 --- a/board/cr50/board.c +++ b/board/cr50/board.c @@ -131,6 +131,7 @@ struct strap_desc { uint8_t sel_offset; /* Entry in the pinmux peripheral selector table for pad */ uint8_t pad_select; + const char *pad_name; }; struct board_cfg { @@ -145,10 +146,11 @@ struct board_cfg { * configure each strapping pin to be either a GPIO input or output. */ const struct strap_desc strap_regs[] = { - { GPIO_STRAP_A0, GOFFSET(PINMUX, DIOA1_SEL), GC_PINMUX_DIOA1_SEL, }, - { GPIO_STRAP_A1, GOFFSET(PINMUX, DIOA9_SEL), GC_PINMUX_DIOA9_SEL, }, - { GPIO_STRAP_B0, GOFFSET(PINMUX, DIOA6_SEL), GC_PINMUX_DIOA6_SEL, }, - { GPIO_STRAP_B1, GOFFSET(PINMUX, DIOA12_SEL), GC_PINMUX_DIOA12_SEL, }, + {GPIO_STRAP_A0, GOFFSET(PINMUX, DIOA1_SEL), GC_PINMUX_DIOA1_SEL, "a1"}, + {GPIO_STRAP_A1, GOFFSET(PINMUX, DIOA9_SEL), GC_PINMUX_DIOA9_SEL, "a9"}, + {GPIO_STRAP_B0, GOFFSET(PINMUX, DIOA6_SEL), GC_PINMUX_DIOA6_SEL, "a6"}, + {GPIO_STRAP_B1, GOFFSET(PINMUX, DIOA12_SEL), GC_PINMUX_DIOA12_SEL, + "a12"}, }; #define BOARD_PROPERTIES_DEFAULT (BOARD_SLAVE_CONFIG_I2C | BOARD_USE_PLT_RESET \ @@ -984,6 +986,7 @@ static int get_strap_config(uint8_t *config) *config = 0; /* Read 2 bit value of each strapping pin. */ + ccprintf("strap pin readings:"); for (s0 = a0; s0 < ARRAY_SIZE(strap_regs); s0++) { lvl = gpio_get_level(strap_regs[s0].gpio_signal); flags = GPIO_INPUT; @@ -996,6 +999,7 @@ static int get_strap_config(uint8_t *config) udelay(STRAP_PIN_DELAY_USEC); lvl = (lvl << 1) | gpio_get_level(strap_regs[s0].gpio_signal); + ccprintf(" %s:%d", strap_regs[s0].pad_name, lvl); *config |= lvl << s0 * 2; /* @@ -1006,6 +1010,7 @@ static int get_strap_config(uint8_t *config) */ strap_config_pin(s0, 0); } + ccprintf("\n"); /* * The strap bits for DIOA12|DIOA6 are in the upper 4 bits of 'config'