diff options
author | li feng <li1.feng@intel.com> | 2020-12-14 19:58:51 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-05 02:05:44 +0000 |
commit | 0e5eda0e47524c6a5ceb8de28b2de23ba4949b14 (patch) | |
tree | 4f8e8eabec1ce24bc2c633cea1d9859fd5354449 /include/usb_common.h | |
parent | 829aa191a6e2b5b51e7d1fe9a5cb30c233dc210a (diff) | |
download | chrome-ec-0e5eda0e47524c6a5ceb8de28b2de23ba4949b14.tar.gz |
retimer: support retimer firmware update
To support AP to update firmware during boot up, one byte EC RAM is
allocated for AP <-> EC communication. AP queries PD port/requests EC
to perform operations via EC_CMD_ACPI_WRITE; and fetches result from EC
via EC_CMD_ACPI_READ.
The flow is:
1. AP queries EC PD ports which port supports retimer firmware update.
2. AP queries current MUX.
3. a) If no device attached, AP requests EC to suspend PD task of the
port. Then AP requests EC to set MUX to USB mode,
Safe mode, TBT mode. After entering TBT mode, the OS can either
enumerate the retimers or do firmware update on the enumerated
retimers. Once done, AP requests EC to disconnect MUX and resume PD
task.
3. b) If device attached, AP moves on as usual. Retimer firmware update
is not performed.
BUG=b:162528867
BRANCH=none
TEST=Tested NDA case on Voxel board, together with coreboot and kernel
changes. Coreboot changes are merged. Kernel patches list is:
https://chromium-review.googlesource.com/c/chromiumos/
third_party/kernel/+/2670719
After power up, host scans retimers, in sysfs
localhost ~ # ls /sys/bus/thunderbolt/devices/
0-0 0-0:1.1 0-0:3.1 domain0
On PD port 1, manually update retimer firmware. Copy firmware to
nvm_non_active1/nvmem, then authenticate it. Host starts flow to update
firmware.
After it's done, PD port 1 resumes. Hotplug DP dongle/TBT device, devices
should function fully.
TEST=Tested DA cases on Voxel board, together with coreboot and kernel
changes. USB4/TBT devices function as usual.
Signed-off-by: li feng <li1.feng@intel.com>
Change-Id: Ie976e75f892d5caf48a948598a058a4f42e07eb3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2594492
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'include/usb_common.h')
-rw-r--r-- | include/usb_common.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/include/usb_common.h b/include/usb_common.h index 1e92a4b22a..c5912b1952 100644 --- a/include/usb_common.h +++ b/include/usb_common.h @@ -200,4 +200,55 @@ void pd_update_saved_port_flags(int port, uint8_t flag, uint8_t do_set); * @return EC_SUCCESS on success else EC_ERROR_INVAL */ int pd_build_alert_msg(uint32_t *msg, uint32_t *len, enum pd_power_role pr); + +/** + * Query USB-C ports state for USB retimer firmware update. + * Support up to 8 ports. + * + * @return Bits[7:0]: represent PD ports 0-7 + * 1 - This port has retimer; + * 0 - not retimer. + */ +__override_proto int usb_retimer_fw_update_query_port(void); + +/** + * During USB retimer firmware update, process operation + * requested by AP + * + * @param port USB-C port number + * @param op + * 0 - USB_RETIMER_FW_UPDATE_QUERY_PORT + * 1 - USB_RETIMER_FW_UPDATE_SUSPEND_PD + * 2 - USB_RETIMER_FW_UPDATE_RESUME_PD + * 3 - USB_RETIMER_FW_UPDATE_GET_MUX + * 4 - USB_RETIMER_FW_UPDATE_SET_USB + * 5 - USB_RETIMER_FW_UPDATE_SET_SAFE + * 6 - USB_RETIMER_FW_UPDATE_SET_TBT + * 7 - USB_RETIMER_FW_UPDATE_DISCONNECT + */ +void usb_retimer_fw_update_process_op(int port, int op); + +/** + * Get result of last USB retimer firmware update operation requested + * by AP. Result is passed to AP via EC_CMD_ACPI_READ. + * + * @return Result of last operation. It's + * which port has retimer if last operation is + * USB_RETIMER_FW_UPDATE_QUERY_PORT; + * PD task is enabled or not if last operations are + * USB_RETIMER_FW_UPDATE_SUSPEND_PD or + * USB_RETIMER_FW_UPDATE_QUERY_PORT; + * current mux if last operations are + * USB_RETIMER_FW_UPDATE_GET_MUX, USB_RETIMER_FW_UPDATE_SET_USB, + * USB_RETIMER_FW_UPDATE_SET_SAFE, USB_RETIMER_FW_UPDATE_SET_TBT, + * or USB_RETIMER_FW_UPDATE_DISCONNECT. + */ +int usb_retimer_fw_update_get_result(void); + +/** + * Process deferred retimer firmware update operations. + * + * @param port USB-C port number + */ +void usb_retimer_fw_update_process_op_cb(int port); #endif /* __CROS_EC_USB_COMMON_H */ |