Skip to content

Commit acf120d

Browse files
committed
Fixes to get DDR4 training working
1 parent 4fe9f1e commit acf120d

5 files changed

Lines changed: 438 additions & 183 deletions

File tree

config/examples/polarfire_mpfs250_m.config

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,15 @@ CFLAGS_EXTRA+=-DSDHCI_SDMA_DISABLED
115115
# race on Arasan/Cadence-family controllers; single-block avoids it.
116116
CFLAGS_EXTRA+=-DSDHCI_FORCE_SINGLE_BLOCK_READ
117117

118+
# MPFS250 Video Kit cache-pressure workaround: sustained PIO writes to
119+
# cached DDR thrash L2 cache enough to corrupt L2 Scratch (where the
120+
# M-mode stack lives) and cause a cause=2 epc=0 trap during the post-
121+
# block CMD13 wait. OR the destination address with this alias mask so
122+
# PIO writes hit the non-cached DDR window (0x82000000 -> 0xC2000000)
123+
# and bypass L2 entirely. Upper layers still read the buffer at the
124+
# cached address; L2 misses and fetches the data back from DDR.
125+
CFLAGS_EXTRA+=-DSDHCI_PIO_WRITE_NONCACHED_ALIAS=0x40000000UL
126+
118127
# Video Kit routes the SD slot's Card Detect (CD#) signal through the FPGA
119128
# fabric rather than MSSIO, so the SDHCI controller's hardware CI/CDPL
120129
# detection always reads 'no card' in M-mode (no fabric configuration).
@@ -136,15 +145,14 @@ CFLAGS_EXTRA+=-DDEBUG_BOOT
136145
#CFLAGS_EXTRA+=-DDEBUG_SDHCI
137146
#CFLAGS_EXTRA+=-DDEBUG_DISK
138147
#CFLAGS_EXTRA+=-DDISK_TEST
139-
# DDR pattern test at 0x82000000 (256 KB triple-write). This MUST
140-
# stay enabled -- without it the post-training MTC sanity check
141-
# times out and the non-cached probe hangs (the cached pattern test
142-
# acts as a "warm-up" that exercises the L2->DDR writeback path
143-
# enough to stabilize controller state). The test halts the boot
144-
# after running, which is fine while disk-load is still under
145-
# investigation; remove the while(1) at the end of the block when
146-
# disk-load reliably completes.
147-
CFLAGS_EXTRA+=-DMPFS_DDR_PATTERN_TEST
148+
# DDR pattern test (256 KB triple-write at cached 0x82000000) is
149+
# DISABLED once disk-load works. Its CPU writes thrash L2 cache
150+
# enough to corrupt L2 Scratch (where the M-mode stack lives) on the
151+
# return from mpfs_ddr_init(). Now that mpfs_clear_bootup_cache_ways
152+
# does PDMA pre-fill via the non-cached path, the pattern test is
153+
# redundant -- the MTC 256 B sanity inside the retry loop already
154+
# verifies DDR works end-to-end before pre-fill runs.
155+
#CFLAGS_EXTRA+=-DMPFS_DDR_PATTERN_TEST
148156
# Verbose register-level DDR tracing. KEEP ENABLED until the timing
149157
# sensitivity in run_training is fixed -- the DBG_DDR printf delays
150158
# during the post-ZQ-cal phase appear to be required for TIP to

docs/Targets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ Key build settings that differ between configurations:
840840
| Setting | SDCard | eMMC | QSPI | L2-LIM | M-Mode | M-Mode + DDR |
841841
|---------|--------|------|------|--------|--------|--------------|
842842
| `WOLFBOOT_ORIGIN` | `0x80000000` | `0x80000000` | `0x80000000` | `0x08040000` | `0x0A000000` | `0x0A000000` |
843-
| `WOLFBOOT_LOAD_ADDRESS` | `0x8E000000` | `0x8E000000` | `0x8E000000` | `0x08060000` | `0x0A010200` | `0x8E000000` |
843+
| `WOLFBOOT_LOAD_ADDRESS` | `0x8E000000` | `0x8E000000` | `0x8E000000` | `0x08060000` | `0x0A010200` | `0x82000000` |
844844
| `WOLFBOOT_LOAD_DTS_ADDRESS` | `0x8A000000` | `0x8A000000` | `0x8A000000` ||| `0x8A000000` |
845845
| `EXT_FLASH` | 0 | 0 | 1 | 1 | 1 | 0 |
846846
| `DISK_SDCARD` | 1 | 0 | 0 | 0 | 0 | 1 |

0 commit comments

Comments
 (0)