radxa / meta-radxa

OpenEmbedded BSP Layer for the Radxa boards
GNU Lesser General Public License v3.0
9 stars 18 forks source link

Fix radxa cm3 #26

Closed floion closed 2 years ago

floion commented 2 years ago

@jack-ma @RadxaYuntian @

floion commented 2 years ago

However booting this compiled u-boot does not work on a roi4 ioboard:

DDR Version V1.10 20210810
ln
ddrconfig:7
LP4 MR14:0x4d
LPDDR4, 324MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
tdqss: cs0 dqs0: 385ps, dqs1: 337ps, dqs2: 361ps, dqs3: 217ps, 
tdqss: cs1 dqs0: 385ps, dqs1: 337ps, dqs2: 361ps, dqs3: 241ps, 

change to: 324MHz
PHY drv:clk:38,ca:38,DQ:30,odt:0
vrefinner:41%, vrefout:41%
dram drv:40,odt:0
clk skew:0x58

change to: 528MHz
PHY drv:clk:38,ca:38,DQ:30,odt:60
vrefinner:16%, vrefout:41%
dram drv:40,odt:0
clk skew:0x6c

change to: 780MHz
PHY drv:clk:38,ca:38,DQ:30,odt:60
vrefinner:16%, vrefout:41%
dram drv:40,odt:0
clk skew:0x58

change to: 1056MHz(final freq)
PHY drv:clk:38,ca:38,DQ:30,odt:60
vrefinner:16%, vrefout:29%
dram drv:40,odt:80
vref_ca:00000068
clk skew:0x28
cs 0:
the read training result:
DQS0:0x3c, DQS1:0x39, DQS2:0x3e, DQS3:0x36, 
min  : 0xd  0xf  0xf  0xe  0x0  0x5  0x7  0x3 , 0x7  0x5  0x3  0x2  0x9  0x8  0xa  0x6 ,
      0x10 0x10  0xd  0xc  0x5  0x1  0x3  0x5 , 0xc  0x7  0x6  0x1  0xc  0xd  0xb  0xc ,
mid  :0x2a 0x2b 0x2c 0x2a 0x1e 0x21 0x24 0x20 ,0x23 0x22 0x20 0x1e 0x26 0x25 0x27 0x23 ,
      0x2c 0x2c 0x28 0x26 0x20 0x1d 0x1e 0x20 ,0x28 0x23 0x22 0x1d 0x28 0x29 0x27 0x27 ,
max  :0x47 0x47 0x49 0x47 0x3c 0x3e 0x41 0x3d ,0x40 0x40 0x3d 0x3a 0x44 0x42 0x44 0x41 ,
      0x49 0x49 0x44 0x41 0x3b 0x39 0x3a 0x3c ,0x45 0x40 0x3f 0x39 0x45 0x45 0x43 0x42 ,
range:0x3a 0x38 0x3a 0x39 0x3c 0x39 0x3a 0x3a ,0x39 0x3b 0x3a 0x38 0x3b 0x3a 0x3a 0x3b ,
      0x39 0x39 0x37 0x35 0x36 0x38 0x37 0x37 ,0x39 0x39 0x39 0x38 0x39 0x38 0x38 0x36 ,
the write training result:
DQS0:0x5c, DQS1:0x55, DQS2:0x58, DQS3:0x45, 
min  :0x90 0x94 0x95 0x93 0x89 0x8d 0x8f 0x8f 0x8f ,0x87 0x88 0x83 0x82 0x8b 0x8c 0x8e 0x8e 0x87 ,
      0x8e 0x8e 0x8c 0x8b 0x85 0x84 0x86 0x8b 0x8a ,0x7d 0x7b 0x78 0x75 0x82 0x84 0x81 0x85 0x79 ,
mid  :0xac 0xaf 0xb0 0xad 0xa3 0xa8 0xaa 0xa9 0xa8 ,0xa3 0xa1 0x9d 0x9d 0xa6 0xa6 0xa7 0xa8 0xa1 ,
      0xaa 0xaa 0xa8 0xa6 0xa0 0x9c 0x9e 0xa3 0xa5 ,0x98 0x95 0x93 0x8f 0x9b 0x9e 0x99 0x9e 0x93 ,
max  :0xc8 0xca 0xcc 0xc7 0xbd 0xc3 0xc5 0xc3 0xc2 ,0xc0 0xbb 0xb8 0xb8 0xc1 0xc1 0xc1 0xc2 0xbb ,
      0xc7 0xc6 0xc4 0xc2 0xbb 0xb5 0xb7 0xbb 0xc0 ,0xb4 0xaf 0xaf 0xaa 0xb5 0xb8 0xb1 0xb7 0xae ,
range:0x38 0x36 0x37 0x34 0x34 0x36 0x36 0x34 0x33 ,0x39 0x33 0x35 0x36 0x36 0x35 0x33 0x34 0x34 ,
      0x39 0x38 0x38 0x37 0x36 0x31 0x31 0x30 0x36 ,0x37 0x34 0x37 0x35 0x33 0x34 0x30 0x32 0x35 ,
cs 1:
the read training result:
DQS0:0x3c, DQS1:0x3d, DQS2:0x43, DQS3:0x3b, 
min  : 0xd  0xd 0x10  0xb  0x1  0x3  0x8  0x1 , 0x8  0x5  0x4  0x1  0xb  0x8  0xc  0x6 ,
      0x10  0xf  0xe  0xc  0x6  0x1  0x5  0x5 , 0xf  0x6  0x9  0x1 0x10  0xe  0xe  0xd ,
mid  :0x29 0x2a 0x2c 0x29 0x1e 0x20 0x24 0x1f ,0x26 0x24 0x21 0x1e 0x28 0x26 0x2a 0x25 ,
      0x2f 0x2d 0x2b 0x29 0x23 0x1f 0x21 0x23 ,0x2b 0x25 0x26 0x1f 0x2c 0x2b 0x2b 0x2a ,
max  :0x46 0x47 0x49 0x47 0x3c 0x3e 0x41 0x3e ,0x44 0x44 0x3f 0x3c 0x46 0x45 0x49 0x45 ,
      0x4e 0x4c 0x48 0x47 0x40 0x3e 0x3e 0x42 ,0x48 0x45 0x44 0x3e 0x49 0x49 0x49 0x48 ,
range:0x39 0x3a 0x39 0x3c 0x3b 0x3b 0x39 0x3d ,0x3c 0x3f 0x3b 0x3b 0x3b 0x3d 0x3d 0x3f ,
      0x3e 0x3d 0x3a 0x3b 0x3a 0x3d 0x39 0x3d ,0x39 0x3f 0x3b 0x3d 0x39 0x3b 0x3b 0x3b ,
the write training result:
DQS0:0x5c, DQS1:0x55, DQS2:0x58, DQS3:0x45, 
min  :0x8f 0x91 0x92 0x90 0x86 0x8b 0x8c 0x8d 0x8d ,0x84 0x86 0x7f 0x7f 0x88 0x8a 0x8b 0x8b 0x85 ,
      0x8d 0x8c 0x8a 0x88 0x83 0x83 0x84 0x89 0x89 ,0x7d 0x7b 0x78 0x76 0x82 0x84 0x7f 0x85 0x7a ,
mid  :0xab 0xad 0xae 0xab 0xa1 0xa7 0xa8 0xa8 0xa7 ,0xa0 0xa0 0x9b 0x9a 0xa4 0xa3 0xa3 0xa5 0x9f ,
      0xa9 0xa8 0xa6 0xa4 0x9e 0x9b 0x9d 0xa1 0xa2 ,0x99 0x96 0x94 0x91 0x9c 0x9f 0x99 0x9f 0x94 ,
max  :0xc8 0xca 0xcb 0xc7 0xbd 0xc3 0xc5 0xc3 0xc1 ,0xbd 0xba 0xb7 0xb6 0xc0 0xbd 0xbc 0xc0 0xb9 ,
      0xc6 0xc5 0xc2 0xc1 0xba 0xb4 0xb6 0xba 0xbc ,0xb5 0xb2 0xb1 0xac 0xb7 0xbb 0xb4 0xba 0xaf ,
range:0x39 0x39 0x39 0x37 0x37 0x38 0x39 0x36 0x34 ,0x39 0x34 0x38 0x37 0x38 0x33 0x31 0x35 0x34 ,
      0x39 0x39 0x38 0x39 0x37 0x31 0x32 0x31 0x33 ,0x38 0x37 0x39 0x36 0x35 0x37 0x35 0x35 0x35 ,
CA Training result:
cs:0 min  :0x49 0x42 0x40 0x36 0x41 0x36 0x44 ,0x43 0x3f 0x3e 0x34 0x3f 0x32 0x43 ,
cs:0 mid  :0x84 0x84 0x7d 0x78 0x7c 0x79 0x70 ,0x7f 0x7e 0x7b 0x77 0x78 0x74 0x6f ,
cs:0 max  :0xbf 0xc6 0xba 0xba 0xb8 0xbd 0x9d ,0xbc 0xbe 0xb8 0xba 0xb1 0xb7 0x9b ,
cs:0 range:0x76 0x84 0x7a 0x84 0x77 0x87 0x59 ,0x79 0x7f 0x7a 0x86 0x72 0x85 0x58 ,
cs:1 min  :0x49 0x48 0x42 0x3d 0x44 0x3b 0x3a ,0x48 0x42 0x42 0x3b 0x41 0x36 0x3a ,
cs:1 mid  :0x85 0x87 0x7f 0x7c 0x7f 0x7b 0x71 ,0x83 0x83 0x80 0x7a 0x7b 0x78 0x71 ,
cs:1 max  :0xc2 0xc6 0xbc 0xbb 0xba 0xbc 0xa8 ,0xbf 0xc4 0xbe 0xb9 0xb6 0xba 0xa8 ,
cs:1 range:0x79 0x7e 0x7a 0x7e 0x76 0x81 0x6e ,0x77 0x82 0x7c 0x7e 0x75 0x84 0x6e ,
out
U-Boot SPL board init
U-Boot SPL 2017.09-g693c4cd017 #stephen (Apr 11 2022 - 15:40:03)
unknown raw ID phN
unrecognized JEDEC id bytes: 00, 00, 00
Trying to boot from MMC2
MMC error: The cmd index is 1, ret is -110
Card did not respond to voltage select!
mmc_init: -95, time 9
spl: mmc init failed with error: -95
Trying to boot from MMC1
## Verified-boot: 0
floion commented 2 years ago

cc @RadxaStephen

RadxaStephen commented 2 years ago

I reproduce the issue.

For normal boot log, it looks like

Trying to boot from MMC1
## Verified-boot: 0
## Checking atf-1 0x00040000 ... sha256(fe4f274c06...) + OK
## Checking uboot 0x00a00000 ... sha256(f47488c32c...) + OK
## Checking fdt 0x00b2f8d0 ... sha256(2154df9e4a...) + OK
## Checking atf-2 0x00068000 ... sha256(8d44036095...) + OK
## Checking atf-3 0xfdcd0000 ... sha256(e410275b51...) + OK
## Checking atf-4 0xfdcc9000 ... sha256(990c53fc01...) + OK
## Checking atf-5 0x00066000 ... sha256(315a4195a9...) + OK
Jumping to U-Boot(0x00a00000) via ARM Trusted Firmware(0x00040000)
Total: 213.990 ms
RadxaStephen commented 2 years ago

Check u-boot.itb generated via yocto.

./mkimage -l u-boot.itb
FIT description: FIT Image with ATF/OP-TEE/U-Boot
Created:         Mon Jul 18 12:21:31 2022
 Image 0 (uboot)
  Description:  U-Boot(64-bit)
  Created:      Mon Jul 18 12:21:31 2022
  Type:         Standalone Program
  Compression:  uncompressed
  Data Size:    1242456 Bytes = 1213.34 KiB = 1.18 MiB
  Architecture: AArch64
  Load Address: 0x00000000
  Entry Point:  unavailable
  Hash algo:    sha256
  Hash value:   bdda5310a9ec87687a5b1418b9a98cb734ed13d9009776dd8285198dbe9cb50d
 Image 1 (fdt)
  Description:  U-Boot dtb
  Created:      Mon Jul 18 12:21:31 2022
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    14290 Bytes = 13.96 KiB = 0.01 MiB
  Architecture: ARM
  Hash algo:    sha256
  Hash value:   2154df9e4ad3e777a219301ce4814189784e8fe28ca1866e15fc1b460888cf13
 Default Configuration: 'conf'
 Configuration 0 (conf)
  Description:  rk3566-radxa-cm3-io
  Kernel:       unavailable
  Firmware:     atf-1
  FDT:          fdt
  Loadables:    uboot
RadxaStephen commented 2 years ago

Check u-boot.itb in Radxa CM3 IO Debian.

./mkimage -l u-boot.itb
FIT description: FIT image for U-Boot with bl31 (TF-A)
Created:         Mon Jul 18 21:47:00 2022
 Image 0 (uboot)
  Description:  U-Boot (64-bit)
  Created:      Mon Jul 18 21:47:00 2022
  Type:         Standalone Program
  Compression:  uncompressed
  Data Size:    1211920 Bytes = 1183.52 KiB = 1.16 MiB
  Architecture: AArch64
  Load Address: 0x00a00000
  Entry Point:  unavailable
 Image 1 (atf_1)
  Description:  ARM Trusted Firmware
  Created:      Mon Jul 18 21:47:00 2022
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    155648 Bytes = 152.00 KiB = 0.15 MiB
  Architecture: AArch64
  Load Address: 0x00040000
 Image 2 (atf_2)
  Description:  ARM Trusted Firmware
  Created:      Mon Jul 18 21:47:00 2022
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    7668 Bytes = 7.49 KiB = 0.01 MiB
  Architecture: AArch64
  Load Address: 0x00066000
 Image 3 (atf_3)
  Description:  ARM Trusted Firmware
  Created:      Mon Jul 18 21:47:00 2022
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    19531 Bytes = 19.07 KiB = 0.02 MiB
  Architecture: AArch64
  Load Address: 0x00068000
 Image 4 (atf_4)
  Description:  ARM Trusted Firmware
  Created:      Mon Jul 18 21:47:00 2022
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    8192 Bytes = 8.00 KiB = 0.01 MiB
  Architecture: AArch64
  Load Address: 0xfdcc9000
 Image 5 (atf_5)
  Description:  ARM Trusted Firmware
  Created:      Mon Jul 18 21:47:00 2022
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    8192 Bytes = 8.00 KiB = 0.01 MiB
  Architecture: AArch64
  Load Address: 0xfdcd0000
 Image 6 (fdt_1)
  Description:  rk3566-radxa-cm3-io.dtb
  Created:      Mon Jul 18 21:47:00 2022
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    92000 Bytes = 89.84 KiB = 0.09 MiB
  Architecture: Unknown Architecture
 Default Configuration: 'config_1'
 Configuration 0 (config_1)
  Description:  rk3566-radxa-cm3-io.dtb
  Kernel:       unavailable
  Firmware:     atf_1
  FDT:          fdt_1
  Loadables:    uboot
                atf_2
                atf_3
                atf_4
                atf_5
RadxaYuntian commented 2 years ago

Maybe we can add mainline U-Boot to yocto as a backup before we figure out what was wrong here?