* [PATCH 1/7] usb: dwc3: Registering a role switch in the DRD code.
[not found] <20200311191501.8165-1-bryan.odonoghue@linaro.org>
@ 2020-03-11 19:14 ` Bryan O'Donoghue
2020-03-11 19:14 ` [PATCH 2/7] dt-bindings: usb: dwc3: Add a gpio-usb-connector example Bryan O'Donoghue
2020-03-11 19:14 ` [PATCH 5/7] usb: dwc3: Add support for usb-conn-gpio connectors Bryan O'Donoghue
2 siblings, 0 replies; 8+ messages in thread
From: Bryan O'Donoghue @ 2020-03-11 19:14 UTC (permalink / raw)
To: balbi, gregkh, linux-usb
Cc: linux-arm-msm, linux-kernel, bjorn.andersson, jackp, robh,
Yu Chen, Rob Herring, Mark Rutland, ShuFan Lee, Heikki Krogerus,
Suzuki K Poulose, Chunfeng Yun, Hans de Goede, Andy Shevchenko,
Jun Li, Valentin Schneider, Guillaume Gardet,
Bryan O'Donoghue, devicetree, John Stultz
From: Yu Chen <chenyu56@huawei.com>
The Type-C drivers use USB role switch API to inform the
system about the negotiated data role, so registering a role
switch in the DRD code in order to support platforms with
USB Type-C connectors.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
CC: ShuFan Lee <shufan_lee@richtek.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>
Cc: Yu Chen <chenyu56@huawei.com>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Jun Li <lijun.kernel@gmail.com>
Cc: Valentin Schneider <valentin.schneider@arm.com>
Cc: Guillaume Gardet <Guillaume.Gardet@arm.com>
Cc: Jack Pham <jackp@codeaurora.org>
Cc: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: linux-usb@vger.kernel.org
Cc: devicetree@vger.kernel.org
Suggested-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Yu Chen <chenyu56@huawei.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Tested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
drivers/usb/dwc3/core.h | 3 ++
drivers/usb/dwc3/drd.c | 78 ++++++++++++++++++++++++++++++++++++++++-
2 files changed, 80 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 77c4a9abe365..a99e57636172 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -25,6 +25,7 @@
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include <linux/usb/otg.h>
+#include <linux/usb/role.h>
#include <linux/ulpi/interface.h>
#include <linux/phy/phy.h>
@@ -953,6 +954,7 @@ struct dwc3_scratchpad_array {
* @hsphy_mode: UTMI phy mode, one of following:
* - USBPHY_INTERFACE_MODE_UTMI
* - USBPHY_INTERFACE_MODE_UTMIW
+ * @role_sw: usb_role_switch handle
* @usb2_phy: pointer to USB2 PHY
* @usb3_phy: pointer to USB3 PHY
* @usb2_generic_phy: pointer to USB2 PHY
@@ -1086,6 +1088,7 @@ struct dwc3 {
struct extcon_dev *edev;
struct notifier_block edev_nb;
enum usb_phy_interface hsphy_mode;
+ struct usb_role_switch *role_sw;
u32 fladj;
u32 irq_gadget;
diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
index c946d64142ad..ba0f6cdc4c71 100644
--- a/drivers/usb/dwc3/drd.c
+++ b/drivers/usb/dwc3/drd.c
@@ -476,6 +476,74 @@ static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc)
return edev;
}
+#if IS_ENABLED(CONFIG_USB_ROLE_SWITCH)
+#define ROLE_SWITCH 1
+static int dwc3_usb_role_switch_set(struct usb_role_switch *sw, enum usb_role role)
+{
+ struct dwc3 *dwc = usb_role_switch_get_drvdata(sw);
+ u32 mode;
+
+ switch (role) {
+ case USB_ROLE_HOST:
+ mode = DWC3_GCTL_PRTCAP_HOST;
+ break;
+ case USB_ROLE_DEVICE:
+ mode = DWC3_GCTL_PRTCAP_DEVICE;
+ break;
+ default:
+ mode = DWC3_GCTL_PRTCAP_DEVICE;
+ break;
+ }
+
+ dwc3_set_mode(dwc, mode);
+ return 0;
+}
+
+static enum usb_role dwc3_usb_role_switch_get(struct usb_role_switch *sw)
+{
+ struct dwc3 *dwc = usb_role_switch_get_drvdata(sw);
+ unsigned long flags;
+ enum usb_role role;
+
+ spin_lock_irqsave(&dwc->lock, flags);
+ switch (dwc->current_dr_role) {
+ case DWC3_GCTL_PRTCAP_HOST:
+ role = USB_ROLE_HOST;
+ break;
+ case DWC3_GCTL_PRTCAP_DEVICE:
+ role = USB_ROLE_DEVICE;
+ break;
+ case DWC3_GCTL_PRTCAP_OTG:
+ role = dwc->current_otg_role;
+ break;
+ default:
+ role = USB_ROLE_DEVICE;
+ break;
+ }
+ spin_unlock_irqrestore(&dwc->lock, flags);
+ return role;
+}
+
+static int dwc3_setup_role_switch(struct dwc3 *dwc)
+{
+ struct usb_role_switch_desc dwc3_role_switch = {NULL};
+
+ dwc3_role_switch.fwnode = dev_fwnode(dwc->dev);
+ dwc3_role_switch.set = dwc3_usb_role_switch_set;
+ dwc3_role_switch.get = dwc3_usb_role_switch_get;
+ dwc3_role_switch.driver_data = dwc;
+ dwc->role_sw = usb_role_switch_register(dwc->dev, &dwc3_role_switch);
+ if (IS_ERR(dwc->role_sw))
+ return PTR_ERR(dwc->role_sw);
+
+ dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
+ return 0;
+}
+#else
+#define ROLE_SWITCH 0
+#define dwc3_setup_role_switch(x) 0
+#endif
+
int dwc3_drd_init(struct dwc3 *dwc)
{
int ret, irq;
@@ -484,7 +552,12 @@ int dwc3_drd_init(struct dwc3 *dwc)
if (IS_ERR(dwc->edev))
return PTR_ERR(dwc->edev);
- if (dwc->edev) {
+ if (ROLE_SWITCH &&
+ device_property_read_bool(dwc->dev, "usb-role-switch")) {
+ ret = dwc3_setup_role_switch(dwc);
+ if (ret < 0)
+ return ret;
+ } else if (dwc->edev) {
dwc->edev_nb.notifier_call = dwc3_drd_notifier;
ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST,
&dwc->edev_nb);
@@ -531,6 +604,9 @@ void dwc3_drd_exit(struct dwc3 *dwc)
{
unsigned long flags;
+ if (dwc->role_sw)
+ usb_role_switch_unregister(dwc->role_sw);
+
if (dwc->edev)
extcon_unregister_notifier(dwc->edev, EXTCON_USB_HOST,
&dwc->edev_nb);
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/7] dt-bindings: usb: dwc3: Add a gpio-usb-connector example
[not found] <20200311191501.8165-1-bryan.odonoghue@linaro.org>
2020-03-11 19:14 ` [PATCH 1/7] usb: dwc3: Registering a role switch in the DRD code Bryan O'Donoghue
@ 2020-03-11 19:14 ` Bryan O'Donoghue
2020-03-19 1:08 ` Stephen Boyd
2020-03-11 19:14 ` [PATCH 5/7] usb: dwc3: Add support for usb-conn-gpio connectors Bryan O'Donoghue
2 siblings, 1 reply; 8+ messages in thread
From: Bryan O'Donoghue @ 2020-03-11 19:14 UTC (permalink / raw)
To: balbi, gregkh, linux-usb
Cc: linux-arm-msm, linux-kernel, bjorn.andersson, jackp, robh,
Bryan O'Donoghue, Rob Herring, Mark Rutland, devicetree
A USB connector should be a child node of the USB controller
connector/usb-connector.txt. This patch adds an example of how to do this
to the dwc3 binding descriptions.
It is necessary to declare a connector as a child-node of a USB controller
for role-switching to work, so this example should be helpful to others
implementing that.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: linux-usb@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Acked-by: Felipe Balbi <balbi@kernel.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Tested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
Documentation/devicetree/bindings/usb/dwc3.txt | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
index 66780a47ad85..4e1e4afccee6 100644
--- a/Documentation/devicetree/bindings/usb/dwc3.txt
+++ b/Documentation/devicetree/bindings/usb/dwc3.txt
@@ -121,4 +121,12 @@ dwc3@4a030000 {
interrupts = <0 92 4>
usb-phy = <&usb2_phy>, <&usb3,phy>;
snps,incr-burst-type-adjustment = <1>, <4>, <8>, <16>;
+
+ usb_con: connector {
+ compatible = "gpio-usb-b-connector";
+ id-gpios = <&tlmm 116 GPIO_ACTIVE_HIGH>;
+ vbus-supply = <&usb3_vbus_reg>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&usb3_id_pin>, <&usb3_vbus_pin>;
+ };
};
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/7] usb: dwc3: Add support for usb-conn-gpio connectors
[not found] <20200311191501.8165-1-bryan.odonoghue@linaro.org>
2020-03-11 19:14 ` [PATCH 1/7] usb: dwc3: Registering a role switch in the DRD code Bryan O'Donoghue
2020-03-11 19:14 ` [PATCH 2/7] dt-bindings: usb: dwc3: Add a gpio-usb-connector example Bryan O'Donoghue
@ 2020-03-11 19:14 ` Bryan O'Donoghue
2 siblings, 0 replies; 8+ messages in thread
From: Bryan O'Donoghue @ 2020-03-11 19:14 UTC (permalink / raw)
To: balbi, gregkh, linux-usb
Cc: linux-arm-msm, linux-kernel, bjorn.andersson, jackp, robh,
Bryan O'Donoghue, John Stultz, Lee Jones, Rob Herring,
Mark Rutland, ShuFan Lee, Heikki Krogerus, Suzuki K Poulose,
Chunfeng Yun, Yu Chen, Hans de Goede, Andy Shevchenko, Jun Li,
Valentin Schneider, devicetree
This patch adds the ability to probe and enumerate a connector based on
usb-conn-gpio.
You would use usb-conn-gpio when a regulator in your system provides VBUS
directly to the connector instead of supplying via the USB PHY.
The parent device must have the "usb-role-switch" property, so that when
the usb-conn-gpio driver calls usb_role_switch_set_role() the notification
in dwc3 will run and the block registers will be updated to match the state
detected at the connector.
Cc: John Stultz <john.stultz@linaro.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
CC: ShuFan Lee <shufan_lee@richtek.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>
Cc: Yu Chen <chenyu56@huawei.com>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Jun Li <lijun.kernel@gmail.com>
Cc: Valentin Schneider <valentin.schneider@arm.com>
Cc: Jack Pham <jackp@codeaurora.org>
Cc: linux-usb@vger.kernel.org
Cc: devicetree@vger.kernel.org
Tested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
drivers/usb/dwc3/drd.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
index ba0f6cdc4c71..2705871ec95e 100644
--- a/drivers/usb/dwc3/drd.c
+++ b/drivers/usb/dwc3/drd.c
@@ -11,6 +11,7 @@
#include <linux/of_graph.h>
#include <linux/platform_device.h>
#include <linux/property.h>
+#include <linux/of_platform.h>
#include "debug.h"
#include "core.h"
@@ -539,9 +540,30 @@ static int dwc3_setup_role_switch(struct dwc3 *dwc)
dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
return 0;
}
+
+static int dwc3_register_gpio_usb_connector(struct dwc3 *dwc)
+{
+ struct device *dev = dwc->dev;
+ struct device_node *np = dev->of_node, *conn_np;
+ int ret = 0;
+
+ conn_np = of_get_child_by_name(np, "connector");
+ if (!conn_np) {
+ dev_dbg(dev, "no connector child node specified\n");
+ goto done;
+ }
+
+ if (of_device_is_compatible(conn_np, "gpio-usb-b-connector"))
+ ret = of_platform_populate(np, NULL, NULL, dev);
+done:
+ of_node_put(conn_np);
+ return ret;
+}
+
#else
#define ROLE_SWITCH 0
#define dwc3_setup_role_switch(x) 0
+#define dwc3_register_gpio_usb_connector(x) 0
#endif
int dwc3_drd_init(struct dwc3 *dwc)
@@ -557,6 +579,9 @@ int dwc3_drd_init(struct dwc3 *dwc)
ret = dwc3_setup_role_switch(dwc);
if (ret < 0)
return ret;
+ ret = dwc3_register_gpio_usb_connector(dwc);
+ if (ret < 0)
+ return ret;
} else if (dwc->edev) {
dwc->edev_nb.notifier_call = dwc3_drd_notifier;
ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST,
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/7] dt-bindings: usb: dwc3: Add a gpio-usb-connector example
2020-03-11 19:14 ` [PATCH 2/7] dt-bindings: usb: dwc3: Add a gpio-usb-connector example Bryan O'Donoghue
@ 2020-03-19 1:08 ` Stephen Boyd
2020-03-19 15:22 ` Bryan O'Donoghue
0 siblings, 1 reply; 8+ messages in thread
From: Stephen Boyd @ 2020-03-19 1:08 UTC (permalink / raw)
To: Bryan O'Donoghue, balbi, gregkh, linux-usb
Cc: linux-arm-msm, linux-kernel, bjorn.andersson, jackp, robh,
Bryan O'Donoghue, Rob Herring, Mark Rutland, devicetree
Quoting Bryan O'Donoghue (2020-03-11 12:14:56)
> A USB connector should be a child node of the USB controller
> connector/usb-connector.txt. This patch adds an example of how to do this
> to the dwc3 binding descriptions.
I read that as a child of the USB interface controller, which is not the
same as the USB controller. For example, we're talking about having the
usb connector be a child of the EC on ChromeOS devices because that
manages the connector
>
> It is necessary to declare a connector as a child-node of a USB controller
> for role-switching to work, so this example should be helpful to others
> implementing that.
Maybe it should be a virtual node at the root of the DT if it's GPIO
controlled? And then the phy can be connected to the usb connector
through the graph binding.
>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: linux-usb@vger.kernel.org
> Cc: devicetree@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Acked-by: Felipe Balbi <balbi@kernel.org>
> Reviewed-by: Rob Herring <robh@kernel.org>
> Tested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
> Documentation/devicetree/bindings/usb/dwc3.txt | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
> index 66780a47ad85..4e1e4afccee6 100644
> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
> @@ -121,4 +121,12 @@ dwc3@4a030000 {
> interrupts = <0 92 4>
> usb-phy = <&usb2_phy>, <&usb3,phy>;
Weird that there's a comma here ^
Not a problem with this patch, just noticing it while reading the diff.
> snps,incr-burst-type-adjustment = <1>, <4>, <8>, <16>;
> +
> + usb_con: connector {
> + compatible = "gpio-usb-b-connector";
> + id-gpios = <&tlmm 116 GPIO_ACTIVE_HIGH>;
> + vbus-supply = <&usb3_vbus_reg>;
> + pinctrl-names = "default";
> + pinctrl-0 = <&usb3_id_pin>, <&usb3_vbus_pin>;
> + };
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/7] dt-bindings: usb: dwc3: Add a gpio-usb-connector example
2020-03-19 1:08 ` Stephen Boyd
@ 2020-03-19 15:22 ` Bryan O'Donoghue
2020-03-19 16:40 ` Stephen Boyd
0 siblings, 1 reply; 8+ messages in thread
From: Bryan O'Donoghue @ 2020-03-19 15:22 UTC (permalink / raw)
To: Stephen Boyd, balbi, gregkh, linux-usb
Cc: linux-arm-msm, linux-kernel, bjorn.andersson, jackp, robh,
Rob Herring, Mark Rutland, devicetree
On 19/03/2020 01:08, Stephen Boyd wrote:
> Quoting Bryan O'Donoghue (2020-03-11 12:14:56)
>> A USB connector should be a child node of the USB controller
>> connector/usb-connector.txt. This patch adds an example of how to do this
>> to the dwc3 binding descriptions.
>
> I read that as a child of the USB interface controller, which is not the
> same as the USB controller. For example, we're talking about having the
> usb connector be a child of the EC on ChromeOS devices because that
> manages the connector
>
>>
>> It is necessary to declare a connector as a child-node of a USB controller
>> for role-switching to work, so this example should be helpful to others
>> implementing that.
>
> Maybe it should be a virtual node at the root of the DT if it's GPIO
> controlled? And then the phy can be connected to the usb connector
> through the graph binding.
Graph binding can probably work.
Re: the PHY.
For myself the hardware model is
Connector -> PHY -> Host controller -> Host controller wrapper
Only
Connector -> Host controller -> Host controller wrapper
care about the USB role though.
If your PHY did care about the role, you'd really need to write a
connector/phy type-c type driver, to detect the state and toggle your
PHY bits before doing usb_role_switch_set_role() back to DWC3.
At least that's my understanding.
---
bod
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/7] dt-bindings: usb: dwc3: Add a gpio-usb-connector example
2020-03-19 15:22 ` Bryan O'Donoghue
@ 2020-03-19 16:40 ` Stephen Boyd
2020-03-19 18:03 ` Bryan O'Donoghue
0 siblings, 1 reply; 8+ messages in thread
From: Stephen Boyd @ 2020-03-19 16:40 UTC (permalink / raw)
To: Bryan O'Donoghue, balbi, gregkh, linux-usb
Cc: linux-arm-msm, linux-kernel, bjorn.andersson, jackp, robh,
Rob Herring, Mark Rutland, devicetree
Quoting Bryan O'Donoghue (2020-03-19 08:22:14)
> On 19/03/2020 01:08, Stephen Boyd wrote:
> >
> > Maybe it should be a virtual node at the root of the DT if it's GPIO
> > controlled? And then the phy can be connected to the usb connector
> > through the graph binding.
>
> Graph binding can probably work.
>
> Re: the PHY.
>
> For myself the hardware model is
>
> Connector -> PHY -> Host controller -> Host controller wrapper
>
> Only
>
> Connector -> Host controller -> Host controller wrapper
>
> care about the USB role though.
>
> If your PHY did care about the role, you'd really need to write a
> connector/phy type-c type driver, to detect the state and toggle your
> PHY bits before doing usb_role_switch_set_role() back to DWC3.
>
Yes some PHYs do care about the role. Sometimes they have to toggle some
bit to switch between host and gadget mode for example. I haven't fully
read this patch series but maybe the PHY can be the one that controls
the gpio for the connector?
We (ChromeOS) need to integrate the type-c connector class, etc. on
sc7180 with the dwc3 driver and the current thinking has the type-c
connectors underneath the cros_ec node because the EC is the type-c
manager. The EC will have a type-c driver associated with it.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/7] dt-bindings: usb: dwc3: Add a gpio-usb-connector example
2020-03-19 16:40 ` Stephen Boyd
@ 2020-03-19 18:03 ` Bryan O'Donoghue
2020-03-19 20:30 ` Stephen Boyd
0 siblings, 1 reply; 8+ messages in thread
From: Bryan O'Donoghue @ 2020-03-19 18:03 UTC (permalink / raw)
To: Stephen Boyd, balbi, gregkh, linux-usb
Cc: linux-arm-msm, linux-kernel, bjorn.andersson, jackp, robh,
Rob Herring, Mark Rutland, devicetree
On 19/03/2020 16:40, Stephen Boyd wrote:
> Quoting Bryan O'Donoghue (2020-03-19 08:22:14)
>> On 19/03/2020 01:08, Stephen Boyd wrote:
>>>
>>> Maybe it should be a virtual node at the root of the DT if it's GPIO
>>> controlled? And then the phy can be connected to the usb connector
>>> through the graph binding.
>>
>> Graph binding can probably work.
>>
>> Re: the PHY.
>>
>> For myself the hardware model is
>>
>> Connector -> PHY -> Host controller -> Host controller wrapper
>>
>> Only
>>
>> Connector -> Host controller -> Host controller wrapper
>>
>> care about the USB role though.
>>
>> If your PHY did care about the role, you'd really need to write a
>> connector/phy type-c type driver, to detect the state and toggle your
>> PHY bits before doing usb_role_switch_set_role() back to DWC3.
>>
>
> Yes some PHYs do care about the role. Sometimes they have to toggle some
> bit to switch between host and gadget mode for example. I haven't fully
> read this patch series but maybe the PHY can be the one that controls
> the gpio for the connector?
Previous version of the PHY from 2019 had extcon toggling vbus.
Since extcon is going away, we moved go usb-gpio
https://lwn.net/ml/devicetree/20190905175802.GA19599@jackp-linux.qualcomm.com/
https://lwn.net/ml/devicetree/5d71edf5.1c69fb81.1f307.fdd6@mx.google.com/
usb-gpio-conn handle VBUS and notifies via the USB role switch API.
Which if the connector is a child of the controller "just works" but,
maybe with a little bit of work DT <port> references could do the same
thing and the connector wouldn't need to be declared as a child.
> We (ChromeOS) need to integrate the type-c connector class, etc. on
> sc7180 with the dwc3 driver and the current thinking has the type-c
> connectors underneath the cros_ec node because the EC is the type-c
> manager. The EC will have a type-c driver associated with it.
right and you don't want, doesn't work or doesn't make sense, to declare
cros_ec as a child of DWC3, fair enough.
I guess a DT remote-endpoint{} will do the job.
Something like:
arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
---
bod
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/7] dt-bindings: usb: dwc3: Add a gpio-usb-connector example
2020-03-19 18:03 ` Bryan O'Donoghue
@ 2020-03-19 20:30 ` Stephen Boyd
0 siblings, 0 replies; 8+ messages in thread
From: Stephen Boyd @ 2020-03-19 20:30 UTC (permalink / raw)
To: Bryan O'Donoghue, balbi, gregkh, linux-usb
Cc: linux-arm-msm, linux-kernel, bjorn.andersson, jackp, robh,
Rob Herring, Mark Rutland, devicetree
Quoting Bryan O'Donoghue (2020-03-19 11:03:58)
> On 19/03/2020 16:40, Stephen Boyd wrote:
> > the gpio for the connector?
>
> Previous version of the PHY from 2019 had extcon toggling vbus.
>
> Since extcon is going away, we moved go usb-gpio
>
> https://lwn.net/ml/devicetree/20190905175802.GA19599@jackp-linux.qualcomm.com/
>
> https://lwn.net/ml/devicetree/5d71edf5.1c69fb81.1f307.fdd6@mx.google.com/
>
> usb-gpio-conn handle VBUS and notifies via the USB role switch API.
>
> Which if the connector is a child of the controller "just works" but,
> maybe with a little bit of work DT <port> references could do the same
> thing and the connector wouldn't need to be declared as a child.
>
> > We (ChromeOS) need to integrate the type-c connector class, etc. on
> > sc7180 with the dwc3 driver and the current thinking has the type-c
> > connectors underneath the cros_ec node because the EC is the type-c
> > manager. The EC will have a type-c driver associated with it.
>
> right and you don't want, doesn't work or doesn't make sense, to declare
> cros_ec as a child of DWC3, fair enough.
>
> I guess a DT remote-endpoint{} will do the job.
>
> Something like:
> arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
>
Yes something like that, but it looks like that dtsi file has the usb
host controller connected through a remote-endpoint to the type-c
connector. I was under the impression that it would only be the phy that
is connected this way because it's possible for there to be multiple
different phys that drive data out through one connector. For example,
in type-c the DP phy can be different from the USB2 phy or USB3 phy and
there could even be other things like an HDMI phy too that all go to the
same connector.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-03-19 20:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20200311191501.8165-1-bryan.odonoghue@linaro.org>
2020-03-11 19:14 ` [PATCH 1/7] usb: dwc3: Registering a role switch in the DRD code Bryan O'Donoghue
2020-03-11 19:14 ` [PATCH 2/7] dt-bindings: usb: dwc3: Add a gpio-usb-connector example Bryan O'Donoghue
2020-03-19 1:08 ` Stephen Boyd
2020-03-19 15:22 ` Bryan O'Donoghue
2020-03-19 16:40 ` Stephen Boyd
2020-03-19 18:03 ` Bryan O'Donoghue
2020-03-19 20:30 ` Stephen Boyd
2020-03-11 19:14 ` [PATCH 5/7] usb: dwc3: Add support for usb-conn-gpio connectors Bryan O'Donoghue
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).