The MultiMediaCard (MMC)/Secure Digital (SD)/Secure Digital Input Output (SDIO) host driver implements a standard Linux driver interface to the SD/MMC host controller (SDMMC). The host driver is part of the Linux kernel MMC framework.
The STMicroelectronics STM32MP15 CPU has three SDMMC controllers.
On the ConnectCore MP15 system-on-module:
-
The three SDMMC interfaces are available at the LGA pads, multiplexed with other functionality.
-
SDMMC2 is available (4 data bits) at the castellated pads, multiplexed with other functionality.
-
SDMMC3 connects internally to the Murata LBEE5PK2AE-564 wireless chip using four data lines (on wireless variants).
On the ConnectCore MP15 Development Kit:
-
SDMMC2 is connected to the microSD card holder (using four data lines).
-
SDMMC3 is available at
J1 RF EXPANSION
connector footprint (to be used only on non-wireless variants).
The STM32MP15 can boot from an SD card from SDMMC1 by default. To boot from an SD card using a different interface, such as SDMMC2 on the ConnectCore MP15 Development Kit, you must blow certain OTP bits. |
Kernel configuration
You can manage the SDMMC driver support through the following kernel configuration option:
-
STMicroelectronics STM32 SDMMC host controller (
CONFIG_MMC_STM32_SDMMC
)
This option is enabled as built-in on the default ConnectCore MP15 kernel configuration file.
Kernel driver
The driver for the SDMMC is located at:
File | Description |
---|---|
SDMMC driver |
Device tree bindings and customization
The SDMMC device tree binding is documented at Documentation/devicetree/bindings/mmc/arm,pl18x.yaml
.
Common MMC device tree bindings are documented at Documentation/devicetree/bindings/mmc/mmc-controller.yaml
.
The common STM32MP15 CPU device tree defines all the SDMMC ports. The platform device tree must:
-
Enable the required SDMMC port, by setting the
status
property to"okay"
. -
Select the
bus-width
depending on the number of data lines to use. -
Select optional properties (
broken-cd
,non-removable
…), depending on the interface (see binding documentation). -
Configure the pinctrl of the pads to use for the interface.
/* SDMMC3 (Wireless) */
&sdmmc3 {
pinctrl-names = "default", "opendrain", "sleep";
pinctrl-0 = <&sdmmc3_b4_pins_a>;
pinctrl-1 = <&sdmmc3_b4_od_pins_a>;
pinctrl-2 = <&sdmmc3_b4_sleep_pins_a>;
non-removable;
no-1-8-v;
st,neg-edge;
bus-width = <4>;
vmmc-supply = <®_rf_wl_en>;
status = "disabled";
};
If you are using the non-wireless variant, you may use sdmmc3 interface on your carrier board.
User space usage
The MMC block driver handles the file system read/write calls and uses the low-level MMC host controller interface driver to send the commands to the SDMMC controller.
The MMC device driver exposes the device through the file system at /dev/mmcblkX
where X is a number, starting at zero, that indicates the device index.
If the block device is partitioned, the partitions will appear as /dev/mcblkXpY
where Y is a number, starting at one, that indicates the partition index.
By default, formatted partitions are auto-mounted upon detection if they are block devices.
You can also mount a partition’s file system using the mount
command with the partition node, the file system type, and the mount point:
# mkdir -p /media/mmcblk1p1 && mount -t vfat /dev/mmcblk1p1 /media/mmcblk1p1
Detect microSD card
The microSD card holder on the ConnectCore MP15 Development Kit does not have a card detection line. However, the Linux driver supports card detection by polling for the presence of a card.
If the device is not partitioned, you can use
If the device is partitioned but you still want to re-partition or re-format it, you must first unmount all the mounted partitions. |