Skip to content

zynqmp: PHY init delay step and timer robustness fixes - #866

Merged
danielinux merged 2 commits into
wolfSSL:masterfrom
dgarske:zynqmp_phy_delay
Aug 21, 2026
Merged

zynqmp: PHY init delay step and timer robustness fixes#866
danielinux merged 2 commits into
wolfSSL:masterfrom
dgarske:zynqmp_phy_delay

Conversation

@dgarske

@dgarske dgarske commented Aug 20, 2026

Copy link
Copy Markdown
Member

Extends the ZynqMP PHY init engine (WOLFBOOT_ZYNQMP_PHY_INIT) with a ZYNQMP_PHY_OP_DELAY step that inserts a millisecond delay between sequence rows. External PHYs commonly specify a post-reset ready time before MDIO access; a sequence typed at a U-Boot prompt absorbs that in console turnaround, but replayed back-to-back from hal_init it needs an explicit delay row. Validated on a ZynqMP board with an external dual-port gigabit PHY behind a PL AXI-GPIO reset line. Since the delay routes through hal_timer_ms(), that function also gains a CNTFRQ_EL0 == 0 fallback (matching hal_get_timer_us()) - without it, an unconfigured counter frequency makes hal_delay_ms() spin forever, since AArch64 UDIV by zero returns 0.

Also makes hal_get_timer_us() link-safe across build variants: the microsecond conversion now uses a split 64-bit divide instead of __uint128_t, which pulled libgcc's __udivti3 into links that build without it (seen in a customer test-app link against this HAL), and its gate accepts WOLFBOOT_UPDATE_DISK/BOOT_BENCHMARK in addition to the MMU/FDT path so the symbol exists in every build that can reference it. A new zynqmp_phy_delay_test CI job builds with BOOT_BENCHMARK=1 and a custom ZYNQMP_PHY_INIT_STEPS list exercising every op (GPIO, WR, RD, DELAY), covering both changes; the existing zynqmp_phy_test job continues to build the default PHY init configuration unchanged. Verified with full config/examples/zynqmp.config builds (wolfboot.bin, test-app, factory.bin) using the exact CI invocation, plus the default build.

@dgarske dgarske self-assigned this Aug 20, 2026
Copilot AI lite review requested due to automatic review settings August 20, 2026 19:33

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.

Pull request overview

This PR enhances the ZynqMP HAL’s board-configurable PHY init “engine” to support an explicit millisecond delay step (useful for external PHY post-reset settle times), and hardens the timer helpers used by those delays and by benchmarking/update-disk builds.

Changes:

  • Add ZYNQMP_PHY_OP_DELAY to the ZynqMP PHY init step list and execute it via hal_delay_ms().
  • Make hal_timer_ms() robust when CNTFRQ_EL0 is unset by falling back to the known ZynqMP counter frequency.
  • Rework hal_get_timer_us() to avoid __uint128_t (and the __udivti3 libgcc dependency) and broaden its compilation gate; add CI coverage for the new op and benchmark dependency.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
hal/zynq.h Adds the new PHY init op-code definition and documents its arguments.
hal/zynq.c Implements delay-step execution, adds CNTFRQ_EL0==0 fallback for ms timing, and replaces 128-bit us conversion with a link-safe split divide; adjusts build gating for hal_get_timer_us().
.github/workflows/test-configs.yml Adds a CI job that exercises the full PHY init op set (including the new delay op) and the BOOT_BENCHMARK dependency path.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/test-configs.yml
@dgarske dgarske changed the title zynqmq: PHY init delay step and timer robustness fixes zynqmp: PHY init delay step and timer robustness fixes Aug 20, 2026
@dgarske dgarske assigned danielinux and wolfSSL-Bot and unassigned dgarske Aug 21, 2026
@dgarske
dgarske requested a review from danielinux August 21, 2026 02:29
@danielinux
danielinux merged commit 5c07c37 into wolfSSL:master Aug 21, 2026
431 of 432 checks passed
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.

4 participants