rockchip-linux / u-boot

U-Boot tree for pending commits
115 stars 79 forks source link

RK3399-EVB: Boot from SD card (mmc1), U-Boot can't detect mmc1. #10

Closed nightseas closed 7 years ago

nightseas commented 7 years ago

Hi,

I'm building system for RK3399-EVB (Shapphire V12) with scripts from rockchip-linux/build. The scripts basically just use the default config for RK3399.

At rockhip-linux/u-boot HEAD e14b1169c0c5a1b362b41451006b492bd16f2fff: I'm able to boot U-Boot from SD card but the U-Boot only find mmc0 (eMMC) and can't detect mmc1, which leads to boot failure. Is this solved by later commits or still an issue?

BTW: With latest release branch 9fe6f2383c5076296d785d79b74cd2b13bbe43de the board can't U-Boot at all, which could be caused by modifications to bootloader offset. So I was not able to test it. Could anyone also provide the newest memory map for bootloaders?

Thanks & BR.

nightseas commented 7 years ago

Move logs here. Tried SanDisk Ultra 8GB and 16GB Class10 cards.

郉DR Version 1.08 20170320
In
Channel 0: LPDDR3, 800MHz
CS = 0
MR0=0x58
MR1=0x58
MR2=0x58
MR3=0x58
MR4=0x3
MR5=0x1
MR6=0x5
MR7=0x0
MR8=0x1F
MR9=0x1F
MR10=0x1F
MR11=0x1F
MR12=0x1F
MR13=0x1F
MR14=0x1F
MR15=0x1F
MR16=0x1F
CS = 1
MR0=0x58
MR1=0x58
MR2=0x58
MR3=0x58
MR4=0x3
MR5=0x1
MR6=0x5
MR7=0x0
MR8=0x1F
MR9=0x1F
MR10=0x1F
MR11=0x1F
MR12=0x1F
MR13=0x1F
MR14=0x1F
MR15=0x1F
MR16=0x1F
Bus Width=32 Col=10 Bank=8 Row=15/15 CS=2 Die Bus-Width=32 Size=2048MB
Channel 1: LPDDR3, 800MHz
CS = 0
MR0=0x58
MR1=0x58
MR2=0x58
MR3=0x58
MR4=0x3
MR5=0x1
MR6=0x5
MR7=0x0
MR8=0x1F
MR9=0x1F
MR10=0x1F
MR11=0x1F
MR12=0x1F
MR13=0x1F
MR14=0x1F
MR15=0x1F
MR16=0x1F
CS = 1
MR0=0x58
MR1=0x58
MR2=0x58
MR3=0x58
MR4=0x3
MR5=0x1
MR6=0x5
MR7=0x0
MR8=0x1F
MR9=0x1F
MR10=0x1F
MR11=0x1F
MR12=0x1F
MR13=0x1F
MR14=0x1F
MR15=0x1F
MR16=0x1F
Bus Width=32 Col=10 Bank=8 Row=15/15 CS=2 Die Bus-Width=32 Size=2048MB
256B stride
ch 0 ddrconfig = 0x101, ddrsize = 0x2020
ch 1 ddrconfig = 0x101, ddrsize = 0x2020
pmugrf_os_reg[2] = 0x3AA0DAA0, stride = 0xD
OUT
Boot1: 2017-04-07, version: 1.06
CPUId = 0x0
ChipType = 0x10, 1836
SdmmcInit=2 0
BootCapSize=100000
UserCapSize=7456MB
FwPartOffset=2000 , 100000
SdmmcInit=0 0
BootCapSize=0
UserCapSize=15193MB
FwPartOffset=2000 , 0
StorageInit ok = 68157
LoadTrustBL
No find bl30.bin
No find bl32.bin
RunBL31 0x10000
NOTICE:  BL31: v1.3(debug):55aa0b4
NOTICE:  BL31: Built : 16:55:03, Mar 31 2017
INFO:    GICv3 with legacy support detected. ARM GICV3 driver initialized in EL3
INFO:    boot cpu mask: 0
INFO:    plat_rockchip_pmu_init(1089): pd status 3e
INFO:    BL31: Initializing runtime services
INFO:    BL31: Preparing for EL3 exit to normal world
INFO:    Entry point address = 0x200000
INFO:    SPSR = 0x3c9

U-Boot 2017.07-ge14b116 (Jul 29 2017 - 18:21:53 +0800)

Model: Rockchip RK3399 Evaluation Board
DRAM:  3.9 GiB
MMC:   sdhci@fe330000: 0
MMC Device 1 not found
*** Warning - No MMC card found, using default environment

In:    serial
Out:   serial
Err:   serial
Model: Rockchip RK3399 Evaluation Board
Net:   
Warning: ethernet@fe300000 (eth0) using random MAC address - 7a:d6:ff:c7:61:fd
eth0: ethernet@fe300000
Hit any key to stop autoboot:  0 
** First descriptor is NOT a primary desc on 0:1 **
switch to partitions #0, OK
mmc0(part 0) is current device
** No partition table - mmc 0 **
MMC Device 1 not found
no mmc device at slot 1
starting USB...
USB0:   failed to enable clock 0
failed to enable clock 1
USB EHCI 1.00
USB1:   failed to enable clock 0
failed to enable clock 1
USB EHCI 1.00
USB2:   Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
USB3:   Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 1 for devices... 1 USB Device(s) found
scanning bus 2 for devices... 1 USB Device(s) found
scanning bus 3 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found

USB device 0: unknown device
=> 
=> 
=> mmc list
sdhci@fe330000: 0 (eMMC)
=>  
nightseas commented 7 years ago

Did the test on 9fe6f2383c5076296d785d79b74cd2b13bbe43de toady, same issue.

Then I put the card into a usb-reader, and got some other failure messages:

U-Boot 2017.07-g9fe6f23 (Jul 30 2017 - 15:06:25 +0800)

Model: Rockchip RK3399 Evaluation Board
DRAM:  3.9 GiB
MMC:   sdhci@fe330000: 0
** First descriptor is NOT a primary desc on 0:1 **
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Model: Rockchip RK3399 Evaluation Board
Net:   
Warning: ethernet@fe300000 (eth0) using random MAC address - 6e:ff:42:80:f0:09
eth0: ethernet@fe300000
Hit any key to stop autoboot:  0 
** First descriptor is NOT a primary desc on 0:1 **
switch to partitions #0, OK
mmc0(part 0) is current device
** No partition table - mmc 0 **
MMC Device 1 not found
no mmc device at slot 1
starting USB...
USB0:   failed to enable clock 0
failed to enable clock 1
USB EHCI 1.00
USB1:   failed to enable clock 0
failed to enable clock 1
USB EHCI 1.00
USB2:   Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
USB3:   Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 1 for devices... 2 USB Device(s) found
scanning bus 2 for devices... 1 USB Device(s) found
scanning bus 3 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found

USB device 0: 
    Device 0: Vendor: Generic- Rev: 1.00 Prod: SD/MMC          
            Type: Removable Hard Disk
            Capacity: 7580.0 MB = 7.4 GB (15523840 x 512)
... is now current device
Scanning usb 0:6...
Found /extlinux/extlinux.conf
Retrieving file: /extlinux/extlinux.conf
reading /extlinux/extlinux.conf
193 bytes read in 21 ms (8.8 KiB/s)
1:      kernel-4.4
Retrieving file: /Image
reading /Image
EHCI timed out on TD - token=0x8008d80
EHCI timed out on TD - token=0x800d8d80
EHCI timed out on TD - token=0x8008d80
EHCI timed out on TD - token=0x128d80
EHCI timed out on TD - token=0x8008d80
EHCI timed out on TD - token=0x128d80
Error reading cluster
** Unable to read file /Image **
Skipping kernel-4.4 for failure retrieving kernel
SCRIPT FAILED: continuing...
EHCI timed out on TD - token=0x2008d80
EHCI timed out on TD - token=0x128d80
EHCI timed out on TD - token=0x2008d80
EHCI timed out on TD - token=0x128d80
EHCI timed out on TD - token=0x2008d80
EHCI timed out on TD - token=0x128d80
*** ERROR: Can't read GPT header ***
part_get_info_efi: *** ERROR: Invalid GPT ***
EHCI timed out on TD - token=0x2008d80
EHCI timed out on TD - token=0x128d80
EHCI timed out on TD - token=0x2008d80
EHCI timed out on TD - token=0x128d80
EHCI timed out on TD - token=0x2008d80
EHCI timed out on TD - token=0x128d80
*** ERROR: Can't read GPT header ***
part_get_info_efi: *** ERROR: Invalid Backup GPT ***
** Invalid partition 6 **
EHCI timed out on TD - token=0x2008d80
EHCI timed out on TD - token=0x128d80
EHCI timed out on TD - token=0x2008d80
EHCI timed out on TD - token=0x128d80
...
nightseas commented 7 years ago

Well I found the root cause. There's no available driver for dwmmc controller.

bind node dwmmc@fe320000
   - attempt to match compatible string 'rockchip,rk3399-dw-mshc'
   - attempt to match compatible string 'rockchip,rk3288-dw-mshc'
No match for node 'dwmmc@fe320000'
bind node sdhci@fe330000
   - attempt to match compatible string 'rockchip,rk3399-sdhci-5.1'
   - attempt to match compatible string 'arasan,sdhci-5.1'
   - found match at 'rockchip_rk3399_sdhci_5_1'

Only an out dated driver for RK3288 that could not be compiled at all.

u-boot/drivers/mmc/rockchip_dw_mmc.c:290:{ .compatible = "rockchip,rk3288-dw-mshc" },

Looks like the only solution for now is to buy a type-C cable. lol

So do you guys have any plan to fix that, or there will be no support for SD card in U-Boot in the foreseeable future?

Thanks & BR, XH Li

wzyy2 commented 7 years ago

try CONFIG_MMC_DW_ROCKCHIP? It seems it's not enabled for rk3399-evb.

keveryang commented 7 years ago

You can sync the config with firefly-rk3399, then you can get the sdcard support. We will update in next version for rk3399-evb.

nightseas commented 7 years ago

Already tried to add CONFIG_MMC_DW_ROCKCHIP but failed.

  LD      spl/drivers/core/built-in.o
  LD      spl/drivers/firmware/built-in.o
  LD      spl/drivers/misc/built-in.o
  CC      spl/drivers/mmc/mmc.o
  CC      spl/drivers/mmc/mmc-uclass.o
  CC      spl/drivers/mmc/dw_mmc.o
  CC      spl/drivers/mmc/rockchip_dw_mmc.o
drivers/mmc/rockchip_dw_mmc.c:25:37: error: field 鈥榙tplat鈥?has incomplete type
  struct dtd_rockchip_rk3288_dw_mshc dtplat;
                                     ^
drivers/mmc/rockchip_dw_mmc.c: In function 鈥榬ockchip_dwmmc_probe鈥?
drivers/mmc/rockchip_dw_mmc.c:236:34: error: dereferencing pointer to incomplete type 鈥榮truct dtd_rockchip_rk3288_dw_mshc鈥?  host->ioaddr = map_sysmem(dtplat->reg[0], dtplat->reg[1]);
                                  ^
scripts/Makefile.build:280: recipe for target 'spl/drivers/mmc/rockchip_dw_mmc.o' failed
make[4]: *** [spl/drivers/mmc/rockchip_dw_mmc.o] Error 1
scripts/Makefile.build:425: recipe for target 'spl/drivers/mmc' failed
make[3]: *** [spl/drivers/mmc] Error 2
scripts/Makefile.spl:339: recipe for target 'spl/drivers' failed
make[2]: *** [spl/drivers] Error 2
Makefile:1396: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 2
Makefile:460: recipe for target '__build_one_by_one' failed
make: *** [__build_one_by_one] Error 2
 MAKE UBOOT IMAGE FAILED.

Then I compared both config file, found that I need to remove the SPL plat data config:

@@ -27,8 +27,6 @@ CONFIG_CMD_USB=y
 CONFIG_CMD_TIME=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
-CONFIG_SPL_OF_PLATDATA=y
-CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_REGMAP=y
 CONFIG_SPL_REGMAP=y
 CONFIG_SYSCON=y

Now everything works fine.

Thanks & BR, XH Li