1. Article purpose[edit | edit source]
This article explains how to configure the HDP driver when the peripheral is assigned to the Linux® OS.
The configuration is performed using the device tree mechanism, which provides a hardware description of the peripheral used by the STM32 HDP driver.
2. DT bindings documentation[edit | edit source]
The HDP tree bindings are composed of:
- STM32 HDP device tree bindings[1].
3. DT configuration[edit | edit source]
This hardware description is a combination of the STM32 microprocessor device tree files (.dtsi extension), pinctrl 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 | edit source]
The HDP node as a pin controller node is composed of several parts:
3.1.1. STM32 HDP information[edit | edit source]
The STM32MPU HDP node is located in the SOC dtsi file:
- for STM32MP13x lines in stm32mp131.dtsi[2]
- for STM32MP15x lines in stm32mp151.dtsi[3]
- for STM32MP25x lines in stm32mp251.dtsi[4]
For example:
hdp: hdp@5002a000 {
compatible = "st,stm32mp-hdp";
reg = <0x5002a000 0x400>;
clocks = <&rcc HDP>;
status = "disabled";
};
See Device tree for further explanation.
3.1.2. HDP signal muxing definition[edit | edit source]
The HDP signal muxing are defined in the pinctrl dtsi file:
- for STM32MP13x lines in stm32mp13-pinctrl.dtsi[5]
- for STM32MP15x lines in stm32mp15-pinctrl.dtsi[6]
- for STM32MP25x lines in stm32mp25-pinctrl.dtsi[7]
The available signals per HDP port are defined in the [8] The required and optional properties are fully described in the bindings files.
For example in stm32mp15-pinctrl.dtsi[6]:
&hdp { hdp2_gpo: hdp2-pins { pins = "hdp2"; function = HDP2_GPOVAL_2; }; };
List of all possible STM32MPU HDP signals are located:
- for STM32MP13x lines in stm32mp13-hdp.h[9]
- for STM32MP15x lines in stm32mp15-hdp.h[10]
- for STM32MP25x lines in stm32mp25-hdp.h[11]
3.1.3. HDP pin configuration[edit | edit source]
HDP is also a client of the GPIO pinctrl as it needs to use pins. Refer to Pinctrl_device_tree_configuration.
&pinctrl { hdp2_pins_a: hdp2-0 { Comments pins { pinmux = <STM32_PINMUX('E', 13, AF0)>; /* HDP2 */ -->Pin muxing information: AF0 (alternate function 0) selected on PE13 pin bias-disable; -->Generic bindings corresponding to "no pull-up" and "no pull-down" drive-push-pull; -->Generic bindings to select pin driving information slew-rate = <2>; -->Generic bindings to select pin speed }; }; };
3.2. HDP DT configuration (board level)[edit | edit source]
Part of the device tree describes the HDP hardware used on a given board. The DT node ("hdp") must be filled in as follows:
- Configure the pins in use and its associated signal via pinctrl, through pinctrl-0 (default pins), pinctrl-1 (sleep pins) and pinctrl-names
- Enable the HDP block by setting status = "okay";
&hdp { pinctrl-names = "default", "sleep"; pinctrl-0 = <&hdpx_pins_y &hdpx_signal>; /* configure pinctrl for hdp pin x with signal y*/ pinctrl-1 = <&hdpx_pins_sleep_y &hdpx_signal>; /* configure "sleep" pinctrl for hdp pin x with signal y*/ status = "okay"; };
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.
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 | edit source]