Role of the SPL in this project
All DDR code lives in drivers/ddr/spacemit/k3/. Per controller,
init_snps_lp5_ddrc() (lpddr5_init.c) does:
DDRC timing/DFI/address-map setup, DCLK release,
dfimisc = 0x00010014;phyinit_lp5_pre_training(): applies the PHY tableslp5_pre_train_table[]with topology and I/O overrides (lpddr_training_table_init()inlpddr_common.c). One entry of that list is the PMU IMEM image (index0x50000) and another is the DMEM table at0x58000(message block + parameter area). Then it clears0x584d2–0x5ffff;pwrctl |= 1 << 11, mux = 1,MICRO_RESET9, 1, 0;major_message_all()until0x07;MICRO_RESET = 1, mux = 0,phyinit_lp5_training()(post-run table),save_snps_ddrc_training_result()(message,phypara, ACSM);DDRC activation and port enable.
spacemit_ddr_probe() (ddr_init.c) picks quickboot vs. training, runs
both controllers, then test_pattern() on DRAM.
What the host tables write
tools/spl_tables.py extracts, from the GPL table sources, the PHY CSR writes
of the host tables (skipping the IMEM/DMEM images). For dual-rank x16 at
6400 MT/s:
pre-training (
lp5_pre_train_table+phy_override_pre_seq_lp5_drank_x16_6400): 457 registers — group0x01324,0x0252,0x0356,0x0c14,0x099,0x0d2 (including0xc00f1–0xc00ff);post-training (
lp5_train_table+phy_override_seq_lp5_drank_x16_6400), applied after the PMU run: 4047 registers — ACSM SRAM0x41000–0x410b7and0x41388–0x41c57(2440),0x9002e–0x9050dand0x9070c–0x9071b(1317 in group0x09), group0x02175,0x0773, plus a few control registers (0xd0000 = 1,0xd00e7 = 0x0600,0xc0080 = 2).
So the mission-mode ACSM program is supplied by the host after training; during the PMU run the ACSM SRAM still holds power-on data.
- What we do not use
the vendor PMU firmware arrays (
lp5_training_fw*,lp5_quickboot_*): never opened, excluded from the build in free-firmware mode.