From 7c09def584ff3bccbd5916b02f7ff7da234be13c Mon Sep 17 00:00:00 2001 From: Aseda Aboagye Date: Wed, 24 Feb 2021 16:30:15 -0800 Subject: draw*: Add GPIO_EC_ENTERING_RW2 This commit adds a new GPIO, GPIO_EC_ENTERING_RW2 which does the same thing as GPIO_EC_ENTERING_RW. However, it's on a pin that's more well behaved around init time. This commit also overrides the board_pulse_ec_entering_rw() function such that both lines can be pulsed. BUG=b:180965428,b:181051734,b:181085178 BRANCH=dedede TEST=Build and flash draw*, verify it boots. Signed-off-by: Aseda Aboagye Change-Id: Ia9cfba97b8fcad5975e412523686a7ba53ea7399 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2719104 Reviewed-by: Diana Z Tested-by: Aseda Aboagye --- board/drawcia/board.c | 15 +++++++++++++++ board/drawcia/gpio.inc | 1 + 2 files changed, 16 insertions(+) diff --git a/board/drawcia/board.c b/board/drawcia/board.c index f160335e53..e1f91871dd 100644 --- a/board/drawcia/board.c +++ b/board/drawcia/board.c @@ -450,6 +450,21 @@ __override void board_ocpc_init(struct ocpc_data *ocpc) ocpc->chg_flags[CHARGER_SECONDARY] |= OCPC_NO_ISYS_MEAS_CAP; } +__override void board_pulse_entering_rw(void) +{ + /* + * On the ITE variants, the EC_ENTERING_RW signal was connected to a pin + * which is active high by default. This causes Cr50 to think that the + * EC has jumped to its RW image even though this may not be the case. + * The pin is changed to GPIO_EC_ENTERING_RW2. + */ + gpio_set_level(GPIO_EC_ENTERING_RW, 1); + gpio_set_level(GPIO_EC_ENTERING_RW2, 1); + usleep(MSEC); + gpio_set_level(GPIO_EC_ENTERING_RW, 0); + gpio_set_level(GPIO_EC_ENTERING_RW2, 0); +} + void board_reset_pd_mcu(void) { /* diff --git a/board/drawcia/gpio.inc b/board/drawcia/gpio.inc index 429b952eef..890b6ee9e4 100644 --- a/board/drawcia/gpio.inc +++ b/board/drawcia/gpio.inc @@ -98,6 +98,7 @@ GPIO(EC_SUB_IO_2_1, PIN(F, 1), GPIO_INPUT) /* Misc */ GPIO(EN_BL_OD, PIN(K, 4), GPIO_ODR_LOW) GPIO(EC_ENTERING_RW, PIN(G, 0), GPIO_OUT_LOW) +GPIO(EC_ENTERING_RW2, PIN(C, 7), GPIO_OUT_LOW) GPIO(CCD_MODE_ODL, PIN(H, 5), GPIO_INPUT) GPIO(EC_BATTERY_PRES_ODL, PIN(I, 4), GPIO_INPUT) GPIO(EN_KB_BL, PIN(J, 3), GPIO_OUT_LOW) /* Currently unused */ -- cgit v1.2.1