A10 USB OTG Controller (USB0)

usb0 is a USB 2.0 OTG controller with both host and gadget mode.

in gadget mode up to 5 endpoints is supported.

GPIO pins are used for ID & power control.

There is strong indications the hardware is based on MentorGraphics USB-OTG IP block (musb).

Driver sources

The driver is not sharing any code with other USB drivers. Seem to be a wrapper around an os-independent driver code for the USB controller.

Registers

Registers with a lower case x is endpoint registers indexed by the EPIND endpoint index select register

0x0000 EPFIFO0

0x0004 EPFIFO1

0x0008 EPFIFO2

0x000C EPFIFO3

0x0010 EPFIFO4

0x0014 EPFIFO5

0x0040 PCTL

Power Control

Bit #

  • 7 0x80 ISO_UPDATE_EN (Device only)
  • 6 0x40 SOFT_CONNECT (Device only)
  • 5 0x20 HIGH_SPEED_EN
  • 4 0x10 HIGH_SPEED_FLAG
  • 3 0x08 RESET
  • 2 0x04 RESUME
  • 1 0x02 SUSPEND
  • 0 0x01 SUSPEND_EN

0x0041 DEVCTL

Bit #

  • 7 0x80 B_DEVICE
  • 6 0x40 FS_DEV
  • 5 0x20 LS_DEV
  • 4 0x10 ????
  • 3 0x08 VBUS
  • 2 0x04 HOST_MODE
  • 1 0x02 HOST_REQ
  • 0 0x01 SESSION

0x0042 EPIND

Endpoint Index

Current active endpoint (0-5).

0x0043 VEND0

Bit #

  • 1- 0xXX DRQ_SEL
  • 0 0x01 BUS_SEL

BUS_SEL = 1 for DMA?

DRQ_SEL = ((ep_index - 0x01) << 1) for TX type endpoints

DRQ_SEL = ((ep_index << 1) - 0x01) for RX type endpoints

0x0044 INTTx

Interrupt Register for Endpoint 0 plus TX Endpoints 1 to 5

0x0046 INTRx

Interrupt Register for RX Endpoints 1 to 5

0x0048 INTTxE

Interrupt Enable Register for INTRTX

0x004A INTRxE

Interrupt Enable Register for INTRRX

0x004C INTUSB

Interrupt Register for Common USB Interrupts

0x0050 INTUSBE

Interrupt Enable Register for INTRUSB

0x0054 FRNUM Frame Number Register

0x006C // PHYCTL

Old register location. See new location below.

0x0078 EPINFO

0x0079 RAMINFO

0x007A LINKINFO

0x007B VPLEN

0x007C HSEOF

0x007C TMCTL

0x007D FSEOF

0x007D VEND1

0x007E LSEOF

0x007E VEND3

0x0080 TXMAXPx

Maximum packet size for peripheral/host TX endpoint

0x0082 CSR0

ep0 Control and Status Register (index register set to select Endpoint 0)

Host mode:

  • 11 DisPing
  • 8 FlushFIFO
  • 7 NAK_Timeout
  • 6 StatusPkt
  • 5 ReqPkt
  • 4 Error
  • 3 SetupPkt
  • 2 RxStall
  • 1 TxPkRdy
  • 0 RxPkRdy

Device mode:

  • 8 FLUSH_FIFO
  • 7 SERVICED_SETUP_END
  • 6 SERVICED_RX_PKT_READY
  • 5 SEND_STALL
  • 4 SETUP_END
  • 3 DATA_END
  • 2 SENT_STALL
  • 1 TX_PKT_READY
  • 0 RX_PKT_READY

0x0082 TXCSRx

Control Status register for host/peripheral TX endpoint.

0x0084 RXMAXPx

Maximum packet size for peripheral/host RX endpoint

0x0086 RXCSRx

Control Status register for host/peripheral RX endpoint.

0x0088 COUNT0

Number of received bytes in Endpoint 0 FIFO.

0x0088 RXCOUNTx

Number of bytes in host RX endpoint FIFO.

0x008A RPCOUNTx

0x008C EP0TYPE

Defines the speed of Endpoint 0

0x008C TXTYPEx

Sets the operating speed, transaction protocol and peripheral endpoint number for the host TX endpoint.

0x008D NAKLIMIT0

Sets the NAK response timeout on Endpoint 0.

0x008D TXINTERVALx

Sets the polling interval for Interrupt/ISOC transactions or the NAK response timeout on Bulk transactions for host TX endpoint.

0x008E RXTYPEx

Sets the operating speed, transaction protocol and peripheral endpoint number for the host RX endpoint.

0x008F RXINTERVALx

Sets the polling interval for Interrupt/ISOC transactions or the NAK response timeout on Bulk transactions for host RX endpoint

0x0090 TXFIFOSZx

TX Endpoint FIFO Size

0x0092 TXFIFOADx

TX Endpoint FIFO Address

0x0094 RXFIFOSZx

RX Endpoint FIFO Size

0x0096 RXFIFOADx

RX Endpoint FIFO Address

0x0098 TXFUNCADDRx

Address of the target function that has to be accessed through the associated TX Endpoint

0x009A TXHUBADDRx

Address of the hub that has to be accessed through the associated TX Endpoint.

This is used only when full-speed or low-speed device is connected via a USB2.0 high-speed hub.

0x009B TXHPORTx

Port of the hub that has to be accessed through the associated TX Endpoint.

This is used only when full-speed or low-speed device is connected via a USB2.0 high-speed hub.

0x009C RXFUNCADDRx

Address of the target function that has to be accessed through the associated RX Endpoint

0x009E RXHUBADDRx

Address of the hub that has to be accessed through the associated RX Endpoint.

This is used only when full-speed or low-speed device is connected via a USB2.0 high-speed hub.

0x009F RXHUBPORTx

Port of the hub that has to be accessed through the associated RX Endpoint.

This is used only when full-speed or low-speed device is connected via a USB2.0 high-speed hub.

0x00c0 // CONFIGDATA

0x0400 ISCR

0x0404 PHYCTL

0x0408 PHYBIST

0x040c PHYTUNE