PHY

The PHY at phy = ddr + 0x40000 carries four 16 KiB register slices, one per frequency point (slice(fp) = phy + (fp << 14)), plus global analog and status registers. Offsets and masks are defined in src/lib/k1_ddrt_regs.h.

Per-byte structure

Each slice has per-byte-lane registers for the four bytes of the 32-bit bus. The firmware addresses byte b of rank cs0 at slice + K1_BYTE_OFF[b] + (cs0 << 8) with K1_BYTE_OFF = { 0x0000, 0x1000, 0x0200, 0x1200 } (The training pass). Per byte the PHY holds the write-leveling delay (+0x24), the DQS read-gate code (+0x70), and the read (+0x30) and write (+0x00) DQ taps that training centres ([measured] across both ranks in logsRefs/000-indep-eye-memory-pattern-sweep/readme.md through logsRefs/005-indep-cs1-16gib/readme.md).

Analog COMMON blocks

Each slice has two COMMON blocks (A at +0x3000 and B at +0x3200, the two sub-PHYs; [measured] split in logsRefs/002-indep-vref-edge-16gib/readme.md) programmed during Device_Init with the memory type’s drive strength, ODT and Vref. They are armed by writing 0 then 1 before the PHY is initialized (k1_phy_analog() in src/lib/k1_ddr_init.c). The electrical values per memory type are the k1_io_lpddr4x / k1_io_lpddr4 configurations (Data tables).

Training status and harvest

Two global PHY registers drive PI training:

  • PHY_STATUS (phy+0x18000): reads 0 after a successful pass ([measured] in logsRefs/020 and 021); non-zero bits flag gate, read-leveling or write errors (src/lib/k1_ddrt_regs.h).

  • the harvest area (phy+0x18200 RX, phy+0x18300 TX): after each PI operation it holds the per-DQ margin of the last operation (8 words of 4 DQ margins each, plus a DM word at +0x20). PI training reads the worst DQ margin from it at every Vref step (The training pass).

The Vref words (VREF0 at slice+0x3004 / VREF1 at slice+0x3204) set the PHY read reference during the read sweep; the gate code and tap registers hold the trained results checked by the acceptance helpers and independent eye (Acceptance and logging, logsRefs/020-eeprom-cs-num-16gib/readme.md, logsRefs/021-eeprom-cs-num-8gib/readme.md).