diff options
author | Peter Marheine <pmarheine@chromium.org> | 2022-02-11 10:17:18 +1100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-02-11 09:47:20 +0000 |
commit | 2486d212b010523c21bd1e86fb07c342a5811715 (patch) | |
tree | b416381bc590ef72ec71158a23d13a07843e5d8b /zephyr | |
parent | 1845f2525ce7d5dc99abc9421f70162f0041136e (diff) | |
download | chrome-ec-2486d212b010523c21bd1e86fb07c342a5811715.tar.gz |
usbc: add CONFIG_USB_PD_STARTUP_DELAY_MS
This option provides a kludge to work around issues when programming some
ECs without a battery, where the EC is allowed to come out of reset and
put into a programming mode via an external command and in doing its
normal startup may interrupt power to the board before it is put into
programming mode.
This option is enabled on Nereid where we've been having this problem,
and set to two seconds because one second didn't help with programming
failures but two seconds seems to be long enough.
BUG=b:218618254
TEST=./util/flash_ec now works on Nereid when no battery is connected
BRANCH=none
Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Change-Id: I8d47ce440d694f90ca0f29583a2e57fcab422f31
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3454464
Reviewed-by: Andrew McRae <amcrae@google.com>
Diffstat (limited to 'zephyr')
-rw-r--r-- | zephyr/Kconfig.usbc | 15 | ||||
-rw-r--r-- | zephyr/projects/nissa/prj_nereid.conf | 7 | ||||
-rw-r--r-- | zephyr/shim/include/config_chip.h | 6 |
3 files changed, 28 insertions, 0 deletions
diff --git a/zephyr/Kconfig.usbc b/zephyr/Kconfig.usbc index 49389cf43e..f7a4f6a3db 100644 --- a/zephyr/Kconfig.usbc +++ b/zephyr/Kconfig.usbc @@ -777,6 +777,21 @@ config PLATFORM_EC_USB_PD_TBT_COMPAT_MODE Enable this to allow entering into Thunderbolt-compatible mode between two port partners. This does not require that USB4 mode be enabled. +config PLATFORM_EC_USB_PD_STARTUP_DELAY_MS + int "PD thread startup delay time in milliseconds" + default 0 + help + Have the USB-PD thread(s) delay this many milliseconds after startup + before beginning regular processing. This can be helpful if external + processes need to happen shortly after reset and PD initialization may + interfere with them. + + For instance, if the EC enters programming mode when it receives a special + signal but requires USB-PD power in order to remain alive, PD + initialization can cause the system to reset and interrupt programming. + Adding a delay to startup can provide a wider window to enter programming + mode and help prevent such issues. + endif # PLATFORM_EC_USB_POWER_DELIVERY menuconfig PLATFORM_EC_USBC_PPC diff --git a/zephyr/projects/nissa/prj_nereid.conf b/zephyr/projects/nissa/prj_nereid.conf index c840b95626..9396e85655 100644 --- a/zephyr/projects/nissa/prj_nereid.conf +++ b/zephyr/projects/nissa/prj_nereid.conf @@ -33,6 +33,13 @@ CONFIG_PLATFORM_EC_USB_PD_TCPM_DRIVER_IT8XXX2=y CONFIG_PLATFORM_EC_USB_PD_VBUS_DETECT_CHARGER=y # SM5803 controls power path on both ports CONFIG_PLATFORM_EC_USB_PD_5V_CHARGER_CTRL=y +# The EC is put into programming mode while firmware is running +# (after releasing reset) and PD after being reset will hard-reset +# the port if a contract was already set up. If the system has no +# battery, this will prevent programming because it will brown out +# the system and reset. Inserting a delay gives the programmer more +# time to put the EC into programming mode. +CONFIG_PLATFORM_EC_USB_PD_STARTUP_DELAY_MS=2000 # Charger driver and configuration CONFIG_PLATFORM_EC_CHARGER_SM5803=y diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h index dcd2277136..5ce4b52bd2 100644 --- a/zephyr/shim/include/config_chip.h +++ b/zephyr/shim/include/config_chip.h @@ -1484,6 +1484,12 @@ #define CONFIG_USB_PD_DEBUG_LEVEL CONFIG_PLATFORM_EC_USB_PD_DEBUG_LEVEL #endif +#undef CONFIG_USB_PD_STARTUP_DELAY_MS +#ifdef CONFIG_PLATFORM_EC_USB_PD_STARTUP_DELAY_MS +#define CONFIG_USB_PD_STARTUP_DELAY_MS \ + CONFIG_PLATFORM_EC_USB_PD_STARTUP_DELAY_MS +#endif + #undef CONFIG_USBC_VCONN #ifdef CONFIG_PLATFORM_EC_USBC_VCONN #define CONFIG_USBC_VCONN |