MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.88k stars 497 forks source link

Odroid N2 Plus: Boot loop when attached USB storage NOT ready #7168

Closed Tin-Bui closed 3 months ago

Tin-Bui commented 3 months ago

Creating a bug report/issue

Required Information

Expected behaviour

u-boot proceed to boot from mmc after detecting USB storage not ready.

Actual behaviour

Boot loop when detecting USB storage NOT ready

Extra details

I manually got around the issue by: 1 .Hit any key to interrup the boot process

  1. Change the boot_target environment variable: setenv boot_targets 'mmc0 mmc1 mmc2 romusb usb0 pxe dhcp'
  2. => boot : succesful. But this require interruption on every boot. Is there anyway to change and persist the boot_target environment variable?

See output from the boot process:

G12B:BL:6e7c85:2a3b91;FEAT:E0F83180:402000;POC:F;RCY:0;EMMC:800;NAND:81;SD?:0;SD:0;READ:0;0.▒!,K▒▒х▒▒}▒▒▒с0x01
bl2_stage_init 0x81
hw id: 0x0000 - pwm id 0x01
bl2_stage_init 0xc1
bl2_stage_init 0x02

no sdio debug board detected
L0:00000000
L1:00000703
L2:0000c067
L3:14000020
B2:00402000
B1:e0f83180

TE: 153057

BL2 Built : 06:17:13, Jun 28 2019. g12b gf0505d7-dirty - qi.duan@droid13

Board ID = 5
Set A53 clk to 24M
Set A73 clk to 24M
Set clk81 to 24M
A53 clk: 1200 MHz
A73 clk: 1200 MHz
CLK81: 166.6M
smccc: 00029e15
DDR driver_vesion: LPDDR4_PHY_V_0_1_14 build time: Jun 28 2019 06:17:09
board id: 5
Load FIP HDR from SD, src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0
fw parse done
Load ddrfw from SD, src: 0x00060200, des: 0xfffd0000, size: 0x0000c000, part: 0
Load ddrfw from SD, src: 0x00038200, des: 0xfffd0000, size: 0x00004000, part: 0
PIEI prepare done
fastboot data load
fastboot data verify
verify result: 255
Cfg max: 2, cur: 1. Board id: 255. Force loop cfg
DDR4 probe
ddr clk to 1320MHz
Load ddrfw from SD, src: 0x00014200, des: 0xfffd0000, size: 0x0000c000, part: 0
Check phy result
INFO : End of initialization
INFO : End of read enable training
INFO : End of fine write leveling
INFO : End of read dq deskew training
INFO : End of MPR read delay center optimization
INFO : End of Write leveling coarse delay
INFO : End of write delay center optimization
INFO : End of read delay center optimization
INFO : End of max read latency training
INFO : Training has run successfully!
1D training succeed
Load ddrfw from SD, src: 0x00020200, des: 0xfffd0000, size: 0x0000c000, part: 0
Check phy result
INFO : End of initialization
INFO : End of 2D read delay Voltage center optimization
INFO : End of 2D write delay Voltage center optimization
INFO : Training has run successfully!

R0_RxClkDly_Margin==70 ps 6
R0_TxDqDly_Margi==118 ps 10

R1_RxClkDly_Margin==0 ps 0
R1_TxDqDly_Margi==0 ps 0

 dwc_ddrphy_apb_wr((0<<20)|(2<<16)|(0<<12)|(0xb0):0001
2D training succeed
auto size-- 65535DDR cs0 size: 2048MB
DDR cs1 size: 2048MB
DMC_DDR_CTRL: 00600024DDR size: 3928MB
cs0 DataBus test pass
cs1 DataBus test pass
cs0 AddrBus test pass
cs1 AddrBus test pass
 pre test  bdlr_100_average==407 bdlr_100_min==407 bdlr_100_max==407 bdlr_100_cur==407
 aft test  bdlr_100_average==407 bdlr_100_min==407 bdlr_100_max==407 bdlr_100_cur==407
non-sec scramble use zero key
ddr scramble enabled

100bdlr_step_size ps== 407
result report
boot times 3Enable ddr reg access
Load FIP HDR from SD, src: 0x00010200, des: 0x01700000, size: 0x00004000, part: 0
Load BL3X from SD, src: 0x0006c200, des: 0x0175c000, size: 0x0009aa00, part: 0
0.0;M3 CHK:0;cm4_sp_mode 0
E30HDR
MVN_1=0x00000000
MVN_2=0x00000000
[Image: g12b_v1.1.3375-8f9c8a7 2019-01-24 10:44:46 guotai.shen@droid11-sz]
OPS=0x40
ring efuse init
chipver efuse init
29 0c 40 00 01 26 14 00 00 17 30 33 32 58 33 50
[3.746986 Inits done]
secure task start!
high task start!
low task start!
run into bl31
NOTICE:  BL31: v1.3(release):ab8811b
NOTICE:  BL31: Built : 15:03:31, Feb 12 2019
NOTICE:  BL31: G12A normal boot!
NOTICE:  BL31: BL33 decompress pass
ERROR:   Error initializing runtime service opteed_fast

<debug_uart>
serial_meson serial@3000: pincu

U-Boot 2022.10-armbian (May 19 2024 - 19:20:08 +0000) odroid-n2/n2-plus

Model: Hardkernel ODROID-N2
SoC:   Amlogic Meson G12B (S922X) Revision 29:c (40:2)
DRAM:  3.8 GiB
Core:  388 devices, 27 uclasses, devicetree: separate
MMC:   sd@ffe05000: 0, mmc@ffe07000: 1
Loading Environment from nowhere... OK
In:    serial
Out:   serial
Err:   serial
Board variant: n2-plus
Net:   dwmac_meson8b ethernet@ff3f0000: Can't get reset: -2
eth0: ethernet@ff3f0000
Hit any key to stop autoboot:  0
starting USB...
Bus usb@ff500000: Register 3000140 NbrPorts 3
Starting the controller
USB XHCI 1.10
scanning bus usb@ff500000 for devices... Device NOT ready
   Request Sense returned 02 04 01
"Synchronous Abort" handler, esr 0x96000010
elr: 0000000001069414 lr : 0000000001002c54 (reloc)
elr: 00000000f2fae414 lr : 00000000f2f47c54
x0 : 00000000f2fbf1f2 x1 : 0000000005100010
x2 : 0000000005100090 x3 : 0000000005100090
x4 : 000000000528e430 x5 : 00000000f0f2d82c
x6 : 0000000000000000 x7 : 000000000528f060
x8 : 0000000000000424 x9 : 0000000000000008
x10: 00000000ffffffd0 x11: 0000000000000008
x12: 0000000000010000 x13: 0000000000000001
x14: 00000000f0f2dc60 x15: 0000000000000001
x16: 00000000f2f78fcc x17: 0000000000000000
x18: 00000000f0f42db0 x19: 00000000051000b0
x20: 000000000528e478 x21: 00000000f2fbf1f2
x22: 000000000528ebb8 x23: 000000000529b8a0
x24: 0000000000000001 x25: 0000000000000008
x26: 00000000ffffffff x27: 00000000ffffffc8
x28: 000000000528ebdb x29: 0000000005100000

Code: b9004fff a90693e3 a9430fe2 a9010fe2 (a9440fe2)
Resetting CPU ...

resetting ...
bl31 reboot reason: 0xd
bl31 reboot reason: 0x0
system cmd  1.
G12B:BL:6e7c85:2a3b91;FEAT:E0F83180:402000;POC:F;RCY:0;EMMC:800;NAND:81;SD?:0;SD:0;READ:0;0.
bl2_stage_init 0x01
bl2_stage_init 0x81
hw id: 0x0000 - pwm id 0x01
bl2_stage_init 0xc1
bl2_stage_init 0x02

no sdio debug board detected
L0:00000000
L1:00000703
L2:0000c067
L3:14000020
B2:00402000
B1:e0f83180

TE: 152858

BL2 Built : 06:17:13, Jun 28 2019. g12b gf0505d7-dirty - qi.duan@droid13

Board ID = 5
Set A53 clk to 24M
Set A73 clk to 24M
Set clk81 to 24M
A53 clk: 1200 MHz
A73 clk: 1200 MHz
CLK81: 166.6M
smccc: 00029d4e
DDR driver_vesion: LPDDR4_PHY_V_0_1_14 build time: Jun 28 2019 06:17:09
board id: 5
Load FIP HDR from SD, src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0
fw parse done
Load ddrfw from SD, src: 0x00060200, des: 0xfffd0000, size: 0x0000c000, part: 0
Load ddrfw from SD, src: 0x00038200, des: 0xfffd0000, size: 0x00004000, part: 0
PIEI prepare done
fastboot data load
fastboot data verify
verify result: 255
Cfg max: 2, cur: 1. Board id: 255. Force loop cfg
DDR4 probe
ddr clk to 1320MHz
Load ddrfw from SD, src: 0x00014200, des: 0xfffd0000, size: 0x0000c000, part: 0
Check phy result
INFO : End of initialization
INFO : End of read enable training
INFO : End of fine write leveling
INFO : End of read dq deskew training
INFO : End of MPR read delay center optimization
INFO : End of Write leveling coarse delay
INFO : End of write delay center optimization
INFO : End of read delay center optimization
INFO : End of max read latency training
INFO : Training has run successfully!
1D training succeed
Load ddrfw from SD, src: 0x00020200, des: 0xfffd0000, size: 0x0000c000, part: 0
Check phy result
INFO : End of initialization
INFO : End of 2D read delay Voltage center optimization
INFO : End of 2D write delay Voltage center optimization
INFO : Training has run successfully!

R0_RxClkDly_Margin==70 ps 6
R0_TxDqDly_Margi==118 ps 10

R1_RxClkDly_Margin==0 ps 0
R1_TxDqDly_Margi==0 ps 0

 dwc_ddrphy_apb_wr((0<<20)|(2<<16)|(0<<12)|(0xb0):0001
2D training succeed
auto size-- 65535DDR cs0 size: 2048MB
DDR cs1 size: 2048MB
DMC_DDR_CTRL: 00600024DDR size: 3928MB
cs0 DataBus test pass
cs1 DataBus test pass
cs0 AddrBus test pass
cs1 AddrBus test pass
 pre test  bdlr_100_average==407 bdlr_100_min==407 bdlr_100_max==407 bdlr_100_cur==407
 aft test  bdlr_100_average==407 bdlr_100_min==407 bdlr_100_max==407 bdlr_100_cur==407
non-sec scramble use zero key
ddr scramble enabled

100bdlr_step_size ps== 398
result report
boot times 4Enable ddr reg access
Load FIP HDR from SD, src: 0x00010200, des: 0x01700000, size: 0x00004000, part: 0
Load BL3X from SD, src: 0x0006c200, des: 0x0175c000, size: 0x0009aa00, part: 0
0.0;M3 CHK:0;cm4_sp_mode 0
E30HDR
MVN_1=0x00000000
MVN_2=0x00000000
[Image: g12b_v1.1.3375-8f9c8a7 2019-01-24 10:44:46 guotai.shen@droid11-sz]
OPS=0x40
ring efuse init
chipver efuse init
29 0c 40 00 01 26 14 00 00 17 30 33 32 58 33 50
[3.746218 Inits done]
secure task start!
high task start!
low task start!
run into bl31
NOTICE:  BL31: v1.3(release):ab8811b
NOTICE:  BL31: Built : 15:03:31, Feb 12 2019
NOTICE:  BL31: G12A normal boot!
NOTICE:  BL31: BL33 decompress pass
ERROR:   Error initializing runtime service opteed_fast

<debug_uart>
serial_meson serial@3000: pincu

U-Boot 2022.10-armbian (May 19 2024 - 19:20:08 +0000) odroid-n2/n2-plus

Model: Hardkernel ODROID-N2
SoC:   Amlogic Meson G12B (S922X) Revision 29:c (40:2)
DRAM:  3.8 GiB
Core:  388 devices, 27 uclasses, devicetree: separate
MMC:   sd@ffe05000: 0, mmc@ffe07000: 1
Loading Environment from nowhere... OK
In:    serial
Out:   serial
Err:   serial
Board variant: n2-plus
Net:   dwmac_meson8b ethernet@ff3f0000: Can't get reset: -2
eth0: ethernet@ff3f0000
Hit any key to stop autoboot:  0
starting USB...
Bus usb@ff500000: Register 3000140 NbrPorts 3
Starting the controller
USB XHCI 1.10
scanning bus usb@ff500000 for devices... Device NOT ready
   Request Sense returned 02 04 01
"Synchronous Abort" handler, esr 0x96000010
"Synchronous Abort" handler, esr 0x96000010
elr: 0000000001002a48 lr : 0000000001002c5c (reloc)
elr: 00000000f2f47a48 lr : 00000000f2f47c5c
x0 : 00000000050fffb0 x1 : 0000000000004383
x2 : 00000000f2f78078 x3 : 000000000000003f
x4 : 00000000f0f548c0 x5 : 0000000000000000
x6 : 0000000000000000 x7 : 0000000000c0c0c0
x8 : 0000000000000424 x9 : 0000000000000008
x10: 00000000ffffffd0 x11: 0000000000000010
x12: 0000000000010000 x13: 0000000000000001
x14: 00000000f0f2dc60 x15: 0000000000000021
x16: 00000000f2f79f98 x17: 0000000000000000
x18: 00000000f0f42db0 x19: 00000000050fffb0
x20: 00000000052ad638 x21: 00000000f2fbf1f2
x22: 00000000052add78 x23: 00000000052afb60
x24: 0000000000000001 x25: 0000000000000008
x26: 00000000ffffffff x27: 00000000ffffffc8
x28: 00000000052add9b x29: 00000000050fff50

Code: a9025bf5 f9001bf7 f9400641 36000141 (f9408663)
Resetting CPU ...

resetting ...
bl31 reboot reason: 0xd
bl31 reboot reason: 0x0
system cmd  1.
G12B:BL:6e7c85:2a3b91;FEAT:E0F83180:402000;POC:F;RCY:0;EMMC:800;NAND:81;SD?:0;SD:0;READ:0;0.
bl2_stage_init 0x01
bl2_stage_init 0x81
hw id: 0x0000 - pwm id 0x01
bl2_stage_init 0xc1
bl2_stage_init 0x02

no sdio debug board detected
L0:00000000
L1:00000703
L2:0000c067
L3:14000020
B2:00402000
B1:e0f83180

TE: 152226

BL2 Built : 06:17:13, Jun 28 2019. g12b gf0505d7-dirty - qi.duan@droid13

Board ID = 5
Set A53 clk to 24M
Set A73 clk to 24M
Set clk81 to 24M
A53 clk: 1200 MHz
A73 clk: 1200 MHz
CLK81: 166.6M
smccc: 00029ad5
DDR driver_vesion: LPDDR4_PHY_V_0_1_14 build time: Jun 28 2019 06:17:09
board id: 5
Load FIP HDR from SD, src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0
fw parse done
Load ddrfw from SD, src: 0x00060200, des: 0xfffd0000, size: 0x0000c000, part: 0
Load ddrfw from SD, src: 0x00038200, des: 0xfffd0000, size: 0x00004000, part: 0
PIEI prepare done
fastboot data load
fastboot data verify
verify result: 255
Cfg max: 2, cur: 1. Board id: 255. Force loop cfg
DDR4 probe
ddr clk to 1320MHz
Load ddrfw from SD, src: 0x00014200, des: 0xfffd0000, size: 0x0000c000, part: 0
Check phy result
INFO : End of initialization
INFO : End of read enable training
INFO : End of fine write leveling
INFO : End of read dq deskew training
INFO : End of MPR read delay center optimization
INFO : End of Write leveling coarse delay
INFO : End of write delay center optimization
INFO : End of read delay center optimization
INFO : End of max read latency training
INFO : Training has run successfully!
1D training succeed
Load ddrfw from SD, src: 0x00020200, des: 0xfffd0000, size: 0x0000c000, part: 0
Check phy result
INFO : End of initialization
INFO : End of 2D read delay Voltage center optimization
INFO : End of 2D write delay Voltage center optimization
INFO : Training has run successfully!

R0_RxClkDly_Margin==82 ps 7
R0_TxDqDly_Margi==118 ps 10

R1_RxClkDly_Margin==0 ps 0
R1_TxDqDly_Margi==0 ps 0

 dwc_ddrphy_apb_wr((0<<20)|(2<<16)|(0<<12)|(0xb0):0001
2D training succeed
auto size-- 65535DDR cs0 size: 2048MB
DDR cs1 size: 2048MB
DMC_DDR_CTRL: 00600024DDR size: 3928MB
cs0 DataBus test pass
cs1 DataBus test pass
cs0 AddrBus test pass
cs1 AddrBus test pass
 pre test  bdlr_100_average==407 bdlr_100_min==407 bdlr_100_max==407 bdlr_100_cur==407
 aft test  bdlr_100_average==407 bdlr_100_min==407 bdlr_100_max==407 bdlr_100_cur==407
non-sec scramble use zero key
ddr scramble enabled

100bdlr_step_size ps== 407
result report
boot times 5Enable ddr reg access
Load FIP HDR from SD, src: 0x00010200, des: 0x01700000, size: 0x00004000, part: 0
Load BL3X from SD, src: 0x0006c200, des: 0x0175c000, size: 0x0009aa00, part: 0
0.0;M3 CHK:0;cm4_sp_mode 0
E30HDR
MVN_1=0x00000000
MVN_2=0x00000000
[Image: g12b_v1.1.3375-8f9c8a7 2019-01-24 10:44:46 guotai.shen@droid11-sz]
OPS=0x40
ring efuse init
chipver efuse init
29 0c 40 00 01 26 14 00 00 17 30 33 32 58 33 50
[3.746311 Inits done]
secure task start!
high task start!
low task start!
run into bl31
NOTICE:  BL31: v1.3(release):ab8811b
NOTICE:  BL31: Built : 15:03:31, Feb 12 2019
NOTICE:  BL31: G12A normal boot!
NOTICE:  BL31: BL33 decompress pass
ERROR:   Error initializing runtime service opteed_fast

<debug_uart>
serial_meson serial@3000: pincu

U-Boot 2022.10-armbian (May 19 2024 - 19:20:08 +0000) odroid-n2/n2-plus

Model: Hardkernel ODROID-N2
SoC:   Amlogic Meson G12B (S922X) Revision 29:c (40:2)
DRAM:  3.8 GiB
Core:  388 devices, 27 uclasses, devicetree: separate
MMC:   sd@ffe05000: 0, mmc@ffe07000: 1
Loading Environment from nowhere... OK
In:    serial
Out:   serial
Err:   serial
Board variant: n2-plus
Net:   dwmac_meson8b ethernet@ff3f0000: Can't get reset: -2
eth0: ethernet@ff3f0000
Hit any key to stop autoboot:  0
=> setenv boot_targets 'mmc0 mmc1 mmc2 romusb usb0 pxe dhcp'
=> boot
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot/boot.scr
2999 bytes read in 3 ms (975.6 KiB/s)
## Executing script at 08000000
306 bytes read in 4 ms (74.2 KiB/s)
27496960 bytes read in 2481 ms (10.6 MiB/s)
13650089 bytes read in 1239 ms (10.5 MiB/s)
80112 bytes read in 15 ms (5.1 MiB/s)
## Loading init Ramdisk from Legacy Image at 13000000 ...
   Image Name:   uInitrd
   Image Type:   AArch64 Linux RAMDisk Image (gzip compressed)
   Data Size:    13650025 Bytes = 13 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 04080000
   Booting using the fdt blob at 0x4080000
   Loading Ramdisk to 3f2fb000, end 3ffff869 ... OK
   Loading Device Tree to 000000003f2e4000, end 000000003f2fa8ef ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 6.6.37-current-meson64 (armbian@next) (aarch64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #1 SMP PREEMPT Fri Jul  5 07:34:07 UTC 2024
[    0.000000] Machine model: Hardkernel ODROID-N2Plus
[    0.000000] efi: UEFI not found.
[    0.000000] Reserved memory: created CMA memory pool at 0x00000000e4c00000, size 256 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] OF: reserved mem: 0x00000000e4c00000..0x00000000f4bfffff (262144 KiB) map reusable linux,cma
[    0.000000] OF: reserved mem: 0x0000000005000000..0x00000000052fffff (3072 KiB) nomap non-reusable secmon@5000000
[    0.000000] OF: reserved mem: 0x0000000005300000..0x00000000072fffff (32768 KiB) nomap non-reusable secmon@5300000
MichaIng commented 3 months ago

Thanks for reporting.

You you boot via SPI bootloader or MMC?

MichaIng commented 3 months ago

In my case, I just tested it with an old little USB 2.0 stick. When using the MMC bootloader, all works fine. When using the SPI bootloader (I flashed the latest one from linux-u-boot-current-odroidn2), I get an error on first attempt, but it works on 2nd:

G12B:BL:6e7c85:2a3b91;FEAT:E0F83180:402000;POC:F;RCY:0;EMMC:0;READ:0;0.▒!,K▒▒х▒▒}▒▒▒с0x01
bl2_stage_init 0x81
hw id: 0x0000 - pwm id 0x01
bl2_stage_init 0xc1
bl2_stage_init 0x02

L0:00000000
L1:00000703
L2:0000c067
L3:14000020
B2:00402000
B1:e0f83180

TE: 84167

BL2 Built : 06:17:13, Jun 28 2019. g12b gf0505d7-dirty - qi.duan@droid13

Board ID = 5
Set A53 clk to 24M
Set A73 clk to 24M
Set clk81 to 24M
A53 clk: 1200 MHz
A73 clk: 1200 MHz
CLK81: 166.6M
smccc: 000190a2
eMMC boot @ 0
sw8 s
DDR driver_vesion: LPDDR4_PHY_V_0_1_14 build time: Jun 28 2019 06:17:09
board id: 5
Load FIP HDR from eMMC, src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0
fw parse done
Load ddrfw from eMMC, src: 0x00060200, des: 0xfffd0000, size: 0x0000c000, part: 0
Load ddrfw from eMMC, src: 0x00038200, des: 0xfffd0000, size: 0x00004000, part: 0
PIEI prepare done
fastboot data load
00000000
emmc switch 1 ok
00000000
emmc switch 2 ok
fastboot data verify
verify result: 255
Cfg max: 2, cur: 1. Board id: 255. Force loop cfg
DDR4 probe
ddr clk to 1320MHz
Load ddrfw from eMMC, src: 0x00014200, des: 0xfffd0000, size: 0x0000c000, part: 0
00000000
emmc switch 0 ok
Check phy result
INFO : End of initialization
INFO : End of read enable training
INFO : End of fine write leveling
INFO : End of read dq deskew training
INFO : End of MPR read delay center optimization
INFO : End of Write leveling coarse delay
INFO : End of write delay center optimization
INFO : End of read delay center optimization
INFO : End of max read latency training
INFO : Training has run successfully!
1D training succeed
Load ddrfw from eMMC, src: 0x00020200, des: 0xfffd0000, size: 0x0000c000, part: 0
Check phy result
INFO : End of initialization
INFO : End of 2D read delay Voltage center optimization
INFO : End of 2D write delay Voltage center optimization
INFO : Training has run successfully!

R0_RxClkDly_Margin==94 ps 8
R0_TxDqDly_Margi==118 ps 10

R1_RxClkDly_Margin==0 ps 0
R1_TxDqDly_Margi==0 ps 0

 dwc_ddrphy_apb_wr((0<<20)|(2<<16)|(0<<12)|(0xb0):0001
2D training succeed
auto size-- 65535DDR cs0 size: 2048MB
DDR cs1 size: 2048MB
DMC_DDR_CTRL: 00600024DDR size: 3928MB
cs0 DataBus test pass
cs1 DataBus test pass
cs0 AddrBus test pass
cs1 AddrBus test pass
 pre test  bdlr_100_average==440 bdlr_100_min==440 bdlr_100_max==440 bdlr_100_cur==440
 aft test  bdlr_100_average==440 bdlr_100_min==440 bdlr_100_max==440 bdlr_100_cur==440
non-sec scramble use zero key
ddr scramble enabled

100bdlr_step_size ps== 430
result report
boot times 2Enable ddr reg access
00000000
emmc switch 3 ok
Authentication key not yet programmed
get rpmb counter error 0x00000007
00000000
emmc switch 0 ok
Load FIP HDR from eMMC, src: 0x00010200, des: 0x01700000, size: 0x00004000, part: 0
Load BL3X from eMMC, src: 0x0006c200, des: 0x0175c000, size: 0x0009aa00, part: 0
0.0;M3 CHK:0;cm4_sp_mode 0
E30HDR
MVN_1=0x00000000
MVN_2=0x00000000
[Image: g12b_v1.1.3375-8f9c8a7 2019-01-24 10:44:46 guotai.shen@droid11-sz]
OPS=0x40
ring efuse init
chipver efuse init
29 0c 40 00 01 17 16 00 00 03 32 33 32 58 33 50
[3.579735 Inits done]
secure task start!
high task start!
low task start!
run into bl31
NOTICE:  BL31: v1.3(release):ab8811b
NOTICE:  BL31: Built : 15:03:31, Feb 12 2019
NOTICE:  BL31: G12A normal boot!
NOTICE:  BL31: BL33 decompress pass
ERROR:   Error initializing runtime service opteed_fast

<debug_uart>
serial_meson serial@3000: pincu

U-Boot 2022.10-armbian (May 19 2024 - 19:20:08 +0000) odroid-n2/n2-plus

Model: Hardkernel ODROID-N2
SoC:   Amlogic Meson G12B (S922X) Revision 29:c (40:2)
DRAM:  3.8 GiB
Core:  388 devices, 27 uclasses, devicetree: separate
MMC:   sd@ffe05000: 0, mmc@ffe07000: 1
Loading Environment from nowhere... OK
In:    serial
Out:   serial
Err:   serial
Board variant: n2-plus
Net:   dwmac_meson8b ethernet@ff3f0000: Can't get reset: -2
eth0: ethernet@ff3f0000
Hit any key to stop autoboot:  0
starting USB...
Bus usb@ff500000: Register 3000140 NbrPorts 3
Starting the controller
USB XHCI 1.10
scanning bus usb@ff500000 for devices... WARN halted endpoint, queueing URB anyway.
Unexpected XHCI event TRB, skipping... (f0f719a0 00000000 13000000 04008400)
BUG at drivers/usb/host/xhci-ring.c:530/abort_td()!
BUG!
resetting ...
bl31 reboot reason: 0xd
bl31 reboot reason: 0x0
system cmd  1.
G12B:BL:6e7c85:2a3b91;FEAT:E0F83180:402000;POC:F;RCY:0;EMMC:0;READ:0;0.
bl2_stage_init 0x01
bl2_stage_init 0x81
hw id: 0x0000 - pwm id 0x01
bl2_stage_init 0xc1
bl2_stage_init 0x02

L0:00000000
L1:00000703
L2:0000c067
L3:14000020
B2:00402000
B1:e0f83180

TE: 144400

BL2 Built : 06:17:13, Jun 28 2019. g12b gf0505d7-dirty - qi.duan@droid13

Board ID = 5
Set A53 clk to 24M
Set A73 clk to 24M
Set clk81 to 24M
A53 clk: 1200 MHz
A73 clk: 1200 MHz
CLK81: 166.6M
smccc: 00027c44
eMMC boot @ 0
sw8 s
DDR driver_vesion: LPDDR4_PHY_V_0_1_14 build time: Jun 28 2019 06:17:09
board id: 5
Load FIP HDR from eMMC, src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0
fw parse done
Load ddrfw from eMMC, src: 0x00060200, des: 0xfffd0000, size: 0x0000c000, part: 0
Load ddrfw from eMMC, src: 0x00038200, des: 0xfffd0000, size: 0x00004000, part: 0
PIEI prepare done
fastboot data load
00000000
emmc switch 1 ok
00000000
emmc switch 2 ok
fastboot data verify
verify result: 255
Cfg max: 2, cur: 1. Board id: 255. Force loop cfg
DDR4 probe
ddr clk to 1320MHz
Load ddrfw from eMMC, src: 0x00014200, des: 0xfffd0000, size: 0x0000c000, part: 0
00000000
emmc switch 0 ok
Check phy result
INFO : End of initialization
INFO : End of read enable training
INFO : End of fine write leveling
INFO : End of read dq deskew training
INFO : End of MPR read delay center optimization
INFO : End of Write leveling coarse delay
INFO : End of write delay center optimization
INFO : End of read delay center optimization
INFO : End of max read latency training
INFO : Training has run successfully!
1D training succeed
Load ddrfw from eMMC, src: 0x00020200, des: 0xfffd0000, size: 0x0000c000, part: 0
Check phy result
INFO : End of initialization
INFO : End of 2D read delay Voltage center optimization
INFO : End of 2D write delay Voltage center optimization
INFO : Training has run successfully!

R0_RxClkDly_Margin==94 ps 8
R0_TxDqDly_Margi==118 ps 10

R1_RxClkDly_Margin==0 ps 0
R1_TxDqDly_Margi==0 ps 0

 dwc_ddrphy_apb_wr((0<<20)|(2<<16)|(0<<12)|(0xb0):0001
2D training succeed
auto size-- 65535DDR cs0 size: 2048MB
DDR cs1 size: 2048MB
DMC_DDR_CTRL: 00600024DDR size: 3928MB
cs0 DataBus test pass
cs1 DataBus test pass
cs0 AddrBus test pass
cs1 AddrBus test pass
 pre test  bdlr_100_average==435 bdlr_100_min==435 bdlr_100_max==435 bdlr_100_cur==435
 aft test  bdlr_100_average==435 bdlr_100_min==435 bdlr_100_max==435 bdlr_100_cur==435
non-sec scramble use zero key
ddr scramble enabled

100bdlr_step_size ps== 435
result report
boot times 3Enable ddr reg access
00000000
emmc switch 3 ok
Authentication key not yet programmed
get rpmb counter error 0x00000007
00000000
emmc switch 0 ok
Load FIP HDR from eMMC, src: 0x00010200, des: 0x01700000, size: 0x00004000, part: 0
Load BL3X from eMMC, src: 0x0006c200, des: 0x0175c000, size: 0x0009aa00, part: 0
0.0;M3 CHK:0;cm4_sp_mode 0
E30HDR
MVN_1=0x00000000
MVN_2=0x00000000
[Image: g12b_v1.1.3375-8f9c8a7 2019-01-24 10:44:46 guotai.shen@droid11-sz]
OPS=0x40
ring efuse init
chipver efuse init
29 0c 40 00 01 17 16 00 00 03 32 33 32 58 33 50
[3.640432 Inits done]
secure task start!
high task start!
low task start!
run into bl31
NOTICE:  BL31: v1.3(release):ab8811b
NOTICE:  BL31: Built : 15:03:31, Feb 12 2019
NOTICE:  BL31: G12A normal boot!
NOTICE:  BL31: BL33 decompress pass
ERROR:   Error initializing runtime service opteed_fast

<debug_uart>
serial_meson serial@3000: pincu

U-Boot 2022.10-armbian (May 19 2024 - 19:20:08 +0000) odroid-n2/n2-plus

Model: Hardkernel ODROID-N2
SoC:   Amlogic Meson G12B (S922X) Revision 29:c (40:2)
DRAM:  3.8 GiB
Core:  388 devices, 27 uclasses, devicetree: separate
MMC:   sd@ffe05000: 0, mmc@ffe07000: 1
Loading Environment from nowhere... OK
In:    serial
Out:   serial
Err:   serial
Board variant: n2-plus
Net:   dwmac_meson8b ethernet@ff3f0000: Can't get reset: -2
eth0: ethernet@ff3f0000
Hit any key to stop autoboot:  0
starting USB...
Bus usb@ff500000: Register 3000140 NbrPorts 3
Starting the controller
USB XHCI 1.10
scanning bus usb@ff500000 for devices... usb_new_device: Cannot read configuration, skipping device 058f:6387
4 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found

Device 0: unknown device
Card did not respond to voltage select! : -110
switch to partitions #0, OK
mmc1(part 0) is current device
Scanning mmc 1:1...
Found U-Boot script /boot/boot.scr
2967 bytes read in 1 ms (2.8 MiB/s)
## Executing script at 08000000
288 bytes read in 1 ms (281.3 KiB/s)
Unknown command 'ini' - try 'help'
27496960 bytes read in 1250 ms (21 MiB/s)
13650867 bytes read in 621 ms (21 MiB/s)
80112 bytes read in 7 ms (10.9 MiB/s)
576 bytes read in 4 ms (140.6 KiB/s)
Applying kernel provided DT overlay meson-g12b-odroid-n2-spi.dtbo
232 bytes read in 3 ms (75.2 KiB/s)
Applying kernel provided DT fixup script meson-fixup.scr
## Executing script at 32000000
## Loading init Ramdisk from Legacy Image at 13000000 ...
   Image Name:   uInitrd
   Image Type:   AArch64 Linux RAMDisk Image (gzip compressed)
   Data Size:    13650803 Bytes = 13 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 04080000
   Booting using the fdt blob at 0x4080000
   Loading Ramdisk to 3f2fb000, end 3ffffb73 ... OK
   Loading Device Tree to 000000003f27f000, end 000000003f2fafff ... OK

Starting kernel ...

Here the first reset, which differs form your's and indicates an error in the driver:

starting USB...
Bus usb@ff500000: Register 3000140 NbrPorts 3
Starting the controller
USB XHCI 1.10
scanning bus usb@ff500000 for devices... WARN halted endpoint, queueing URB anyway.
Unexpected XHCI event TRB, skipping... (f0f719a0 00000000 13000000 04008400)
BUG at drivers/usb/host/xhci-ring.c:530/abort_td()!
BUG!
resetting ...

On next attempt, it works:

starting USB...
Bus usb@ff500000: Register 3000140 NbrPorts 3
Starting the controller
USB XHCI 1.10
scanning bus usb@ff500000 for devices... usb_new_device: Cannot read configuration, skipping device 058f:6387
4 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found

Device 0: unknown device
Card did not respond to voltage select! : -110
switch to partitions #0, OK
mmc1(part 0) is current device
Scanning mmc 1:1...
Found U-Boot script /boot/boot.scr

On another reboot, it looped 4 times before it succeeded 🤔. Weird, either there is a bug in the driver, or not. Though probably one at the stage where the USB device is not fully ready yet, being some kind of race condition. I have another USB 3.0 device, where it works well on every attempt, so it seems to depend on the particular USB stick, how fast it initialises or such.

Did you try other USB ports?

EDIT: Here is a matching report on the Armbian forum: https://forum.armbian.com/topic/36141-usb-errors/ Removing the linked patch would solve it. But it is not particularly a bad idea to try booting from USB first, in case it works. Maybe the other way round it works more reliable, since USB devices have more time for initialisation, when tried to be booted last instead of first.

MichaIng commented 3 months ago

I just pushed a U-Boot update to our APT server:

apt update
apt upgrade

And then dietpi-config > Advanced Options > Update MMC bootloader.

Tin-Bui commented 3 months ago

I think that broke something else.

sudo apt update
Hit:1 https://deb.debian.org/debian bookworm InRelease
Hit:2 https://download.docker.com/linux/debian bookworm InRelease
Get:3 https://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Hit:4 https://deb.debian.org/debian-security bookworm-security InRelease
Get:5 https://deb.debian.org/debian bookworm-backports InRelease [56.6 kB]
Hit:6 https://dietpi.com/apt bookworm InRelease
Hit:7 https://dietpi.com/apt all InRelease
Get:8 https://deb.debian.org/debian bookworm-backports/main arm64 Packages.diff/Index [63.3 kB]
Get:9 https://deb.debian.org/debian bookworm-backports/main arm64 Packages T-2024-07-23-0206.05-F-2024-07-23-0206.05.pdiff [696 B]
Get:9 https://deb.debian.org/debian bookworm-backports/main arm64 Packages T-2024-07-23-0206.05-F-2024-07-23-0206.05.pdiff [696 B]
Fetched 176 kB in 3s (60.9 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
dietpi@***:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  linux-u-boot-odroidn2-current
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 761 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://dietpi.com/apt all/odroidn2 arm64 linux-u-boot-odroidn2-current arm64 24.8.0-trunk-dietpi2 [761 kB]
Fetched 761 kB in 1s (1,093 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 28023 files and directories currently installed.)
Preparing to unpack .../linux-u-boot-odroidn2-current_24.8.0-trunk-dietpi2_arm64.deb ...
Unpacking linux-u-boot-odroidn2-current (24.8.0-trunk-dietpi2) over (24.8.0-trunk-dietpi1) ...
dpkg: unrecoverable fatal error, aborting:
 unable to fsync updated status of 'linux-u-boot-odroidn2-current': Input/output errorE: Sub-process /usr/bin/dpkg returned an error code (2)
dietpi@***:~$ sudo apt update
bash: /usr/bin/sudo: Input/output error
dietpi@***:~$ sudo apt upgrade
bash: /usr/bin/sudo: Input/output error

a reboot didn't make it better:

dietpi@***:~$ sudo apt update
Hit:1 https://deb.debian.org/debian bookworm InRelease
Hit:2 https://deb.debian.org/debian bookworm-updates InRelease
Hit:3 https://deb.debian.org/debian-security bookworm-security InRelease
Hit:4 https://download.docker.com/linux/debian bookworm InRelease
Hit:5 https://dietpi.com/apt bookworm InRelease
Hit:6 https://dietpi.com/apt all InRelease
Hit:7 https://deb.debian.org/debian bookworm-backports InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
dietpi@***:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/761 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
dpkg: error processing package linux-u-boot-odroidn2-current (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
Errors were encountered while processing:
 linux-u-boot-odroidn2-current
E: Sub-process /usr/bin/dpkg returned an error code (1)
dietpi@***:~$ sudo dpkg --configure -a
dpkg: error processing package linux-u-boot-odroidn2-current (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
Errors were encountered while processing:
 linux-u-boot-odroidn2-current

I'll flash a fresh SD card to see if this still happen.

Tin-Bui commented 3 months ago

Yep, an upgrade on a fresh SD card worked for me. Thank you.