Skip to content

Let a caller defer the PHY link wait and resolve the link later - #185

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

dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:zynqmp_gem_link_defer

Conversation

@dgarske

@dgarske dgarske commented Oct 1, 2026

Copy link
Copy Markdown
Member

Description

amd_eth_init() previously blocked for up to 10 seconds waiting for copper link establishment (GEM_PHY_ANEG_TIMEOUT_MS + GEM_PHY_LINK_TIMEOUT_MS), preventing callers from running initialization in parallel.

Key Changes

  • Non-blocking Negotiation: Setting both timeout budgets to 0 now triggers auto-negotiation and returns immediately. Callers poll via gem_link_resolve() to handle MAC programming and speed/duplex resolution asynchronously.
  • Guarded Speed Resolution: Added a BMSR_ANCOMPLETE check before resolving link parameters. Prevents early reads from transient PHY registers (e.g., TI DP83867 PHYSTS defaulting to 10M/HD) from corrupting MAC and reference clock settings.
  • Direct MAC Configuration: Updated gem_link_resolve() to overwrite the entire MAC speed/duplex register field rather than bitwise clearing, ensuring idempotency across multiple resolutions.

Hardware / Test Status

  • Hardware: Tested on ZCU102 (GEM3/RGMII, DP83867 PHY) with timeouts set to 0.
  • Behavior: amd_eth_init() returned immediately while negotiation ran in background. Link resolved ~3.1s later at 1000 Mbps Full Duplex with successful ICMP ping responses.
  • Build Targets: Clean builds verified for zcu102, zynq7000, and versal.

@dgarske dgarske self-assigned this Oct 1, 2026
Copilot AI balanced review requested due to automatic review settings October 1, 2026 19:11

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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