On 2019-09-20 12:43 p.m., Matwey V. Kornilov wrote:
Could you please use u-boot console and try to locate and load dtb
file manually using `ls` and `load` commands in both scenarios?

Results attached.

I'm using a regular microSD card, not eMMC, but you're right: Using the U-Boot TPL the DTB file isn't loaded correctly; it's placed in memory but the data is corrupt:

    => md ${fdt_addr_r}
    01f00000: adaaaa8a ea22282a baa0aeae aa7aa3aa    ....*(".......z.
    01f00010: a8a200ab abaa000a a8a2aa08 aa88aafa    ................
    01f00020: e92a00a3 aabcf8a8 eaaaa8fa aaaaab88    ..*.............
    01f00030: aaa8a0aa 2aa8088a 22a5e3ba 8bea4abe    .......*...".J..
    01f00040: 23b188aa a20aa84a 82aaaaaa 8eee8cae    ...#J...........
    01f00050: 92aaaa4a aaa4feaa aa8a2eae eaa38b8a    J...............
    01f00060: aae4b2a8 aaacaaba aaea8ab8 2aeeb82a    ............*..*
    (...)
    => load mmc 1 ${fdt_addr_r} /dtb/rockchip/rk3328-rock64.dtb
    53513 bytes read in 10 ms (5.1 MiB/s)
    => md ${fdt_addr_r}
    01f00000: edfe0d50 09d10000 38000000 70ba0000    P..........8...p
    01f00010: 28000000 11000000 10000000 00000000    ...(............
    01f00020: 99120000 38ba0000 00000000 00000000    .......8........
    01f00030: 00000000 00000000 01000000 00000000    ................
    01f00040: 03000000 1e000000 00000000 656e6970    ............pine
    01f00050: 722c3436 366b636f 6f720034 68636b63    64,rock64.rockch
    01f00060: 722c7069 3233336b 00000038 03000000    ip,rk3328.......
    (...)
    => fdt addr ${fdt_addr_r}
    libfdt fdt_check_header(): FDT_ERR_BADMAGIC
    =>

Note the magic number at the start, which should be "edfe0dd0".

When the Rockchip TPL is used the same DTB file loads without issue, and the magic number is correct.

My current theory (following Mark Kettenis' email) is that all this is due to U-Boot's not configuring the RK805 PMIC on the ROCK64. The device tree suggests it's used to regulate power to the DRAM and is expected to be set up at pre-boot:

    vcc_ddr: DCDC_REG3 {
        regulator-name = "vcc_ddr";
        regulator-always-on;
        regulator-boot-on;
        regulator-state-mem {
            regulator-on-in-suspend;
        };
    };

However I see only yesterday Elaine Zhang posted patches that enable support in U-Boot for the RK805, which makes me think this isn't taking place currently. And while NetBSD includes its own RK805 driver it is likely assuming this setup has already happened ("regulator-boot-on") by the time the kernel starts and does not need to be done again.

Does this sound reasonable?

I'm going to apply Elaine's patches and see if that changes things.

--
Simon South
si...@simonsouth.net
U-Boot TPL 2019.10-rc3-00361-ga9fa70b7b7 (Sep 20 2019 - 04:55:01)
LPDDR3
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2019.10-rc3-00361-ga9fa70b7b7 (Sep 20 2019 - 04:55:01 -0400)
Trying to boot from MMC2
Card did not respond to voltage select!
spl: mmc init failed with error: -95
Trying to boot from MMC1
NOTICE:  BL31: v2.1(release):v2.1-678-g2fc6ffc4-dirty
NOTICE:  BL31: Built : 12:10:07, Sep 12 2019
ERROR:   over or zero region, nr=4187432, max=10
NOTICE:  BL31:Rockchip release version: v1.2


U-Boot 2019.10-rc3-00361-ga9fa70b7b7 (Sep 20 2019 - 04:56:02 -0400)

Model: Pine64 Rock64
DRAM:  4 GiB
MMC:   rksdmmc@ff500000: 1, rksdmmc@ff520000: 0
Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:    serial@ff130000
Out:   serial@ff130000
Err:   serial@ff130000
Model: Pine64 Rock64
Net:   
Warning: ethernet@ff540000 (eth0) using random MAC address - 9a:fd:d8:85:88:9f
eth0: ethernet@ff540000
Hit any key to stop autoboot:  2  0 
=> md ${fdt_addr_r}
01f00000: adaaaa8a ea22282a baa0aeae aa7aa3aa    ....*(".......z.
01f00010: a8a200ab abaa000a a8a2aa08 aa88aafa    ................
01f00020: e92a00a3 aabcf8a8 eaaaa8fa aaaaab88    ..*.............
01f00030: aaa8a0aa 2aa8088a 22a5e3ba 8bea4abe    .......*...".J..
01f00040: 23b188aa a20aa84a 82aaaaaa 8eee8cae    ...#J...........
01f00050: 92aaaa4a aaa4feaa aa8a2eae eaa38b8a    J...............
01f00060: aae4b2a8 aaacaaba aaea8ab8 2aeeb82a    ............*..*
01f00070: aaa0aaac aaeeab9a aeae84c8 ac2e8aaa    ................
01f00080: aaaa88a2 8a8a98a8 aee8aacc 686aa880    ..............jh
01f00090: acaa8a8a ac8eaec4 eaaaec80 aaaaca8c    ................
01f000a0: 28acaacd aae88a8a aba88e89 aaa8aaa8    ...(............
01f000b0: 122caca4 a24eacc8 abea8cca 8aa0aa6e    ..,...N.....n...
01f000c0: ea08988a aaacc8ca ee8eac8c 2488e89a    ...............$
01f000d0: c22ca84e 82a98a8c 88e888ae 8ac0aa92    N.,.............
01f000e0: a8a8a289 aeaaa8c8 8ccceacb aaeaee84    ................
01f000f0: 2feaa947 aae2a628 a3c688a8 ceaee8a9    G../(...........
=> ls mmc 1 /dtb/rockchip
            ./
            ../
    77017   rk3399-sapphire.dtb
    81304   rk3399-sapphire-excavator.dtb
    78646   rk3399-rockpro64.dtb
    77846   rk3399-rock960.dtb
    76155   rk3399-rock-pi-4.dtb
    77701   rk3399-roc-pc.dtb
    78035   rk3399-puma-haikou.dtb
    78483   rk3399-nanopi-m4.dtb
    78791   rk3399-nanopc-t4.dtb
    86532   rk3399-gru-scarlet-kd.dtb
    86507   rk3399-gru-scarlet-inx.dtb
    89522   rk3399-gru-kevin.dtb
    85495   rk3399-gru-bob.dtb
    80312   rk3399-firefly.dtb
    78519   rk3399-ficus.dtb
    68842   rk3399-evb.dtb
    53513   rk3328-rock64.dtb
    52150   rk3328-roc-cc.dtb
    51134   rk3328-evb.dtb

19 file(s), 2 dir(s)

=> load mmc 1 ${fdt_addr_r} /dtb/rockchip/rk3328-rock64.dtb
53513 bytes read in 10 ms (5.1 MiB/s)
=> md ${fdt_addr_r}
01f00000: edfe0d50 09d10000 38000000 70ba0000    P..........8...p
01f00010: 28000000 11000000 10000000 00000000    ...(............
01f00020: 99120000 38ba0000 00000000 00000000    .......8........
01f00030: 00000000 00000000 01000000 00000000    ................
01f00040: 03000000 1e000000 00000000 656e6970    ............pine
01f00050: 722c3436 366b636f 6f720034 68636b63    64,rock64.rockch
01f00060: 722c7069 3233336b 00000038 03000000    ip,rk3328.......
01f00070: 04000000 0b000000 01000000 03000000    ................
01f00080: 04000000 1c000000 02000000 03000000    ................
01f00090: 04000000 2b000000 02000000 03000000    .......+........
01f000a0: 0e000000 37000000 656e6950 52203436    .......7Pine64 R
01f000b0: 366b636f 00000034 01000000 61696c61    ock64.......alia
01f000c0: 00736573 03000000 11000000 3d000000    ses............=
01f000d0: 7265732f 406c6169 31316666 30303030    /serial@ff110000
01f000e0: 00000000 03000000 11000000 45000000    ...............E
01f000f0: 7265732f 406c6169 32316666 30303030    /serial@ff120000
=> fdt addr ${fdt_addr_r}
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
=> load mmc 1 ${fdt_addr_r} /dtb/rockchip/rk3328-rock64.dtb
53513 bytes read in 10 ms (5.1 MiB/s)
=> md ${fdt_addr_r}
01f00000: edfe0d50 09d10000 38000000 70ba0000    P..........8...p
01f00010: 28000000 11000000 10000000 00000000    ...(............
01f00020: 99120000 38ba0000 00000000 00000000    .......8........
01f00030: 00000000 00000000 01000000 00000000    ................
01f00040: 03000000 1e000000 00000000 656e6970    ............pine
01f00050: 722c3436 366b636f 6f720034 68636b63    64,rock64.rockch
01f00060: 722c7069 3233336b 00000038 03000000    ip,rk3328.......
01f00070: 04000000 0b000000 01000000 03000000    ................
01f00080: 04000000 1c000000 02000000 03000000    ................
01f00090: 04000000 2b000000 02000000 03000000    .......+........
01f000a0: 0e000000 37000000 656e6950 52203436    .......7Pine64 R
01f000b0: 366b636f 00000034 01000000 61696c61    ock64.......alia
01f000c0: 00736573 03000000 11000000 3d000000    ses............=
01f000d0: 7265732f 406c6169 31316666 30303030    /serial@ff110000
01f000e0: 00000000 03000000 11000000 45000000    ...............E
01f000f0: 7265732f 406c6169 32316666 30303030    /serial@ff120000
=> fdt addr ${fdt_addr_r}
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
=> 
DDR version 1.16 20190528
ID:0x805 Y
In
LPDDR3
333MHz
Bus Width=32 Col=11 Bank=8 Row=15/15 CS=2 Die Bus-Width=32 Size=4096MB
ddrconfig:7
OUT

U-Boot SPL 2019.10-rc3-00361-ga9fa70b7b7 (Sep 20 2019 - 04:55:01 -0400)
Trying to boot from MMC2
Card did not respond to voltage select!
spl: mmc init failed with error: -95
Trying to boot from MMC1
NOTICE:  BL31: v2.1(release):v2.1-678-g2fc6ffc4-dirty
NOTICE:  BL31: Built : 12:10:07, Sep 12 2019
ERROR:   over or zero region, nr=4187432, max=10
NOTICE:  BL31:Rockchip release version: v1.2


U-Boot 2019.10-rc3-00361-ga9fa70b7b7 (Sep 20 2019 - 04:56:02 -0400)

Model: Pine64 Rock64
DRAM:  4 GiB
MMC:   rksdmmc@ff500000: 1, rksdmmc@ff520000: 0
Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:    serial@ff130000
Out:   serial@ff130000
Err:   serial@ff130000
Model: Pine64 Rock64
Net:   
Warning: ethernet@ff540000 (eth0) using random MAC address - 9e:e6:27:9f:84:80
eth0: ethernet@ff540000
Hit any key to stop autoboot:  2  0
=> md ${fdt_addr_r}
01f00000: adaaaa9a ea23282a baa8aeae aa7aa3aa    ....*(#.......z.
01f00010: bef200ab abaa020a a8b6aa88 aa88aafa    ................
01f00020: e92a4ca3 aafcf9aa eaaaa8fa aaaaaf89    .L*.............
01f00030: aaa8a0aa aaea888b 62a5ebfa abea6abe    ...........b.j..
01f00040: a3b188aa a29aac4a 8aaaaaaa 8eee8cae    ....J...........
01f00050: daaaaa4e aaacfeea ea8a6ebe eaa38b8a    N........n......
01f00060: aee4f2a9 aaacaaba aaea8ab8 2aeeb8aa    ...............*
01f00070: aab1aeac aaeeeb9e aeae84e8 ac2e8aea    ................
01f00080: aaae88e6 8aced8ba aeecaacc 686ae884    ..............jh
01f00090: acaaeaaa ac8faec0 eaeeec84 aaaaca8c    ................
01f000a0: 68aeaacd aae89a8a abe8ce89 aaaaaaa8    ...h............
01f000b0: 326caca4 e2ceaccc abea8ece 8ae0eaee    ..l2............
01f000c0: ea08d88a aaacc8ea ee9eacac 248ae99a    ...............$
01f000d0: c2aea8ce 82a98ecc aae888ae 8ac1aa9a    ................
01f000e0: acbaa289 aeaeb8cc 8ccceecb aaeaeeac    ................
01f000f0: 2feaad43 aae6ee69 a7c688ac eeaee8a9    C../i...........
=> ls mmc 1 /dtb/rockchip
            ./
            ../
    77017   rk3399-sapphire.dtb
    81304   rk3399-sapphire-excavator.dtb
    78646   rk3399-rockpro64.dtb
    77846   rk3399-rock960.dtb
    76155   rk3399-rock-pi-4.dtb
    77701   rk3399-roc-pc.dtb
    78035   rk3399-puma-haikou.dtb
    78483   rk3399-nanopi-m4.dtb
    78791   rk3399-nanopc-t4.dtb
    86532   rk3399-gru-scarlet-kd.dtb
    86507   rk3399-gru-scarlet-inx.dtb
    89522   rk3399-gru-kevin.dtb
    85495   rk3399-gru-bob.dtb
    80312   rk3399-firefly.dtb
    78519   rk3399-ficus.dtb
    68842   rk3399-evb.dtb
    53513   rk3328-rock64.dtb
    52150   rk3328-roc-cc.dtb
    51134   rk3328-evb.dtb

19 file(s), 2 dir(s)

=> load mmc 1 ${fdt_addr_r} /dtb/rockchip/rk3328-rock64.dtb
53513 bytes read in 9 ms (5.7 MiB/s)
=> md ${fdt_addr_r}
01f00000: edfe0dd0 09d10000 38000000 70ba0000    ...........8...p
01f00010: 28000000 11000000 10000000 00000000    ...(............
01f00020: 99120000 38ba0000 00000000 00000000    .......8........
01f00030: 00000000 00000000 01000000 00000000    ................
01f00040: 03000000 1e000000 00000000 656e6970    ............pine
01f00050: 722c3436 366b636f 6f720034 68636b63    64,rock64.rockch
01f00060: 722c7069 3233336b 00000038 03000000    ip,rk3328.......
01f00070: 04000000 0b000000 01000000 03000000    ................
01f00080: 04000000 1c000000 02000000 03000000    ................
01f00090: 04000000 2b000000 02000000 03000000    .......+........
01f000a0: 0e000000 37000000 656e6950 52203436    .......7Pine64 R
01f000b0: 366b636f 00000034 01000000 61696c61    ock64.......alia
01f000c0: 00736573 03000000 11000000 3d000000    ses............=
01f000d0: 7265732f 406c6169 31316666 30303030    /serial@ff110000
01f000e0: 00000000 03000000 11000000 45000000    ...............E
01f000f0: 7265732f 406c6169 32316666 30303030    /serial@ff120000
=> fdt addr ${fdt_addr_r}
=> boot
Card did not respond to voltage select!
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
53513 bytes read in 10 ms (5.1 MiB/s)
Found EFI removable media binary efi/boot/bootaa64.efi
Scanning disk rksd...@ff500000.blk...
Card did not respond to voltage select!
Scanning disk rksd...@ff520000.blk...
Disk rksd...@ff520000.blk not ready
Found 3 disks
BootOrder not defined
EFI boot manager: Cannot load any image
205136 bytes read in 17 ms (11.5 MiB/s)
|/-\|/-

>> NetBSD/evbarm EFI Boot (aarch64), Revision 1.11 (Wed Sep 18 15:50:45 UTC 
>> 2019) (from NetBSD 9.99.12)
Press return to boot now, any other key for boot prompt
booting netbsd - starting in 5 seconds. 4 seconds. 3 
seconds. 2 seconds. 1 seconds. 0 seconds.     
\|/-\|/-\|/-\6100056|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\+2730512|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/+1985652-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/+1823764-\
 [701640|/-\|/-\|/-+490622\|/-\|/]=0xec5b00
[   1.0000000] NetBSD/evbarm (fdt) booting ...
[   1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 
2004, 2005,
[   1.0000000]     2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 
2016, 2017,
[   1.0000000]     2018, 2019 The NetBSD Foundation, Inc.  All rights reserved.
[   1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[   1.0000000]     The Regents of the University of California.  All rights 
reserved.

[   1.0000000] NetBSD 9.99.12 (GENERIC64) #16: Wed Sep 18 12:30:03 EDT 2019
[   1.0000000]  ssouth@laptop:/usr/src/sys/arch/evbarm/compile/obj/GENERIC64
[   1.0000000] total memory = 4064 MB
[   1.0000000] avail memory = 3918 MB
[   1.0000000] armfdt0 (root)
[   1.0000000] simplebus0 at armfdt0: Pine64 Rock64
[   1.0000000] cpus0 at simplebus0
[   1.0000000] simplebus1 at simplebus0
[   1.0000000] simplebus2 at simplebus0
[   1.0000000] cpu0 at cpus0: Cortex-A53 r0p4 (Cortex V8-A core)
...
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to