Skip to contentSkip to conversation

Thunderbolt3/USB4 cable rounded and active cable plug link training support

PATCH Applied Utkarsh Patel 5 participants 28 messages Nov 13, 2020 – Nov 18, 2020

Subsystems (6)

v2 of 4 Applied Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Thunderbolt3/USB4 cable rounded and active cable plug link training support

This patch series adds the support for Thunderbolt3/USB4 rounded and non-rounded frequencies cables and fixes the active cable plug link training support.

Changes in v2:
- Removed the fixes tag as there is no functional implication from patches 1/8, 2/8 and 4/8.

Utkarsh Patel (8):
usb: typec: Correct the bit values for the Thunderbolt
rounded/non-rounded cable support
platform/chrome: cros_ec_typec: Correct the Thunderbolt
rounded/non-rounded cable support
usb: typec: intel_pmc_mux: Configure Thunderbolt cable generation bits
usb: typec: Remove one bit support for the Thunderbolt
rounded/non-rounded cable
usb: typec: Use Thunderbolt 3 cable discover mode VDO in Enter_USB
message
platform/chrome: cros_ec_typec: Use Thunderbolt 3 cable discover mode
VDO in USB4 mode
usb: typec: intel_pmc_mux: Configure active cable properties for USB4
usb: typec: Remove active_link_training variable from Enter_USB
message

 drivers/platform/chrome/cros_ec_typec.c | 17 +++++++++++++----
 drivers/usb/typec/mux/intel_pmc_mux.c   | 21 ++++++++++++++++++---
 include/linux/usb/typec.h               |  8 ++------
 include/linux/usb/typec_tbt.h           |  6 +++++-
 4 files changed, 38 insertions(+), 14 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/8 usb: typec: Correct the bit values for the Thunderbolt rounded/non-rounded cable support

Rounded and non-rounded Thunderbolt cables are represented by two bits as per USB Type-C Connector specification v2.0 section F.2.6. Corrected that in the Thunderbolt 3 cable discover mode VDO.

--
Changes in v2:
- Removed the fixes tag as there is no functional implication. --

---
 include/linux/usb/typec_tbt.h | 5 +++++
 1 file changed, 5 insertions(+)
include/linux/usb/typec_tbt.h +5 -0
index 47c2d501ddce..aad648d14bb3 100644
@@ -40,11 +40,16 @@ struct typec_thunderbolt_data {
 #define   TBT_CABLE_USB3_PASSIVE	2
 #define   TBT_CABLE_10_AND_20GBPS	3
 #define TBT_CABLE_ROUNDED		BIT(19)
+#define TBT_CABLE_ROUNDED_SUPPORT(_vdo_) \
+					(((_vdo_) & GENMASK(20, 19)) >> 19)
+#define   TBT_GEN3_NON_ROUNDED                 0
+#define   TBT_GEN3_GEN4_ROUNDED_NON_ROUNDED    1
 #define TBT_CABLE_OPTICAL		BIT(21)
 #define TBT_CABLE_RETIMER		BIT(22)
 #define TBT_CABLE_LINK_TRAINING		BIT(23)
 
 #define TBT_SET_CABLE_SPEED(_s_)	(((_s_) & GENMASK(2, 0)) << 16)
+#define TBT_SET_CABLE_ROUNDED(_g_)	(((_g_) & GENMASK(1, 0)) << 19)
 
 /* TBT3 Device Enter Mode VDO bits */
 #define TBT_ENTER_MODE_CABLE_SPEED(s)	TBT_SET_CABLE_SPEED(s)
Signature · 1 line
2.17.1
maintainer Reviewed-by on v2 1/8
#2 lore raw

Re: [PATCH v2 1/8] usb: typec: Correct the bit values for the Thunderbolt rounded/non-rounded cable support

Quoted 5 lines · Utkarsh Patel

Rounded and non-rounded Thunderbolt cables are represented by two bits as per USB Type-C Connector specification v2.0 section F.2.6. Corrected that in the Thunderbolt 3 cable discover mode VDO.

Quoted 19 lines

--
Changes in v2:
- Removed the fixes tag as there is no functional implication. --

---
 include/linux/usb/typec_tbt.h | 5 +++++
 1 file changed, 5 insertions(+)
include/linux/usb/typec_tbt.h +3 -0
index 47c2d501ddce..aad648d14bb3 100644
@@ -40,11 +40,16 @@ struct typec_thunderbolt_data {
 #define   TBT_CABLE_USB3_PASSIVE	2
 #define   TBT_CABLE_10_AND_20GBPS	3
 #define TBT_CABLE_ROUNDED		BIT(19)
+#define TBT_CABLE_ROUNDED_SUPPORT(_vdo_) \
+					(((_vdo_) & GENMASK(20, 19)) >> 19)
+#define   TBT_GEN3_NON_ROUNDED                 0

include/linux/usb/typec_tbt.h struct typec_thunderbolt_data { · line 55

Quoted 10 lines
include/linux/usb/typec_tbt.h +2 -0
+#define   TBT_GEN3_GEN4_ROUNDED_NON_ROUNDED    1
 #define TBT_CABLE_OPTICAL		BIT(21)
 #define TBT_CABLE_RETIMER		BIT(22)
 #define TBT_CABLE_LINK_TRAINING		BIT(23)
 
 #define TBT_SET_CABLE_SPEED(_s_)	(((_s_) & GENMASK(2, 0)) << 16)
+#define TBT_SET_CABLE_ROUNDED(_g_)	(((_g_) & GENMASK(1, 0)) << 19)
 
 /* TBT3 Device Enter Mode VDO bits */
 #define TBT_ENTER_MODE_CABLE_SPEED(s)	TBT_SET_CABLE_SPEED(s)

thanks,

Signature · 1 line
heikki
#3 lore raw

PATCH v2 2/8 platform/chrome: cros_ec_typec: Correct the Thunderbolt rounded/non-rounded cable support

In reply to Utkarsh Patel

Thunderbolt rounded/non-rounded cable support is two bits value. Correcting it as per the Thunderbolt 3 cable discover mode VDO changes done in the Thunderbolt 3 alternate mode header.

--
Changes in v2:
- Removed the fixes tag as there is no functional implication. --

---
 drivers/platform/chrome/cros_ec_typec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/platform/chrome/cros_ec_typec.c +1 -2
index 31be31161350..8111ed1fc574 100644
@@ -438,8 +438,7 @@ static int cros_typec_enable_tbt(struct cros_typec_data *typec,
 	if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_LINK_UNIDIR)
 		data.cable_mode |= TBT_CABLE_LINK_TRAINING;
 
-	if (pd_ctrl->cable_gen)
-		data.cable_mode |= TBT_CABLE_ROUNDED;
+	data.cable_mode |= TBT_SET_CABLE_ROUNDED(pd_ctrl->cable_gen);
 
 	/* Enter Mode VDO */
 	data.enter_vdo = TBT_SET_CABLE_SPEED(pd_ctrl->cable_speed);
Signature · 1 line
2.17.1
maintainer Reviewed-by on v2 2/8
#4 lore raw

Re: [PATCH v2 2/8] platform/chrome: cros_ec_typec: Correct the Thunderbolt rounded/non-rounded cable support

Quoted 5 lines · Utkarsh Patel

Thunderbolt rounded/non-rounded cable support is two bits value. Correcting it as per the Thunderbolt 3 cable discover mode VDO changes done in the Thunderbolt 3 alternate mode header.

Quoted 24 lines

--
Changes in v2:
- Removed the fixes tag as there is no functional implication. --

---
 drivers/platform/chrome/cros_ec_typec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/platform/chrome/cros_ec_typec.c +1 -2
index 31be31161350..8111ed1fc574 100644
@@ -438,8 +438,7 @@ static int cros_typec_enable_tbt(struct cros_typec_data *typec,
 	if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_LINK_UNIDIR)
 		data.cable_mode |= TBT_CABLE_LINK_TRAINING;
 
-	if (pd_ctrl->cable_gen)
-		data.cable_mode |= TBT_CABLE_ROUNDED;
+	data.cable_mode |= TBT_SET_CABLE_ROUNDED(pd_ctrl->cable_gen);
 
 	/* Enter Mode VDO */
 	data.enter_vdo = TBT_SET_CABLE_SPEED(pd_ctrl->cable_speed);
Signature · 1 line
2.17.1

thanks,

Signature · 1 line
heikki
Acked-by on v2 2/8
#5 lore raw

Re: [PATCH v2 2/8] platform/chrome: cros_ec_typec: Correct the Thunderbolt rounded/non-rounded cable support

In reply to Utkarsh Patel
Quoted 5 lines · Utkarsh Patel

Thunderbolt rounded/non-rounded cable support is two bits value. Correcting it as per the Thunderbolt 3 cable discover mode VDO changes done in the Thunderbolt 3 alternate mode header.

Quoted 23 lines

--
Changes in v2:
- Removed the fixes tag as there is no functional implication. --

---
 drivers/platform/chrome/cros_ec_typec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/platform/chrome/cros_ec_typec.c +1 -2
index 31be31161350..8111ed1fc574 100644
@@ -438,8 +438,7 @@ static int cros_typec_enable_tbt(struct cros_typec_data *typec,
 	if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_LINK_UNIDIR)
 		data.cable_mode |= TBT_CABLE_LINK_TRAINING;
 
-	if (pd_ctrl->cable_gen)
-		data.cable_mode |= TBT_CABLE_ROUNDED;
+	data.cable_mode |= TBT_SET_CABLE_ROUNDED(pd_ctrl->cable_gen);
 
 	/* Enter Mode VDO */
 	data.enter_vdo = TBT_SET_CABLE_SPEED(pd_ctrl->cable_speed);
#6 lore raw

PATCH v2 3/8 usb: typec: intel_pmc_mux: Configure Thunderbolt cable generation bits

In reply to Utkarsh Patel

Thunderbolt cable generation bits received as a part of Thunderbolt 3 cable discover mode VDO needs to be configured for Thunderbolt rounded and non-rounded cable support in the Thunderbolt alternate mode.

--
Changes in v2:
- No change.
--

---
 drivers/usb/typec/mux/intel_pmc_mux.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/usb/typec/mux/intel_pmc_mux.c +3 -0
index d7f63b74c6b1..aa3211f1c4c3 100644
@@ -256,6 +256,7 @@ static int
 pmc_usb_mux_tbt(struct pmc_usb_port *port, struct typec_mux_state *state)
 {
 	struct typec_thunderbolt_data *data = state->data;
+	u8 cable_rounded = TBT_CABLE_ROUNDED_SUPPORT(data->cable_mode);
 	u8 cable_speed = TBT_CABLE_SPEED(data->cable_mode);
 	struct altmode_req req = { };
 
@@ -284,6 +285,8 @@ pmc_usb_mux_tbt(struct pmc_usb_port *port, struct typec_mux_state *state)
 
 	req.mode_data |= PMC_USB_ALTMODE_CABLE_SPD(cable_speed);
 
+	req.mode_data |= PMC_USB_ALTMODE_TBT_GEN(cable_rounded);
+
 	return pmc_usb_command(port, (void *)&req, sizeof(req));
 }
 
Signature · 1 line
2.17.1
maintainer Reviewed-by on v2 3/8
#7 lore raw

Re: [PATCH v2 3/8] usb: typec: intel_pmc_mux: Configure Thunderbolt cable generation bits

Quoted 5 lines · Utkarsh Patel

Thunderbolt cable generation bits received as a part of Thunderbolt 3 cable discover mode VDO needs to be configured for Thunderbolt rounded and non-rounded cable support in the Thunderbolt alternate mode.

Quoted 31 lines

--
Changes in v2:
- No change.
--

---
 drivers/usb/typec/mux/intel_pmc_mux.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/usb/typec/mux/intel_pmc_mux.c +3 -0
index d7f63b74c6b1..aa3211f1c4c3 100644
@@ -256,6 +256,7 @@ static int
 pmc_usb_mux_tbt(struct pmc_usb_port *port, struct typec_mux_state *state)
 {
 	struct typec_thunderbolt_data *data = state->data;
+	u8 cable_rounded = TBT_CABLE_ROUNDED_SUPPORT(data->cable_mode);
 	u8 cable_speed = TBT_CABLE_SPEED(data->cable_mode);
 	struct altmode_req req = { };
 
@@ -284,6 +285,8 @@ pmc_usb_mux_tbt(struct pmc_usb_port *port, struct typec_mux_state *state)
 
 	req.mode_data |= PMC_USB_ALTMODE_CABLE_SPD(cable_speed);
 
+	req.mode_data |= PMC_USB_ALTMODE_TBT_GEN(cable_rounded);
+
 	return pmc_usb_command(port, (void *)&req, sizeof(req));
 }
 
Signature · 1 line
2.17.1
Signature · 1 line
heikki
#8 lore raw

PATCH v2 4/8 usb: typec: Remove one bit support for the Thunderbolt rounded/non-rounded cable

In reply to Utkarsh Patel

Two bits support for the Thunderbolt rounded/non-rounded cable has been added to the header file.
Hence, removing unused TBT_CABLE_ROUNDED definition from the header file.

--
changes in v2:
- Removed the fixes tag as there is no functional implication. --

---
 include/linux/usb/typec_tbt.h | 1 -
 1 file changed, 1 deletion(-)
include/linux/usb/typec_tbt.h +0 -1
index aad648d14bb3..63dd44b72e0c 100644
@@ -39,7 +39,6 @@ struct typec_thunderbolt_data {
 #define   TBT_CABLE_USB3_GEN1		1
 #define   TBT_CABLE_USB3_PASSIVE	2
 #define   TBT_CABLE_10_AND_20GBPS	3
-#define TBT_CABLE_ROUNDED		BIT(19)
 #define TBT_CABLE_ROUNDED_SUPPORT(_vdo_) \
 					(((_vdo_) & GENMASK(20, 19)) >> 19)
 #define   TBT_GEN3_NON_ROUNDED                 0
Signature · 1 line
2.17.1
maintainer Reviewed-by on v2 4/8
#9 lore raw

Re: [PATCH v2 4/8] usb: typec: Remove one bit support for the Thunderbolt rounded/non-rounded cable

Quoted 5 lines · Utkarsh Patel

Two bits support for the Thunderbolt rounded/non-rounded cable has been added to the header file.
Hence, removing unused TBT_CABLE_ROUNDED definition from the header file.

Quoted 22 lines

--
changes in v2:
- Removed the fixes tag as there is no functional implication. --

---
 include/linux/usb/typec_tbt.h | 1 -
 1 file changed, 1 deletion(-)
include/linux/usb/typec_tbt.h +0 -1
index aad648d14bb3..63dd44b72e0c 100644
@@ -39,7 +39,6 @@ struct typec_thunderbolt_data {
 #define   TBT_CABLE_USB3_GEN1		1
 #define   TBT_CABLE_USB3_PASSIVE	2
 #define   TBT_CABLE_10_AND_20GBPS	3
-#define TBT_CABLE_ROUNDED		BIT(19)
 #define TBT_CABLE_ROUNDED_SUPPORT(_vdo_) \
 					(((_vdo_) & GENMASK(20, 19)) >> 19)
 #define   TBT_GEN3_NON_ROUNDED                 0
Signature · 1 line
2.17.1

thanks,

Signature · 1 line
heikki
#10 lore raw

PATCH v2 5/8 usb: typec: Use Thunderbolt 3 cable discover mode VDO in Enter_USB message

In reply to Utkarsh Patel

USB4 also uses same cable properties as Thunderbolt 3 so use Thunderbolt 3 cable discover mode VDO to fill details such as active cable plug link training and cable rounded support.

--
Changes in v2:
- No change.
--

---
 include/linux/usb/typec.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/usb/typec.h +2 -0
index 6be558045942..d91e09d9d91c 100644
@@ -75,6 +75,7 @@ enum typec_orientation {
 /*
  * struct enter_usb_data - Enter_USB Message details
  * @eudo: Enter_USB Data Object
+ * @tbt_cable_vdo: TBT3 Cable Discover Mode Response
  * @active_link_training: Active Cable Plug Link Training
  *
  * @active_link_training is a flag that should be set with uni-directional SBRX
@@ -83,6 +84,7 @@ enum typec_orientation {
  */
 struct enter_usb_data {
 	u32			eudo;
+	u32			tbt_cable_vdo;
 	unsigned char		active_link_training:1;
 };
 
Signature · 1 line
2.17.1
maintainer
#11 lore raw

Re: [PATCH v2 5/8] usb: typec: Use Thunderbolt 3 cable discover mode VDO in Enter_USB message

Quoted 3 lines · Utkarsh Patel

USB4 also uses same cable properties as Thunderbolt 3 so use Thunderbolt 3 cable discover mode VDO to fill details such as active cable plug link training and cable rounded support.

I'm sorry, but I think that has to be explained better. We only need the Thunderbolt 3 properties when we create the USB4 connection with Thunderbolt 3 cables. With USB4 cables that information is simply not available. Claiming that USB4 uses the same properties in general is not true.

Quoted 15 lines

--
Changes in v2:
- No change.
--

---
 include/linux/usb/typec.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/usb/typec.h +0 -0
index 6be558045942..d91e09d9d91c 100644

include/linux/usb/typec.h enum typec_orientation { · line 81

Quoted 7 lines
include/linux/usb/typec.h +1 -0
@@ -75,6 +75,7 @@ enum typec_orientation {
 /*
  * struct enter_usb_data - Enter_USB Message details
  * @eudo: Enter_USB Data Object
+ * @tbt_cable_vdo: TBT3 Cable Discover Mode Response
  * @active_link_training: Active Cable Plug Link Training
  *
  * @active_link_training is a flag that should be set with uni-directional SBRX

Please also explain the same here with a short comment. So basically, if the USB4 connection is created using TBT3 cable, then we need to supply also the TBT3 Cable VDO as part of this data. But if USB4 cable is used, then that member should not be filled at all.

include/linux/usb/typec.h enum typec_orientation { · line 89

Quoted 7 lines
include/linux/usb/typec.h +1 -0
@@ -83,6 +84,7 @@ enum typec_orientation {
  */
 struct enter_usb_data {
 	u32			eudo;
+	u32			tbt_cable_vdo;
 	unsigned char		active_link_training:1;
 };

thanks,

Signature · 1 line
heikki
#12 lore raw

RE: [PATCH v2 5/8] usb: typec: Use Thunderbolt 3 cable discover mode VDO in Enter_USB message

Hi Heikki,

Quoted 11 lines

-----Original Message-----
From: Heikki Krogerus <[email protected]>
Sent: Tuesday, November 17, 2020 4:10 AM
To: Patel, Utkarsh H <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Mani, Rajmohan <[email protected]>; Shaikh, Azhar <[email protected]>
Subject: Re: [PATCH v2 5/8] usb: typec: Use Thunderbolt 3 cable discover mode VDO in Enter_USB message

On Fri, Nov 13, 2020 at 12:25:00PM -0800, Utkarsh Patel wrote:

Quoted 8 lines
Quoted 3 lines

USB4 also uses same cable properties as Thunderbolt 3 so use Thunderbolt 3 cable discover mode VDO to fill details such as active cable plug link training and cable rounded support.

I'm sorry, but I think that has to be explained better. We only need the Thunderbolt 3 properties when we create the USB4 connection with Thunderbolt 3 cables. With USB4 cables that information is simply not available. Claiming that USB4 uses the same properties in general is not true.

Ack. I will change the commit message.

Quoted 21 lines
Quoted 21 lines

--
Changes in v2:
- No change.
--

---
 include/linux/usb/typec.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/usb/typec.h +1 -0
index 6be558045942..d91e09d9d91c 100644
@@ -75,6 +75,7 @@ enum typec_orientation {
 /*
  * struct enter_usb_data - Enter_USB Message details
  * @eudo: Enter_USB Data Object
+ * @tbt_cable_vdo: TBT3 Cable Discover Mode Response
  * @active_link_training: Active Cable Plug Link Training
Quoted 8 lines
Quoted 3 lines
include/linux/usb/typec.h +0 -0
  *
  * @active_link_training is a flag that should be set with

uni-directional SBRX

Please also explain the same here with a short comment. So basically, if the USB4 connection is created using TBT3 cable, then we need to supply also the TBT3 Cable VDO as part of this data. But if USB4 cable is used, then that member should not be filled at all.

Ack.

Quoted 11 lines

include/linux/usb/typec.h enum typec_orientation { · line 89

Quoted 8 lines
include/linux/usb/typec.h +1 -0
@@ -83,6 +84,7 @@ enum typec_orientation {
  */
 struct enter_usb_data {
 	u32			eudo;
+	u32			tbt_cable_vdo;
 	unsigned char		active_link_training:1;
 };

thanks,

Quoted 2 lines

--
Heikki

Sincerely,
Utkarsh Patel.

#13 lore raw

Re: [PATCH v2 5/8] usb: typec: Use Thunderbolt 3 cable discover mode VDO in Enter_USB message

In reply to Utkarsh Patel

Hi Utkarsh,

Quoted 28 lines · Utkarsh Patel

USB4 also uses same cable properties as Thunderbolt 3 so use Thunderbolt 3 cable discover mode VDO to fill details such as active cable plug link training and cable rounded support.

--
Changes in v2:
- No change.
--

---
 include/linux/usb/typec.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/usb/typec.h +1 -0
index 6be558045942..d91e09d9d91c 100644
@@ -75,6 +75,7 @@ enum typec_orientation {
 /*
  * struct enter_usb_data - Enter_USB Message details
  * @eudo: Enter_USB Data Object
+ * @tbt_cable_vdo: TBT3 Cable Discover Mode Response
  * @active_link_training: Active Cable Plug Link Training
  *
  * @active_link_training is a flag that should be set with uni-directional SBRX

include/linux/usb/typec.h enum typec_orientation { · line 87

Quoted 4 lines
include/linux/usb/typec.h +1 -0
@@ -83,6 +84,7 @@ enum typec_orientation {
  */
 struct enter_usb_data {
 	u32			eudo;
+	u32			tbt_cable_vdo;

Can we instead just include a field for the rounded cable support property , similar to what was done for active_link_training? That way this gets decoupled from whether a TBT VDO was present in the cable or not

Quoted 6 lines
include/linux/usb/typec.h +0 -0
 	unsigned char		active_link_training:1;
 };
 
Signature · 1 line
2.17.1

Best regards,

-Prashant

#14 lore raw

Re: [PATCH v2 5/8] usb: typec: Use Thunderbolt 3 cable discover mode VDO in Enter_USB message

Quoted 7 lines · Prashant Malani

Hi Utkarsh,

Quoted 3 lines · Utkarsh Patel

USB4 also uses same cable properties as Thunderbolt 3 so use Thunderbolt 3 cable discover mode VDO to fill details such as active cable plug link training and cable rounded support.

On digging into the Cros EC code further, sounds like active cable link training and cable rounded are necessarily only part of cables that have a TBT cable VDO, so sounds like the approach in the patch is fine.

Sorry for the noise.

Best regards,

-Prashant

#15 lore raw

PATCH v2 6/8 platform/chrome: cros_ec_typec: Use Thunderbolt 3 cable discover mode VDO in USB4 mode

In reply to Utkarsh Patel

Configure Thunderbolt3/USB4 cable generation value by filing Thunderbolt 3 cable discover mode VDO to support rounded and non-rounded Thunderbolt3/ USB4 cables.
While we are here use Thunderbolt 3 cable discover mode VDO to fill active cable plug link training value.

--
Changes in v2:
- No change.
--

---
 drivers/platform/chrome/cros_ec_typec.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/platform/chrome/cros_ec_typec.c +12 -2
index 8111ed1fc574..b7416e82c3b3 100644
@@ -514,8 +514,18 @@ static int cros_typec_enable_usb4(struct cros_typec_data *typec,
 	else if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_CABLE)
 		data.eudo |= EUDO_CABLE_TYPE_RE_TIMER << EUDO_CABLE_TYPE_SHIFT;
 
-	data.active_link_training = !!(pd_ctrl->control_flags &
-				       USB_PD_CTRL_ACTIVE_LINK_UNIDIR);
+	/*
+	 * This driver does not have access to the identity information or
+	 * capabilities of the cable, so we don't know is it a real USB4 or
+	 * TBT3 cable. Therefore pretending that it's always TBT3 cable by
+	 * filling the TBT3 Cable VDO.
+	 */
+	data.tbt_cable_vdo = TBT_MODE;
+
+	if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_LINK_UNIDIR)
+		data.tbt_cable_vdo |= TBT_CABLE_LINK_TRAINING;
+
+	data.tbt_cable_vdo |= TBT_SET_CABLE_ROUNDED(pd_ctrl->cable_gen);
 
 	port->state.alt = NULL;
 	port->state.data = &data;
Signature · 1 line
2.17.1
Acked-by on v2 6/8
#16 lore raw

Re: [PATCH v2 6/8] platform/chrome: cros_ec_typec: Use Thunderbolt 3 cable discover mode VDO in USB4 mode

Quoted 8 lines · Utkarsh Patel

Configure Thunderbolt3/USB4 cable generation value by filing Thunderbolt 3 cable discover mode VDO to support rounded and non-rounded Thunderbolt3/ USB4 cables.
While we are here use Thunderbolt 3 cable discover mode VDO to fill active cable plug link training value.

Quoted 35 lines

--
Changes in v2:
- No change.
--

---
 drivers/platform/chrome/cros_ec_typec.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/platform/chrome/cros_ec_typec.c +12 -2
index 8111ed1fc574..b7416e82c3b3 100644
@@ -514,8 +514,18 @@ static int cros_typec_enable_usb4(struct cros_typec_data *typec,
 	else if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_CABLE)
 		data.eudo |= EUDO_CABLE_TYPE_RE_TIMER << EUDO_CABLE_TYPE_SHIFT;
 
-	data.active_link_training = !!(pd_ctrl->control_flags &
-				       USB_PD_CTRL_ACTIVE_LINK_UNIDIR);
+	/*
+	 * This driver does not have access to the identity information or
+	 * capabilities of the cable, so we don't know is it a real USB4 or
+	 * TBT3 cable. Therefore pretending that it's always TBT3 cable by
+	 * filling the TBT3 Cable VDO.
+	 */
+	data.tbt_cable_vdo = TBT_MODE;
+
+	if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_LINK_UNIDIR)
+		data.tbt_cable_vdo |= TBT_CABLE_LINK_TRAINING;
+
+	data.tbt_cable_vdo |= TBT_SET_CABLE_ROUNDED(pd_ctrl->cable_gen);
 
 	port->state.alt = NULL;
 	port->state.data = &data;
maintainer Reviewed-by on v2 6/8
#17 lore raw

Re: [PATCH v2 6/8] platform/chrome: cros_ec_typec: Use Thunderbolt 3 cable discover mode VDO in USB4 mode

In reply to Utkarsh Patel
Quoted 8 lines · Utkarsh Patel

Configure Thunderbolt3/USB4 cable generation value by filing Thunderbolt 3 cable discover mode VDO to support rounded and non-rounded Thunderbolt3/ USB4 cables.
While we are here use Thunderbolt 3 cable discover mode VDO to fill active cable plug link training value.

FWIW:

Quoted 35 lines

--
Changes in v2:
- No change.
--

---
 drivers/platform/chrome/cros_ec_typec.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/platform/chrome/cros_ec_typec.c +12 -2
index 8111ed1fc574..b7416e82c3b3 100644
@@ -514,8 +514,18 @@ static int cros_typec_enable_usb4(struct cros_typec_data *typec,
 	else if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_CABLE)
 		data.eudo |= EUDO_CABLE_TYPE_RE_TIMER << EUDO_CABLE_TYPE_SHIFT;
 
-	data.active_link_training = !!(pd_ctrl->control_flags &
-				       USB_PD_CTRL_ACTIVE_LINK_UNIDIR);
+	/*
+	 * This driver does not have access to the identity information or
+	 * capabilities of the cable, so we don't know is it a real USB4 or
+	 * TBT3 cable. Therefore pretending that it's always TBT3 cable by
+	 * filling the TBT3 Cable VDO.
+	 */
+	data.tbt_cable_vdo = TBT_MODE;
+
+	if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_LINK_UNIDIR)
+		data.tbt_cable_vdo |= TBT_CABLE_LINK_TRAINING;
+
+	data.tbt_cable_vdo |= TBT_SET_CABLE_ROUNDED(pd_ctrl->cable_gen);
 
 	port->state.alt = NULL;
 	port->state.data = &data;
Signature · 1 line
2.17.1
Signature · 1 line
heikki
#18 lore raw

Re: [PATCH v2 6/8] platform/chrome: cros_ec_typec: Use Thunderbolt 3 cable discover mode VDO in USB4 mode

In reply to Utkarsh Patel

Hi Utkarsh,

Quoted 24 lines · Utkarsh Patel

Configure Thunderbolt3/USB4 cable generation value by filing Thunderbolt 3 cable discover mode VDO to support rounded and non-rounded Thunderbolt3/ USB4 cables.
While we are here use Thunderbolt 3 cable discover mode VDO to fill active cable plug link training value.

--
Changes in v2:
- No change.
--

---
 drivers/platform/chrome/cros_ec_typec.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/platform/chrome/cros_ec_typec.c +0 -0
index 8111ed1fc574..b7416e82c3b3 100644
@@ -514,8 +514,18 @@ static int cros_typec_enable_usb4(struct cros_typec_data *typec,
 	else if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_CABLE)
 		data.eudo |= EUDO_CABLE_TYPE_RE_TIMER << EUDO_CABLE_TYPE_SHIFT;

drivers/platform/chrome/cros_ec_typec.c static int cros_typec_enable_usb4(struct cros_typec_data *typec, · line 523

Quoted 10 lines
drivers/platform/chrome/cros_ec_typec.c +7 -2
 
-	data.active_link_training = !!(pd_ctrl->control_flags &
-				       USB_PD_CTRL_ACTIVE_LINK_UNIDIR);
+	/*
+	 * This driver does not have access to the identity information or
+	 * capabilities of the cable, so we don't know is it a real USB4 or
+	 * TBT3 cable. Therefore pretending that it's always TBT3 cable by
+	 * filling the TBT3 Cable VDO.
+	 */
+	data.tbt_cable_vdo = TBT_MODE;

Is it safe to be making this assumption unconditionally? It might work for Intel Mux agent but is it guaranteed to be safe for any other future mux implementation? In other words, what if a "true" USB4 cable is connected which doesn't have the Thunderbolt SVID alt mode?

(Pre-fetching some alternatives in case the answer is no)

You might want to check with the Cros EC team if you can repurpose a bit of the "reserved" field for specifying whether the cable is TBT or not.

Either that or see if there is a way to determine from the pd_ctrl->cable_speed whether the cable is actually TBT or not.

Failing all the above, perhaps you'll have to wait for the PD discovery stuff to make it's way through review and use that (note that there may be timing issues between the Mux update event and PD discovery complete event reaching the port driver).

Best regards,

-Prashant

#19 lore raw

Re: [PATCH v2 6/8] platform/chrome: cros_ec_typec: Use Thunderbolt 3 cable discover mode VDO in USB4 mode

Quoted 29 lines · Prashant Malani

Hi Utkarsh,

Quoted 25 lines · Utkarsh Patel

Configure Thunderbolt3/USB4 cable generation value by filing Thunderbolt 3 cable discover mode VDO to support rounded and non-rounded Thunderbolt3/ USB4 cables.
While we are here use Thunderbolt 3 cable discover mode VDO to fill active cable plug link training value.

--
Changes in v2:
- No change.
--

---
 drivers/platform/chrome/cros_ec_typec.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/platform/chrome/cros_ec_typec.c +0 -0
index 8111ed1fc574..b7416e82c3b3 100644
@@ -514,8 +514,18 @@ static int cros_typec_enable_usb4(struct cros_typec_data *typec,
      else if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_CABLE)
              data.eudo |= EUDO_CABLE_TYPE_RE_TIMER << EUDO_CABLE_TYPE_SHIFT;
 
Quoted 14 lines

drivers/platform/chrome/cros_ec_typec.c static int cros_typec_enable_usb4(struct cros_typec_data *typec, · line 523

Quoted 9 lines
drivers/platform/chrome/cros_ec_typec.c +7 -2
-     data.active_link_training = !!(pd_ctrl->control_flags &
-                                    USB_PD_CTRL_ACTIVE_LINK_UNIDIR);
+     /*
+      * This driver does not have access to the identity information or
+      * capabilities of the cable, so we don't know is it a real USB4 or
+      * TBT3 cable. Therefore pretending that it's always TBT3 cable by
+      * filling the TBT3 Cable VDO.
+      */
+     data.tbt_cable_vdo = TBT_MODE;

Is it safe to be making this assumption unconditionally? It might work for Intel Mux agent but is it guaranteed to be safe for any other future mux implementation? In other words, what if a "true" USB4 cable is connected which doesn't have the Thunderbolt SVID alt mode?

I dug into this a bit more and can maybe articulate my concern better:

Is there a situation where both of the following are true ? :
- Cable type = EUDO_CABLE_TYPE_OPTICAL or EUDO_CABLE_TYPE_RE_TIMER
- No TBT_CABLE_LINK_TRAINING or TBT_CABLE_ROUNDED_SUPPORT defined (both these are 0).

If both the above are true, then in Patch 7/8, wouldn't we never hit the else condition (labeled "Active USB cable") and therefore not set the mode_data correctly?

Quoted 8 lines

(Pre-fetching some alternatives in case the answer is no)

You might want to check with the Cros EC team if you can repurpose a bit of the "reserved" field for specifying whether the cable is TBT or not.

Either that or see if there is a way to determine from the pd_ctrl->cable_speed whether the cable is actually TBT or not.

It seems link cable_gen and USB_PD_CTRL_ACTIVE_LINK_UNIDIR are reasonable proxies for whether the cable has TBT support, so perhaps we should only set tbt_cable_vdo = TBT_MODE if either of those are non-zero?

WDYT?

Best regards,

-Prashant

#20 lore raw

RE: [PATCH v2 6/8] platform/chrome: cros_ec_typec: Use Thunderbolt 3 cable discover mode VDO in USB4 mode

Hi Prashant,

Thank you for the review and feedback.

Quoted 50 lines
Quoted 22 lines · Prashant Malani

Hi Utkarsh,

Quoted 18 lines · Utkarsh Patel

Configure Thunderbolt3/USB4 cable generation value by filing Thunderbolt 3 cable discover mode VDO to support rounded and non-rounded Thunderbolt3/
USB4 cables.
While we are here use Thunderbolt 3 cable discover mode VDO to fill active cable plug link training value.

--
Changes in v2:
- No change.
--

---
 drivers/platform/chrome/cros_ec_typec.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
Quoted 6 lines

drivers/platform/chrome/cros_ec_typec.c static int cros_typec_enable_usb4(struct

Quoted 6 lines
drivers/platform/chrome/cros_ec_typec.c +0 -0
index 8111ed1fc574..b7416e82c3b3 100644
@@ -514,8 +514,18 @@ static int cros_typec_enable_usb4(struct

cros_typec_data *typec,

Quoted 14 lines

drivers/platform/chrome/cros_ec_typec.c static int cros_typec_enable_usb4(struct cros_typec_data *typec, · line 523

Quoted 13 lines
drivers/platform/chrome/cros_ec_typec.c +7 -2
      else if (pd_ctrl->control_flags & USB_PD_CTRL_ACTIVE_CABLE)
              data.eudo |= EUDO_CABLE_TYPE_RE_TIMER <<
 EUDO_CABLE_TYPE_SHIFT;
 
-     data.active_link_training = !!(pd_ctrl->control_flags &
-                                    USB_PD_CTRL_ACTIVE_LINK_UNIDIR);
+     /*
+      * This driver does not have access to the identity information or
+      * capabilities of the cable, so we don't know is it a real USB4 or
+      * TBT3 cable. Therefore pretending that it's always TBT3 cable by
+      * filling the TBT3 Cable VDO.
+      */
+     data.tbt_cable_vdo = TBT_MODE;
Quoted 4 lines

Is it safe to be making this assumption unconditionally? It might work for Intel Mux agent but is it guaranteed to be safe for any other future mux implementation? In other words, what if a "true" USB4 cable is connected which doesn't have the Thunderbolt SVID alt mode?

Quoted 7 lines

I dug into this a bit more and can maybe articulate my concern better:

Is there a situation where both of the following are true ? :
- Cable type = EUDO_CABLE_TYPE_OPTICAL or EUDO_CABLE_TYPE_RE_TIMER
- No TBT_CABLE_LINK_TRAINING or TBT_CABLE_ROUNDED_SUPPORT defined (both
these are 0).

No, not in the case of USB4.

Quoted 11 lines

If both the above are true, then in Patch 7/8, wouldn't we never hit the else condition (labeled "Active USB cable") and therefore not set the mode_data correctly?

Quoted 6 lines

(Pre-fetching some alternatives in case the answer is no)

You might want to check with the Cros EC team if you can repurpose a bit of the "reserved" field for specifying whether the cable is TBT or not.

Quoted 8 lines
Quoted 2 lines

Either that or see if there is a way to determine from the pd_ctrl->cable_speed whether the cable is actually TBT or not.

It seems link cable_gen and USB_PD_CTRL_ACTIVE_LINK_UNIDIR are reasonable proxies for whether the cable has TBT support, so perhaps we should only set tbt_cable_vdo = TBT_MODE if either of those are non-zero?

WDYT?

Since we do not have these information available with USB4 cables, we can use them to check for TBT support and then set tbt_cable_vdo.

Quoted 4 lines

Best regards,

-Prashant

Sincerely,
Utkarsh Patel.

#21 lore raw

PATCH v2 7/8 usb: typec: intel_pmc_mux: Configure active cable properties for USB4

In reply to Utkarsh Patel

Value received as a part of Thunderbolt 3 cable discover mode VDO needs to be configured in the USB4 mode for the Thunderbolt rounded support and active cable plug link training.

--
Changes in v2:
- No change.
--

---
 drivers/usb/typec/mux/intel_pmc_mux.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/usb/typec/mux/intel_pmc_mux.c +15 -3
index aa3211f1c4c3..61feb358aad3 100644
@@ -295,6 +295,7 @@ pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state)
 {
 	struct enter_usb_data *data = state->data;
 	struct altmode_req req = { };
+	u8 cable_rounded;
 	u8 cable_speed;
 
 	if (IOM_PORT_ACTIVITY_IS(port->iom_status, TBT) ||
@@ -308,9 +309,6 @@ pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state)
 	/* USB4 Mode */
 	req.mode_data = PMC_USB_ALTMODE_FORCE_LSR;
 
-	if (data->active_link_training)
-		req.mode_data |= PMC_USB_ALTMODE_ACTIVE_LINK;
-
 	req.mode_data |= (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT;
 	req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT;
 
@@ -322,6 +320,20 @@ pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state)
 		fallthrough;
 	default:
 		req.mode_data |= PMC_USB_ALTMODE_ACTIVE_CABLE;
+
+		if (data->tbt_cable_vdo) {
+			/* Active Thunderbolt 3 cable */
+			if (data->tbt_cable_vdo & TBT_CABLE_LINK_TRAINING)
+				req.mode_data |= PMC_USB_ALTMODE_ACTIVE_LINK;
+
+			cable_rounded =
+				TBT_CABLE_ROUNDED_SUPPORT(data->tbt_cable_vdo);
+			req.mode_data |= PMC_USB_ALTMODE_TBT_GEN(cable_rounded);
+		} else {
+			/* Active USB4 cable */
+			req.mode_data |= PMC_USB_ALTMODE_ACTIVE_LINK |
+				PMC_USB_ALTMODE_TBT_GEN(1);
+		}
 		break;
 	}
 
Signature · 1 line
2.17.1
maintainer
#22 lore raw

Re: [PATCH v2 7/8] usb: typec: intel_pmc_mux: Configure active cable properties for USB4

Quoted 39 lines · Utkarsh Patel

Value received as a part of Thunderbolt 3 cable discover mode VDO needs to be configured in the USB4 mode for the Thunderbolt rounded support and active cable plug link training.

--
Changes in v2:
- No change.
--

---
 drivers/usb/typec/mux/intel_pmc_mux.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/usb/typec/mux/intel_pmc_mux.c +1 -3
index aa3211f1c4c3..61feb358aad3 100644
@@ -295,6 +295,7 @@ pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state)
 {
 	struct enter_usb_data *data = state->data;
 	struct altmode_req req = { };
+	u8 cable_rounded;
 	u8 cable_speed;
 
 	if (IOM_PORT_ACTIVITY_IS(port->iom_status, TBT) ||
@@ -308,9 +309,6 @@ pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state)
 	/* USB4 Mode */
 	req.mode_data = PMC_USB_ALTMODE_FORCE_LSR;
 
-	if (data->active_link_training)
-		req.mode_data |= PMC_USB_ALTMODE_ACTIVE_LINK;
-
 	req.mode_data |= (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT;
 	req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT;
 
@@ -322,6 +320,20 @@ pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state)
 		fallthrough;

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state) · line 330

Quoted 10 lines
drivers/usb/typec/mux/intel_pmc_mux.c +8 -0
 	default:
 		req.mode_data |= PMC_USB_ALTMODE_ACTIVE_CABLE;
+
+		if (data->tbt_cable_vdo) {
+			/* Active Thunderbolt 3 cable */
+			if (data->tbt_cable_vdo & TBT_CABLE_LINK_TRAINING)
+				req.mode_data |= PMC_USB_ALTMODE_ACTIVE_LINK;
+
+			cable_rounded =
+				TBT_CABLE_ROUNDED_SUPPORT(data->tbt_cable_vdo);

No need for the newline:

			cable_rounded = TBT_CABLE_ROUNDED_SUPPORT(data->tbt_cable_vdo);

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state) · line 338

Quoted 8 lines
drivers/usb/typec/mux/intel_pmc_mux.c +6 -0
+			req.mode_data |= PMC_USB_ALTMODE_TBT_GEN(cable_rounded);
+		} else {
+			/* Active USB4 cable */
+			req.mode_data |= PMC_USB_ALTMODE_ACTIVE_LINK |
+				PMC_USB_ALTMODE_TBT_GEN(1);
+		}
 		break;
 	}

thanks,

Signature · 1 line
heikki
#23 lore raw

RE: [PATCH v2 7/8] usb: typec: intel_pmc_mux: Configure active cable properties for USB4

Hi Heikki,

Quoted 63 lines

-----Original Message-----
From: Heikki Krogerus <[email protected]>
Sent: Tuesday, November 17, 2020 4:22 AM
To: Patel, Utkarsh H <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Mani, Rajmohan <[email protected]>; Shaikh, Azhar <[email protected]>
Subject: Re: [PATCH v2 7/8] usb: typec: intel_pmc_mux: Configure active cable properties for USB4

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_usb4(struct pmc_usb_port *port,

Quoted 21 lines · Utkarsh Patel

Value received as a part of Thunderbolt 3 cable discover mode VDO needs to be configured in the USB4 mode for the Thunderbolt rounded support and active cable plug link training.

--
Changes in v2:
- No change.
--

---
 drivers/usb/typec/mux/intel_pmc_mux.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/usb/typec/mux/intel_pmc_mux.c +0 -0
index aa3211f1c4c3..61feb358aad3 100644
@@ -295,6 +295,7 @@ pmc_usb_mux_usb4(struct pmc_usb_port *port,

struct

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state)

Quoted 7 lines
drivers/usb/typec/mux/intel_pmc_mux.c +1 -0
 typec_mux_state *state)  {
 	struct enter_usb_data *data = state->data;
 	struct altmode_req req = { };
+	u8 cable_rounded;
 	u8 cable_speed;
 
 	if (IOM_PORT_ACTIVITY_IS(port->iom_status, TBT) || @@ -308,9

+309,6

Quoted 1 line

@@ pmc_usb_mux_usb4(struct pmc_usb_port *port, struct

typec_mux_state *state)

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state)

Quoted 7 lines
drivers/usb/typec/mux/intel_pmc_mux.c +0 -3
 	/* USB4 Mode */
 	req.mode_data = PMC_USB_ALTMODE_FORCE_LSR;
 
-	if (data->active_link_training)
-		req.mode_data |= PMC_USB_ALTMODE_ACTIVE_LINK;
-
 	req.mode_data |= (port->orientation - 1) <<

PMC_USB_ALTMODE_ORI_SHIFT;

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_usb4(struct pmc_usb_port *port,

Quoted 3 lines
drivers/usb/typec/mux/intel_pmc_mux.c +0 -0
 	req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT;
@@ -322,6 +320,20 @@ pmc_usb_mux_usb4(struct pmc_usb_port *port,

struct typec_mux_state *state)

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state)

Quoted 7 lines
drivers/usb/typec/mux/intel_pmc_mux.c +4 -0
 		fallthrough;
 	default:
 		req.mode_data |= PMC_USB_ALTMODE_ACTIVE_CABLE;
+
+		if (data->tbt_cable_vdo) {
+			/* Active Thunderbolt 3 cable */
+			if (data->tbt_cable_vdo &

TBT_CABLE_LINK_TRAINING)

Quoted 8 lines

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_usb4(struct pmc_usb_port *port, · line 327

Quoted 1 line
drivers/usb/typec/mux/intel_pmc_mux.c +1 -0
+				req.mode_data |=

PMC_USB_ALTMODE_ACTIVE_LINK;

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state)

Quoted 4 lines
drivers/usb/typec/mux/intel_pmc_mux.c +3 -0
+
+			cable_rounded =
+				TBT_CABLE_ROUNDED_SUPPORT(data-
 tbt_cable_vdo);

No need for the newline:

Ack

Quoted 17 lines

cable_rounded =
TBT_CABLE_ROUNDED_SUPPORT(data->tbt_cable_vdo);

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_usb4(struct pmc_usb_port *port, · line 332

Quoted 1 line
drivers/usb/typec/mux/intel_pmc_mux.c +1 -0
+			req.mode_data |=

PMC_USB_ALTMODE_TBT_GEN(cable_rounded);

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state)

Quoted 3 lines
drivers/usb/typec/mux/intel_pmc_mux.c +3 -0
+		} else {
+			/* Active USB4 cable */
+			req.mode_data |= PMC_USB_ALTMODE_ACTIVE_LINK

|

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state) · line 338

Quoted 4 lines
drivers/usb/typec/mux/intel_pmc_mux.c +2 -0
+				PMC_USB_ALTMODE_TBT_GEN(1);
+		}
 		break;
 	}

thanks,

Quoted 2 lines

--
Heikki

Sincerely,
Utkarsh Patel.

#24 lore raw

PATCH v2 8/8 usb: typec: Remove active_link_training variable from Enter_USB message

In reply to Utkarsh Patel

Thunderbolt 3 cable discover mode VDO support has been added as part of Enter_USB message to fill details of active cable plug link training. Hence, removing unused variable active_link_training from Enter_USB message data structure.

--
Changes in v2:
- No change.
--

---
 include/linux/usb/typec.h | 6 ------
 1 file changed, 6 deletions(-)
include/linux/usb/typec.h +0 -6
index d91e09d9d91c..4a9608a15ac1 100644
@@ -76,16 +76,10 @@ enum typec_orientation {
  * struct enter_usb_data - Enter_USB Message details
  * @eudo: Enter_USB Data Object
  * @tbt_cable_vdo: TBT3 Cable Discover Mode Response
- * @active_link_training: Active Cable Plug Link Training
- *
- * @active_link_training is a flag that should be set with uni-directional SBRX
- * communication, and left 0 with passive cables and with bi-directional SBRX
- * communication.
  */
 struct enter_usb_data {
 	u32			eudo;
 	u32			tbt_cable_vdo;
-	unsigned char		active_link_training:1;
 };
 
 /*
Signature · 1 line
2.17.1
maintainer Reviewed-by on v2 8/8
#25 lore raw

Re: [PATCH v2 8/8] usb: typec: Remove active_link_training variable from Enter_USB message

Quoted 6 lines · Utkarsh Patel

Thunderbolt 3 cable discover mode VDO support has been added as part of Enter_USB message to fill details of active cable plug link training. Hence, removing unused variable active_link_training from Enter_USB message data structure.

Quoted 31 lines

--
Changes in v2:
- No change.
--

---
 include/linux/usb/typec.h | 6 ------
 1 file changed, 6 deletions(-)
include/linux/usb/typec.h +0 -6
index d91e09d9d91c..4a9608a15ac1 100644
@@ -76,16 +76,10 @@ enum typec_orientation {
  * struct enter_usb_data - Enter_USB Message details
  * @eudo: Enter_USB Data Object
  * @tbt_cable_vdo: TBT3 Cable Discover Mode Response
- * @active_link_training: Active Cable Plug Link Training
- *
- * @active_link_training is a flag that should be set with uni-directional SBRX
- * communication, and left 0 with passive cables and with bi-directional SBRX
- * communication.
  */
 struct enter_usb_data {
 	u32			eudo;
 	u32			tbt_cable_vdo;
-	unsigned char		active_link_training:1;
 };
 
 /*
Signature · 1 line
2.17.1

thanks,

Signature · 1 line
heikki
maintainer Applied
#26 lore raw
In reply to Utkarsh Patel
Quoted 7 lines · Utkarsh Patel

This patch series adds the support for Thunderbolt3/USB4 rounded and non-rounded frequencies cables and fixes the active cable plug link training support.

Changes in v2:
- Removed the fixes tag as there is no functional implication from patches 1/8, 2/8 and 4/8.

I've queued up the first 4 patches of this series. Feel free to redo the rest and resend.

thanks,

greg k-h

#27 lore raw

Hi Greg,

Quoted 16 lines

-----Original Message-----
From: Greg KH <[email protected]>
Sent: Wednesday, November 18, 2020 3:55 AM
To: Patel, Utkarsh H <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Mani, Rajmohan <[email protected]>; Shaikh, Azhar <[email protected]>
Subject: Re: [PATCH v2 0/8] Thunderbolt3/USB4 cable rounded and active cable plug link training support

Quoted 4 lines · Utkarsh Patel

This patch series adds the support for Thunderbolt3/USB4 rounded and non-rounded frequencies cables and fixes the active cable plug link training support.

Quoted 6 lines
Quoted 3 lines

Changes in v2:
- Removed the fixes tag as there is no functional implication from patches 1/8, 2/8 and 4/8.

I've queued up the first 4 patches of this series. Feel free to redo the rest and resend.

Thank you. I will send v3 with the rest of the patches.

Quoted 4 lines

thanks,

greg k-h

Sincerely,
Utkarsh Patel.