DESK-MX8M-L/Peripherals/SD

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes

2022/02/17

First DESK-MX8M-L release

2023/02/24

DESK-MX8M-L-2.0.0 release

2023/08/22

DESK-MX8M-L-4.0.0 release

2024/04/11

DESK-MX8M-L-4.x.x release

2024/05/30

Fix device tree configid
2026/03/26 DESK-MX8M-L-6.x.x release


Peripheral SD[edit | edit source]

Device tree configuration[edit | edit source]

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 SOM[edit | edit source]

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.dtsi:

&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 Mini[edit | edit source]

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

From imx8mm-mito8mmini-sbcx.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
		>;
	};
...
...

From imx8mm-mito8mmini.dtsi:

...
...
&iomuxc {
...
...
	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 SOM[edit | edit source]

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 time[edit | edit source]

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.999812] sdhci: Secure Digital Host Controller Interface driver
[    2.006013] sdhci: Copyright(c) Pierre Ossman
[    2.018039] sdhci-pltfm: SDHCI platform and OF driver helper
...
...
[    2.056527] mmc2: SDHCI controller on 30b60000.mmc [30b60000.mmc] using ADMA
[    2.145811] mmc2: new HS400 Enhanced strobe MMC card at address 0001
[    2.164099] mmcblk2: mmc2:0001 DG4008 7.28 GiB
[    2.171495]  mmcblk2: p1 p2
[    2.177272] mmcblk2boot0: mmc2:0001 DG4008 4.00 MiB
[    2.188332] mmcblk2boot1: mmc2:0001 DG4008 4.00 MiB
[    2.197573] mmcblk2rpmb: mmc2:0001 DG4008 4.00 MiB, chardev (234:0)
[    3.639133] sdhci-esdhc-imx 30b50000.mmc: Got CD GPIO
[    3.639657] sdhci-esdhc-imx 30b40000.mmc: allocated mmc-pwrseq
[    3.672666] mmc1: SDHCI controller on 30b50000.mmc [30b50000.mmc] using ADMA
[    3.680554] mmc0: SDHCI controller on 30b40000.mmc [30b40000.mmc] using ADMA
[    3.714316] mmc0: new high speed SDIO card at address 0001
[    3.717859] mmc1: host does not support reading read-only switch, assuming write-enable
[    3.721153] mmc1: new high speed SDHC card at address aaaa
[    3.738538] mmcblk1: mmc1:aaaa SA16G 14.8 GiB
[    3.746022]  mmcblk1: p1 p2
[    5.136125] EXT4-fs (mmcblk1p2): mounted filesystem b1ceb8fb-311e-4b63-ab4c-a713e8e2579e r/w with ordered data mode. Quota mode: none.
[    7.440962] EXT4-fs (mmcblk1p2): re-mounted b1ceb8fb-311e-4b63-ab4c-a713e8e2579e r/w. Quota mode: none.
...
...

Accessing the peripheral in MITO 8M Mini[edit | edit source]

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 time[edit | edit source]

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.910278] sdhci: Secure Digital Host Controller Interface driver
[    1.916480] sdhci: Copyright(c) Pierre Ossman
[    1.927992] sdhci-pltfm: SDHCI platform and OF driver helper
...
...
[    1.970025] mmc0: SDHCI controller on 30b40000.mmc [30b40000.mmc] using ADMA
[    2.053725] mmc0: new HS400 Enhanced strobe MMC card at address 0001
[    2.064929] mmcblk0: mmc0:0001 DG4008 7.28 GiB
[    2.075727]  mmcblk0: p1 p2
[    2.080364] mmcblk0boot0: mmc0:0001 DG4008 4.00 MiB
[    2.090239] mmcblk0boot1: mmc0:0001 DG4008 4.00 MiB
[    2.108263] mmcblk0rpmb: mmc0:0001 DG4008 4.00 MiB, chardev (234:0)
[    3.375369] sdhci-esdhc-imx 30b50000.mmc: Got CD GPIO
[    3.430689] mmc1: SDHCI controller on 30b50000.mmc [30b50000.mmc] using ADMA
[    3.571031] mmc2: SDHCI controller on 30b60000.mmc [30b60000.mmc] using ADMA
[    3.725861] mmc1: host does not support reading read-only switch, assuming write-enable
[    3.737665] mmc1: new high speed SDHC card at address aaaa
[    3.744111] mmcblk1: mmc1:aaaa SA16G 14.8 GiB
[    3.752294]  mmcblk1: p1 p2
...
...
[    6.434299] EXT4-fs (mmcblk1p2): mounted filesystem 9f6bc0c5-ccf9-465e-aeae-12e1c938040b r/w with ordered data mode. Quota mode: none.
[    8.827416] EXT4-fs (mmcblk1p2): re-mounted 9f6bc0c5-ccf9-465e-aeae-12e1c938040b r/w. Quota mode: none.
...
...

Additional information[edit | edit source]

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:~# ls /mnt/boot/
Image  boot.scr  imx8mp-mito8mplus-cb1001.dtb  imx8mp-mito8mplus-cb1004.dtb  imx8mp-mito8mplus-cb1005.dtb  imx8mp-mito8mplus-cb1001.dtb  splash_image.bmp  stress_m7.bin  tee.bin
root@desk-mx8mp:~# ls /mnt/rfs/
bin  boot  dev  etc  home  lib  lost+found  media  mnt  opt  proc  run  sbin  srv  sys  tmp  unit_tests  usr  var
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.