Memory controller

The MC at ddr = 0xc0000000 holds the command ports, STATUS, the four per-frequency timing banks and the address map. All register offsets used by the firmware are in src/lib/k1_ddrt_regs.h.

Command ports

The firmware issues DRAM commands through a few write ports; each takes a CS mask in its top byte (bit 0 = CS0, bit 1 = CS1):

port

offset

use

USER_0

0x20

JEDEC init, ZQ calibration (per-rank selector), self-refresh enter/exit

CA_CMD

0x24

mode-register read/write, MR14 path

PI_CMD

0x13d0

PI training-engine commands (Training engine)

MISC

0x28

secondary command words used in the DFC flows (src/lib/k1_ddr_tables.c)

The mode-register path (CA_CMD / MR_DATA) is in Mode registers; the firmware wrappers are in The training pass and Controller bring-up.

STATUS

STATUS (ddr+0x08) reports the controller/rank state, including the self-refresh bits. A healthy 2-rank controller out of self-refresh reads 0x33 (0x11 after a PI pass is also observed, [measured] in logsRefs/020-eeprom-cs-num-16gib/readme.md and logsRefs/021-eeprom-cs-num-8gib/readme.md); 0x77 means two ranks are parked in self-refresh ([measured] in logsRefs/020, 021, and logsRefs/043-docsclean-claims-sweep/readme.md; 0x37 observed for cs_num 1 in logsRefs/019-mr14-cs-sel-cs1-16gib/readme.md). The protocol and masks are in Self-refresh; the firmware waits on specific masks rather than full values.

Timing banks

Four banks hold the frequency-dependent MC words, selected by CTL_FREQ[31:28] (ddr+0x304). Device_Init writes every bank (fp3 down to fp0) from the programming tables in src/lib/k1_ddr_tables.c, including three IO rows computed from the electrical configuration of the memory type, and — for x8 parts — two overlay words per bank. k1_mc_globals, k1_mc_timing and k1_mc_x8_overlay (Data tables) are the programmed words that boot ([measured] in logsRefs/020, 021). fp2 timing accepted ranges and isolated optima are in MC timing: accepted ranges and optima (logsRefs/030–038).

The “MC is clocked” check: writing CTL0 (the first global) and reading it back is how the firmware confirms the MC has a clock and is out of reset before programming the rest (Controller bring-up).