diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2022-02-11 01:36:08 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-02-24 00:22:17 +0000 |
commit | 17bb02cc7484f9e420d6a9aa93d2db0c3bc94e9c (patch) | |
tree | 694f48f05bb395118bbd9d5fd9b0aabf168e0a20 /driver/nfc | |
parent | 92e58fe0120eb7bbe2348f499c48aa1a2a248cbe (diff) | |
download | chrome-ec-17bb02cc7484f9e420d6a9aa93d2db0c3bc94e9c.tar.gz |
CTN730: Enter download mode for FW corruption
When there is FW corruption, CTN730 switch from normal mode to download
mode. The chip sends a reset event with
WLC_HOST_CTRL_RESET_EVT_DOWNLOAD_MODE. We currently handle it as a reset
event without switching to download mode. A reset event handler in
normal mode resets the chip to normal mode, thus, causing a reset loop.
This patche makes the reset event handler switch the internal state to
PCHG_MODE_DOWNLOAD if WLC_HOST_CTRL_RESET_EVT_DOWNLOAD_MODE is found.
This will allow the PCHG state machine to avoid an infinite reset loop
and stay in PCHG_STATE_DOWNLOAD.
BUG=b:210796767, b:207479211
BRANCH=None
TEST=Redrix
Change-Id: I71c5e3ceb05d735b5465f4f00ac371bae7db34b1
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3454216
Tested-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: caveh jalali <caveh@chromium.org>
Diffstat (limited to 'driver/nfc')
-rw-r--r-- | driver/nfc/ctn730.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/driver/nfc/ctn730.c b/driver/nfc/ctn730.c index 6f711c509e..775149e659 100644 --- a/driver/nfc/ctn730.c +++ b/driver/nfc/ctn730.c @@ -390,6 +390,17 @@ static int _process_payload_event(struct pchg *ctx, struct ctn730_msg *res) CPRINTS("Download Mode (%s)", _text_reset_reason(buf[1])); ctx->event = PCHG_EVENT_RESET; + /* + * CTN730 sends a reset event to notify us it entered + * download mode unintentionally (e.g. corrupted FW). + * In such cases, we stay in download mode to avoid an + * infinite loop. + * + * If it's intended, we leave alone the mode, respecting + * the mode set by the PCHG task. + */ + if (buf[1] != WLC_HOST_CTRL_RESET_REASON_INTENDED) + ctx->mode = PCHG_MODE_DOWNLOAD; } else { return EC_ERROR_INVAL; } |