Difference between revisions of "HASH device tree configuration"

[unchecked revision] [quality revision]
m
m
 
Applicable for STM32MP13x lines, STM32MP15x lines

1 Article purpose[edit]

This article explains The purpose of this article is to explain how to configure the HASH internal peripheral when it is assigned to the Linux® OS. In that case, it is controlled by the Crypto framework. The configuration is performed using the device tree mechanism that provides a hardware description of the HASH peripheral, used by the STM32 HASH Linux driver. If the peripheral is assigned to another execution context, refer , relying on the bindings documentation, that is the description of the required and optional device-tree properties.

The peripheral can be assigned to different contexts/software components, depending on the final product needs. Refer to How to assign an internal peripheral to a runtime context article for guidelines on peripheral assignment and this configuration .

2 DT bindings documentation[edit]

The HASH is represented by the STM32 HASH device tree bindings[1] device tree binding documents are stored either in the given applicable components listed below, or in the Linux kernel repository:

3 DT configuration[edit]

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 splitorganization.

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/SoC level)[edit]

The HASH node is declared in stm32mp151.dtsi[2]. It describes the hardware register address, clock, interrupt, reset and dma.

 hash1: hash@54002000 {                                                         Comments
 	compatible = "st,stm32f756-hash";
 	reg = <0x54002000 0x400>;                                               --> Register location and length
 	interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;                          --> The interrupt number used
 	clocks = <&scmi0_clk CK_SCMI0_HASH1>;
 	resets = <&scmi0_reset RST_SCMI0_HASH1>;
 	dmas = <&mdma1 31 0x10 0x1000A02 0x0 0x0 0x0>;                          --> DMA specifiers[3]
 	dma-names = "in";
 	dma-maxburst = <2>;
 	status = "disabled";
 };

located in the device tree file for the software components, supporting the peripheral and listed in the above DT bindings documentation paragraph.

Warning white.png Warning
This device tree part is related to STM32 microprocessors. It must be kept as is, without being modified by the end-user.

3.2 DT configuration (board level)[edit]

This part is used to enable the HASH used on a board which is done by setting the status property to okayThe objective of this chapter is to explain how to enable and configure the HASH DT nodes for a board.

Peripheral configuration should be done in specific board device tree files (board dts file).

3.3 DT configuration examples[edit]

   &hash1hash {
	        status = "okay";
   };

4 How to configure the DT using STM32CubeMX[edit]

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 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]

Please refer Refer to the following links for additional information:



== Article purpose ==
This article explains <noinclude>{{ApplicableFor
|MPUs list=STM32MP13x,STM32MP15x
|MPUs checklist=STM32MP13x,STM32MP15x
}}</noinclude>


== Article purpose ==
The purpose of this article is to explain how to configure the [[HASH _internal _peripheral|'''HASH''' internal peripheral]] when it is assigned to the Linux<sup>&reg;</sup> OS. In that case, it is controlled by the [[Crypto API overview|Crypto framework]].

The configuration is performed ]] using the [[Device tree|device tree]] mechanism that provides a hardware description of the HASH peripheral, used by the STM32 HASH Linux driver.

If the peripheral is assigned to another execution context, refer , relying on the bindings documentation, that is the description of the required and optional device-tree properties.

The peripheral can be assigned to different contexts/software components, depending on the final product needs. Refer to [[How to assign an internal peripheral to a runtime context]] article for guidelines on peripheral assignment and configurationthis configuration .

== DT bindings documentation ==
The [[HASH internal peripheral|HASH]] is represented by the STM32 device tree binding documents are stored either in the given applicable components listed below, or in the Linux kernel repository: <br>


* OP-TEE, Linux<sup>&reg;</sup> Kernel:
** HASH device tree bindings<ref> : {{CodeSource | Linux kernel | Documentation/devicetree/bindings/crypto/st,stm32-hash.txt | Device tree bindings}}</ref>yaml}}


== 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 splitorganization.

'''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/SoC level) ===
The [[HASH node is declared in stm32mp151.dtsi<ref name="stm32mp151_dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp151.dtsi | STM32MP151 device tree file}}</ref>. It describes the hardware register address, clock, interrupt, reset and dma.

  hash1: hash@54002000 {                                                        {{highlight| Comments}}
  	compatible = "st,stm32f756-hash";
  	reg = <0x54002000 0x400>;                                               {{highlight|--> Register location and length}}
  	interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;                          {{highlight|--> The interrupt number used}}
  	clocks = <&scmi0_clk CK_SCMI0_HASH1>;
  	resets = <&scmi0_reset RST_SCMI0_HASH1>;
  	dmas = <&mdma1 31 0x10 0x1000A02 0x0 0x0 0x0>;                          {{highlight|--> DMA specifiers<ref>{{CodeSource | Linux kernel | Documentation/devicetree/bindings/dma/stm32-mdma.txt | Documentation/devicetree/bindings/dma/stm32-mdma.txt}}, STM32 MDMA controller</ref>}}
  	dma-names = "in";
  	dma-maxburst = <2>;
  	status = "disabled";
  };_internal_peripheral|'''HASH''']] node is located in the [[STM32 MPU device_tree#Device tree structure|device tree file]] for the software components, supporting the peripheral and listed in the above [[#DT bindings documentation|DT bindings documentation]] paragraph. 
{{Warning|This device tree part is related to STM32 microprocessors. It must be kept as is, without being modified by the end-user.}}

=== DT configuration (board level) ===This part is used to enable the HASH used on a board which is done by setting the '''status''' property to '''okay'''.

=== DT configuration examples ===
 &hash1 {
 	status = "okay";

The objective of this chapter is to explain how to enable and configure the [[HASH_internal_peripheral|'''HASH''']] DT nodes for a board.<br>


Peripheral configuration should be done in specific board device tree files (board dts file).<br>


=== DT configuration examples ===

    &hash {
         status = "okay";};

==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|platform configuration device tree]] files.<br />
The STM32CubeMX may not support all the properties described in DT binding files listed 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==Please refer Refer to the following links for additional information:<references />

<noinclude>

{{ArticleBasedOnModel| | Peripheral or framework device tree configuration model}}{{PublicationRequestId | 8898 | 2018-10-08 | AlainF}}
[[Category:Device tree configuration]]
[[Category:Crypto]]
[[Category:OP-TEE Crypto]]</noinclude>
Line 1: Line 1:
  +
<noinclude>{{ApplicableFor
  +
|MPUs list=STM32MP13x,STM32MP15x
  +
|MPUs checklist=STM32MP13x,STM32MP15x
  +
}}</noinclude>
  +
 
== Article purpose ==
 
== Article purpose ==
This article explains how to configure the [[HASH internal peripheral|'''HASH''' internal peripheral]] when it is assigned to the Linux<sup>&reg;</sup> OS. In that case, it is controlled by the [[Crypto API overview|Crypto framework]].
+
The purpose of this article is to explain how to configure the [[HASH_internal_peripheral|'''HASH''']] using the [[Device tree|device tree]] mechanism, relying on the bindings documentation, that is the description of the required and optional device-tree properties.
   
The configuration is performed using the [[Device tree|device tree]] mechanism that provides a hardware description of the HASH peripheral, used by the STM32 HASH Linux driver.
+
The peripheral can be assigned to different contexts/software components, depending on the final product needs. Refer to [[How to assign an internal peripheral to a runtime context]] article for guidelines on this configuration .
   
If the peripheral is assigned to another execution context, refer to [[How to assign an internal peripheral to a runtime context]] article for guidelines on peripheral assignment and configuration.
+
== DT bindings documentation ==
   
== DT bindings documentation ==
+
The device tree binding documents are stored either in the given applicable components listed below, or in the Linux kernel repository: <br>
The [[HASH internal peripheral|HASH]] is represented by the STM32 HASH device tree bindings<ref>{{CodeSource | Linux kernel | Documentation/devicetree/bindings/crypto/st,stm32-hash.txt | Device tree bindings}}</ref>
+
 
  +
* OP-TEE, Linux<sup>&reg;</sup> Kernel:
  +
** HASH device tree bindings : {{CodeSource | Linux kernel | Documentation/devicetree/bindings/crypto/st,stm32-hash.yaml}}
   
 
== 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) 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|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/SoC level) ===
The HASH node is declared in stm32mp151.dtsi<ref name="stm32mp151_dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp151.dtsi | STM32MP151 device tree file}}</ref>. It describes the hardware register address, clock, interrupt, reset and dma.
+
 
  +
The [[HASH_internal_peripheral|'''HASH''']] node is located in the [[STM32 MPU device_tree#Device tree structure|device tree file]] for the software components, supporting the peripheral and listed in the above [[#DT bindings documentation|DT bindings documentation]] paragraph.  
   
  hash1: hash@54002000 {                                                        {{highlight| Comments}}
 
  compatible = "st,stm32f756-hash";
 
  reg = <0x54002000 0x400>;                                              {{highlight|--> Register location and length}}
 
  interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;                          {{highlight|--> The interrupt number used}}
 
  clocks = <&scmi0_clk CK_SCMI0_HASH1>;
 
  resets = <&scmi0_reset RST_SCMI0_HASH1>;
 
  dmas = <&mdma1 31 0x10 0x1000A02 0x0 0x0 0x0>;                          {{highlight|--> DMA specifiers<ref>{{CodeSource | Linux kernel | Documentation/devicetree/bindings/dma/stm32-mdma.txt | Documentation/devicetree/bindings/dma/stm32-mdma.txt}}, STM32 MDMA controller</ref>}}
 
  dma-names = "in";
 
  dma-maxburst = <2>;
 
  status = "disabled";
 
  };
 
 
{{Warning|This device tree part is related to STM32 microprocessors. It must be kept as is, without being modified by the end-user.}}
 
{{Warning|This device tree part is related to STM32 microprocessors. It must be kept as is, without being modified by the end-user.}}
   
 
=== DT configuration (board level) ===
 
=== DT configuration (board level) ===
This part is used to enable the HASH used on a board which is done by setting the '''status''' property to '''okay'''.
+
 
  +
The objective of this chapter is to explain how to enable and configure the [[HASH_internal_peripheral|'''HASH''']] DT nodes for a board.<br>
  +
 
  +
Peripheral configuration should be done in specific board device tree files (board dts file).<br>
   
 
=== DT configuration examples ===
 
=== DT configuration examples ===
&hash1 {
+
 
status = "okay";
+
    &hash {
};
+
        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|platform configuration device tree]] files.<br />
 
The [[STM32CubeMX]] tool can be used to configure the STM32MPU device and get the corresponding [[Device_tree#STM32|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.
+
STM32CubeMX may not support all the properties described in DT binding files listed 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==
Please refer to the following links for additional information:
+
Refer to the following links for additional information:
 
<references />
 
<references />
   
 
<noinclude>
 
<noinclude>
{{ArticleBasedOnModel|Peripheral or framework device tree configuration model}}
+
{{ArticleBasedOnModel | Peripheral or framework device tree configuration model}}
{{PublicationRequestId | 8898 | 2018-10-08 | AlainF}}
+
 
 
[[Category:Device tree configuration]]
 
[[Category:Device tree configuration]]
[[Category:Crypto]]
 
 
[[Category:OP-TEE Crypto]]
 
[[Category:OP-TEE Crypto]]
 
</noinclude>
 
</noinclude>