Re: [PATCH v7 4/8] usb: misc: qcom_eud: add per-path role switch support

From: Elson Serrao

Date: Wed Sep 23 2026 - 00:43:08 EST




On 9/21/2026 5:36 AM, Konrad Dybcio wrote:
> On 8/31/26 5:01 AM, Elson Serrao wrote:
>> The EUD hardware can support multiple High-Speed USB paths, each connected
>> to different USB controllers. The current implementation uses a single
>> chip-level role switch, which cannot properly handle multi-path
>> configurations where each path needs independent role management. Since
>> EUD is physically present between the USB connector and the controller,
>> it should also relay the role change requests from the connector.
>>
>> Restructure the driver to support per-path role switches and remove the
>> chip-level role switch. Additionally, as EUD need not modify the USB
>> role upon enabling, remove the unnecessary role switch call from
>> enable_eud().
>>
>> Reviewed-by: Peter Chen <peter.chen@xxxxxxxxxx>
>> Signed-off-by: Elson Serrao <elson.serrao@xxxxxxxxxxxxxxxx>
>> ---
>
> [...]
>
>> + of_property_read_string(controller_node, "dr_mode", &dr_mode);
>> +
>> + /* No role switch needed for fixed role controllers */
>> + if (!strcmp(dr_mode, "host")) {
>> + path->curr_role = USB_ROLE_HOST;
>> + of_node_put(controller_node);
>> + return 0;
>> + }
>> +
>> + if (!strcmp(dr_mode, "peripheral")) {
>> + path->curr_role = USB_ROLE_DEVICE;
>> + of_node_put(controller_node);
>> + return 0;
>> + }
>
> I was thinking.. wouldn't that also get rid of the virtual detach
> functionality on fixed-role controllers?
>

For the attached DWC3 controller (the only controller coupled
with EUD as of today), a cable disconnect in fixed `dr_mode`
configurations is effectively a no-op from the controller's perspective,
as the disconnect event simply does not reach the controller and hence
DISCONNECT irq is never generated. The behavior being emulated by the
EUD driver for these fixed-role configurations therefore matches that
of a real cable disconnect, where the detach event is not propagated
to the controller. As such, there is no need to handle virtual detach
for these configurations, since it would not emulate any real
use-case scenario.
 
That said, I do agree that if a real use case arises in the future,
either due to changes in DWC3 HW/SW behavior where cable disconnect
handling becomes meaningful in fixed `dr_mode` configurations, then
we would need to revisit this logic.

Thanks
Elson

> dwc3 currently only registers a role_switch if it's in OTG mode,
> but other drivers (such as dwc2) do it unconditionally - see
>
> https://lore.kernel.org/linux-usb/8fabc049-7fdf-498a-a3ef-6f2570d510c8@xxxxxxxxxxxxxxxx/T/#u
>
> if that's the reason, we can change the dwc3 driver to match
> since the maintainer there expressed he wouldn't mind
>
> Konrad