Skip to main content
Universal serial bus (USB) is an industry standard that allows data exchange and delivery of power between various types of electronics. It can run at different speeds such as low speed at 1.5 Mbps, full speed at 12 Mbps, high speed at 480 Mbps, SuperSpeed at 5 Gbps, and SuperSpeed Plus at 10 Gbps. Synopsys DesignWare® Core SuperSpeed USB 3.x powers the USB on the Qualcomm SoC and is connected to two PHYs, USB2 PHY through UTMI and USB3 PHY through PIPE interfaces. These PHYs are wired to the physical Type-C port and facilitate communication to the external world. The following are the key hardware components of the USB.
  • USB controllers
    • The primary controller is a Synopsys DesignWare Core SuperSpeed USB 3.x controller (Gen1/Gen2).
      • Two instances of Qualcomm multipurpose PHY (QMP) for USB SuperSpeed and DisplayPort.
      • Synopsys PHY for high-speed USB.
    • The secondary controller is a Synopsys DesignWare Core high-speed USB 2.0 controller.
      • Synopsys PHY for high-speed USB
    • The tertiary controller is a Synopsys DesignWare Core high-speed USB 2.0 controller.
      • Synopsys PHY for high-speed USB.
    • Dragonwing IQ-9075 has three USB controllers (primary USB 3.2, secondary USB 3.2, tertiary USB 2.0)
  • Synopsys DesignWare core SuperSpeed USB 3.x controller features
    • Synopsys DesignWare Core SuperSpeed USB 3.x controller is a USB SuperSpeed-compliant controller, which can be configured in one of the following ways:
      • Peripheral-only configuration
      • Host-only configuration
      • Dual-role configuration
    • Supports all transfer types (control, bulk, interrupt, and isochronous)
    • Supports SuperSpeed bulk streams
    • Compliant with the eXtensible host controller interface (xHCI) specification
    • Host mode supports SuperSpeed (5 Gbps), high-speed (480 Mbps), full-speed (12 Mbps), and low-speed (1.5 Mbps) operations.
    • Device mode supports SuperSpeed (5 Gbps), high-speed (480 Mbps), and full-speed (12 Mbps) operations, and up to 16 bidirectional endpoints (including the control pipe ep0).
    • Link power management
  • USB PHY access method
    • Register-level interface through AHB2PHY for performing PHY-related operations.
  • USB Type-C
    • Supports USB Type-C and power delivery using the PM7325B PD controller.
    • Fully compliant with the USB Type-C 3.0 power delivery specifications.
    • Supports the PM7325B software driver updates according to the UCSI framework after the delivery controller determines the Type‑C orientation, role, and mode of the connected link partner.
    • Used only for the primary USB controller.

Clocks

The following tables list the clocks and operating frequencies required for the USB controller, and the high speed and SuperSpeed PHYs to function. Table : USB controller clocks Table : High-speed PHY clocks Table : SuperSpeed PHY clocks

Voltage rails

The following table lists the required voltage rails for the HighSpeed and SuperSpeed PHYs. Table : USB voltage rails Dragonwing IQ-9075 USB voltage rails
  • HS PHY: L7A (0.88 V), L6C (1.8 V), L9A (3.3 V)
  • SS PHY: L1C, L7A

Interrupts

The following table lists the various interrupts used by the USB controller to notify events. Table : USB controller interrupts

Interconnect

The following table lists the various interconnects used by the USB controller. Table : USB interconnects

USB controller reset using clock control

The following table lists the reset methods used for the USB controller and PHY. Table : USB clock reset methods

USB controller software reset using register

The following table lists the register options to reset the USB controller. Table : USB controller resets Dragonwing IQ-9075 controller reset registers
  • HS: GCC_USB2_PHY_PRIM_BCR
  • SS: GCC_USB3_PHY_PRIM_BCR/ GCC_USB3PHY_PHY_PRIM_BCR
  • GCC_USB3_PHY_TERT_BCR
  • USB30_PRIM_GDSC
  • USB30_SEC_GDSC
  • USB20_PRIM_GDSC
Dragonwing IQ-615 secondary USB controller reset registers
  • GCC_USB20_SEC_BCR
  • GCC_QUSB2PHY_SEC_BCR
  • GCC_USB2_PHY_SEC_BCR

USB controller and SoC integration

The intellectual property and PHYs of the USB controller are integrated into the SoC as shown in the following figure. Figure : USB controller PHYs and SoC integrationUSB 3.xcontrollerSoCType-C connectorAHB 2PHYDisplay port controllerSS0_1DPPHY (QMP)SS0_0DPPHY (QMP)EUDHS0PHY(SNPS)PipeUTMISSHS The Synopsys DesignWare Core SuperSpeed USB 3.0 intellectual property controls only the core functionality and not the device specifications, such as clocks, interconnects, regulators, and GDSCs. The Synopsys DesignWare Core intellectual property is embedded inside a Qscratch wrapper (intellectual property and software driver), which takes up the responsibility of managing the required resources (clocks, interconnects, interrupts, GDSC, and regulators) during the probe, suspends, or resume state. Both these drivers coexist to ensure the USB functionality. For information about the USB Qscratch wrapper driver, see https://github.com/torvalds/linux/blob/master/drivers/usb/dwc3/dwc3-qcom.c. For information about the controller core driver, see https://github.com/torvalds/linux/blob/master/drivers/usb/dwc3/core.c.

xHCI support

The xHCI specification describes the register-level host controller interface for USB 2.0 and later. The USB controller is compliant with xHCI specifications, and in host mode it supports SuperSpeed (5 Gbps), high-speed (480 Mbps), full-speed (12 Mbps), and low-speed (1.5 Mbps) operations. Linux standard xHCI drivers are used to operate the USB controller in host mode.

USB Type-C connector system software interface (UCSI)

NoteDragonwing IQ-9075 and Dragonwing IQ-8275 don’t support USB Type-C feature.

USB features

Qualcomm chip hardware SoCs allow working in the dual-role device (DRD) mode. DRD enables both device and host roles. The device dynamically detects the role to move to and programs the controller accordingly. The autosuspend capability is supported to shut down the USB controller when the cable is removed. Function interfaces, such as video, audio, tethering, file transfer, media transfer, and charging are supported. Table : USB features: Linux

Runtime power management

The Runtime power management feature can be enabled according to the your requirements. LPM support is added as part of https://lore.kernel.org/all/20231017131851.8299-1-quic_kriskura@quicinc.com/. NoteDragonwing IQ-9075 and Dragonwing IQ-8275 don’t support runtime power management for USB Type-A ports. By default, USB-suspend and resume in runtime are disabled. To enable these features, run the following command:
The default autosuspend delay is set to 5 s. To change the delay, run the following sysfs command:
During a role switch, the DWC3 controller enters the suspend state, toggles GDSC, and resets the controller to ensure successful host mode peripheral enumeration. While in host mode, for remote wake-up to work, wake-up, and autosuspend are enabled for the xHCI interface, USB root hubs, and the connected peripherals according to your requirements.
NoteThe host controller driver (HCD) device generates the xhci-hcd.X.auto value, where X = 0, 1, 2. It indicates the number of devices connected to the USB. The connected devices are listed at /sys/bus/platform/devices/xhci-hcd.X.auto/usb1/<node number>. The<node number> value depends on the number of devices connected to the USB port. To enable the remote wake up for an LS optical mouse, run the following commands:
To check the runtime status, run the following command:
To avoid suspending in the composition switch, remove the active UDC to rebind the composition by running the following command:

Software features

The following USB features are supported in software. Table : USB software features

USB architecture

The Qualcomm USB software architecture is loosely made up of two components, one is based on pure upstream, and the other is a sandbox where some of the pending feature-related changes are present. The pure upstream is directly picked from the latest stable kernel long-term support (LTS) 6.6.2. The architecture uses a Yocto (release 4.0) recipe for creating the binaries. Figure : USB software architecture/dev/ffs-xxx//dev/ffs-xxx//dev/ffs-xxx//sys/kernel/config/usb_gadget/…/sys/bus/usb/…Function driverFunction driverGadget frameworkconfigfs, UDC coreDevice controller driverClassdriverClassdriverUSB coreHost controller driverdwc3-qcomDWC3 core driversFemto phy driverQMP phy driverUCSIPMIC GLINKPM7325BaDSP corecharger firmwareVBUS, CC, D+,D-HSSS/sys/class/typec/port0/…Dual-role class driverType-C role swapdiag-routerport-bridgeadbd.serviceUSB peripheral mode configurationRuntime power management controlUser-space servicesVFSKernel-spaceType-C connector The sandbox is implemented with the following Qualcomm-specific features.

USB interfaces

USB supports multiple interfaces to transfer audio, video, debug information, and tethering. Each of the following USB interface communication protocol is different and has its own protocols in addition to the standard USB protocol.
  • Android debug bridge (ADB)
  • Diagnostics (diag)
    • Diag is a diagnostics framework used for collecting log data from various subsystems, and debugging. The diag data is transmitted through USB to the host PC.
    • Kernel driver: Diag uses f_fs.c to expose the /dev/ffs-diag node, which is operated by a user space service for various operations. The dev node has the following three files:
  • Mass storage
  • Remote network driver interface specification (RNDIS)
    • RNDIS is a specification developed by Microsoft for network devices on dynamic plug and play I/O buses such as USB.
    • Kernel driver: It uses a f_rndis driver, which is present in the upstream Linux kernel and directly communicates with the network interfaces or stack.
  • Network control model (NCM)
    • NCM is a protocol designed to offer advanced features and capabilities compared to RNDIS.
    • It’s commonly found in applications where USB devices must handle demanding networking tasks.
  • USB audio class 2 (UAC2)
    • UAC2 is a standard governing the communication between USB audio devices and computers.
    • UAC2 supports higher audio data transfer rates, resulting in improved audio quality and reduced latency.
  • USB video class (UVC)
    • UVC is a standard that defines how video streaming devices, such as webcams, should communicate with computers using USB.
    • UVC facilitates the plug-and-play functionality for video devices.

USB tools

A few commonly used USB tools are listed in the following table. Table : USB tool and download details

Configure USB boot loader

The device tree parameters for tuning the high-speed and SuperSpeed USB signal quality in the boot loader can be modified using the Qualcomm DeviceTree editor (QDTE) tool. QDTE tool is used to configure the device tree binary blob by editing the xbl_config.elf file, as shown in the following figure. For more information about how to configure the device tree blobs, see the  QDTE section. The device tree file path at the Linux host machine is /boot_images/boot/Settings/Soc/<Chipset>/Core/WiredConnectivity/USB/usb.dtsi. Figure : Device tree layout The following table lists the properties for tuning the HS-USB PHY and SS USB PHY signal quality. Table : USB configuration properties

Configure USB camera

The Qualcomm Linux devices provide driver support for USB web cameras that adhere to the USB video class (UVC) standard. The uvcvideo driver of the Linux kernel supports cameras. For more information about the uvcvideo driver, see https://www.kernel.org/doc/html/v4.19/media/v4l-drivers/uvcvideo.html. The uvcvideo driver exposes these cameras as V4L2 video devices, which can be accessed through the character device nodes such as /dev/videoX. In the user space, applications can manage USB cameras using the v4l2src GStreamer plug-in, which comes bundled with the Qualcomm Intelligent Multimedia SDK (IM SDK). Alternatively, programs such as Yavta (yet another V4L2 test application) directly interact with the V4L2 (Video4Linux2) interface to test and control camera devices. The current release doesn’t include the Yavta program by default. To obtain and cross-compile Yavta on the host device, do the following:
  1. The cross-compilation environment can be established using any of the following methods.
    • Method 1: To set up the cross-compilation environment, run the following command.
    • Method 2: To set up the cross-compilation environment, run the following commands:
      1. Download the cross-compiler.
      2. Extract the cross-compiler.
      3. Set up the environment for cross-compilation by running the following command.
  2. Clone the Yavta repository and change the directory.
  3. Cross-compile the tool.
  4. To push Yavta to the Qualcomm Linux hardware SoCs, do the following:
    1. Open the SSH shell in permissive mode or use the ADB shell. For more information about how to run SSH, see the Use SSH section.
    2. Mount the file system.
    3. Transfer files using SCP or similar tools. For example, scp yavta root@10.92.162.185:/usr/bin
    4. Assign permission to execute in Yavta.

Prerequisite: Obtain image format and size

To configure the USB camera either through Yavta or GStreamer, the following steps are mandatory.
  1. To know the enumeration details, plug in the USB camera and run the following command.
    The following output is displayed.
  2. Identify the USB camera video node created as /dev/videoX from the serial console.
    NoteThe 1-1/1-1:1.0 value varies according to the USB device connected. The following output is displayed.
  3. To view the supported output formats and sizes using Yavta, run the following command:
    where X value is based on the node. For example:
    The following output is displayed.
  4. Select the required image format and size from step 3.

Configure USB camera using Yavta

Prerequisite: Ensure that Yavta is cross-compiled, and the output format, size are identified.
  • To select MJPEG format of 1280x720 output size and 30 fps, capture 10 frames under /tmp/ with filename testmjpeg-00000*.bin, run the following command.
    The following output is displayed.
  • To select YUV format of 1280x960 output size, 30 fps, capture 10 frames under /tmp/, the generated filename is testyuv-00000*.bin, run the following command.
    NoteEnable the Permissive mode using command #setenforce 0. The following output is displayed.

Configure USB camera using GStreamer in Qualcomm IM SDK

Qualcomm IM SDK uses GStreamer, an open-source multimedia framework to expose easy APIs and plugins in both the multimedia and machine learning domains. For information about installing the Qualcomm IM SDK, see the Getting Started section. The Qualcomm IM SDK includes the v4l2src plug-in, which allows input from USB cameras with a selected format. The waylandsink plug-in is responsible for rendering the video output on a Wayland display. NotePrerequisites:
  1. To set the environment variables for the Wayland display, run the following command in the serial console.
  2. Use GStreamer commands to stream video from the camera to the UI. Ensure that you set the appropriate device ID (/dev/videoX) and select the correct format based on the USB camera detection. NoteIn GStreamer, the YUYV color format is referred to as YUY2. Hence, you must specify the YUYV format while setting up a pipeline and use YUY2 in the caps filter.
    • For 720p, run the following command:
      The following output is displayed.
    • For 1080p, run the following command:

Customize USB device

This section describes the requirements for various configurations and customizations in the USB software.

Example shell script for a USB composition with diag and ADB interfaces

Change USB composition through QUSB service

usb.service starts the QUSB service at /usr/bin/qusb to provide users the flexibility to configure the USB gadgets. It completely removes the hassle of manually executing commands to initialize USB from configfs. Prerequisite: Enable SELinux by running the following command.
Example:

Enable and configure UVC use case

The USB video device class (also USB video class or UVC) is a USB device class that describes devices capable of streaming video, such as webcams, digital camcorders, transcoders, analog video converters, and still-image cameras. The latest revision of the USB video class specification is v1.5. The USB implementers forum describes both the basic protocol and the different payload formats in v1.5. NoteDragonwing IQ-9075 and Dragonwing IQ-8275 don’t support the UVC use case. The tools and procedures to test the UVC are as follows:
  • UVC gadget (device side): It’s a sample application to test the f_uvc functional driver. It opens the video node created by uvc_gadget and sends MJPEG frames at a specified frame rate. This application is cross-compiled for the DUT. NoteEnsure that the packages and tools required for cross-compiling a 64‑bit Arm® technology compiler are installed on the host machine.
    1. The cross-compilation environment can be established using any of the following options.
      • Option A: Run the following command.
      • Option B: To set up the cross-compilation environment, run the following commands:
        1. Download the cross-compiler.
        2. Extract the cross-compiler.
        3. Set up the environment for cross-compilation by running the following command.
    2. To build the UVC gadget tool, do the following.
      1. Clone the uvc-gadget repository.
      2. Modify Makefile for a static build.
      3. Cross-compile for arm64 to generate the uvc‑gadget executable.
  • UVC viewer (host side): To receive the UVC data, open any USB webcam application on the computer.
    1. To validate, push the UVC gadget application and sample image files to the device, do the following:
      1. Open the SSH shell in permissive mode or use the ADB shell. For more information about how to run SSH, see the Use SSH section.
      2. Mount the file system.
      3. Transfer files using SCP or similar tools. For example, scp uvc-gadget root@10.92.175.138:/usr/bin
      4. Assign permission to execute.
    2. Change to any UVC composition (90DF or 90CB). For example,
USB is enumerated in UVC composition only when a user space video application is open. For the USB enumeration to occur, start the uvc_gadget application through a console (serial console or SSH shell or use the ADB shell).
  • YUYV
    1. Push the image-720.yuv image file to /root or /etc.
    2. Verify the image-720.yuv image with the uvc-gadget tool.
      • Where X indicates the new video node created after the composition switch
      • Where -f is format with the following values:
        • 0 = V4L2_PIX_FMT_YUYV
        • 1 = V4L2_PIX_FMT_MJPEG
  • MJPEG
    1. Push the image-720.jpg image file to /root or /etc.
    2. Verify the image-720.jpg image with the uvc-gadget tool.
      • Where X indicates the new video node created after the composition switch
      • Where -f is <format> with the following values:
        • 0 = V4L2_PIX_FMT_YUYV
        • 1 = V4L2_PIX_FMT_MJPEG
  • For information about usage, run the following command.
    The following output is displayed.

UAC use cases

USB audio uses isochronous, interrupt, and control transfers. All audio data is transferred using isochronous transfers. The interrupt transfers are used to relay information regarding the availability of audio clocks and control transfers are used to set volume, request sample rates. NoteDragonwing IQ-9075 and Dragonwing IQ-8275 don’t support the UAC use case. To verify, select a USB composition with a UAC function.
To capture or play back, use tinyutils applications such as tinyplay/tinycap available in the rootfs. The application opens the PCM nodes created in /dev/snd/ when the UAC driver binds are successful. The following are a few sample commands.
  • List the sound card on the Linux host machine.
  • Play back the audio file.
    • To play the audio from device to host, push the file.wav file with the matching audio configuration. The following is an example of a sample configuration.
      Output:
      Output:
      Output:
      Output:
      Output:
      Output:
      NoteTo modify the audio configuration, adjust the preceding parameters before establishing the USB composition to 90CA.
    • Run the following command on the SSH shell or use the ADB shell.
      The following output is displayed.
    • Run the following command on a Linux host machine with an application such as arecord to capture the audio.
  • Record an audio file.
    • Run the following command on a Linux host machine with an application such as aplay to play the audio.
    • Run the following command on the SSH shell of the device or use the ADB shell.
      The following output is displayed.

Data role swapping in USB power delivery

Data role swap (DR_SWAP) is the exchange of DFP (host) and UFP (device) roles between port partners using a USB Type-C connector. Power role swap (PR_SWAP) exchanges the source and sink roles between the port partners. NoteDragonwing IQ-9075 and Dragonwing IQ-8275 don’t support data and power role swapping using Type-C connectors.
  • Data role
    • To swap data roles from host to device, run the following commands:
      The following output is displayed.
      The following output is displayed.
    • To swap data roles from device to host, run the following commands:
      The following output is displayed.
      The following output is displayed.
  • Power role
    • To swap power roles from sink to source, run the following commands:
      The following output is displayed.
      The following output is displayed.
    • To swap power role from source to sink, run the following commands:
      The following output is displayed.
      The following output is displayed.

Customize with configfs

The configfs file system provides the converse of the sysfs functionality. A number of interfaces can configure Linux USB gadgets, with each interface representing a USB function. The qusb executable configures the configfs USB gadget using the following commands.
  1. Create configfs and mount functionfs.
  2. Start adbd/diag services.
  3. Bind configfs with the USB gadget application.
  4. Stop or unbind the USB gadget application.
  5. Set diag and ADB composition.
  6. List the available USB compositions.
    The USB compositions are as follows.
    • A4A1 NCM
    • 4EE7 ADB
    • 900E DIAG
    • 901C DIAG + UAC2
    • 901D DIAG + ADB
    • 9015 MASS_STORAGE + ADB
    • 9024 RNDIS + ADB
    • 902A RNDIS + MASS_STORAGE
    • 902B RNDIS + ADB + MASS_STORAGE
    • 902C RNDIS + DIAG
    • 902D RNDIS + DIAG + ADB
    • 902F RNDIS + DIAG + MASS_STORAGE
    • 9060 DIAG + QDSS + ADB
    • 908C NCM + ADB
    • 90CA DIAG + UAC2 + ADB
    • 90CB DIAG + UVC + ADB
    • 90CC DIAG + UAC2 + UVC + ADB
    • 90DF DIAG + UVC
    • 90E0 DIAG + UAC2 + UVC
    • F000 MASS_STORAGE
    • F00E RNDIS

Verify USB device

The following table lists the various methods to verify the USB device and host modes. Table : USB device and host mode verification

Debug USB issues

This section provides information on the various methods to obtain debugging logs. The debugging methods include regdumps, debug ftraces, configfs nodes. The logs provide visibility into the event and controller state details when debugging issues with low-power mode entry-exit, SMMU faults, unclocked accesses. NoteDragonwing IQ-9075 and Dragonwing IQ-8275 don’t support USB Type-C feature.

Trace USB

The debugfs tracing provides a deeper view into each transaction over the USB line. To view the list of traces, run the following command.
NoteEnsure that debugfs is mounted. If not mounted, run the following command to mount debugfs.
Following are the traces available for verifying data transfers in the xHCI/gadget stack/USB Type-C connector system software interface (UCSI).
To list the traces in xHCI/host controller driver (HCD), run the following command.
Following are the traces available for verifying data transfers in the xHCI/HCD.
To list the available events of the USB video class (UVC) gadget driver, run the following command.
The following output is displayed.
To list the available events in the UCSI driver, run the following command.
The following output is displayed.

USB regdump

The USB debugfs provides the following information. NoteThe a600000.usb address varies depending the chipset.
  • Mode of operation.
    Sample output:
  • State and transfer ring buffer (TRB) queues to all endpoints in device mode.
  • Current link state.
    Sample output.
  • List processor (LSP) dump.
    Sample output:
Sample output:
The regdump command provides the current state of the register space for the following registers:
  • Device mode registers, such as DCTL, DSTS, and DCFG
  • Global registers, such as GCTL and GSTS
Sample output:

View file system attributes for host mode using sysfs

To view the bus details, run the following command.
Sample output:
To list the contents of the current directory, run the following command.
Sample output:
To view details about the USB devices, run the following command.
Sample output:

USB examples

QCS6490: https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts For information about RPM changes in the USB driver and other examples, see https://patchwork.kernel.org/project/linux-usb/list/?series=793939&archive=both. For information about how to flatten a device tree, see https://lore.kernel.org/all/af60c05b-4a0f-51b8-486a-1fc601602515@quicinc.com/ and https://lore.kernel.org/all/20231016-dwc3-refactor-v1-0-ab4a84165470@quicinc.com/. \