Device Detection, Enumeration

Zynq UltraScale+ Device Technical Reference Manual (UG1085)

Document ID
UG1085
Release Date
2023-12-21
Revision
2.4 English

The USB device initialization process is the same, whether the device attached to the port is a function or a hub. Once the pipes associated with an external hub are set up, the hub driver enumerates the devices attached to the external hub's ports using standard hub class command sequences.

1.When the xHCI detects a device attach, it sets the current connect status (CCS) and connect status change (CSC) flags to 1. If the assertion of CSC results in a 0 to 1 transition of the port status change event generation, the xHCI generates a port status change event.

2.Upon receipt of a port status change event the system software evaluates the port ID field to determine the port that generated the event.

3.System software then reads the PORTSC register of the port that generated the event. CSC = 1 if the event was due to attach (CCS =  1) or detach (CCS = 0).

4.A USB2 protocol port requires software to reset the port, to advance the port to the enabled state, and a USB device from the powered state to the default state. After an attach event, the PED and PR flags is 0 and the PLS field is 7 (polling) in the PORTSC register.

5.System software enables the port by resetting the port (writing a 1 to the PORTSC PR bit) then waiting for a port status change event due to the assertion of the port reset change (PRC) flag.

6.The completion of the port reset causes the PORTSC register PRC and PED flags to be set (1), the PR flag to be cleared (0), and the PLS field to be U0 (0). If the assertion of PRC results in a 0 to 1 transition of PSCEG, the xHCI generates a port status change event as a result of the transition of PRC. The reset operation sets the USB2 device into the default state, preparing it for a SET_ADDRESS request.

7.After the port successfully reaches the enabled state, the system software obtains a device slot for the newly attached device using an enable slot command.

8.After successfully obtaining a device slot, the system software initializes the data structures associated with the slot.

9.Once the slots related data structures are initialized, the system software uses an address device command to assign an address to the device and enable its default control endpoint.

10.For full-speed devices, the system software should initially read the first 8 bytes of the USB device descriptor to retrieve the value of the bMaxPacketSize0 field and determine the actual maximum packet size for the default control endpoint, by issuing a USB GET_DESCRIPTOR request to the device, update the default control endpoint context with the actual maximum packet size, and inform the xHCI of the context change.

11.Software then issues an evaluate context command with add context bit [1] (A1) set to 1 to inform the xHCI of the change to the default control endpoint's maximum packet size parameter.

12.Now that the default control endpoint is fully operational.

a.System software can read the complete USB device descriptor and possibly the configuration descriptors to be able to hand the device off to the appropriate class driver(s).

b.The class driver can then configure the device slot using a configure endpoint command, and configure the USB device itself by issuing a USB SET_CONFIGURATION request through the devices' default control endpoint.

c.The successful completion of both operations is required to advance the state of the USB device from Address to Configured and the xHCI device slot from Address to Configured.

d.If required, the system software can configure alternate interfaces.

13.The pipe interfaces to the USB device are now fully operational.