Skip to content

Improve Qualcomm EUD driver and platform support #542

Open
akakum-qualcomm wants to merge 9 commits intoqualcomm-linux:qcom-6.18.yfrom
akakum-qualcomm:eud-rb3-change
Open

Improve Qualcomm EUD driver and platform support #542
akakum-qualcomm wants to merge 9 commits intoqualcomm-linux:qcom-6.18.yfrom
akakum-qualcomm:eud-rb3-change

Conversation

@akakum-qualcomm
Copy link
Copy Markdown

The Embedded USB Debugger (EUD) is a High-Speed USB on-chip hub that
provides debug and trace capabilities on Qualcomm platforms. The current
EUD driver, however, lacks essential hardware resources such as PHY
references and support for multi-port configurations. This series
addresses those gaps and introduces the necessary device tree updates
to enable testing and validation of the enhanced functionality.

Below is a high-level block diagram showing the EUD and its connections.

		              EUD Block
                   +------------------------------+  
		   |                              |

[Conn-0]-->[USB2PHY-0]---->|-------- Path 0 --------------|-->[USBCtrl-0]
| |
[Conn-1]-->[USB2PHY-1]---->|-------- Path 1 --------------|-->[USBCtrl-1]
| |
| +------------------+ |
| | EUD Debug Hub | |
| +------------------+ |
+------------------------------+

This work builds upon an earlier EUD driver submission:
https://lore.kernel.org/all/20240730222439.3469-1-quic_eserrao@quicinc.com/
and extends it with support for multi-port use cases and proper handling
of EUD operation across different USB roles.

The series has been validated on the Qualcomm Dragonwing Q6 platform
(RB3 Gen2 board), confirming successful OpenOCD connectivity to the EUD
interface. For detailed usage instructions, refer to Qualcomm’s Linux
kernel debugging guide:

Link: https://lore.kernel.org/all/20260501170635.2641748-1-elson.serrao@oss.qualcomm.com/

CRs-Fixed: 4526131

@akakum-qualcomm akakum-qualcomm requested review from a team, quic-tingweiz, sgaud-quic and trsoni May 6, 2026 07:28
elsonroy added 9 commits May 6, 2026 16:02
…TMI routing

The Qualcomm Embedded USB Debugger (EUD) can intercept one or two
independent High-Speed UTMI paths, depending on the SoC configuration.
Each path is distinct, with its own connector/controller connection
and role-dependent UTMI routing.

Because the EUD sits between the USB connector and the USB controller,
it must relay role changes across the UTMI path. In device role, the
EUD inserts its internal hub into the path to enable debug
functionality. In host role, the path remains directly connected
between the PHY and the USB controller, bypassing the EUD hub. These
hardware constraints require per-path role awareness, as UTMI path
roles may differ.

The existing binding models only a single UTMI path and assumes a
uniform routing model. While sufficient for simple device-role-only
configurations, this representation does not accurately describe EUD
hardware when role switching and/or multiple UTMI paths are involved.

To address this limitation, per-path child nodes are introduced to
describe individual UTMI paths through the EUD. Each path includes its
own ports description, allowing controller and connector associations,
as well as role-aware routing.

Link: https://lore.kernel.org/all/20260501170635.2641748-1-elson.serrao@oss.qualcomm.com/

Signed-off-by: Elson Serrao <elson.serrao@oss.qualcomm.com>
Signed-off-by: Akash Kumar <akakum@qti.qualcomm.com>
EUD can be mapped to either the primary USB port or the secondary USB port
depending on the value of the EUD_PORT_SEL register. Add a 'port' sysfs
attribute to allow userspace to select which port EUD should operate on
and update the ABI documentation. This is needed for systems with dual
USB ports where EUD needs to be accessible on either port depending on the
system configuration and use case.

Link: https://lore.kernel.org/all/20260501170635.2641748-1-elson.serrao@oss.qualcomm.com/

Signed-off-by: Elson Serrao <elson.serrao@oss.qualcomm.com>
Signed-off-by: Akash Kumar <akakum@qti.qualcomm.com>
EUD hardware can support multiple High-Speed USB paths, each routed
through its own PHY. The active path is selected in hardware via the
EUD_PORT_SEL register. As a High-Speed hub, EUD requires access to
the High-Speed PHY associated with the active path. To support this
multi-path capability, the driver must manage PHY resources on a
per-path basis, ensuring that the PHY for the currently selected
path is properly initialized and powered.

This patch restructures the driver to implement per-path PHY management.
The driver now powers the appropriate PHY based on the selected and
enabled UTMI path, ensuring correct operation when EUD is enabled.

Historically, EUD appeared to work on single-path systems because the
USB controller kept the PHY initialized. However, EUD is designed to
operate independently of the USB controller and therefore requires
explicit PHY control for proper operation.

Link: https://lore.kernel.org/all/20260501170635.2641748-1-elson.serrao@oss.qualcomm.com/

Signed-off-by: Elson Serrao <elson.serrao@oss.qualcomm.com>
Signed-off-by: Akash Kumar <akakum@qti.qualcomm.com>
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().

Link: https://lore.kernel.org/all/20260501170635.2641748-1-elson.serrao@oss.qualcomm.com/

Signed-off-by: Elson Serrao <elson.serrao@oss.qualcomm.com>
Signed-off-by: Akash Kumar <akakum@qti.qualcomm.com>
Currently enable_store() allows operations irrespective of the EUD state,
which can result in redundant operations. Avoid this by adding duplicate
state checks to skip requests when EUD is already in the desired state.
Additionally, improve error handling with explicit logging to provide
better feedback.

Link: https://lore.kernel.org/all/20260501170635.2641748-1-elson.serrao@oss.qualcomm.com/

Signed-off-by: Elson Serrao <elson.serrao@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Akash Kumar <akakum@qti.qualcomm.com>
EUD functions by presenting itself as a USB device to the host PC for
debugging, making it incompatible with USB host mode configurations.
Enabling EUD while in host mode can also cause the USB controller to
misbehave, as the EUD hub supports only a single upstream-facing port.

Handle the following scenarios to prevent these conflicts:
1. Prevent the user from enabling EUD via sysfs when the USB port is in
   host mode.
2. Automatically disable EUD when the USB port switches to host mode,
   and re-enable it when exiting host mode.

This ensures consistent state management without creating conflicts
between the EUD debug hub and the USB controller.

Link: https://lore.kernel.org/all/20260501170635.2641748-1-elson.serrao@oss.qualcomm.com/

Signed-off-by: Elson Serrao <elson.serrao@oss.qualcomm.com>
Signed-off-by: Akash Kumar <akakum@qti.qualcomm.com>
EUD provides virtual USB attach/detach events to simulate cable
plug/unplug while maintaining the physical debug connection. However,
the current implementation incorrectly sets the USB role to HOST on
virtual detach, which doesn't represent the disconnected state.

Fix the virtual detach handling by setting the USB role to NONE
instead of HOST, correctly representing the disconnected state.

Link: https://lore.kernel.org/all/20260501170635.2641748-1-elson.serrao@oss.qualcomm.com/

Signed-off-by: Elson Serrao <elson.serrao@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Akash Kumar <akakum@qti.qualcomm.com>
…d node

The existing EUD description uses a legacy single-path representation
that assumes uniform UTMI routing. This was sufficient for minimal
configurations where the USB port operated only in device mode and role
switching was not considered.

Update the description to explicitly model the topology using eud path
child node and add a role-switch declaration to reflect role-dependent
UTMI routing. Also on this SoC, the EUD hardware intercepts only the
primary UTMI path. So remove the USB endpoint mapping to the secondary
controller and associate it with the primary controller.

With the UTMI path now accurately described, enable the EUD by default.
The connector side of the path is left unspecified, allowing board-level
DTS files to describe the physical connector mapping.

Link: https://lore.kernel.org/all/20260501170635.2641748-1-elson.serrao@oss.qualcomm.com/

Signed-off-by: Elson Serrao <elson.serrao@oss.qualcomm.com>
Signed-off-by: Akash Kumar <akakum@qti.qualcomm.com>
On Kodiak-based boards, the primary USB connector is connected through
the EUD on the High-Speed path. Update the board-level descriptions to
map the USB connector endpoint to EUD, reflecting the intended hardware
topology.

Link: https://lore.kernel.org/all/20260501170635.2641748-1-elson.serrao@oss.qualcomm.com/

Signed-off-by: Elson Serrao <elson.serrao@oss.qualcomm.com>
Signed-off-by: Akash Kumar <akakum@qti.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants