summaryrefslogtreecommitdiff
path: root/include/usb_pd.h
diff options
context:
space:
mode:
authorTodd Broch <tbroch@chromium.org>2015-01-02 20:30:21 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-07 08:45:38 +0000
commit5ef45ad19e839006a17668d792770021e022f3c8 (patch)
treec7c1a37cba02756ce2c012559c7500f30b7666d7 /include/usb_pd.h
parentc0f64b13e981fd0c2901e1c33d7f6e52287ca0df (diff)
downloadchrome-ec-5ef45ad19e839006a17668d792770021e022f3c8.tar.gz
pd: Add timeout for HC flash commands.
For flash commands add timeout so if VDM doesn't return properly host can receive error message. Note, for flash erase its performed by page at a cost of 20-40ms according to datasheet. For hoho/dingdong that leaves maximum erase time at 40ms * 32 =< 1280ms which is above the host command timeout. Increasing the host command delay (i2c bus pending) is not an option and since the erase will complete and subsequent erases will be much faster do to early out in physical_flash_erase this solution should be acceptable. Future CLs could alternatively push the burden of command latency to host altogether and return EC_RES_SUCCESS in similar fashion to reboot command. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=samus BUG=chrome-os-partner:33947 TEST=manual, if VDM doesn't return by timeout HC command is properly returned EC_RES_TIMEOUT error code. Change-Id: I33c515200c2999dd97fdd690a7e900c5548b2d47 Reviewed-on: https://chromium-review.googlesource.com/238290 Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org>
Diffstat (limited to 'include/usb_pd.h')
-rw-r--r--include/usb_pd.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/usb_pd.h b/include/usb_pd.h
index b1d72d1402..0f080c24e0 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -10,6 +10,9 @@
#include "common.h"
+/* PD Host command timeout */
+#define PD_HOST_COMMAND_TIMEOUT_US SECOND
+
enum pd_errors {
PD_ERR_INVAL = -1, /* Invalid packet */
PD_ERR_HARD_RESET = -2, /* Got a Hard-Reset packet */