mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* grumpy DWC3+UCSI, usb-role-switch semantics
@ 2026-03-11 12:40 Konrad Dybcio
  2026-03-11 19:21 ` Thinh Nguyen
  0 siblings, 1 reply; 4+ messages in thread
From: Konrad Dybcio @ 2026-03-11 12:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Dmitry Baryshkov, Heikki Krogerus, Johan Hovold,
	Thinh Nguyen
  Cc: linux-usb, dt, lkml, Wesley Cheng

Hi,

The description for the usb-role-switch property (usb-drd.yaml) states:

  Indicates that the device is capable of assigning the USB data role
  (USB host or USB device) for a given USB connector, such as Type-C,
  Type-B(micro). See connector/usb-connector.yaml.

That to me sounds like a description of the capability of the on-SoC
controller (i.e. should/could be set regardless of device specifics),
however in this configuration:

&usb {
	dr_mode = "host";
	usb-role-switch;
};

the role switch device is never registered on devices with a DWC3
controller, since that's handled in dwc3_drd_init(), which is only called
if dr_mode = "otg" (or absent since otg is the default).


This notably causes:

ucsi_init()
 -> ucsi_register_port()
    -> fwnode_usb_role_switch_get()

to loop in -EPROBE_DEFER, since the 'usb-role-switch' property is present
on the connected DWC3 core, but the rolesw device is never registered.

Now, it seems like different drivers do this differently, e.g. DWC2 seems
to always register a rolesw.


How should we tackle this?

FWIW I'd prefer (for maintainability reasons) to not have to set/remove
'usb-role-switch' separately for each board, depending on whether whatever is
at the other end of the USB cables is rolesw-capable (since again, the controller
itself is), but if we go that route, I'd request that we explicitly forbid the
combination of usb-role-switch && dr_mode=host/peripheral in bindings, so that
the computer yells at me if I overlook that

Konrad

P.S. this is the reason behind the issue we encountered at:
https://lore.kernel.org/linux-arm-msm/Z1gbyXk-SktGjL6-@hovoldconsulting.com/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-13 22:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-11 12:40 grumpy DWC3+UCSI, usb-role-switch semantics Konrad Dybcio
2026-03-11 19:21 ` Thinh Nguyen
2026-03-13 13:56   ` Konrad Dybcio
2026-03-13 22:14     ` Thinh Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®