2.9.7. eMMC/SD Card

The commands for using SD cards and eMMC are very similar.

2.9.7.1. eMMC/SD card access from U-Boot

The eMMC/SD card device number (device num) can be found from the u-boot prompt:

=> mmc list
mmc@fa10000: 0
mmc@fa00000: 1

where “mmc 0” is eMMC, and “mmc 1” is SD card on AM62x SK EVM.

The following are useful u-boot commands for accessing eMMC/SD card:

=> mmc dev 1
switch to partitions #0, OK
mmc1 is current device

=> mmc info
Device: mmc@fa00000
Manufacturer ID: 3
OEM: 5344
Name: SC16G
Bus Speed: 50000000
Mode: SD High Speed (50MHz)
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 14.8 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes

=> mmc part
Partition Map for MMC device 1  --   Partition Type: DOS
Part    Start Sector    Num Sectors             UUID             Type
1                   2048         153600         0caef930-01      0c Boot
2                 155648       30960640         0caef930-02      83

=> ls mmc 1:1
 723856         tispl.bin
 431102         tiboot3.bin
1006404         u-boot.img
   1490         uEnv.txt
=> ls mmc 1:2 boot
<DIR>       4096 .
<DIR>       4096 ..
<SYM>         25 Image
        19276288 Image-5.10.87-g822e9445b7
           29900 k3-am625-minimal.dtb
           29849 k3-am625-sk-lpmdemo.dtb
           42259 k3-am625-sk.dtb
         6645760 tisdk-tiny-image-am62xx-evm.cpio
<SYM>         30 vmlinux.gz
         9053003 vmlinux.gz-5.10.87-g822e9445b7

Note

The active mmc device (eMMC or SD card) is selected by using the command mmc dev <device num>. An SD card is shown in the above example.

2.9.7.2. eMMC/SD card access from Linux

The following are useful Linux commands for accessing eMMC/SD card, where mmcblk0* is eMMC, and mmcblk1* is SD card.

# grep mmcblk /proc/partitions
179        0   15540224 mmcblk0
179        1   15540190 mmcblk0p1
179       96   15558144 mmcblk1
179       97      76800 mmcblk1p1
179       98   15480320 mmcblk1p2

# ls -l /dev/mmcblk*
brw-------    1 root     root      179,   0 Jan  1  1970 /dev/mmcblk0
brw-------    1 root     root      179,  32 Jan  1  1970 /dev/mmcblk0boot0
brw-------    1 root     root      179,  64 Jan  1  1970 /dev/mmcblk0boot1
brw-------    1 root     root      179,   1 Jan  1  1970 /dev/mmcblk0p1
crw-------    1 root     root      237,   0 Jan  1  1970 /dev/mmcblk0rpmb
brw-------    1 root     root      179,  96 Jan  1  1970 /dev/mmcblk1
brw-------    1 root     root      179,  97 Jan  1  1970 /dev/mmcblk1p1
brw-------    1 root     root      179,  98 Jan  1  1970 /dev/mmcblk1p2

# mount /dev/mmcblk1p1 /mnt/testing
# ls -lrt /mnt/testing
-rwxr-xr-x    1 root     root          1490 Aug 23  2021 uEnv.txt
-rwxr-xr-x    1 root     root       1006404 Aug 23  2021 u-boot.img
-rwxr-xr-x    1 root     root        723856 Aug 23  2021 tispl.bin
-rwxr-xr-x    1 root     root        431102 Aug 23  2021 tiboot3.bin

In the last example, mmcblk1p1 is the boot partition (FAT) on the SD card. The boot partition is mounted as /mnt/testing.