Last edited one month ago

USB2PHY device tree configuration

Applicable for STM32MP21x lines, STM32MP23x lines, STM32MP25x lines


1. Article purpose[edit | 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 | edit source]

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

3. DT configuration[edit | 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 | edit source]

The USB2PHY nodes, one for each instance, are declared in:

  • stm32mp211.dtsi[3] on STM32MP21x lines More info.png.
  • stm32mp231.dtsi[4] on STM32MP23x lines More info.png.
  • stm32mp251.dtsi[5] on STM32MP25x lines More info.png.

Below is the template for each node:

/* For STM32MP21 */
usb2_phyX: usb2-phyX {
	compatible = "st,stm32mp21-usb2phy";
	...		/* usb2phy resources: registers, clocks, resets and supplies */
};
/* For STM32MP23 */
usb2_phyX: usb2-phyX {
	compatible = "st,stm32mp25-usb2phy";
	...		/* usb2phy resources: registers, clocks, resets and supplies */
};
/* For STM32MP25 */
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 | 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[6] 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[7].

  • Optionally configure the USB2PHY 1V8 regulator by setting vdda18-supply = <&your_regulator>.
  • Optionally, the VBUS 5V regulator[6] can be added, under a connector subnode with vbus-supply = <&your_regulator> as specified in usb-connector.yaml[8] bindings.

3.3. DT configuration example[edit | edit source]

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

&usb2_phy1 {
	vdd33-supply = <&scmi_vdd3v3_usb>;
	status = "okay";	/* enable USB2PHY1 controller */
	connector {
		compatible = "usb-a-connector";
		vbus-supply = <&vbus>;
	};
};


&usb2phy2 {
	vdd33-supply = <&scmi_vdd3v3_usb>;
	status = "okay";	/* enable USB2PHY2 controller */
};
Info white.png Information
Static assignment of usb2phy(s) is done by the PHY user node[9]:

4. How to configure the DT using STM32CubeMX[edit | 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 | edit source]

Refer to the following links for additional information: