apritzel / pine64

Pine64 Linux images and information
119 stars 28 forks source link

U-Boot comes up with MMC2 device #16

Closed gmbnomis closed 3 years ago

gmbnomis commented 3 years ago

I built the firmware image according to the description in README.md from the git repo (tag v2021.07-rc3 which happened to be the current master at that time). Config is pine64_plus_defconfig

This went well, but for some reason the device mmc@1c0f000, which is the only enabled mmc device in the device tree, comes up as MMC device 2 in U-Boot:

U-Boot 2021.07-rc3-dirty (May 27 2021 - 23:04:35 +0200) Allwinner Technology

CPU:   Allwinner A64 (SUN50I)
Model: Pine64+
DRAM:  2 GiB
MMC:   mmc@1c0f000: 2
Loading Environment from FAT... OK
In:    serial
Out:   serial
Err:   serial
Net:   phy interface10
eth0: ethernet@1c30000
starting USB...
Bus usb@1c1a000: USB EHCI 1.00
Bus usb@1c1a400: USB OHCI 1.0
Bus usb@1c1b000: USB EHCI 1.00
Bus usb@1c1b400: USB OHCI 1.0
scanning bus usb@1c1a000 for devices... 1 USB Device(s) found
scanning bus usb@1c1a400 for devices... 1 USB Device(s) found
scanning bus usb@1c1b000 for devices... 1 USB Device(s) found
scanning bus usb@1c1b400 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0 
=> mmc list
mmc@1c0f000: 2 (SD)

I can then force to boot from that device using:

=> devnum=2
=> run mmc_boot

In Linux (Fedora 34), the device is /dev/mmcblk2 as well. One thing is odd: The device tree defines an alias for mmc1:

[root@pine64 ~]# ls /proc/device-tree/aliases/
ethernet0  mmc1  name  serial0  serial1  serial2  serial3  serial4
[root@pine64 ~]# cat /proc/device-tree/aliases/mmc1 
/soc/mmc@1c11000

If I force to use the dtb that comes with the distribution kernel, the MMC device is /dev/mmcblk0 and I don't see that alias:

[root@pine64 ~]# ls /proc/device-tree/aliases/
ethernet0  name  serial0  serial1  serial2  serial3  serial4

The dts files of the distribution kernel (5.12.6) and u-boot are identical.

I am running out of ideas where that alias comes from and why the MMC device is device 2...

gmbnomis commented 3 years ago

Ah, this is https://lists.denx.de/pipermail/u-boot/2021-April/447472.html

I applied that patch and it works now. And it's clear now where this alias comes from.