summaryrefslogtreecommitdiff
path: root/include/usb_common.h
diff options
context:
space:
mode:
authorSam Hurst <shurst@google.com>2020-03-24 16:46:14 -0700
committerCommit Bot <commit-bot@chromium.org>2020-04-02 09:40:09 +0000
commit28f07760f384789a6a28801c0c42d9d61af2f99b (patch)
tree6a3b98e52fa4fa3d49909be781df1c7f77c92a45 /include/usb_common.h
parentf648164f18293a2b3e2c5e0b766a8edef787ee9d (diff)
downloadchrome-ec-28f07760f384789a6a28801c0c42d9d61af2f99b.tar.gz
TCPMv2: Restore PD state after Sysjump
When a PD explicit contract is negotiated in RO, the contract is maintained while performing a sysjump to RW. This is done by serializing the PD Power, Data, and VCONN Roles, along with the explicit contract flag. After jumping to RW, deserialization is performed by restoring the power roles and setting the explicit contract flag. BUG=b:152350558,b:152027807,b:152967274 BRANCH=none TEST=make -j buildall Manual tests: Used total phase to verify that charging voltage was maintained across sysjump from RO to RW and that DP was reestablished when a dock was used. Tested that Kohaku booted properly without a battery and a charger connected to port 0. This test was repeated with a charger connected to port 1. Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I349c41f2279e9af9830564d44ac73ad8435f1f80 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2119131 Tested-by: Sam Hurst <shurst@google.com> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'include/usb_common.h')
-rw-r--r--include/usb_common.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/usb_common.h b/include/usb_common.h
index 5078ff071e..be7ead8055 100644
--- a/include/usb_common.h
+++ b/include/usb_common.h
@@ -159,4 +159,22 @@ void notify_sysjump_ready(volatile const task_id_t * const
* @param port USB-C port number
*/
void set_usb_mux_with_current_data_role(int port);
+
+/**
+ * Get the PD flags stored in BB Ram
+ *
+ * @param port USB-C port number
+ * @param flags pointer where flags are written to
+ * @return EC_SUCCESS on success
+ */
+int pd_get_saved_port_flags(int port, uint8_t *flags);
+
+/**
+ * Update the flag in BB Ram with the give value
+ *
+ * @param port USB-C port number
+ * @param flag BB Ram flag to update
+ * @param do_set value written to the BB Ram flag
+ */
+void pd_update_saved_port_flags(int port, uint8_t flag, uint8_t do_set);
#endif /* __CROS_EC_USB_COMMON_H */