Integration of the free firmware
Kconfig (drivers/ddr/spacemit/k3/Kconfig)
K3_DDR_LP5_FREE_FWuse the free firmware. Requires
K3_DDR_LPDDR4X=n(single-type build, uncompressed tables) and notDDR_TRAINING_UPDATE_FSBL.K3_DDR_LP5_FREE_FW_PREFIXpath prefix of
<prefix>.imem.binand<prefix>.dmem.bin.K3_DDR_PMU_MBOX_LOGlog every major and stream frame with a µs timestamp.
K3_DDR_PMU_MBOX_TIMEOUT_MSbound for each mailbox wait (default 30000; 0 = unbounded).
K3_DDR_PMU_STOP_AFTER_FWexperiments: run the PMU on both controllers, stop it, print the elapsed time and
hang()without activating the DDRC.K3_DDR_PMU_COMPARE_DUMPwith the
csrdumpfirmware: after the PMU stops, run the normal result collection, comparephypara/ACSM with the PMU’s copy at DMEM index0x5c000and print every host value (PMU<n> P/Alines, extracted bytools/dump_extract.py).K3_DDR_REF_ENVELOPE,K3_DDR_REF_ENVELOPE_PATHembed a reference
DDRTenvelope (0x9800bytes) as a development fixture and restore it after the PMU run; adds the sampled memory test and halts. See Host-assisted quickboot and experiment hooks.K3_DDR_REF_QUICKBOOThost-assisted quickboot: saved
phyparawritten before the PMU starts, firmware run withQuickboot = 1, Pass 3 and the ACSM image after it.K3_DDR_REF_BOOTcontinue the boot when the memory test is clean.
K3_DDR_REF_EYESCANread-eye scan of the per-bit read delays from the host.
K3_DDR_REF_PROBEsecond PMU run with the RdDQS probe.
Fragments: configs/k3_freefw.config (training),
configs/k3_freefw_probe.config (probe experiments) and
configs/k3_freefw_csrdump.config (CSR read-out comparison).
Code changes
lpddr5_free_fw.S.incbinof both images, wrapped asphy_init_configlinear tables:k3_free_fw_imem_table(base0x50000) andk3_free_fw_dmem_table(base0x5a000= ARC0x80004000).lpddr5_pre_training_table.cthe vendor firmware arrays are compiled out; the IMEM slot of
lp5_pre_train_table[]points tok3_free_fw_imem_table.lpddr5_init.cafter the DMEM clear, loads
k3_free_fw_dmem_table; a non-0x07mailbox result aborts the controller and setsk3_pmu_failed.ddr_init.cforces the training path (the vendor quickboot image is never run); halts with a message if any PMU run failed, so DDRC ports are never enabled on an untrained PHY. With
K3_DDR_REF_QUICKBOOTthe free firmware runs its own quickboot path instead (Host-assisted quickboot and experiment hooks).lpddr_common.cnew mailbox receiver, see Host mailbox receiver.
lpddr5_ref_env.S,lpddr_training_result.cthe embedded fixture and the restore code (
k3_ref_*,k3_qb_*), see Host-assisted quickboot and experiment hooks.ddr_init.c(withK3_DDR_REF_ENVELOPE)fixture copy, sampled memory test, read-eye scan, header clearing, halt or continue.
The SPL still writes the vendor DMEM table at 0x58000–0x584d1; the free
firmware reads only the documented message block there.