USB2PHY device tree configuration

Revision as of 16:31, 3 June 2024 by Registered User (→‎Article purpose)
Applicable for STM32MP25x lines


1. Article purpose[edit source]

The purpose of this article is to explain how to configure the USB2PHY internal peripheral using the device tree mechanism, relying on the bindings documentation, that is the description of the required and optional device-tree properties.

It is used by:

  • the USB2PHY Linux driver[1] which registers the relevant information in PHY framework.
  • the USB2PHY U-Boot driver[2]

The peripheral can be assigned to different contexts or software components, depending on the final product needs. Refer to How to assign an internal peripheral to an execution context for guidelines on this configuration.

2. DT bindings documentation[edit source]

The device tree binding documents are stored in the Linux® kernel repository:

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 organization.

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 usb2phyX root node must be filled in:

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

It may be necessary to adjust the PHY settings to compensate for parasitics, which can be due to the USB connector or receptacle, routing, and ESD protection components. An optional list of tuning parameters is available in the USB2PHY device tree bindings[5].

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 white.png Information
Static assignment of usb2phy(s) is done by the PHY user node[6]:

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.
STM32CubeMX may not support all the properties described in DT binding files listed 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]

Refer to the following links for additional information: