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:
- STM32 USB2PHY device tree bindings: Documentation/devicetree/bindings/phy/st,stm32-usb2phy.yaml
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:
- stm32mp251.dtsi[3] on STM32MP25x lines .
Below is the template for each node:
usb2_phyX: usb2-phyX {
compatible = "st,stm32mp25-usb2phy";
... /* usb2phy resources: registers, clocks, resets and supplies */
};
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[4] by setting vdd33-supply = <&your_regulator>.
3.3. DT configuration example[edit | edit source]
The example below shows how to enable and configure USB2PHY instances in the board file.
For ecosystem release ≥ v5.0.0
&usb2phy1 { status = "okay"; /* enable USB2PHY1 controller */ }; &usb2phy2 { status = "okay"; /* enable USB2PHY2 controller */ };
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:
- ↑ drivers/phy/st/phy-stm32-usb2phy.c , STM32 USB2PHY Linux driver,
- ↑ drivers/phy/phy-stm32-usb2phy.c , STM32 USB2PHY U-Boot driver
- ↑ arch/arm64/boot/dts/st/stm32mp251.dtsi , STM32MP251 device tree file
- ↑ Regulator overview
- ↑ Documentation/devicetree/bindings/phy/st,stm32-usb2phy.yaml , USB2PHY device tree bindings
- ↑ Documentation/devicetree/bindings/phy/phy-bindings.txt ,PHY generic bindings