Open main menu

DAVE Developer's Wiki β

DESK-MX8M-L/Peripherals/SD

< DESK-MX8M-L
Revision as of 15:34, 14 February 2023 by U0007 (talk | contribs) (Device tree configuration)

History
Version Issue Date Notes
1.0.0 Jan 2022 First DESK-MX8M release


Contents

Peripheral SDEdit

Device tree configurationEdit

N.B. The USDHC interface is re-configured on carrier device tree because of the Card Detect pin (which is related to the real board hardware implementation).

ORCAEdit

Here below an example of device tree configuration used on standard DAVE's kit for the ORCA SOM:

From imx8mp-mito8mplus-cb1001.dts:

&usdhc2 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>;
	cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
	bus-width = <4>;
	status = "okay";
};

From imx8mp-mito8mplus-cb1001.dts:

&iomuxc {
...
...
	pinctrl_usdhc2_gpio: usdhc2grp-gpio {
		fsl,pins = <
			MX8MP_IOMUXC_SD2_CD_B__GPIO2_IO12 	0x1c4
		>;
	};

	pinctrl_usdhc2: usdhc2grp {
		fsl,pins = <
			MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK	0x190
			MX8MP_IOMUXC_SD2_CMD__USDHC2_CMD	0x1d0
			MX8MP_IOMUXC_SD2_DATA0__USDHC2_DATA0	0x1d0
			MX8MP_IOMUXC_SD2_DATA1__USDHC2_DATA1	0x1d0
			MX8MP_IOMUXC_SD2_DATA2__USDHC2_DATA2	0x1d0
			MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3	0x1d0
		>;
	};
...
...
};

MITO 8M MiniEdit

Here below an example of device tree configuration used on standard DAVE's kit for the MITO 8M Mini SOM:

From imx8mm-mito8mmini.dts :


Accessing the peripheralEdit

Once initialized, the SD device is mapped to the standard /dev/mmcblk0pX block device, depending on how many partition are created on the SD card.

Linux messages at boot timeEdit

If the microSd card is inserted at boot time, the kernel - once the USDHC interface has been initialized - prints the device information and the partition detected like p1, p2, etc.:

...
...
[    1.283284] sdhci: Secure Digital Host Controller Interface driver
[    1.289476] sdhci: Copyright(c) Pierre Ossman
[    1.300935] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.342624] mmc0: SDHCI controller on 30b40000.mmc [30b40000.mmc] using ADMA
[    1.388722] mmc2: SDHCI controller on 30b60000.mmc [30b60000.mmc] using ADMA
...
[    1.618036] mmcblk2: mmc2:0001 DG4008 7.28 GiB
[    1.622685] mmcblk2boot0: mmc2:0001 DG4008 partition 1 4.00 MiB
[    1.628729] mmcblk2boot1: mmc2:0001 DG4008 partition 2 4.00 MiB
[    1.635352] mmcblk2rpmb: mmc2:0001 DG4008 partition 3 4.00 MiB, chardev (237:0)
[    1.644839]  mmcblk2: p1 p2 p3
...
[    2.382461] sdhci-esdhc-imx 30b50000.mmc: Got CD GPIO
[    2.418293] mmc1: SDHCI controller on 30b50000.mmc [30b50000.mmc] using ADMA
[    2.505677] mmc1: new high speed SDHC card at address aaaa
[    2.514258] mmcblk1: mmc1:aaaa SA16G 14.8 GiB
[    2.527325]  mmcblk1: p1 p2
...
...
[    3.245015] EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null)
[    4.792069] EXT4-fs (mmcblk1p2): re-mounted. Opts: (null)

Additional informationEdit

If the root file system configuration does not automatically mount the partition, it is possible to mount the device using the following command:

root@desk-mx8mp:~# mkdir -p /mnt/boot
root@desk-mx8mp:~# mkdir -p /mnt/rfs
root@desk-mx8mp:~# mount /dev/mmcblk0p1 /mnt/boot
root@desk-mx8mp:~# mount /dev/mmcblk0p2 /mnt/rfs
root@desk-mx8mp:~#

and then the mounted partition are available on the /mnt/boot and /mnt/rfs root file system directories.