USB Driver
The JH-7110 SoC Platform supports the following features and specifications for the USB module.
- As the master device, connect mass storage devices, USB mouse and other USB devices.
- As the slave device, perform ADB debugs and mass storage device
USB Driver Framework
The following figure shows the block diagram of the PWM driver for JH-7110.
Linux kernel provides a complete set of USB driver programs. The USB framework uses a tree structure and only allows to have one host device on a bus.
The following diagram shows the USB framework from the host or slave’s point of view.
Figure 1. Driver Framework
The main tasks of the USB subsystem include:
- Register and manage device drivers
- Locate drivers for USB devices, then initialize and configure the device
- Display device tree in the kernel
- Interact with devices
USB Driver Device Tree Source Code
The following code block shows the device tree source code of the USB driver in the
jh7110.dtsi
file.
usbdrd30: usbdrd{
compatible = "starfive,jh7110-cdns3";
reg = <0x0 0x10210000 0x0 0x1000>,
<0x0 0x10200000 0x0 0x1000>;
clocks = <&clkgen JH7110_USB_125M>,
<&clkgen JH7110_USB0_CLK_APP_125>,
<&clkgen JH7110_USB0_CLK_LPM>,
<&clkgen JH7110_USB0_CLK_STB>,
<&clkgen JH7110_USB0_CLK_USB_APB>,
<&clkgen JH7110_USB0_CLK_AXI>,
<&clkgen JH7110_USB0_CLK_UTMI_APB>,
<&clkgen JH7110_PCIE0_CLK_APB>;
clock-names = "125m","app","lpm","stb","apb","axi","utmi", "phy";
resets = <&rstgen RSTN_U0_CDN_USB_PWRUP>,
<&rstgen RSTN_U0_CDN_USB_APB>,
<&rstgen RSTN_U0_CDN_USB_AXI>,
<&rstgen RSTN_U0_CDN_USB_UTMI_APB>,
<&rstgen RSTN_U0_PLDA_PCIE_APB>;
reset-names = "pwrup","apb","axi","utmi", "phy";
starfive,stg-syscon = <&stg_syscon 0x4 0xc4 0x148 0x1f4>;
starfive,sys-syscon = <&sys_syscon 0x18>;
status = "disabled";
#address-cells = <2>;
#size-cells = <2>;
#interrupt-cells = <1>;
ranges;
usbdrd_cdns3: usb@10100000 {
compatible = "cdns,usb3";
reg = <0x0 0x10100000 0x0 0x10000>,
<0x0 0x10110000 0x0 0x10000>,
<0x0 0x10120000 0x0 0x10000>;
reg-names = "otg", "xhci", "dev";
interrupts = <100>, <108>, <110>;
interrupt-names = "host", "peripheral", "otg";
phy-names = "cdns3,usb3-phy", "cnds3,usb2-phy";
maximum-speed = "super-speed";
};
};The following table describes the DT parameters:| Parameter | Description |
|---|---|
| Parameters common to usbdrd30: usbdrd (main node) and usbdrd_cdns3 nodes | |
| compatible | Compatibility information, used to associate the driver and its target device |
| reg | Register base address "0x10030000" and range "0x4000". |
| clocks | The clocks used by the USB module |
| clock-names | The names of the clocks used by the USB module |
| resets | The reset signals used by the USB module |
| reset_names | The names of the reset signals |
| starfive,stg-syscon | The register values for the StarFive STG SYSCON control registers |
| starfive,sys-syscon | The register values for the StarFive SYS SYSCON control registers |
| status |
The work status of the USB module. To enable the module, set this bit to okay. To disable the module, set this bit to disabled. |
| Parameters specific to usbdrd_cdns3 node | |
| interrupts | Hardware interrupt ID |
| interrupt-names | Hardware interrupt names |
| phy-names | USB PHY names |
| maximum-speed | Whether to support USB 3.0 super-speed |
Driver Source Code Structure
The following code block displays the source code structure for the USB Subsystem.
| Node | Stricture |
|---|---|
| USB on the core level |
|
| xHCI-host |
|
| CDNS3 on the core and role level |
|
| CDNS3 on the platform level |
|
| CDN3 host |
|
| Node | Structure |
|---|---|
| USB gadget driver |
|
| USB device function (mass storage and functionfs) |
|
| USB UDC driver |
|
| CDN3 USB device driver |
|