Accessing EMMC from U-boot - SAMA5D27

Discussion around products based on ARM Cortex-A5 core.

Moderator: nferre

Posts: 2
Joined: Sat Dec 01, 2018 6:54 am

Accessing EMMC from U-boot - SAMA5D27

Sat Dec 01, 2018 7:03 am

Hi everyone,

We have custom board based on SAMA5D27 SOM1 EK. In our custom board we have one EMMC device which is connected to the SDHC0 bus on the processor. We are trying to access the EMMC from U-boot(I booted U-boot from QSPI flash). But U-boot is not able to access the EMMC it is throwing error ** Bad device mmc 0 **. Hardware wise EMMC device is working, I tested(Reading and Writing into EMMC device) with bare metal software using IAR embedded studio for ARM.
In SAMA5D27 SOM1 EK kit SDHC0 bus is connected to SD card but in our case SDHC0 is connected to EMMC. I'm getting doubt in initialization of registers for EMMC(SDHC0) device, because if I build u-boot image for SAMA5D27 SOM1 board I think by default U-boot will assume that SDHC0 is connected to SD card and will generate the image, in initialization there is a register called capabilities register(SDMMC_CA0R) there we have to specify whether bus(SDHC0) is connected to removable/non removable(SDMMC_CA0R_SLTYPE) device I saw this configuration in bare metal drivers, but I'm not able to find out where this register configuration has been done in u-boot.

To know what is happening in u-boot when I tried to access EMMC I added debug messages in mmc.c file( mmc drivers) there I observed one thing i.e., proper initialization of EMMC(SDHC0) is not taken place. When ever I try to access the EMMC I'm getting error as

selecting mode MMC legacy (freq : 0 MHz)
** Bad device mmc 0 **

Whereas when I'm trying to access the SD(SDHC1) U-boot detects SD card and gives below log,

fatload mmc 1
selecting mode MMC legacy (freq : 0 MHz)
selecting mode MMC legacy (freq : 25 MHz)

sd _get_capabilities
sd card: widths [4, 1] modes [SD Legacy, SD High Speed (50MHz)]
host: widths [4, 1] modes [MMC legacy, SD Legacy, MMC High Speed (26MHz), SD High Speed (50MHz), MMC High Speed (52MHz)]
trying mode SD High Speed (50MHz) width 4 (at 50 MHz)
selecting mode SD High Speed (50MHz) (freq : 50 MHz)
unable to read ssr
selecting mode SD Legacy (freq : 25 MHz)
trying mode SD High Speed (50MHz) width 1 (at 50 MHz)
selecting mode SD High Speed (50MHz) (freq : 50 MHz)
** No boot file defined **
=> fatlist mmc 1
Unknown command 'fatlist' - try 'help'
=> fatls mmc 1
12708 BOOT.bin
14293 BOOT_SD_U.bin
3901236 sama5d27_som1_ek.itb
System Volume Information/
445295 u-boot.bin
16384 uboot.env
5 file(s), 4 dir(s)

I tried same with evaluation board(SAMA5D2_Xplained_Ultra) in this u-boot is able to detect both EMMC and SD card. I attached log of both evaluation and custom board please do find.

Note: We don't have Sama5d27Som1EK kit, we've SAMA5D2_Xplained_Ultra kit. So images tested on evaluation board not support/run on our custom board.

U-Boot version : U-Boot 2018.07-linux4sam_6.0-dirty (Dec 01 2018 - 16:45:40 +0530)
Compiler : gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-

Steps I followed to create U-boot.bin

1. Cross compile
export CROSS_COMPILE=`pwd`/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-

2. Config
make sama5d27_som1_ek_mmc_defconfig

- At this stage I not written any script to load the files from EMMC. Just I'm trying to detect the EMMC when U-boot is up.

3. make

4.Loaded generated U-boot.bin to QSPI flash and booted.

Thanks for your time. Hoping for your response

Posts: 2
Joined: Sat Dec 01, 2018 6:54 am

Re: Accessing EMMC from U-boot - SAMA5D27

Tue Dec 04, 2018 1:08 pm

My problem has been resolved. Problem is with SD Card detect signal(SDMMC_CD) so I bypassed card detection procedure by setting Force card detect bit(FCD) in eMMC control 1 register( In U-boot mmc drivers).

But eMMC is working in 4-bit mode though device is 8-bit. To move ahead I'll go with 4-bit mode only.


Return to “SAMA5D Cortex-A5 MPU”

Who is online

Users browsing this forum: No registered users and 2 guests