Self-refresh

Training runs with the ranks parked in self-refresh (SR) so the PI engine can drive the bus without the controller issuing traffic. The protocol and masks are in src/lib/k1_ddrt.c and src/lib/k1_ddrt_regs.h.

Enter and exit

The firmware enters and leaves SR through the USER_0 port (ddr+0x20):

  • enter: USER_0 = 0x10000000 | (mode << 24) | (1 << 6);

  • exit: USER_0 = 0x10000000 | (mode << 24) | (2 << 6);

with mode = 3 for two ranks and 1 for one. The wait mask on STATUS (ddr+0x08) is 0x44 (bits 2 and 6, two ranks) or 0x04 (one rank). The enter waits for those bits to set; the exit waits for them to clear and never waits for a particular full STATUS value (The training pass).

STATUS and the parked state

[measured] transitions on silicon:

  • Out of SR at boot, 2-rank STATUS reads 0x33; entering SR sets it to 0x77, and exiting returns to 0x33 (or 0x11 after a PI retrain pass, observed in logsRefs/020-eeprom-cs-num-16gib/readme.md, logsRefs/021-eeprom-cs-num-8gib/readme.md and logsRefs/043-docsclean-claims-sweep/readme.md).

  • With cs_num = 1, SR enter sets STATUS to 0x37 (logsRefs/019-mr14-cs-sel-cs1-16gib/readme.md).

A DFC kicked while ranks are in SR is refused by the firmware (DFC table and hardware freq. change); the recovery path on a stuck DFC issues an SR exit to make the DRAM accessible again before reporting the timeout (verified in the tools/test/model.c test double; [open] on silicon, docsClean/dfc-engine).