diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2020-03-17 15:31:24 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-19 21:56:29 +0000 |
commit | a62fd24addc0c84a033d2f701670cc207f49b52b (patch) | |
tree | 429f1c5e9a797d4438698b1aaed2ef657a179253 | |
parent | d7957d559f0af9bd07fcb56dcafec6f4bf061191 (diff) | |
download | chrome-ec-a62fd24addc0c84a033d2f701670cc207f49b52b.tar.gz |
USB-C: Determine port partner's data role based on PD's data role
Current code uses the CC lines to find out the data role of a
port partner, however when the PD based data role swap happens
DR_swap command has no effect on the CC lines. Hence need to
use PD's data role to determine port partner's data role.
Reference: USB Type-C cable and connector specification, Release 2.0
4.5.1.4.2 USB PD-based Power Role, Data Role and VCONN Swapping
Table 4-12 USB PD Swapping Port Behavior Summary
BUG=b:151653348
BRANCH=none
TEST=UFP/DFP is correctly configured hence no PMC timeout errors
observed on Volteer.
Change-Id: I237d5c3f88096f4bd2d043ab823c98fe47686fa9
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2107890
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | common/usb_common.c | 11 | ||||
-rw-r--r-- | driver/retimer/bb_retimer.c | 7 | ||||
-rw-r--r-- | include/usb_pd.h | 7 |
3 files changed, 5 insertions, 20 deletions
diff --git a/common/usb_common.c b/common/usb_common.c index 4859d440e1..9f10e953e3 100644 --- a/common/usb_common.c +++ b/common/usb_common.c @@ -228,17 +228,8 @@ enum pd_cc_states pd_get_cc_state( /** * This function checks the current CC status of the port partner - * and returns true if the attached partner is UFP. + * and returns true if the attached partner is debug accessory. */ -bool pd_partner_is_ufp(int port) -{ - enum pd_cc_states cc_state = pd_get_task_cc_state(port); - - return cc_state == PD_CC_UFP_ATTACHED || - cc_state == PD_CC_UFP_DEBUG_ACC || - cc_state == PD_CC_UFP_AUDIO_ACC; -} - bool pd_is_debug_acc(int port) { enum pd_cc_states cc_state = pd_get_task_cc_state(port); diff --git a/driver/retimer/bb_retimer.c b/driver/retimer/bb_retimer.c index f0c7f52ebf..2a9bcb5f12 100644 --- a/driver/retimer/bb_retimer.c +++ b/driver/retimer/bb_retimer.c @@ -145,11 +145,12 @@ static int retimer_set_state(const struct usb_mux *me, mux_state_t mux_state) set_retimer_con |= BB_RETIMER_USB_3_CONNECTION; /* - * Bit 7: USB_DATA_ROLE (ignored if BIT5=0) + * Bit 7: USB_DATA_ROLE for the Burnside Bridge side of + * connection (ignored if BIT5=0). * 0 - DFP - * 1 - UPF + * 1 - UFP */ - if (pd_partner_is_ufp(port)) + if (pd_get_data_role(port) == PD_ROLE_UFP) set_retimer_con |= BB_RETIMER_USB_DATA_ROLE; } diff --git a/include/usb_pd.h b/include/usb_pd.h index cdd111d687..b16000d0f6 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -2480,13 +2480,6 @@ static inline uint8_t board_get_usb_pd_port_count(void) #endif /* CONFIG_USB_PD_PORT_MAX_COUNT */ /** - * Return true if specified PD port partner is UFP. - * - * @param port USB-C port number - */ -bool pd_partner_is_ufp(int port); - -/** * Return true if specified PD port is debug accessory. * * @param port USB-C port number |