Open main menu

DAVE Developer's Wiki β

DESK-MX6-L/Pheripherals/SD

< DESK-MX6-L
Revision as of 14:22, 16 July 2021 by U0009 (talk | contribs) (U0009 moved page AXEL Lite SOM/DESK-MX6-L/Pheripherals/SD to DESK-MX6-L/Pheripherals/SD: modifica gestione DESK come prodotto a se stante)

History
Version Issue Date Notes
1.0.0 Oct 2020 First DESK release


Contents

Peripheral SDEdit

Device tree configurationEdit

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

From imx6qdl-sbcx-revb-common.dtsi:

&usdhc1 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_usdhc1_sbcx>;
    no-1-8-v;
    keep-power-in-suspend;
    enable-sdio-wakeup;
    cd-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>; /* GPIO3_19 */
    status = "okay";
};
...
...
&iomuxc {
...
...
    usdhc1 {
        pinctrl_usdhc1_sbcx: usdhc1grp-1{
            fsl,pins = <
                MX6QDL_PAD_SD1_CMD__SD1_CMD    0x17060
                MX6QDL_PAD_SD1_CLK__SD1_CLK    0x10060
                MX6QDL_PAD_SD1_DAT0__SD1_DATA0 0x17060
                MX6QDL_PAD_SD1_DAT1__SD1_DATA1 0x17060
                MX6QDL_PAD_SD1_DAT2__SD1_DATA2 0x17060
                MX6QDL_PAD_SD1_DAT3__SD1_DATA3 0x17060
                /* card detect */
                MX6QDL_PAD_EIM_D19__GPIO3_IO19  0x1b0b0
            >;
        };
    };
...
...
};

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).

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

...
...
[    2.905623] sdhci: Secure Digital Host Controller Interface driver
[    2.911834] sdhci: Copyright(c) Pierre Ossman
[    2.916241] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.923102] sdhci-esdhc-imx 2190000.usdhc: Got CD GPIO
[    2.993842] mmc0: SDHCI controller on 2190000.usdhc [2190000.usdhc] using ADMA
[    3.063468] mmc0: host does not support reading read-only switch, assuming write-enable
[    3.079464] mmc0: new high speed SDHC card at address aaaa
[    3.085551] mmcblk0: mmc0:aaaa SA16G 14.8 GiB
[    3.092098]  mmcblk0: p1 p2
[    3.233654] mmc1: SDHCI controller on 2194000.usdhc [2194000.usdhc] using ADMA
...
...
[    4.857362] EXT4-fs (mmcblk0p2): mounting ext3 file system using the ext4 subsystem
[    4.877965] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. 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-mx6:~# mkdir -p /mnt/boot
root@desk-mx6:~# mkdir -p /mnt/rfs
root@desk-mx6:~# mount /dev/mmcblk0p1 /mnt/boot
root@desk-mx6:~# mount /dev/mmcblk0p2 /mnt/rfs
root@desk-mx6:~#

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