Registered User No edit summary |
Registered User mNo edit summary |
||
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<noinclude>{{ApplicableFor | |||
|MPUs list=STM32MP13x, STM32MP15x | |||
|MPUs checklist=STM32MP13x,STM32MP15x | |||
}}</noinclude> | |||
== Article purpose == | == Article purpose == | ||
The purpose of this article is to explain how to configure the [[SDMMC internal peripheral|'''SDMMC''']] 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 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. | |||
== DT bindings documentation == | == DT bindings documentation == | ||
The | The device tree binding documents are stored either in the given applicable components listed below, or in the Linux kernel repository: <br> | ||
* SDMMC MMC/SD/SDIO interface bindings | * TF-A BL2, U-Boot, OP-TEE, Linux<sup>®</sup> OS: | ||
** Generic MMC device tree bindings: {{CodeSource | Linux kernel | Documentation/devicetree/bindings/mmc/mmc-controller.yaml}}. | |||
** SDMMC MMC/SD/SDIO interface device tree bindings: {{CodeSource | Linux kernel | Documentation/devicetree/bindings/mmc/arm,pl18x.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 | 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 level) === | ||
The SDMMC | The SDMMC 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) === | |||
The objective of this chapter is to explain how to enable and configure the SDMMC DT nodes for a board. | |||
Peripheral configuration should be done in specific board device tree files (board dts file and [[Pinctrl device tree configuration|pinctrl dtsi file]]). | |||
The SDMMC peripheral may connect to one SD card, one ''e''•MMC™ device or one SDIO card. | The SDMMC peripheral may connect to one SD card, one ''e''•MMC™ device or one SDIO card. | ||
Line 56: | Line 50: | ||
* st,sig-dir: This property allows to select external transceiver direction signals polarity. When this property is set, the voltage transceiver IOs are driven as output when the direction signals are high. Without setting this property, the voltage transceiver IOs are driven as output when the direction signals are low. | * st,sig-dir: This property allows to select external transceiver direction signals polarity. When this property is set, the voltage transceiver IOs are driven as output when the direction signals are high. Without setting this property, the voltage transceiver IOs are driven as output when the direction signals are low. | ||
* st,use-ckin: By setting this property, the sdmmc_ckin pin from an external transceiver is used to sample the receive data. | * st,use-ckin: By setting this property, the sdmmc_ckin pin from an external transceiver is used to sample the receive data. | ||
{{Warning|On {{MicroprocessorDevice | device=15}}, the HS200 mode for ''e''•MMC™ and SDR104 mode for SD/SDIO are not supported: see [[STM32MP15_ecosystem_errata_sheet]], section 2.3.19}} | |||
=== DT configuration examples === | === DT configuration examples === | ||
Below example shows how to configure the SDMMC when an ''e''•MMC™ is connected with 8 data lines | Below example shows how to configure the SDMMC when an ''e''•MMC™ is connected with 8 data lines. | ||
&sdmmc2{ {{highlight|Comments}} | &sdmmc2{ {{highlight|Comments}} | ||
Line 76: | Line 72: | ||
}; | }; | ||
Below example shows how to configure the SDMMC to SD card (4 data lines) with an external transceiver | Below example shows how to configure the SDMMC to SD card (4 data lines) with an external transceiver. | ||
&sdmmc1{ {{highlight|Comments}} | &sdmmc1{ {{highlight|Comments}} | ||
Line 88: | Line 84: | ||
st,use-ckin; | st,use-ckin; | ||
bus-width = <4>; | bus-width = <4>; | ||
sd-uhs-sdr12; {{highlight|--> sd modes supported | sd-uhs-sdr12; {{highlight|--> sd modes supported}} | ||
sd-uhs-sdr25; | sd-uhs-sdr25; | ||
sd-uhs-sdr50; | sd-uhs-sdr50; | ||
sd-uhs-ddr50; | sd-uhs-ddr50; | ||
vmmc-supply = <&vdd_sd>; | vmmc-supply = <&vdd_sd>; | ||
vqmmc-supply = <&sd_switch>; | vqmmc-supply = <&sd_switch>; | ||
Line 99: | Line 94: | ||
==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# | 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 /> | ||
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== | ||
Refer to the following links for additional information: | |||
<references /> | <references /> | ||
Revision as of 17:16, 26 October 2022
1. Article purpose[edit | edit source]
The purpose of this article is to explain how to configure the SDMMC using the device tree mechanism, 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 this configuration.
2. DT bindings documentation[edit | edit source]
The device tree binding documents are stored either in the given applicable components listed below, or in the Linux kernel repository:
- TF-A BL2, U-Boot, OP-TEE, Linux® OS:
- Generic MMC device tree bindings: Documentation/devicetree/bindings/mmc/mmc-controller.yaml .
- SDMMC MMC/SD/SDIO interface device tree bindings: Documentation/devicetree/bindings/mmc/arm,pl18x.yaml .
3. DT configuration[edit | 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 organization.
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 SDMMC node is located in the device tree file for the software components, supporting the peripheral and listed in the above DT bindings documentation paragraph.
3.2. DT configuration (board level)[edit | edit source]
The objective of this chapter is to explain how to enable and configure the SDMMC DT nodes for a board.
Peripheral configuration should be done in specific board device tree files (board dts file and pinctrl dtsi file).
The SDMMC peripheral may connect to one SD card, one e•MMC™ device or one SDIO card.
Comments pinctrl-names = "default", "opendrain", "sleep"; --> For pinctrl configuration, please refer to Pinctrl device tree configuration pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_a>; pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_dir_pins_a>; pinctrl-2 = <&sdmmc1_b4_sleep_pins_a &sdmmc1_dir_sleep_pins_a>; st,neg-edge; --> Generate data and command on sdmmc clock falling edge st,sig-dir; --> Allow to select direction polarity of an external transceiver st,use-ckin; --> Use sdmmc_ckin pin from an external transceiver to sample the receive data bus-width = <4>; --> Number of data lines, can be 1, 4 or 8 vmmc-supply = <&vdd_sd>; --> Supply node for card's power vqmmc-supply = <&sd_switch>; --> Supply node for IO line power status = "okay"; --> Enable the node };&sdmmc1{
Below optional properties have to be used when an external transceiver is connected:
- st,sig-dir: This property allows to select external transceiver direction signals polarity. When this property is set, the voltage transceiver IOs are driven as output when the direction signals are high. Without setting this property, the voltage transceiver IOs are driven as output when the direction signals are low.
- st,use-ckin: By setting this property, the sdmmc_ckin pin from an external transceiver is used to sample the receive data.
3.3. DT configuration examples[edit | edit source]
Below example shows how to configure the SDMMC when an e•MMC™ is connected with 8 data lines.
Comments pinctrl-names = "default", "opendrain", "sleep"; pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_dir_pins_a>; pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_dir_pins_a>; pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_dir_sleep_pins_a>; non-removable; --> Non-removable slot, assume always present no-sd; --> Avoid to send SD command during initialization no-sdio; --> Avoid to send SDIO command during initialization st,neg-edge; bus-width = <8>; vmmc-supply = <&v3v3>; vqmmc-supply = <&vdd>; mmc-ddr-3_3v; --> Host supports e•MMC™ DDR 3.3V status = "okay"; };&sdmmc2{
Below example shows how to configure the SDMMC to SD card (4 data lines) with an external transceiver.
Comments pinctrl-names = "default", "opendrain", "sleep"; pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_a>; pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_dir_pins_a>; pinctrl-2 = <&sdmmc1_b4_sleep_pins_a &sdmmc1_dir_sleep_pins_a>; broken-cd; --> use polling mode for card detection st,neg-edge; st,sig-dir; st,use-ckin; bus-width = <4>; sd-uhs-sdr12; --> sd modes supported sd-uhs-sdr25; sd-uhs-sdr50; sd-uhs-ddr50; vmmc-supply = <&vdd_sd>; vqmmc-supply = <&sd_switch>; status = "okay"; };&sdmmc1{
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.
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 | edit source]
Refer to the following links for additional information: