USB2PHY device tree configuration

Revision as of 13:14, 2 October 2023 by Registered User (→‎DT configuration (board level))
Applicable for STM32MP25x lines


1. Article purpose[edit source]

This article explains how to configure the USB2PHY internal peripheral when it is assigned to the Linux® OS. In that case, it is controlled by the PHY framework.

The configuration is performed using the device tree mechanism.

It is used by the USB2PHY Linux driver[1] which registers the relevant information in PHY framework.

2. DT bindings documentation[edit source]

USB2PHY device tree bindings[2] describe all the required and optional functions.

3. DT configuration[edit source]

This hardware description is a combination of the STM32 microprocessor device tree files (.dtsi extension) and board device tree files (.dts extension). See the Device tree for an explanation of the device tree file split.

STM32CubeMX can be used to generate the board device tree. Refer to How to configure the DT using STM32CubeMX for more details.

3.1. DT configuration (STM32 level)[edit source]

The USB2PHY nodes (one for each instance) are declared in:

  • stm32mp251.dtsi[3] on STM32MP25x lines More info.png.

Below is the template for each node:

usb2_phyX: usb2-phyX {
	compatible = "st,stm32mp25-usb2phy";
	...		/* usb2phy resources: registers, clocks, resets and supplies */
};
Warning white.png Warning
This device tree part is related to STM32 microprocessors. It must be kept as is, without being modified by the end-user.

3.2. DT configuration (board level)[edit source]

Follow the sequences described in the below chapters to configure and enable the USB2PHY on your board.

The 'usbphyc' root node must be filled in:

  • Enable the USB2PHY instance by setting status = "okay".
  • Configure the USB2PHY 3V3 regulator[4] by setting phy-supply = <&your_regulator>.
Info white.png Information
USB2PHY require an external 3V3 power supply to be provided at VDD33USB pin.

It may be necessary to adjust the phy settings to compensate parasitics, which can be due to USB connector/receptacle, routing, ESD protection component. Optional tuning parameter list is available in USB2PHY device tree bindings[2].

3.3. DT configuration example[edit source]

The example below shows how to enable and configure USB2PHY instances in the board file.

For ecosystem release ≥ v5.0.0 More info.png

&usb2phy1 {
	status = "okay";	/* enable USB2PHY1 controller */
};

&usb2phy2 {
	status = "okay";	/* enable USB2PHY2 controller */
};

{{Info| Static configuration of the UTMI switch to assign the port#2 to either USBH or OTG is done by the PHY user node[5]:

4. How to configure the DT using STM32CubeMX[edit source]

The STM32CubeMX tool can be used to configure the STM32MPU device and get the corresponding platform configuration device tree files.
The STM32CubeMX may not support all the properties described in the above DT bindings documentation paragraph. If so, the tool inserts user sections in the generated device tree. These sections can then be edited to add some properties and they are preserved from one generation to another. Refer to STM32CubeMX user manual for further information.

5. References[edit source]

Please refer to the following links for additional information: