Skip to content

Add LS1028A eSDHC SD card disk boot support - #889

Open
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:ls1028a_esdhc
Open

Add LS1028A eSDHC SD card disk boot support#889
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:ls1028a_esdhc

Conversation

@dgarske

@dgarske dgarske commented Sep 11, 2026

Copy link
Copy Markdown
Member

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_DRIVER build variable selects eSDHC over the Cadence SDHCI driver, replacing the previous ARCH != PPC test.

Validated on an LS1028ARDB: signed image loaded from a GPT A/B slot, integrity and ECC256 signature verified, and booted.

@dgarske dgarske self-assigned this Sep 11, 2026
Copilot AI lite review requested due to automatic review settings September 11, 2026 20:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 from WOLFBOOT_LOAD_ADDRESS. boot_aarch64.c applies WOLFBOOT_MMU_FLUSH_APP_SIZE starting at the final app_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 thread hal/nxp_esdhc.c
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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=cadence leaves this assignment unchanged, while the block still adds hal/nxp_esdhc.o; options.mk then adds src/sdhci.o and the two drivers collide on every disk_* symbol. Force or validate DISK_DRIVER=esdhc before 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_SEL is LE on 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 thread arch.mk
Comment on lines +191 to +194
ifeq ($(DISK_SDCARD),1)
DISK_DRIVER=esdhc
OBJS+=hal/nxp_esdhc.o
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants