Skip to main content
Mark81
Associate III
April 21, 2020
Solved

Check SDMMC bus from u-boot

  • April 21, 2020
  • 3 replies
  • 2819 views

Here the output of some commands issued on our target at u-boot stage:

> STM32MP> mmc list 
> STM32 SDMMC2: 0 (SD)
> STM32 SDMMC2: 1
>
> STM32MP> ls mmc 0:4
> <DIR> 1024 .
> <DIR> 1024 ..
> <DIR> 12288 lost+found
> 8192 uboot.env
> 6677056 uImage
> 71859 stm32mp151a-<myimage>-mx.dtb
> 583 boot.scr.uimg
>
> STM32MP> mmc list 
> STM32 SDMMC2: 0 (SD)
> STM32 SDMMC2: 1 (eMMC)

Two questions:

  1. why the eMMC is not enumerated before trying to list anything in the SD device?
  2. why both are referred to the SDMMC2 bus? I'm expecting the SD card on SDMMC2 and eMMC on SDMMC1... in other words, how to check if the MPU finds the right device when changing the boot dip-switches to eMMC?

This topic has been closed for replies.
Best answer by PatrickD

Answer for 2.

mmc is a U-Boot « class », with index starting at 0 (same logic than in Linux kernel).

 And normally mmc “index�? are allocated in driver UCLASS_MMC, following the probe order.

“STM32 SDMMC2�? is a driver of UCLASS_MMC (SDMMCv2 in fact, the 2nd version of the ST IP SDMMC)

u-boot/drivers/mmc/sdmmc2 => .cf->name= “STM32 SDMMC2�?

 But this name is not really clear.

In device tree you have

aliases {

           mmc0 = &sdmmc1;

           mmc1 = &sdmmc2;

}

With

            sdmm1: sdmmc@0x58005000 {

           }

            Sdmm2: sdmmc@0x58007000 {

           }

So in U-Boot, we have 2 instance of "STM32 SDMMC2" driver:

  1. > STM32MP> mmc list
  2. > STM32 SDMMC2: 0 (SD) => mmc0 = SDMMC1 is SD card on EV1 / DK1 / DK2
  3. > STM32 SDMMC2: 1 (eMMC) => mmc1 = SDMMC2 is eMMC on EV1

And at the end "ls mmc 0:4 “ => ls on the 4th partition of mmc instance 0 = 4th partition of SDMMC1: SD card

3 replies

PatrickD
ST Employee
April 29, 2020

​Answer for 1.

In u-boot, all the driver are probed only when requested.

And eMMC is detected on mmc1 only if this mmc  driver is probed

but is can be forced by "mmc dev [dev]" command

STM32MP> mmc dev 0

STM32MP> mmc dev 1

STM32MP> mmc list

But yes it is strange that mmc1 is probed just by "ls mmc" command,

I don't check the command (./fs/fs.c:739:int do_ls) to explain it

but it is a genric U-Boot behavior.

Regards

Patrick

PatrickD
PatrickDBest answer
ST Employee
April 30, 2020

Answer for 2.

mmc is a U-Boot « class », with index starting at 0 (same logic than in Linux kernel).

 And normally mmc “index�? are allocated in driver UCLASS_MMC, following the probe order.

“STM32 SDMMC2�? is a driver of UCLASS_MMC (SDMMCv2 in fact, the 2nd version of the ST IP SDMMC)

u-boot/drivers/mmc/sdmmc2 => .cf->name= “STM32 SDMMC2�?

 But this name is not really clear.

In device tree you have

aliases {

           mmc0 = &sdmmc1;

           mmc1 = &sdmmc2;

}

With

            sdmm1: sdmmc@0x58005000 {

           }

            Sdmm2: sdmmc@0x58007000 {

           }

So in U-Boot, we have 2 instance of "STM32 SDMMC2" driver:

  1. > STM32MP> mmc list
  2. > STM32 SDMMC2: 0 (SD) => mmc0 = SDMMC1 is SD card on EV1 / DK1 / DK2
  3. > STM32 SDMMC2: 1 (eMMC) => mmc1 = SDMMC2 is eMMC on EV1

And at the end "ls mmc 0:4 “ => ls on the 4th partition of mmc instance 0 = 4th partition of SDMMC1: SD card

Mark81
Mark81Author
Associate III
April 30, 2020

Thanks, now it's clear why it appears as SDMMC(v)2! I thought it was the MPU bus SDMMC2....

PatrickD
ST Employee
April 30, 2020