khadas / u-boot

U-Boot for Khadas VIMs & Edge
74 stars 73 forks source link

q201 3g board, LPDDR3 initialization error #12

Open 645i opened 4 years ago

645i commented 4 years ago

branch: khadas-vims-pie rank0+1 are initialized incorrectly (probably bug in BL2 binary)

GXM:BL1:dc8b51:76f1a5;FEAT:ADFC318C:80;POC:3;RCY:0;EMMC:0;READ:0;CHK:AA;SD:0;READ:0;0.0;CHK:0;
no sdio debug board detected 
TE: 161593

BL2 Built : 15:21:18, Aug 28 2019. gxl g1bf2b53 - luan.yuan@droid15-sz

set vdd cpu_a to 1120 mv
set vdd cpu_b to 1050 mv
set vddee to 1000 mv
Board ID = 1
CPU clk: 1200MHz
DQS-corr enabled
DDR scramble enabled
LPDDR3 chl: Rank0+1 @ 792MHz

bist_test rank: 0 12 05 1f 30 1e 43 2b 2b 2b 2b 2b 2b 1c 0c 2d 34 21 47 1c 0c 2c 34 20 49 734  rank: 1 12 06 1f 31 20 42 2b 2b 2b 2b 2b 2b 1c 0b 2d 31 20 42 19 08 2b 36 22 4a 734  
Rank0: 128MB(auto)-2T-3

Rank1: 4096MB(auto)-2T-3
  ADDR-W[0x00000004]:0xaaaaaaaa,R:0xaabaaaff
  ADDR-W[0x00000008]:0xaaaaaaaa,R:0xaaaa5555
  ADDR-W[0x00000020]:0xaaaaaaaa,R:0xaaaaffaa
  ADDR-W[0x00000040]:0xaaaaaaaa,R:0x00aaffff
  ADDR-W[0x00000080]:0xaaaaaaaa,R:0xaaaaffff
  ADDR-W[0x00000100]:0xaaaaaaaa,R:0x00aaffff
  ADDR-W[0x00000200]:0xaaaaaaaa,R:0xaaaaffff
  ADDR-W[0x00000400]:0xaaaaaaaa,R:0x00aaffff
  ADDR-W[0x00000800]:0xaaaaaaaa,R:0xaaaaffff
  ADDR-W[0x00001000]:0xaaaaaaaa,R:0x00aaffff
  ADDR-W[0x00002000]:0xaaaaaaaa,R:0xeaaaffff
  ADDR-W[0x00004000]:0xaaaaaaaa,R:0xaaaaffff
  ADDR-W[0x00008000]:0xaaaaaaaa,R:0x00aaffff
  ADDR-W[0x00010000]:0xaaaaaaaa,R:0xaaaaffff
  ADDR-W[0x00020000]:0xaaaaaaaa,R:0xaaaaffff
  ADDR-W[0x00040000]:0xaaaaaaaa,R:0xaaaaffff
  ADDR-W[0x00080000]:0xaaaaaaaa,R:0x00aaffff
  ADDR-W[0x00100000]:0xaaaaaaaa,R:0x00aaffff
  ADDR-W[0x00200000]:0xaaaaaaaa,R:0xaaaaffff
  ADDR-W[0x00400000]:0xaaaaaaaa,R:0xaaaaffff
  ADDR-W[0x00800000]:0xaaaaaaaa,R:0x00aaffff
  ADDR-W[0x01000000]:0xaaaaaaaa,R:0x00aaffff
  ADDR-W[0x02000000]:0xaaaaaaaa,R:0xaaaaffff
  ADDR-W[0x04000000]:0xaaaaaaaa,R:0xaaaaffff
  ADDR-W[0x08000000]:0xaaaaaaaa,R:0xd4aaffff
  ADDR-W[0x10000000]:0xaaaaaaaa,R:0xaaaaffff
  ADDR-W[0x20000000]:0xaaaaaaaa,R:0xaaaaffff
  ADDR-W[0x40000000]:0xaaaaaaaa,R:0xaaaaffff
  ADDR-W[0x80000000]:0xaaaaaaaa,R:0xaaaaffff
  ADDR-W[0x00000000]:0xaaaaaaaa,R:0x5555ffff
  ADDR-W[0x00000000]:0xaaaaaaaa,R:0x0055ffff
  ADDR3-W[0x00000020]:0x55555555,R:0xaaaaffaa
  ADDR3-W[0x00000040]:0x55555555,R:0xaaaaffff
  ADDR3-W[0x00000080]:0x55555555,R:0xaaaaffff

The last commit in Khadas-Vims-Nougat works very well. https://github.com/khadas/u-boot/commit/efe14653965672a934d5ca2d8baa770609f60c25 Can the khadas-vims-pie branch be updated accordingly? Thanks a lot

HighwayStar commented 4 years ago

I faced same issue, but it seems latest khadas-vims-pie branchinits LPDDR3 memory fine. But there is another issue - it hangs right after Kernel starting...

GXM:BL1:dc8b51:76f1a5;FEAT:ADFC318C:80;POC:3;RCY:0;EMMC:0;READ:0;CHK:AA;SD:0;READ:0;0.0;CHK:0;
no sdio debug board detected 
TE: 198309

BL2 Built : 15:21:58, Mar 26 2020. gxl g486bc38 - gongwei.chen@droid11-sz

set vdd cpu_a to 1120 mv
set vdd cpu_b to 1050 mv
set vddee to 1000 mv
Board ID = 1
CPU clk: 1200MHz
DQS-corr enabled
DDR scramble enabled
LPDDR3 chl: Rank0+1 @ 600MHz

bist_test rank: 0 21 02 41 44 20 68 32 08 5d 3e 19 64 24 01 47 40 1a 67 2b 00 56 44 1b 6d 706  rank: 1 23 00 46 45 20 6a 32 08 5c 3d 17 63 22 01 43 40 1a 67 2d 02 58 46 1c 70 706  
Rank0: 2048MB-2T-3

Rank1: 1024MB-2T-3
AddrBus test pass!
Load fip header from SD, src: 0x0000c200, des: 0x01400000, size: 0x00004000, part: 0
New fip structure!
Load bl30 from SD, src: 0x00010200, des: 0x013c0000, size: 0x0000d600, part: 0
Load bl31 from SD, src: 0x00020200, des: 0x05100000, size: 0x0002c400, part: 0
0002c400Load bl33 from SD, src: 0x00050200, des: 0x01000000, size: 0x0007fc00, part: 0
NOTICE:  BL3-1: v1.0(release):f5121da90
NOTICE:  BL3-1: Built : 20:18:22, Nov 22 2019
NOTICE:  BL3-1: GXM normal boot!
NOTICE:  BL3-1: BL33 decompress pass
mpu_config_enable:system pre init ok

dmc sec lock

[Image: gxl_v1.1.3394-7d43064d5 2020-05-07 15:37:15 gongwei.chen@droid11-sz]

OPS=0x82

wdt: reset registers!

22 0b 82 00 d9 92 04 4d c2 9f 98 76 86 ac 11 2a 

[0.985334 Inits done]

secure task start!
high task start!
low task start!
ERROR:   Error initializing runtime service opteed_fast

U-Boot 2015.01-gabeeb4952b-dirty (Jul 09 2020 - 14:01:09)

DRAM:  3 GiB
Relocation Offset is: b6e7e000
mmu cfg end: 0xc0000000
mmu cfg end: 0xc0000000
register usb cfg[0][1] = 00000000b7f50240
[CANVAS]canvas init
boot_device_flag : 1
Nand PHY Ver:1.01.001.0006 (c) 2013 Amlogic Inc.
init bus_cycle=6, bus_timing=7, system=5.0ns
reset failed
get_chip_type and ret:fffffffe
get_chip_type and ret:fffffffe
chip detect failed and ret:fffffffe
nandphy_init failed and ret=0xfffffff1
MMC:   aml_priv->desc_buf = 0x00000000b3e7e6b0
aml_priv->desc_buf = 0x00000000b3e809f0
SDIO Port B: 0, SDIO Port C: 1
co-phase 0x2, tx-dly 0, clock 400000
co-phase 0x2, tx-dly 0, clock 400000
co-phase 0x2, tx-dly 0, clock 400000
emmc/sd response timeout, cmd8, cmd->cmdarg=0x1aa, status=0x1ff2800
emmc/sd response timeout, cmd55, cmd->cmdarg=0x0, status=0x1ff2800
co-phase 0x2, tx-dly 0, clock 400000
co-phase 0x2, tx-dly 0, clock 40000000
init_part() 297: PART_TYPE_AML
[mmc_init] mmc init success
      Amlogic multi-dtb tool
      Single dtb detected
start dts,buffer=00000000b3e83240,dt_addr=00000000b3e83240
get_partition_from_dts() 92: ret 0
      Amlogic multi-dtb tool
      Single dtb detected
parts: 17
00:      logo   0000000000800000 1
01:  recovery   0000000001800000 1
02:      misc   0000000000800000 1
03:      dtbo   0000000000800000 1
04:  cri_data   0000000000800000 2
05:     param   0000000001000000 2
06:      boot   0000000001000000 1
set has_boot_slot = 0
07:       rsv   0000000001000000 1
08:  metadata   0000000001000000 1
09:    vbmeta   0000000000200000 1
10:       tee   0000000002000000 1
11:    vendor   0000000014000000 1
12:       odm   0000000008000000 1
13:    system   0000000062c00000 1
14:   product   0000000008000000 1
15:     cache   0000000046000000 2
16:      data   ffffffffffffffff 4
init_part() 297: PART_TYPE_AML
eMMC/TSD partition table have been checked OK!
crc32_s:0x1577dad == storage crc_pattern:0x1577dad!!!
crc32_s:0xee152b83 == storage crc_pattern:0xee152b83!!!
crc32_s:0x79f50f07 == storage crc_pattern:0x79f50f07!!!
mmc env offset: 0x4d400000 
In:    serial
Out:   serial
Err:   serial
aml log : internal sys error!
reboot_mode=cold_boot
[store]To run cmd[emmc dtb_read 0x1000000 0x40000]
_verify_dtb_checksum()-3476: calc 958dff49, store 958dff49
_verify_dtb_checksum()-3476: calc 958dff49, store 958dff49
dtb_read()-3691: total valid 2
update_old_dtb()-3672: do nothing
      Amlogic multi-dtb tool
      Single dtb detected
vpu: driver version: v20190313
vpu: detect chip type: 3
vpu: clk_level default: 7(666667000Hz), max: 7(666667000Hz)
vpu: clk_level in dts: 7
vpu: vpu_power_on
vpu: set_vpu_clk
vpu: set clk: 666667000Hz, readback: 666666667Hz(0x300)
vpu: set_vpu_clk finish
vpu: vpu_module_init_config
vpp: vpp_init
cvbs: cpuid:0x22
cvbs: find performance_pal config
hpd_state=1
do_hpd_detect: hdmimode=1080p60hz
do_hpd_detect: colorattribute=444,8bit
cvbs: outputmode[1080p60hz] is invalid
vpp: vpp_matrix_update: 2
set hdmitx VIC = 16
config HPLL = 2970000
HPLL: 0xc000027b
config HPLL done
j = 6  vid_clk_div = 1
hdmitx: set enc for VIC: 16
hdmitx phy setting done
rx version is 1.4 or below  div=10
hdmtix: set audio
card in
co-phase 0x2, tx-dly 0, clock 400000
co-phase 0x2, tx-dly 0, clock 400000
co-phase 0x2, tx-dly 0, clock 400000
co-phase 0x2, tx-dly 0, clock 400000
co-phase 0x2, tx-dly 0, clock 40000000
init_part() 282: PART_TYPE_DOS
[mmc_init] mmc init success
Device: SDIO Port B
Manufacturer ID: 89
OEM: 302
Name: NCard 
Tran Speed: 50000000
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: (0x77d000000 Bytes) 30 GiB
mmc clock: 40000000
Bus Width: 4-bit
vpp: vpp_pq_load pq val error !!!
Net:   [KM]Error:f[keymanage_dts_get_key_device]L100:/unify not parsed yet!
[KM]Error:f[_get_km_ops_by_name]L240:key eth_exphy_para not know device 4
[KM]Error:f[key_unify_read]L304:key[eth_exphy_para] no cfg in dts
dwmac.c9410000 Waiting for PHY auto negotiation to complete.... done
The Best Window is index -1
[KM]Error:f[keymanage_dts_get_key_device]L100:/unify not parsed yet!
[KM]Error:f[_get_km_ops_by_name]L240:key eth_exphy_para not know device 4
[KM]Error:f[key_unify_write]L271:key[eth_exphy_para] no cfg in dts
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
dwmac.c9410000amlkey_init() enter!
[EFUSE_MSG]keynum is 4
[BL31]: tee size: 0

CONFIG_AVB2: null 
Start read misc partition datas!
info->magic = 
info->version_major = 1
info->version_minor = 0
info->slots[0].priority = 15
info->slots[0].tries_remaining = 7
info->slots[0].successful_boot = 0
info->slots[1].priority = 14
info->slots[1].tries_remaining = 7
info->slots[1].successful_boot = 0
info->crc32 = -1075449479
active slot = 0
wipe_data=successful
wipe_cache=successful
upgrade_step=0
aml log : internal sys error!
reboot_mode:::: cold_boot
amlkey_init() enter!
amlkey_init() 71: already init!
[EFUSE_MSG]keynum is 4
[BL31]: tee size: 0
[KM]Error:f[key_manage_query_size]L515:key[usid] not programed yet
[KM]Error:f[key_manage_query_size]L515:key[deviceid] not programed yet
[KM]Error:f[key_manage_query_size]L515:key[region_code] not programed yet
[OSD]load fb addr from dts:/meson-fb
[OSD]fb_addr for logo: 0x7f800000
[OSD]load fb addr from dts:/meson-fb
[OSD]fb_addr for logo: 0x7f800000
[OSD]VPP_OFIFO_SIZE:0xfff00fff
[CANVAS]addr=0x7f800000 width=3840, height=2160
Err imgread(L570):Logo header err.
There is no valid bmp file at the given address
[OSD]osd_hw.free_dst_data: 0,1919,0,1079
amlkey_init() enter!
amlkey_init() 71: already init!
[EFUSE_MSG]keynum is 4
[BL31]: tee size: 0
[KM]Error:f[key_manage_query_size]L515:key[usid] not programed yet
[KM]Error:f[key_manage_query_size]L515:key[deviceid] not programed yet
[KM]Error:f[key_manage_query_size]L515:key[region_code] not programed yet
gpio: pin GPIOAO_2 (gpio 102) value is 1
Command: bcb uboot-command 
Start read misc partition datas!
BCB hasn't any datas,exit!
amlkey_init() enter!
amlkey_init() 71: already init!
[EFUSE_MSG]keynum is 4
[BL31]: tee size: 0
[KM]Error:f[key_manage_query_size]L515:key[usid] not programed yet
[KM]Error:f[key_manage_query_size]L515:key[deviceid] not programed yet
[KM]Error:f[key_manage_query_size]L515:key[region_code] not programed yet
Hit Enter or space or Ctrl+C key to stop autoboot -- :  1  0 
CONFIG_SYSTEM_AS_ROOT: systemroot 
system_mode: 1
Start read misc partition datas!
info->magic = 
info->version_major = 1
info->version_minor = 0
info->slots[0].priority = 15
info->slots[0].tries_remaining = 7
info->slots[0].successful_boot = 0
info->slots[1].priority = 14
info->slots[1].tries_remaining = 7
info->slots[1].successful_boot = 0
info->crc32 = -1075449479
active slot = 0
CONFIG_AVB2: null 
active_slot: normal
Err imgread(L358):Fmt unsupported!genFmt 0x0 != 0x3
amlkey_init() enter!
amlkey_init() 71: already init!
[EFUSE_MSG]keynum is 4
[BL31]: tee size: 0
[KM]Error:f[key_manage_query_size]L515:key[usid] not programed yet
[KM]Error:f[key_manage_query_size]L515:key[deviceid] not programed yet
[KM]Error:f[key_manage_query_size]L515:key[region_code] not programed yet
InUsbBurn
noSof
Device: SDIO Port B
Manufacturer ID: 89
OEM: 302
Name: NCard 
Tran Speed: 50000000
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: (0x77d000000 Bytes) 30 GiB
mmc clock: 40000000
Bus Width: 4-bit
Device: SDIO Port B
Manufacturer ID: 89
OEM: 302
Name: NCard 
Tran Speed: 50000000
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: (0x77d000000 Bytes) 30 GiB
mmc clock: 40000000
Bus Width: 4-bit
reading aml_autoscript
** Unable to read file aml_autoscript **
reading recovery.img
17119232 bytes read in 958 ms (17 MiB/s)
reading dtb.img
** Unable to read file dtb.img **
avb2: 0
ee_gate_off ...
avb2: 0
## Booting Android Image at 0x01080000 ...
reloc_addr =b3f03500
copy done
Kernel command line: androidboot.dtbo_idx=0 --cmdline root=/dev/mmcblk0p18 androidboot.selinux=permissive buildvariant=userdebug
[store]Is good fdt check header, no need decrypt!
active_slot is normal
DTBO partition header is incorrect
load dtb from 0x1000000 ......
      Amlogic multi-dtb tool
      Single dtb detected
No valid dtbo image found
   Uncompressing Kernel Image ... OK
   kernel loaded at 0x01080000, end = 0x02b1a200
   Loading Ramdisk to b37ef000, end b3e6bd4c ... OK
   Loading Device Tree to 000000001ffee000, end 000000001ffff5a6 ... OK
fdt_fixup_memory_banks, reg:0000000000000000
fdt_instaboot: no instaboot image

Starting kernel ...

uboot time: 12893747 us
HighwayStar commented 4 years ago

Managed to stable boot with lpddr3 after reverting Revert "Ethernet: add M2X board control interface support" and cherry-picked LPDDR3 timings for q201 from nougat branch. My current test branch for amlogic s912 box with LPDDR3 is here https://github.com/Amlogic-Lineage/u-boot/commits/khadas-vims-pie_lpddr