Uboot mmc_init problem

Hi,

I’m trying to get a poplar board up and running, following the instructions here.

All goes OK, insofar as everything compiles and I can flash the images onto the Poplar board.

The problem I’m seeing is that the u-boot I build is unable initialize the eMMC. I get:

poplar# version
U-Boot 2018.01-rc2-g8453779d31 (May 29 2019 - 12:04:02 +0100)poplar

aarch64-linux-gnu-gcc (Linaro GCC 7.4-2019.02) 7.4.1 20181213 [linaro-7.4-2019.02 revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4]
GNU ld (Linaro_Binutils-2019.02) 2.28.2.20170706

poplar# mmc info
mmc_init: -110, time 17

Whereas if I load this version of u-boot on a usb drive, and boot from usb, there doesn’t seem to be a problem initializing mmc:

poplar# version
U-Boot 2018.01-rc2-00018-ga82c10022005 (Jan 26 2018 - 10:06:20 +0800)poplar

aarch64-linux-gnu-gcc (Linaro GCC 6.3-2017.05) 6.3.1 20170404
GNU ld (Linaro_Binutils-2017.05) 2.27.0.20161019

poplar# mmc info
Device: Hisilicon DWMMC
Manufacturer ID: 15
OEM: 100
Name: 8WPD3
Tran Speed: 52000000
Rd Block Len: 512
MMC version 5.0
High Capacity: Yes
Capacity: 7.3 GiB
Bus Width: 8-bit
Erase Group Size: 512 KiB
HC WP Group Size: 8 MiB
User Capacity: 7.3 GiB WRREL
Boot Capacity: 4 MiB ENH
RPMB Capacity: 512 KiB ENH

Have any of you seen something like this before, or know what might be going on?

I have the same problem.
When I use the prebuilt one using usb bootstrap, mmc seems to be working fine:

    poplar# mmc info
    Device: Hisilicon DWMMC
    Manufacturer ID: 15
    OEM: 100
    Name: 8WPD3 
    Tran Speed: 52000000
    Rd Block Len: 512
    MMC version 5.0
    High Capacity: Yes
    Capacity: 7.3 GiB
    Bus Width: 8-bit
    Erase Group Size: 512 KiB
    HC WP Group Size: 8 MiB
    User Capacity: 7.3 GiB WRREL
    Boot Capacity: 4 MiB ENH
    RPMB Capacity: 512 KiB ENH
    poplar# 

I have started to tag the commit IDs of u-boot that have this mmc init failure issue (‘latest’ branch as you can see):

commit 8453779d31b102a5f44b9fdc63912cf3757e2426 (HEAD → latest, tag: mmc_init_fail, origin/latest, origin/HEAD)
Author: Shawn Guo shawn.guo@linaro.org
Date: Fri Aug 24 15:41:07 2018 +0800

I spent some time on this, and found out it is a regression caused by arm-trust-firmware. Please comment out the following line from arm-trust-firmware, file drivers/synopsys/emmc/dw_mmc.c, function dw_mmc_init(), and try again.

mmio_write_32(dw_params.reg_base + DWMMC_FIFOTH, 0x103ff);

Thanks a lot for your response Shawn, your suggestion worked for me as you can see below:

        U-Boot 2018.01-rc2-g8453779d31 (Jun 03 2019 - 07:39:21 -0700)poplar
        Model: HiSilicon Poplar Development Board
        BOARD: Hisilicon HI3798cv200 Poplar
        DRAM:  959.5 MiB
        MMC:   Hisilicon DWMMC: 0
        In:    serial_pl01x
        Out:   serial_pl01x
        Err:   serial_pl01x
        Net:   Net:      configured
        No such device: mdio0
        No such device: mdio0
        No such device: mdio1
        gmac1
        Hit any key to stop autoboot:  0 
        poplar# 
        poplar# 
        poplar# saveenv
        Saving Environment to MMC...
        Writing to MMC(0)... done
        poplar# saveenv
        Saving Environment to MMC...
        Writing to MMC(0)... done
        poplar# mmc info
        Device: Hisilicon DWMMC
        Manufacturer ID: 15
        OEM: 100
        Name: 8WPD3 
        Tran Speed: 52000000
        Rd Block Len: 512
        MMC version 5.0
        High Capacity: Yes
        Capacity: 7.3 GiB
        Bus Width: 8-bit
        Erase Group Size: 512 KiB
        HC WP Group Size: 8 MiB
        User Capacity: 7.3 GiB WRREL
        Boot Capacity: 4 MiB ENH
        RPMB Capacity: 512 KiB ENH
        poplar#

Thanks Shawn. That fixed the issue I was seeing and it seems to be working as expected now