PolarFire SoC M-Mode LPDDR4 + minimal SBI runtime#774
Open
dgarske wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds standalone wolfBoot M-mode support for the PolarFire SoC MPFS250T Video Kit, including LPDDR4 bring-up (replacing HSS in the early boot path) and Linux S-mode handoff plumbing.
Changes:
- Enhance SDHCI diagnostics and reliability workarounds (CMD0→CMD8 delay, single-block read option, capability logging).
- Extend RISC-V M-mode boot flow with a reusable M→S handoff API and MPFS-specific “release U54 hart” implementation.
- Introduce MPFS250 DDR/PHY init infrastructure, build-time enablement via
LIBERO_FPGA_CONFIG_DIR, new config template, and CI build job.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/sdhci.c | Adds richer error logging, controller register dump, and reliability workarounds for Cadence SD4HC. |
| src/boot_riscv.c | Adds trap register dump support (regs frame) and factors M→S handoff into overridable helpers. |
| hal/mpfs250.h | Adds MPFS250 peripheral bits and extensive DDRC/PHY register definitions + DDR init declarations. |
| hal/mpfs250.c | Implements MPFS250 DDR/PLL/PHY init, M→S boot on a U54 via IPI handoff, and UART reinit after PLL. |
| docs/Targets.md | Documents new “M-Mode + DDR” configuration and build-time Libero config integration. |
| config/examples/polarfire_mpfs250_m.config | Adds new example config for M-mode + LPDDR4 + SD + S-mode Linux boot. |
| arch.mk | Enables MPFS DDR init when LIBERO_FPGA_CONFIG_DIR is provided (adds -DMPFS_DDR_INIT and include path). |
| .github/workflows/test-configs.yml | Adds CI build job for the new MPFS250 M-mode + DDR config template. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
115db4a to
776474f
Compare
Comment on lines
+565
to
+573
| void sdhci_shutdown(void) | ||
| { | ||
| uint32_t to = 100000U; | ||
| sdhci_reg_or(SDHCI_SRS11, SDHCI_SRS11_RESET_ALL); | ||
| while ((SDHCI_REG(SDHCI_SRS11) & SDHCI_SRS11_RESET_ALL) != 0U && | ||
| to > 0U) { | ||
| to--; | ||
| } | ||
| } |
Comment on lines
+560
to
+568
| /* Full controller software reset for OS handoff: the bootloader has been | ||
| * driving the SDHC (clocks, PIO mode, an initialized card), and handing | ||
| * that state to the OS driver makes its re-init/tuning intermittently | ||
| * fail. SDHCI software-reset-all returns the host registers to their | ||
| * power-on defaults so the OS finds a clean controller. */ | ||
| void sdhci_shutdown(void) | ||
| { | ||
| uint32_t to = 100000U; | ||
| sdhci_reg_or(SDHCI_SRS11, SDHCI_SRS11_RESET_ALL); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wolfBoot runs standalone in M-mode on the E51 monitor core, replacing both HSS and OpenSBI: it brings up LPDDR4 in software, secure-boots a signed Yocto FIT from SD, and stays resident as a minimal SBI runtime so the U54 cores boot Linux. Result: secure-boot 4-CPU SMP Yocto Linux to a login prompt in ~40 s from power-on, with no Microchip firmware in the boot chain.
Commits
src/ddr_cadence.c+include/ddr_cadence.h; the Microchip PHY/PLL/clock/training and the boardLIBERO_SETTING_*values stay inhal/mpfs250_ddr.c.src/riscv_sbi.c): BASE/TIME/IPI/RFENCE/HSM/DBCN plus the legacy calls, with per-hart M-mode trap stacks,rdtimeand misaligned load/store emulation, atomic cross-hart IPI ops with self-directed SSIP delivery, and the trap-entry / M->S hand-off wiring. PolarFire SoC bring-up adds CLINT MTIME enable, per-hart HSMhart_startmailboxes, the watchdog policy, and the dtb fixups that bring up 4-CPU SMP Linux.Key design points
DDR_CADENCE_CTRL_BASE); the SoC-specific PHY/PLL/training is behind the platform HAL. Both compile only whenMPFS_DDR_INITis set.rdtimeis emulated in M-mode for S and U mode.Validation (MPFS250T Video Kit, power-controlled cold boots)
smp: Brought up 1 node, 4 CPUswith zero "failed to come online"; login at ~40 s.ddr_cadence.o(driver correctly gated).versal_vmk180_sdcard,zynqmp_sdcard,zynq7000_sdcardalso build (shared sdhci/boot files).Notes for reviewers
src/vector_riscv.Strap-macro changes areWOLFBOOT_RISCV_MMODE-gated; S-mode builds keep the original frame behavior.src/sdhci.ckeeps the cross-platform driver clean: the MPFS PDMA/watchdog specifics are behind weaksdhci_platform_block_copy()/sdhci_platform_wdt_pet()hooks.src/fdt.cgains a weakwolfBoot_fit_memcpyhook so the platform can route FIT subimage copies through PDMA.tools/ci/mpfs_libero_stub/fpga_design_config.hlets the M-mode + DDR path compile in GitHub Actions (compile-only; not runnable).lib/wolfsslsubmodule pointer is bumped (came in with the DDR work); drop it if the project prefers to bump separately.docs/Targets.mddocuments the M-mode + DDR Linux boot flow, the wolfSBI runtime, the watchdog policy, and the generic Cadence driver split.