Role of the SPL
Mainline U-Boot’s K1 SPL (board/spacemit/k1/spl.c) is the host side of the
firmware contract. Around the DDR bring-up it does, in order:
basic SoC setup: console, clocks, I²C, PMIC;
reads the board EEPROM (TLV format) for the memory configuration;
in
ddr_early_init(): looks up the embeddedddr-fwblob through binman symbols,memcpys it toDDR_FIRMWARE_BASE = 0xc082d000in SRAM and runsfence.i;calls the firmware as
ddr_init(0xc0000000, cs_num, data_rate, puts)(The boot interface);ignores the return value, writes
0xaa55aa55to physical address 0, flushes and re-reads that line, and printsDDR is readyorDDR is not ready;continues the normal boot (loads OpenSBI + U-Boot proper).
No change to the mainline SPL sources is required to use the free firmware —
only the build-time wiring that supplies the image (Integration into the build). The one
part of spl.c that matters to the firmware is the call above and the EEPROM
read that feeds it.
Memory configuration from the EEPROM
The SPL fills a small config from the EEPROM TLV and passes two of its fields.
When the EEPROM cannot be read (common under FDL; the SPL prints
Fail to detect board:-2) it falls back to defaults:
field |
default |
passed to the firmware? |
|---|---|---|
|
2 |
yes ( |
|
2400 |
yes ( |
memory type |
|
no — the ABI has no slot for it |
Tx ODT |
80 Ω |
no |
Because the type and Tx ODT never reach the firmware, the image is built for a
fixed memory type (LPDDR4X, Tx ODT 80 Ω); see The boot interface and
src/blob/blob.c. When EEPROM is present (e.g. logsRefs/020-eeprom-cs-num-16gib/readme.md
and logsRefs/021-eeprom-cs-num-8gib/readme.md), the DDR TLV still supplies
cs_num even if board detection prints Fail to detect board:-2.
The puts argument
Mainline passes a real puts only in DEBUG builds of spl.c; a normal
build passes NULL and the firmware runs silently. A failing ddr_init is
therefore invisible to a normal mainline build except through the magic-word
test at address 0, which can still pass on a marginal DRAM. Honouring the return
value needs the small spl.c change shown in Validation vehicle.