AM335X USB Driver User Guide 04.06.00

From Texas Instruments Wiki
Jump to: navigation, search


TIBanner.png
AM335X USB Driver User Guide
Linux PSP



Quick Start Guide

This section is a quick guide on how to start using usb ports on AM335x platform with supplied pre-built binaries. Please refer to USB Quick Start

Introduction

AM335x USB subsystem has two instance of mentor usb controller. Each controller is based on USB2.0 standards supporting high, full and low speed. Communication Port Programming Interface 4.1 (CPPI4.1) DMA controller is used by each musb controller to transfer data between external memory and endpoint FIFOs. There are 15 Tx and 15 Rx endpoints for each musb controller in addition to endpoint-0. CPPI4.1 DMA can not be used for data transfers on endpoint-0 and so CPU is used for all transfers on endpoint-0. Please refer to AM335x Technical Reference Manual (TRM) for details.

References

  • The USB2.0 specification standard USB 2.0 spec
  • AM335x Technical Reference Manual here

Acronyms & Definitions

Acronym Definition
USB Universal Serial Bus
OTG On The Go
HS/FS/LS Highspeed/Fullspeed/LowSpeed
UAC USB Audio Class
UVC USB Video Class
HID Human Interface Devices
CDC Communication Device Class
RNDIS Remote Network Device Interface Specification
DTM Driver Test Manager

Linux Software Architecture

MUSB controller driver

The Linux MUSB controller driver is a host controller driver (HCD) and gadget controller driver for musb controller. As musb controller is an OTG controller so each musb port can act as either as host or as a device. The musb host controller driver (HCD) registers the host controller hardware to linux usb core stack and similarly musb gadget controller driver registers itself to the udc core.

Linux USB Stack Architecture

Linux usb stack is a layered architecture where musb controller driver is at lowest layer. Linux USB core layer provides API interface to host class drivers and forwards the request from class drivers to intended host controller driver. Gadget drivers (function driver) binds itself with gadget controller driver and uses gadget drivers functions to perform data transfers.

Usb-stack-arch-image.JPG

Driver Features

This section describes the Linux musb controller driver feature.

  • The musb controller driver can be built as loadable module or statically built inside the kernel image.
  • Supports both PIO (non DMA mode) and DMA mode (Note: DMA mode not applicable for control endpoint)
  • Concurrent usage of both the musb ports either in host or in device mode.

Please refer the table below for supported usb class and gadget drivers with the release.

Host Device
Feature Status Feature Status
Hub class Supported File Storage Gadget Supported
HID Supported CDC Supported
MSC Supported RNDIS Supported
UVC Supported from PSP-04.06.00.05 onward
UAC Supported from PSP-04.06.00.05 onward
OTG (HNP) Supported from PSP-04.06.00.05 onward


Configuration

This section describes the kernel config options to be selected for building musb controller driver along with host class and gadget drivers.


MUSB controller driver

Please refer MUSB Controller Driver Config for kernel config option for MUSB controller driver.

USB Host Configuration

This section has details of USB host class kernel configurations.

Host Mass Storage Class (MSC)

Please refer Host MSC for kernel config options to be enabled for host mass storage class.

Host HID class

Please refer Host HID for kernel config options to be enabled for host HID class.

Host Audio class

Please refer Host Audio for kernel config options to be enabled for host audio class.

Host Video class

Please refer Host Video for kernel config options to be enabled for host video class.

Host CDC class

Please refer Host CDC for kernel config options to be enabled for host CDC class.

USB Device Configuration

This section has details of USB gadget driver kernel configurations.

Device CDC and RNDIS gadget

Please refer CDC Gadget for kernel config options to be enabled for CDC gadget driver and refer RNDIS Gadget for kernel config options to be enabled for RNDIS gadget driver.

Device File Storage gadget

Please refer File Storage Gadget for kernel config options to be enabled for File Storage gadget driver.

Module build

Module build for usb driver is supported. Please select <M> in place of <*> for all the drivers in kernel config as explained above.

Port mode configuration

AM335x has two musb port and each of them are OTG capable which means each of them can act host only or device only or both based on board configurations. Each musb port mode can be configured for a custom board at it's board file at arch/arm/mach-omap2/board-xxx.c. Please update "mode" field within 'struct omap_musb_board_data' for configuring port mode. mode[D0:D3] is mode for musb0 port and mode[D4:D7] is mode for musb1 port.

Modular tests

Selecting the musb controller driver as module would build four different module which needs to inserted in below order for testing musb port.

  • insmod musb_hdrc.ko for inserting musb core module.
  • insmod cppi41dma.ko for inserting dma module. Please skip this step if DMA is disabled.
  • insmod ti81xx.ko for inserting platform glue module.
  • insmod g_ether.ko OR insmod g_file_storage.ko file=<file-path> stall=0 to insert a gadget module. Please skip this step if port is configured to be host only in board file.

USB OTG (HNP/SRP) testing

NOTE

SRP doesn't work on AM335x and Vbus is always switched on from initial A-device.

Please refer USB OTG (HNP/SRP) testing for details on how to test HNP and SRP.

Software Interface

Please refer Software Interface for details on software interface available in sysfs, profs and debugfs.