Host-assisted quickboot and experiment hooks
The SPL side of the quickboot experiments (K3_DDR_REF_* options,
Integration of the free firmware). All of it is development code: it uses a reference
training result published in docsClean as a fixture, tests the memory and
normally halts. The hardware order it follows is in
Quickboot hardware sequence; the PMU side is in
Quickboot.
Flow with K3_DDR_REF_QUICKBOOT
ddr_init.ccopies the fixture (
lpddr5_ref_env.S,.incbinofK3_DDR_REF_ENVELOPE_PATH) overDDR_TRAINING_INFO_BUFFand prints its header. Whatever the boot left there is not used.lpddr5_init.c, per controllernormal DDRC and PHY setup, pre-training tables, free firmware loaded;
k3_ref_load_message(): the fixture’s message block to DMEM withSequenceCtrl = 1,Quickboot = 1and the trained VREF / DFE / DCA values copied intoMR12,MR14,MR15,MR24,MR30(byte 0 =0xa5withK3_DDR_REF_PROBE);k3_qb_pre_pmu(): everyphyparaentry of the fixture written to its CSR, in serialization order, with the commit triad at each change of CSR group; then two0x2f052pulses (whenMsgMisc[0]),0x20090 = 1,0x20060 = 3,0xc0086 = 1;PMU start (
0xd0000 = 1,0xd0099 = 9, 1, 0), mailbox service until major0x07, PMU stop;k3_qb_post_pmu(): Pass 3 entries written again,0x2004ekept at the value the PMU sampled,0x2f052pulse,0x90808/13recomputed from0x20314/15, commit triad,0x20037bit 6 cleared, ACSM image written and read back,0xd00e7 = 0x0600,0xc0080 = 2,0xd0000 = 1;DDRC activation as in the vendor flow.
Entries not written in step 3: 0xc0080, the 0xd0xxx block and the
eight runtime controls 0x20020/27/28/2a/31/41/60/78.
k3_qb_pass() classifies each CSR as Pass 1, 2 or 3 of docsClean/11; group
0x01 offsets in none of its lists are treated as Pass 1.
ddr_init.c, after both controllersk3_ref_memtest()and the vendortest_pattern(); then the training info header is cleared (see below) and the SPL halts, or continues withK3_DDR_REF_BOOTif both tests are clean.
Memory test
k3_ref_memtest() writes and reads back 64 KiB at the start of every
256 MiB over the whole part (64 blocks for 16 GiB), with the address as
pattern and then its complement. It prints the error count, how many wrong
words change on a second read, errors per block and per data bit, and the
first 24 failing words. The per-block and per-bit counts are what identify
a rank, a byte lane or a single bit (DQ data path: group 0x01 registers, address map, eye). It is
a sampled test, not a full memory test.
The SPL tiny printf has no %llu/%llx: 64-bit values are printed as
two %08x halves or as unsigned long with %lx.
Never saving the fixture
U-Boot proper writes a valid envelope found in DDR_TRAINING_INFO_BUFF to
the boot private partition (save_ddr_training_info() in
board/spacemit/k3/k3.c). With K3_DDR_REF_ENVELOPE the SPL therefore
clears the 128-byte header of the buffer after the memory test, in every
path, so the fixture is never written to flash [exp 014].
Hooks
K3_DDR_REF_BOOT[exp 014]continue to U-Boot when the memory test and
test_patternreport no error; halt otherwise.K3_DDR_REF_EYESCAN[exp 015]k3_ref_eyescan(): pre-writes 512 KiB in each of the 64 blocks, then for each0x01<r><l>4eand4fof both PHYs writes 0, 2, …, 126, reads 4 KiB of every block at each value and restores the trained value. Each point reads a chunk not read recently (128 chunks, alternating halves per scan) so the data cache cannot hide an error. Output: oneESline per CSR with the passing window, the pass bitmap, the blocks and data bits that failed.tools/eyescan_stats.pysummarises a log.K3_DDR_REF_PROBE[exp 016]after step 5 without the finalization (
0xd00e7, clocks, mux), starts the PMU a second time; the firmware, having seen the flag0xa5, runs RdDQS alone. Then step 5 is repeated in full. The host cannot changeSequenceCtrlitself at that point (Addressing and access rules).
Earlier variant: K3_DDR_REF_ENVELOPE without K3_DDR_REF_QUICKBOOT
runs a full DevInit (Quickboot = 0) and then
k3_ref_restore_training_result() writes the saved result with the
keep-live / blocklist rules of docsClean/11. Kept as the record of experiments
exp 011 and exp 012 (3 clean boots of 10).
Fragments
|
Use |
|---|---|
|
011: DevInit + restore, SPI fixture |
|
012: DevInit + restore, FDL fixture E1 |
|
013, 018, 019: quickboot, test, halt |
|
014: quickboot, continue to U-Boot |
|
015: quickboot, read-eye scan |
|
016, 017, 019: second PMU run (RdDQS) |
python3 tools/gen_ref_envelope.py docsClean/appendix-reference-envelope-fdl-e1.md \
build/envelope/ref6400-fdl-e1.bin
make fsbl FW=train FSBL_FRAG=configs/k3_freefw_qb_e1.config
SERIAL_PORT=/dev/ttyUSB0 tools/bench.sh build/fsbl-train/FSBL.bin qb-run 120 halting