@@ -115,6 +115,15 @@ CFLAGS_EXTRA+=-DSDHCI_SDMA_DISABLED
115115# race on Arasan/Cadence-family controllers; single-block avoids it.
116116CFLAGS_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
0 commit comments