Add LS1028A eSDHC SD card disk boot support - #889
Open
dgarske wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical eMMC driver-selection failure and LS1028A handoff/configuration issues block approval.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds LS1028A SD-card disk boot support using the NXP eSDHC controller.
Changes:
- Adds LS1028A-specific eSDHC addressing, clock setup, and byte ordering.
- Adds selectable disk-driver configuration and an SD-card example.
- Updates documentation and CI coverage.
File summaries
| File | Summary | Findings |
|---|---|---|
options.mk |
Selects the configured disk driver. | None. |
hal/nxp_esdhc.c |
Implements LS1028A eSDHC support. | Critical: eMMC-only PPC configurations can select an empty eSDHC object because the implementation is guarded by DISK_SDCARD (1 vote). |
docs/Targets.md |
Documents LS1028A SD-card boot. | None. |
config/examples/nxp-ls1028a-sdcard.config |
Defines the LS1028A SD-card boot configuration. | Moderate: Cache flushing may not cover all relocated load ranges (1 vote). Nit: The documented 128KB partition size conflicts with the configured 16MB size (1 vote). |
arch.mk |
Links the eSDHC driver for supported targets. | None. |
.github/workflows/test-configs.yml |
Adds CI build coverage. | None. |
Review details
Suppressed comments (2)
config/examples/nxp-ls1028a-sdcard.config:47
- With this config
ELF?=1, and the FIT path can also relocate the kernel (and optionally other subimages) away fromWOLFBOOT_LOAD_ADDRESS.boot_aarch64.cappliesWOLFBOOT_MMU_FLUSH_APP_SIZEstarting at the finalapp_offset/entry point, not across every ELF PT_LOAD/FIT destination; leaving the MMU/cache enabled on LS1028A can therefore hand off stale DDR contents for a segment outside this 16-MB span. Make the handoff flush the actual loaded ranges (or constrain and record all destinations) instead of treating one size as the whole RAMBOOT window.
CFLAGS_EXTRA+=-DWOLFBOOT_MMU_FLUSH_APP_SIZE=0x1000000
config/examples/nxp-ls1028a-sdcard.config:46
- This says the partition size is 128KB, but the same config sets
WOLFBOOT_PARTITION_SIZE?=0x1000000(16MB) at line 66. The resulting explanation for overriding the cache-flush size is inaccurate and can mislead users sizing disk images.
# WOLFBOOT_PARTITION_SIZE (128KB here), far too small for a disk-loaded
# image. Clean the whole RAMBOOT window instead.
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+34
to
+36
| * Compiled as its own object (the target's arch.mk block adds | ||
| * hal/nxp_esdhc.o and sets DISK_DRIVER=esdhc when DISK_SDCARD is set); | ||
| * per-target base address, clocks and byte order are selected below. |
dgarske
force-pushed
the
ls1028a_esdhc
branch
from
September 12, 2026 16:23
17ce244 to
4824426
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The DISK_DRIVER conflict can cause link failures, and the byte-order documentation needs clarification.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (2)
arch.mk:1579
- The same command-line override problem exists for the PPC eSDHC targets: passing
DISK_DRIVER=cadenceleaves this assignment unchanged, while the block still addshal/nxp_esdhc.o;options.mkthen addssrc/sdhci.oand the two drivers collide on everydisk_*symbol. Force or validateDISK_DRIVER=esdhcbefore the common driver-selection block runs.
ifeq ($(DISK_SDCARD),1)
CFLAGS+=-D"WOLFBOOT_UPDATE_DISK" -D"MAX_DISKS=1"
UPDATE_OBJS:=src/update_disk.o
OBJS+=src/disk.o
DISK_DRIVER=esdhc
ifneq ($(STAGE1),1)
OBJS+=hal/nxp_esdhc.o
hal/nxp_esdhc.c:591
- The final sentence is now ambiguous and contradicts the new target split:
ESDHC_EMODE_SELisLEon LS1028A, but this says that little-endian mode reverses every word. Qualify that observation to the T1040/PPC path and document the LS1028A behavior so future maintenance does not mistake the new setting for a byte-order bug.
* PROCTL[EMODE] is set per target above, so a native 32-bit read of
* DATPORT returns the four media bytes already in order and they can be
* stored as-is. Silicon-verified: little-endian mode returned every
* aligned 4-byte group byte-reversed. */
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
Comment on lines
+191
to
+194
| ifeq ($(DISK_SDCARD),1) | ||
| DISK_DRIVER=esdhc | ||
| OBJS+=hal/nxp_esdhc.o | ||
| endif |
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.
Adds SD card disk boot to the NXP LS1028A, reusing the Freescale eSDHC driver from the QorIQ PPC targets with the base address, source clock and DATPORT byte order parameterized for the little-endian Layerscape integration. The driver reprograms the eSDHC source clock (HWA2) at init, because the NOR-boot RCW leaves it on a source too fast for card identification. A new
DISK_DRIVERbuild variable selects eSDHC over the Cadence SDHCI driver, replacing the previousARCH != PPCtest.Validated on an LS1028ARDB: signed image loaded from a GPT A/B slot, integrity and ECC256 signature verified, and booted.