Open main menu

DAVE Developer's Wiki β

DESK-MX8M-L/Peripherals/SD

< DESK-MX8M-L
Revision as of 17:06, 24 February 2023 by U0007 (talk | contribs)

History
ID# Issue Date Notes

15715

17/02/2022 First DESK-MX8M-L release

17556

24/02/2023 DESK-MX8M-L-2.0.0 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).

ORCA SOMEdit

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 :

...
...
&usdhc2 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>;
	cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
	no-1-8-v;
	bus-width = <4>;
	status = "okay";
};
...
...
&iomuxc {
...
...
	pinctrl_usdhc2_gpio: usdhc2grpgpio {
		fsl,pins = <
			MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12		0x159
			MX8MM_IOMUXC_SD2_RESET_B_GPIO2_IO19	0x41
		>;
	};

	pinctrl_usdhc2: usdhc2grp {
		fsl,pins = <
			MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK		0x190
			MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD		0x1d0
			MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0	0x1d0
			MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1	0x1d0
			MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2	0x1d0
			MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3	0x1d0
		>;
	};
...
...
};

Accessing the peripheral in ORCA SOMEdit

Once initialized, the SD device is mapped to the standard /dev/mmcblk1pX 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)
...
...

Accessing the peripheral in MITO 8M MiniEdit

Once initialized, the SD device is mapped to the standard /dev/mmcblk1pX 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.:

...
...
[    2.645186] sdhci: Secure Digital Host Controller Interface driver
[    2.651380] sdhci: Copyright(c) Pierre Ossman
[    2.662531] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.704795] mmc0: SDHCI controller on 30b40000.mmc [30b40000.mmc] using ADMA
[    5.145562] sdhci-esdhc-imx 30b50000.mmc: Got CD GPIO
[    5.182388] mmc1: SDHCI controller on 30b50000.mmc [30b50000.mmc] using ADMA
...
[    2.843189] mmcblk0: mmc0:0001 DG4008 7.28 GiB 
[    2.859563] mmcblk0boot0: mmc0:0001 DG4008 partition 1 4.00 MiB
[    2.865671] mmcblk0boot1: mmc0:0001 DG4008 partition 2 4.00 MiB
[    2.875922] mmcblk0rpmb: mmc0:0001 DG4008 partition 3 4.00 MiB, chardev (237:0)
[    5.295199] mmcblk1: mmc1:e624 SA32G 29.7 GiB 
[    5.309428]  mmcblk1: p1 p2
...
[    5.145562] sdhci-esdhc-imx 30b50000.mmc: Got CD GPIO
[    5.182388] mmc1: SDHCI controller on 30b50000.mmc [30b50000.mmc] using ADMA
[    5.257298] mmc1: host does not support reading read-only switch, assuming write-enable
[    5.280627] mmc1: new high speed SDHC card at address e624
[    5.295199] mmcblk1: mmc1:e624 SA32G 29.7 GiB
...
...
[    5.489982] EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null)
[   11.347308] 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/mmcblk1p1 /mnt/boot
root@desk-mx8mp:~# mount /dev/mmcblk1p2 /mnt/rfs
root@desk-mx8mp:~#

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

This instruction can be performed both on ORCA and MITO 8M MINI.