Registered User mNo edit summary |
Registered User m (show text pointed by ref) Tag: 2017 source edit |
||
(19 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{ApplicableFor | |||
|MPUs list=STM32MP13x, STM32MP15x | |MPUs list=STM32MP13x, STM32MP15x, STM32MP21x, STM32MP23x, STM32MP25x | ||
|MPUs checklist=STM32MP13x,STM32MP15x | |MPUs checklist=STM32MP13x, STM32MP15x, STM32MP21x, STM32MP23x, STM32MP25x | ||
}}</noinclude> | }} | ||
<noinclude> | |||
</noinclude> | |||
== Article purpose == | == Article purpose == | ||
This article explains how to configure the [[HDP Linux driver|HDP driver]] when the peripheral is assigned to the Linux<sup>®</sup> OS'''. | This article explains how to configure the [[HDP Linux driver|HDP driver]] when the peripheral is assigned to the Linux<sup>®</sup> OS'''. | ||
The configuration is performed using the [[Device tree|device tree]] mechanism, which provides a hardware description of the | The configuration is performed using the [[Device tree|device tree]] mechanism, which provides a hardware description of the peripheral used by the STM32 HDP driver. | ||
== DT bindings documentation == | == DT bindings documentation == | ||
The ''HDP'' tree bindings are composed of: | The ''HDP'' tree bindings are composed of: | ||
* STM32 HDP device tree bindings <ref>{{CodeSource | Linux kernel | Documentation/devicetree/bindings/ | * STM32 HDP device tree bindings<ref>{{CodeSource | Linux kernel | Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl-hdp.yaml | Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl-hdp.yaml}}</ref>. | ||
== DT configuration == | == DT configuration == | ||
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. | 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|How to configure the DT using STM32CubeMX]] for more details. | '''STM32CubeMX''' can be used to generate the board device tree. Refer to [[#How_to_configure_the_DT_using_STM32CubeMX|How to configure the DT using STM32CubeMX]] for more details. | ||
=== DT configuration (STM32 level) === | === DT configuration (STM32 level) === | ||
The [[HDP internal peripheral| HDP]] node as a pin controller node is composed of several parts: | |||
{{ | ==== STM32 HDP information ==== | ||
The STM32MPU [[HDP internal peripheral| HDP]] node is located in the SOC dtsi file: | |||
* for STM32MP1 lines in stm32mp1xx.dtsi<ref name="STM32MP1 soc dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/st/stm32mp131.dtsi | stm32mp131.dtsi}} | {{CodeSource | Linux kernel | arch/arm/boot/dts/st/stm32mp151.dtsi | stm32mp151.dtsi}}</ref> | |||
* for STM32MP2 lines in stm32mp2xx.dtsi<ref name="STM32MP2 soc dtsi">{{CodeSource | Linux kernel | arch/arm64/boot/dts/st/stm32mp211.dtsi | stm32mp211.dtsi}} | {{CodeSource | Linux kernel | arch/arm64/boot/dts/st/stm32mp231.dtsi | stm32mp231.dtsi}} | {{CodeSource | Linux kernel | arch/arm64/boot/dts/st/stm32mp251.dtsi | stm32mp251.dtsi}}</ref> | |||
For example: | |||
<pre> | <pre> | ||
hdp: hdp@5002a000 { | hdp: hdp@5002a000 { | ||
compatible = "st, | compatible = "st,stm32mp-hdp"; | ||
reg = <0x5002a000 0x400>; | reg = <0x5002a000 0x400>; | ||
clocks = <&rcc HDP>; | clocks = <&rcc HDP>; | ||
status = "disabled"; | status = "disabled"; | ||
}; | }; | ||
</pre> | </pre> | ||
{{Warning|This device tree part is related to STM32 microprocessors. It must be kept as is, without being modified by the end user.}} | |||
See [[Device tree]] for further explanation. | |||
==== HDP signal muxing definition ==== | |||
The HDP signal muxing are defined in the pinctrl dtsi file: | |||
* for STM32MP1 lines in stm32mp1x-pinctrl.dtsi<ref name="STM32MP1 pinctrl dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/st/stm32mp13-pinctrl.dtsi | stm32mp13-pinctrl.dtsi}} | {{CodeSource | Linux kernel | arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi | stm32mp15-pinctrl.dtsi}}</ref> | |||
* for STM32MP2 lines in stm32mp2x-pinctrl.dtsi<ref name="STM32MP2 pinctrl dtsi">{{CodeSource | Linux kernel | arch/arm64/boot/dts/st/stm32mp21-pinctrl.dtsi | stm32mp21-pinctrl.dtsi}} | {{CodeSource | Linux kernel | arch/arm64/boot/dts/st/stm32mp23-pinctrl.dtsi | stm32mp23-pinctrl.dtsi}} | {{CodeSource | Linux kernel | arch/arm64/boot/dts/st/stm32mp25-pinctrl.dtsi | stm32mp25-pinctrl.dtsi}}</ref> | |||
The available signals per HDP port are defined in the STM32MPU reference manuals <ref>[[STM32 MPU resources#Reference manuals|STM32MPU reference manuals]]</ref>. | |||
The required and optional properties are fully described in the [[HDP device tree configuration#DT bindings documentation|bindings files]]. | The required and optional properties are fully described in the [[HDP device tree configuration#DT bindings documentation|bindings files]]. | ||
= | For example in stm32mp15-pinctrl.dtsi<ref name="STM32MP1 pinctrl dtsi"></ref>: | ||
<pre> | <pre> | ||
&hdp { | &hdp { | ||
hdp2_gpo: hdp2-pins { | |||
pins = "hdp2"; | |||
function = HDP2_GPOVAL_2; | |||
}; | |||
}; | }; | ||
</pre> | </pre> | ||
=== | List of all possible STM32MPU [[HDP internal peripheral| HDP ]] signals are located: | ||
* for STM32MP1 lines in stm32mp1x-hdp.dtsi<ref name="STM32MP1 hdp dt-bindings headers">{{CodeSource | Linux kernel | include/dt-bindings/pinctrl/stm32mp13-hdp.h | stm32mp13-hdp.h}} | {{CodeSource | Linux kernel | include/dt-bindings/pinctrl/stm32mp15-hdp.h | stm32mp15-hdp.h}}</ref> | |||
* for STM32MP2 lines in stm32mp2x-pinctrl.dtsi<ref name="STM32MP2 hdp dt-bindings headers">{{CodeSource | Linux kernel | include/dt-bindings/pinctrl/stm32mp21-hdp.h | stm32mp21-hdp.h}} | {{CodeSource | Linux kernel | include/dt-bindings/pinctrl/stm32mp25-hdp.h | stm32mp25-hdp.h}}</ref> | |||
==== HDP pin configuration ==== | |||
HDP is also a client of the GPIO pinctrl as it needs to use pins. Refer to [[Pinctrl_device_tree_configuration#Pin_state_definition|Pinctrl_device_tree_configuration]]. | |||
&pinctrl { | |||
hdp2_pins_a: hdp2-0 { {{Highlight|Comments}} | |||
pins { | |||
pinmux = <STM32_PINMUX('E', 13, AF0)>; /* HDP2 */ {{Highlight|-->Pin muxing information: AF0 (alternate function 0) selected on PE13 pin}} | |||
bias-disable; {{Highlight|-->Generic bindings corresponding to "no pull-up" and "no pull-down"}} | |||
drive-push-pull; {{Highlight|-->Generic bindings to select pin driving information}} | |||
slew-rate = <2>; {{Highlight|-->Generic bindings to select pin speed}} | |||
}; | |||
}; | |||
}; | |||
=== HDP DT configuration (board level) === | |||
Part of the [[Device tree|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 overview|pinctrl]], through '''pinctrl-0''' (default pins), '''pinctrl-1''' (sleep pins) and '''pinctrl-names''' | |||
* Enable the HDP block by setting '''status = "okay";''' | |||
&hdp { | &hdp { | ||
pinctrl-names = "default", "sleep"; | |||
pinctrl-0 = <&hdpx_pins_y &hdpx_signal>; {{highlight|/* configure pinctrl for hdp pin x with signal y*/}} | |||
pinctrl-1 = <&hdpx_pins_sleep_y &hdpx_signal>; {{highlight|/* configure "sleep" pinctrl for hdp pin x with signal y*/}} | |||
status = "okay"; | |||
}; | }; | ||
== How to configure the DT using STM32CubeMX == | == How to configure the DT using STM32CubeMX == | ||
The [[STM32CubeMX]] tool can be used to configure the STM32MPU device and get the corresponding [[Device_tree#STM32_MPU|platform configuration device tree]] files.<br /> | The [[STM32CubeMX]] tool can be used to configure the STM32MPU device and get the corresponding [[Device_tree#STM32_MPU|platform configuration device tree]] files.<br /> | ||
The STM32CubeMX may not support all the properties described in the above [[#DT bindings documentation|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. | The [[STM32CubeMX]] may not support all the properties described in the above [[#DT bindings documentation|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. | ||
==References== | ==References== | ||
Line 84: | Line 106: | ||
[[Category:Device tree configuration]] | [[Category:Device tree configuration]] | ||
[[Category:Embedded trace and debug]] | [[Category:Embedded trace and debug]] | ||
{{PublicationRequestId | 10413 | {{PublicationRequestId | 31119| 2024-05-16 | PhilipS, 10413, 2019-01-24 }} | ||
{{ArticleBasedOnModel |Peripheral or framework device tree configuration model}} | {{ArticleBasedOnModel |Peripheral or framework device tree configuration model}} | ||
</noinclude> | </noinclude> |
Latest revision as of 16:40, 22 October 2024
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 example:
HDP>; status = "disabled"; };hdp: hdp@5002a000 { compatible = "st,stm32mp-hdp"; reg = <0x5002a000 0x400>; clocks = <&rcc
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:
The available signals per HDP port are defined in the STM32MPU reference manuals [6]. The required and optional properties are fully described in the bindings files.
For example in stm32mp15-pinctrl.dtsi[4]:
&hdp {
hdp2_gpo: hdp2-pins {
pins = "hdp2";
function = HDP2_GPOVAL_2;
};
};
List of all possible STM32MPU HDP signals are located:
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.
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 }; }; };&pinctrl { hdp2_pins_a: hdp2-0 {
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";
/* 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"; };&hdp { pinctrl-names = "default", "sleep"; pinctrl-0 = <&hdpx_pins_y &hdpx_signal>;
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]
- ↑ Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl-hdp.yaml
- ↑ stm32mp131.dtsi | stm32mp151.dtsi
- ↑ stm32mp211.dtsi | stm32mp231.dtsi | stm32mp251.dtsi
- ↑ Jump up to: 4.0 4.1 stm32mp13-pinctrl.dtsi | stm32mp15-pinctrl.dtsi
- ↑ stm32mp21-pinctrl.dtsi | stm32mp23-pinctrl.dtsi | stm32mp25-pinctrl.dtsi
- ↑ STM32MPU reference manuals
- ↑ stm32mp13-hdp.h | stm32mp15-hdp.h
- ↑ stm32mp21-hdp.h | stm32mp25-hdp.h