Source Code Structure

The source code of USB driver is in the drivers/usb directory.

The following code blocks show the source code of the USB driver.

USB Host

The following list shows the source code of the USB driver in host mode.
  • For USB on the core level:
    drivers/usb/core
    ├── Makefile
    ├── usb.c
    ├── hub.c
    ├── hcd.c
    ├── urb.c
    ├── message.c
    ├── driver.c
    ├── config.c
    ├── file.c
    ├── buffer.c
    ├── sysfs.c
    ├── endpoint.c
    ├── devio.c
    ├── notify.c
    ├── generic.c
    ├── quirks.c
    ├── devices.c
    ├── phy.c
    ├── port.c
    ├── of.c
    ├── hcd-pci.c
    ├── usb-acpi.c
    ├── Kconfig
    
  • For Xhci-host:
    drivers/usb/host/
    ├── Makefile
    ├── Kconfig
    ├── xhci.c
    ├── xhci-plat.c
    ├── xhci-mem.c
    ├── xhci-ext-caps.c
    ├── xhci-ring.c
    ├── xhci-hub.c
    ├── xhci-dbg.c
    ├── xhci-trace.c
    ├── xhci-pci.c
    ├── xhci-debugfs.c
    
  • For CDNS3 on the core and role level:
    drivers/usb/cdns3/
    ├── Makefile
    ├── core.c
    ├── drd.c
    ├── Kconfig
    
  • For CDNS3 on the platform level:
    drivers/usb/cdns3/
    ├── cdns3-plat.c
    ├── cdns3-starfive.c
    
  • For CDN3 host:
    drivers/usb/cdn3/
    ├── host.c
    

USB Device

The following list shows the source code of the USB driver in device mode.
  • For USB gadget driver:
    drivers/usb/gadget/
    ├── usbstring.c
    ├── config.c
    ├── epautoconf.c
    ├── composite.c
    ├── functions.c
    ├── configfs.c
    ├── u_f.c
    ├── Makefile
    ├── Kconfig
    
  • For USB device function (mass storage and functionfs):
    drivers/usb/gadget/function/
    ├── f_mass_storage.c
    ├── storage_common.c
    ├── f_fs.c
    ├── Makefile
    ├── Kconfig
    
  • For USB UDC driver:
    drivers/usb/gadget/udc/
    ├── core.c
    ├── trace.c
    ├── Makefile
    ├── Kconfig
    
  • For CDN3 USB device driver:
    • For Linux 5.15:
      drivers/usb/cdn3/
      ├── cdns3-gadget.c
      ├── cdns3-ep0.c
      
    • For Linux 5.10:
      drivers/usb/cdn3/
      ├── gadget.c
      ├── ep0.c