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 .
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 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>.
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
&usb2phy1 { status = "okay"; /* enable USB2PHY1 controller */ }; &usb2phy2 { status = "okay"; /* enable USB2PHY2 controller */ };
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:
- ↑ drivers/phy/st/phy-stm32-usb2femto.c , STM32 USB PHY Controller driver
- ↑ 2.0 2.1 Documentation/devicetree/bindings/phy/phy-stm32-usb2femto.yaml , USB2PHY device tree bindings
- ↑ arch/arm64/boot/dts/st/stm32mp251.dtsi , STM32MP251 device tree file
- ↑ Regulator overview
- ↑ Documentation/devicetree/bindings/phy/phy-bindings.txt ,PHY generic bindings