summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2019-12-08 12:23:27 +0800
committerCommit Bot <commit-bot@chromium.org>2019-12-10 22:21:35 +0000
commit6ab9c3b94cae0b5fb77e45483f9d36e189352f20 (patch)
treeead1f2208626a30c4942bd4c0f3b7f55a53696d4
parentae270f04de3f975dc013904930b60ffb2a3e7862 (diff)
downloadchrome-ec-6ab9c3b94cae0b5fb77e45483f9d36e189352f20.tar.gz
Trogdor: Prevent getting into a boot loop assertion failure
In any case failing to talk to the PPC chip, e.g. a hardware bug or a daughter-board not attached, returning a failure return code will result a boot loop assertion failure. Should prevent this case. This is the same behavior as other boards, like octopus, grunt, etc. BRANCH=None BUG=b:145648750 TEST=Don't attach the daughter-board, unplug and plug the charger. No assertion boot loop. > [26.148463 USB MUX 1] C0 st2 SNK_DISCONNECTED [26.150189 Disabling all charging port] [26.151815 ppc p1: Failed to set FUNC_SET3!] [26.152277 Disabling p1 sink path failed.] [26.157214 CL: p-1 s-1 i0 v0] [26.180500 AC off] [27.198359 Battery 99% (Display 0.0 %) / 44h:22 to empty, not accepting current] C0 st3 SNK_DISCONNECTED_DEBOUNCE [30.896588 VBUS p0 1] C0 st14 SRC_DISCONNECTED [30.934551 VBUS p0 0] C0 st3 SNK_DISCONNECTED_DEBOUNCE [31.170306 VBUS p0 1] [31.189848 USB MUX 0] C0 st5 SNK_DISCOVERY C0 RECV 51a1/5 [0]0801912c [1]0002d12c [2]0003c12c [3]0004b12c [4]000640e1 C0 Req [1] 5000mV 3000mA [31.283610 New charge port: p0] [31.284181 ppc p1: Failed to set FUNC_SET3!] [31.284585 p1: sink path disable failed.] ... Change-Id: Ifa81eea0a7d2fc2f90b1a64dacce2a6802165b0a Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1954915 Reviewed-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--board/trogdor/board.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/board/trogdor/board.c b/board/trogdor/board.c
index 3925051ba7..83a5550808 100644
--- a/board/trogdor/board.c
+++ b/board/trogdor/board.c
@@ -416,21 +416,21 @@ int board_set_active_charge_port(int port)
int is_real_port = (port >= 0 &&
port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
- int rv;
if (!is_real_port && port != CHARGE_PORT_NONE)
return EC_ERROR_INVAL;
- CPRINTS("New chg p%d", port);
-
if (port == CHARGE_PORT_NONE) {
+ CPRINTS("Disabling all charging port");
+
/* Disable all ports. */
for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) {
- rv = board_vbus_sink_enable(i, 0);
- if (rv) {
+ /*
+ * Do not return early if one fails otherwise we can
+ * get into a boot loop assertion failure.
+ */
+ if (board_vbus_sink_enable(i, 0))
CPRINTS("Disabling p%d sink path failed.", i);
- return rv;
- }
}
return EC_SUCCESS;
@@ -438,10 +438,13 @@ int board_set_active_charge_port(int port)
/* Check if the port is sourcing VBUS. */
if (board_is_sourcing_vbus(port)) {
- CPRINTF("Skip enable p%d", port);
+ CPRINTS("Skip enable p%d", port);
return EC_ERROR_INVAL;
}
+
+ CPRINTS("New charge port: p%d", port);
+
/*
* Turn off the other ports' sink path FETs, before enabling the
* requested charge port.