1. Article purpose[edit source]
This article explains how to configure TAMP internal peripheral.
This article describes the TAMP configuration performed using the device tree mechanism, which provides an hardware description of the TAMP peripheral.
2. DT bindings documentation[edit source]
The following binding-related documentation explains how to write device tree files for TAMP:
- TF-A: Tamper related part: tf-a/docs/devicetree/bindings/soc/st,stm32-tamp.txt"[1]
- Linux Kernel: Backup register management: Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.txt'[2]
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 STM32MP1 TAMP node is located in the file stm32mp151.dtsi[3] (see Device tree for further explanation). TAMP is used in the Linux context to access to the backup registers.
/ { ... soc { ... tamp: tamp@5c00a000 { compatible = "simple-bus", "syscon", "simple-mfd"; reg = <0x5c00a000 0x400>; reboot-mode { compatible = "syscon-reboot-mode"; offset = <0x150>; /* reg20 */ mask = <0xff>; mode-normal = <0>; mode-fastboot = <0x1>; mode-recovery = <0x2>; mode-stm32cubeprogrammer = <0x3>; mode-ums_mmc0 = <0x10>; mode-ums_mmc1 = <0x11>; mode-ums_mmc2 = <0x12>; }; }; ... }; ... };
3.2. DT configuration (board level)[edit source]
3.2.1. STM32MP1 TAMP node append[edit source]
The board definition in the device tree may include some additional board-specific pin control management.
&tamp { pinctrl-0 = <&tamp1_pins_a>; // Must be defined in the pinctrl corresponding to the board wakeup-source; // Enable the tamper as wake up source };
3.2.2. STM32MP1 TAMP node append (bootloader specific)[edit source]
The bootloader-specific STM32MP1 TAMP node append data is located in the file stm32mp151.dtsi [4] for TF-A (see Device tree for further explanation).
tamp: tamp@5c00a000 { compatible = "st,stm32-tamp", "simple-bus", "syscon", "simple-mfd"; reg = <0x5c00a000 0x400>; secure-interrupts = <GIC_SPI 197 IRQ_TYPE_LEVEL_HIGH>; clocks = <&rcc RTCAPB>; };
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.
STM32CubeMX may not support all the properties described in the documents listed in DT bindings documentation above. If so, the tool inserts user sections in the generated device tree. These sections can then be edited to add some properties that are preserved from one generation to another. Refer to the STM32CubeMX user manual for further information.
5. References[edit source]
Please refer to the following links for additional information:
- ↑ docs/devicetree/bindings/soc/st,stm32-tamp.txt TF-A TAMP binding information file
- ↑ Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.txt
- ↑ arch/arm/boot/dts/stm32mp151.dtsi : STM32MP151 kernel device tree files
- ↑ fdts/stm32mp151.dtsi STM32MP151 TF-A device tree files