Skip to content

fix(igc): stabilize i225 phy bring-up#680

Merged
ytakano merged 4 commits intotier4:mainfrom
ytakano:igc_phy_bringup
Apr 21, 2026
Merged

fix(igc): stabilize i225 phy bring-up#680
ytakano merged 4 commits intotier4:mainfrom
ytakano:igc_phy_bringup

Conversation

@ytakano
Copy link
Copy Markdown
Collaborator

@ytakano ytakano commented Apr 20, 2026

Description

Align the Awkernel I225 bring-up path more closely with the BSD igc drivers and improve diagnostics around the PHY reset path.

This change makes the MAC reset path tolerant of auto-read completion timeouts, initializes and synchronizes the MDIC PHY address, powers the PHY up before reading its ID, and clears GO_LINKD/ULP before attempting the hardware reset. The PHY reset path now retries once, logs the relevant control/status registers, and treats a missing RST_COMPL bit as non-fatal when direct MDIC reads show that the PHY is already responding.

On the driver side, tick-based link polling was added so link state can advance even when only the periodic path runs, and link transitions now log speed/duplex changes. In hardware testing over a serial console, the previous hard timeout message was replaced by a benign "PHY reset completion bit did not assert, but PHY responded" diagnostic, and the port reached "Up (Full Duplex)" during boot.

Related links

How was this PR tested?

  • Tested on a physical machine.

Notes for reviewers

ytakano added 2 commits April 20, 2026 11:18
Align the Awkernel I225 bring-up path more closely with the BSD igc drivers and improve diagnostics around the PHY reset path.

This change makes the MAC reset path tolerant of auto-read completion timeouts, initializes and synchronizes the MDIC PHY address, powers the PHY up before reading its ID, and clears GO_LINKD/ULP before attempting the hardware reset. The PHY reset path now retries once, logs the relevant control/status registers, and treats a missing RST_COMPL bit as non-fatal when direct MDIC reads show that the PHY is already responding.

On the driver side, tick-based link polling was added so link state can advance even when only the periodic path runs, and link transitions now log speed/duplex changes. In hardware testing over /dev/ttyUSB0, the previous hard timeout message was replaced by a benign "PHY reset completion bit did not assert, but PHY responded" diagnostic, and the port reached "Up (Full Duplex)" during boot.
Signed-off-by: Yuuki Takano <ytakanoster@gmail.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Stabilizes Intel I225 PHY bring-up by aligning reset/MDIO initialization behavior with BSD igc drivers and improving link-state diagnostics in the Awkernel driver.

Changes:

  • Make the MAC/PHY reset and PHY reset-completion handling more tolerant (retry, extra register diagnostics, non-fatal when PHY is responsive).
  • Synchronize MDIC PHY address and power up the PHY before attempting PHY-ID reads.
  • Add tick-based link polling and log link transitions (speed/duplex and status changes).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
awkernel_drivers/src/pcie/intel/igc/igc_phy.rs Adds MDIC PHY address sync helper; hardens PHY reset path (ULP/GO_LINKD clearing, retry, improved diagnostics).
awkernel_drivers/src/pcie/intel/igc/i225.rs Tolerates auto-read-done timeout; syncs MDIC PHY address; clears low-power/link-down bits; powers PHY before ID read.
awkernel_drivers/src/pcie/intel/igc.rs Adds tick-driven link polling when no LSC interrupt; logs link up/down and status changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread awkernel_drivers/src/pcie/intel/igc/igc_phy.rs Outdated
Comment thread awkernel_drivers/src/pcie/intel/igc/i225.rs
Address the review feedback on PR tier4#680.

Replace the unbounded 100,000-iteration 1us busy-wait in igc_phy_hw_reset_generic with a two-phase reset-completion poll: a short tight loop for the fast-success case followed by a 1ms backoff loop to avoid burning CPU during bring-up while preserving the existing MDIC-based fallback when RST_COMPL does not assert.

Also replace the PHPM magic number 0x0400 in i225 bring-up with the shared IGC_I225_PHPM_ULP constant so the low-power bit definition stays named and centralized.

Verification:

- make fmt

- make x86_64 RELEASE=1

- rebooted the physical x86_64 target over /dev/ttyUSB0 at 38400 baud

- confirmed the rebuilt kernel booted via TFTP and igc still reached link up
Comment thread awkernel_drivers/src/pcie/intel/igc/igc_phy.rs
Comment thread awkernel_drivers/src/pcie/intel/igc/igc_phy.rs
Comment thread awkernel_drivers/src/pcie/intel/igc/igc_phy.rs
Comment thread awkernel_drivers/src/pcie/intel/igc.rs
Comment thread awkernel_drivers/src/pcie/intel/igc.rs Outdated
- Elevate PHY reset timeout log from debug to warn for visibility
- Add write_flush after IGC_MDICNFG write in igc_sync_mdic_phy_addr
- Add doc comments to igc_sync_mdic_phy_addr and igc_poll_link
- Simplify redundant should_poll_link condition to irq.is_none()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@atsushi421 atsushi421 self-requested a review April 21, 2026 11:35
@ytakano ytakano merged commit 9c4d7fc into tier4:main Apr 21, 2026
1 check 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.

3 participants