Skip to contentSkip to conversation

USB phy type C

RFC David Cohen 2 participants 4 messages Feb 12, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Felipe, et al,

Is there any on going discussion regarding to USB phy for type C connectors?

We'd like to know the community's preferable direction for handling (still unsupported) cases like USB3.1 PD, Accessories and Alternate modes as a new layer or an extension of current USB phy layer.

Comments are welcome :)

Br, David

#1 lore raw

Hi,

Quoted 9 lines · David Cohen

Hi Felipe, et al,

Is there any on going discussion regarding to USB phy for type C connectors?

We'd like to know the community's preferable direction for handling (still unsupported) cases like USB3.1 PD, Accessories and Alternate modes as a new layer or an extension of current USB phy layer.

Comments are welcome :)

Not the USB phy layer, but the generic phy layer. All you need to do is add a new phy provider and add support for it from within dwc3. Something like below:

drivers/usb/dwc3/core.c +13 -0
index 9f0e209b8f6c..55a85b40e43e 100644
@@ -653,6 +653,19 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
 		}
 	}
 
+	dwc->usb3_typec_phy = devm_phy_get(dev, "usb3-typec-phy");
+	if (IS_ERR(dwc->usb3_typec_phy)) {
+		ret = PTR_ERR(dwc->usb3_typec_phy);
+		if (ret == -ENOSYS || ret == -ENODEV) {
+			dwc->usb3_typec_phy = NULL;
+		} else if (ret == -EPROBE_DEFER) {
+			return ret;
+		} else {
+			dev_err(dev, "no usb3 typeC phy, continuing without\n");
+			dwc->usb3_typec_phy = NULL;
+		}
+	}
+
 	return 0;
 }
 

The only interesting part will be dealing with the other modes of operation, I haven't wrapped my head around it yet.

Signature · 1 line
balbi
#2 lore raw
Quoted 30 lines · Felipe Balbi

Hi,

Quoted 9 lines · David Cohen

Hi Felipe, et al,

Is there any on going discussion regarding to USB phy for type C connectors?

We'd like to know the community's preferable direction for handling (still unsupported) cases like USB3.1 PD, Accessories and Alternate modes as a new layer or an extension of current USB phy layer.

Comments are welcome :)

Not the USB phy layer, but the generic phy layer. All you need to do is add a new phy provider and add support for it from within dwc3. Something like below:

drivers/usb/dwc3/core.c +5 -0
index 9f0e209b8f6c..55a85b40e43e 100644
@@ -653,6 +653,19 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
 		}
 	}
 
+	dwc->usb3_typec_phy = devm_phy_get(dev, "usb3-typec-phy");
+	if (IS_ERR(dwc->usb3_typec_phy)) {
+		ret = PTR_ERR(dwc->usb3_typec_phy);
+		if (ret == -ENOSYS || ret == -ENODEV) {
+			dwc->usb3_typec_phy = NULL;

drivers/usb/dwc3/core.c static int dwc3_core_get_phy(struct dwc3 *dwc) · line 670

Quoted 10 lines
drivers/usb/dwc3/core.c +8 -0
+		} else if (ret == -EPROBE_DEFER) {
+			return ret;
+		} else {
+			dev_err(dev, "no usb3 typeC phy, continuing without\n");
+			dwc->usb3_typec_phy = NULL;
+		}
+	}
+
 	return 0;
 }

Thanks. That's a nice direction.

Quoted 4 lines

The only interesting part will be dealing with the other modes of operation, I haven't wrapped my head around it yet.

We'll probably get back to here with more questions/proposals about that.

Br, David

#3 lore raw
Quoted 35 lines · David Cohen
Quoted 34 lines · Felipe Balbi

Hi,

Quoted 9 lines · David Cohen

Hi Felipe, et al,

Is there any on going discussion regarding to USB phy for type C connectors?

We'd like to know the community's preferable direction for handling (still unsupported) cases like USB3.1 PD, Accessories and Alternate modes as a new layer or an extension of current USB phy layer.

Comments are welcome :)

Not the USB phy layer, but the generic phy layer. All you need to do is add a new phy provider and add support for it from within dwc3. Something like below:

drivers/usb/dwc3/core.c +9 -0
index 9f0e209b8f6c..55a85b40e43e 100644
@@ -653,6 +653,19 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
 		}
 	}
 
+	dwc->usb3_typec_phy = devm_phy_get(dev, "usb3-typec-phy");
+	if (IS_ERR(dwc->usb3_typec_phy)) {
+		ret = PTR_ERR(dwc->usb3_typec_phy);
+		if (ret == -ENOSYS || ret == -ENODEV) {
+			dwc->usb3_typec_phy = NULL;
+		} else if (ret == -EPROBE_DEFER) {
+			return ret;
+		} else {
+			dev_err(dev, "no usb3 typeC phy, continuing without\n");
Quoted 8 lines

drivers/usb/dwc3/core.c static int dwc3_core_get_phy(struct dwc3 *dwc) · line 670

Quoted 6 lines
drivers/usb/dwc3/core.c +4 -0
+			dwc->usb3_typec_phy = NULL;
+		}
+	}
+
 	return 0;
 }

Thanks. That's a nice direction.

btw, for typec, let's support only the new phy framework, that ought to get people to move :-)

Signature · 1 line
balbi