[PATCH v2 0/2] phy: tegra: xusb: Default otg mode to peripheral

Aaron Kling via B4 Relay posted 2 patches 9 months, 1 week ago
.../bindings/phy/nvidia,tegra124-xusb-padctl.yaml  | 33 ++++++++++++++++++++
.../bindings/phy/nvidia,tegra186-xusb-padctl.yaml  | 27 ++++++++++++++++
.../bindings/phy/nvidia,tegra194-xusb-padctl.yaml  | 36 ++++++++++++++++++++++
.../bindings/phy/nvidia,tegra210-xusb-padctl.yaml  | 36 ++++++++++++++++++++++
drivers/phy/tegra/xusb.c                           | 11 +++----
5 files changed, 136 insertions(+), 7 deletions(-)
[PATCH v2 0/2] phy: tegra: xusb: Default otg mode to peripheral
Posted by Aaron Kling via B4 Relay 9 months, 1 week ago
Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
---
Changes in v2:
- Add new patch to document role-switch-default-mode in xusb padctl
- Simplify code change, per review
- Comment in code why device mode is default
- Link to v1: https://lore.kernel.org/r/20250404-xusb-peripheral-v1-1-99c184b9bf5f@gmail.com

---
Aaron Kling (2):
      dt-bindings: phy: tegra-xusb: Document role-switch-default-mode
      phy: tegra: xusb: Default otg mode to peripheral

 .../bindings/phy/nvidia,tegra124-xusb-padctl.yaml  | 33 ++++++++++++++++++++
 .../bindings/phy/nvidia,tegra186-xusb-padctl.yaml  | 27 ++++++++++++++++
 .../bindings/phy/nvidia,tegra194-xusb-padctl.yaml  | 36 ++++++++++++++++++++++
 .../bindings/phy/nvidia,tegra210-xusb-padctl.yaml  | 36 ++++++++++++++++++++++
 drivers/phy/tegra/xusb.c                           | 11 +++----
 5 files changed, 136 insertions(+), 7 deletions(-)
---
base-commit: 91e5bfe317d8f8471fbaa3e70cf66cae1314a516
change-id: 20250404-xusb-peripheral-c45b1637f33b

Best regards,
-- 
Aaron Kling <webgeek1234@gmail.com>
Re: [PATCH v2 0/2] phy: tegra: xusb: Default otg mode to peripheral
Posted by Jon Hunter 9 months ago
On 06/05/2025 18:09, Aaron Kling via B4 Relay wrote:
> Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
> ---
> Changes in v2:
> - Add new patch to document role-switch-default-mode in xusb padctl
> - Simplify code change, per review
> - Comment in code why device mode is default
> - Link to v1: https://lore.kernel.org/r/20250404-xusb-peripheral-v1-1-99c184b9bf5f@gmail.com


I have been asking our team about this and this is the feedback I 
received ...

"By design, a port’s data role starts out as USB_ROLE_NONE.
It remains in that state until a dedicated role‐switch driver, such as 
the GPIO-based driver, usb-conn-gpio, or a Type-C controller driver, 
CCG, probes VBUS/ID or CC lines and tells the USB core whether to switch 
to host or device.
The role-switch-default-mode DT property exists precisely for controlled 
use cases where a board truly only ever needs one role and doesn’t 
include any role-detection hardware.
In that scenario, you’re effectively opting out of dynamic role switching.
In the general OTG case, though, we shouldn’t assume the data role of an 
OTG port.

In his case, he should work out
1. If his platform has a role-switch component, then he should enable it 
rather than adding this change.
2. If his platform doesn’t have a role-switch controller, add 
role-switch-default-mode = "peripheral"; to the PHY node instead of 
changing the core driver."

So I guess the question is, does your platform have a role-switch 
controller?

The bottom line here is that we don't want to make this change by 
default for all Tegra platforms.

Thanks
Jon

-- 
nvpublic

Re: [PATCH v2 0/2] phy: tegra: xusb: Default otg mode to peripheral
Posted by Aaron Kling 9 months ago
On Wed, May 7, 2025 at 5:48 AM Jon Hunter <jonathanh@nvidia.com> wrote:
>
>
> On 06/05/2025 18:09, Aaron Kling via B4 Relay wrote:
> > Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
> > ---
> > Changes in v2:
> > - Add new patch to document role-switch-default-mode in xusb padctl
> > - Simplify code change, per review
> > - Comment in code why device mode is default
> > - Link to v1: https://lore.kernel.org/r/20250404-xusb-peripheral-v1-1-99c184b9bf5f@gmail.com
>
>
> I have been asking our team about this and this is the feedback I
> received ...
>
> "By design, a port’s data role starts out as USB_ROLE_NONE.
> It remains in that state until a dedicated role‐switch driver, such as
> the GPIO-based driver, usb-conn-gpio, or a Type-C controller driver,
> CCG, probes VBUS/ID or CC lines and tells the USB core whether to switch
> to host or device.
> The role-switch-default-mode DT property exists precisely for controlled
> use cases where a board truly only ever needs one role and doesn’t
> include any role-detection hardware.
> In that scenario, you’re effectively opting out of dynamic role switching.
> In the general OTG case, though, we shouldn’t assume the data role of an
> OTG port.
>
> In his case, he should work out
> 1. If his platform has a role-switch component, then he should enable it
> rather than adding this change.
> 2. If his platform doesn’t have a role-switch controller, add
> role-switch-default-mode = "peripheral"; to the PHY node instead of
> changing the core driver."
>
> So I guess the question is, does your platform have a role-switch
> controller?
>
> The bottom line here is that we don't want to make this change by
> default for all Tegra platforms.

I wasn't familiar with role-switch controllers and that seems to have
been my problem. I wasn't loading the usb-conn-gpio or ucsi_ccg
modules which was why the current role wasn't being auto-detected.
After loading those, the majority of the Jetson devkits and Shield
devices I'm targeting worked as expected without this change. The only
failure I've seen so far is p3509+p3636. And I've got a fix I'll push
separately for that. So this series can be abandoned.

Sincerely,
Aaron