Skip to content

arch/arm/stm32n6: Add Ethernet support - #21969

Open
raiden00pl wants to merge 9 commits into
apache:masterfrom
raiden00pl:stm32n6-eth
Open

raiden00pl wants to merge 9 commits into
apache:masterfrom
raiden00pl:stm32n6-eth

Conversation

@raiden00pl

Copy link
Copy Markdown
Member

Summary

Ethernet for STM32N6, using the H7 Ethernet driver moved to common.

  • Move the STM32H7 Ethernet driver to arch/arm/src/common/stm32; H5/H7
    provide the PHY interface select hooks.
  • RGMII support through PHYLIB: the board registers the PHY driver and
    sets BOARD_ETH_PHY_INTERFACE. No PHY-specific code in the arch driver.
  • 64-bit AXI DMA, shared MTL FIFOs, MAC reset timeout, D-cache fix.
  • Keep received frames with only a dribble bit error (CRC good).
  • STM32N6 GPIO I/O delay (needed for RGMII GTX_CLK on the DK).
  • Boards: stm32n6570-dk (RTL8211F, RGMII 1000M), nucleo-n657x0-q
    (LAN8742A, RMII), stm32h573i-dk (RMII).

Impact

H5/H7 Ethernet keeps its existing (non-PHYLIB) path.

Testing

  • stm32n6570-dk:netnsh: 1000 Mbps link, 2999/3000 host pings,
    50/50 1400-byte pings, 3/3 ifdown/ifup.
  • nucleo-n657x0-q:netnsh, stm32h573i-dk:netnsh, stm32h735g-dk:netnsh:
    link and ping OK.
  • Builds: nucleo-h743zi2:netnsh, nucleo-h563zi:netnsh.

The PHY interface is selected in SBS PMCR on STM32H5 and STM32H7R/S and
in SYSCFG PMC on the other STM32H7, for the common Ethernet driver.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: raiden00pl <raiden00@railab.me>
The Ethernet QoS MAC driver of STM32H7 and its MDIO drivers become
common/stm32/stm32_eth_v2.c behind STM32_HAVE_IP_ETHMAC_V2, and replace
the STM32H5 copy; the H5 checksum offload is carried over.  Each family
selects the PHY interface in its stm32_eth_phyif.h.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: raiden00pl <raiden00@railab.me>
With CONFIG_NET_PHYLIB the driver hands the PHY to PHYLIB: the board
registers the PHY driver and may set the PHY interface mode with
BOARD_ETH_PHY_INTERFACE, and the link speed and duplex come from the PHY
state machine.  RGMII up to 1000 Mbps requires PHYLIB.

The driver also learns 64-bit AXI DMA masters and MTL FIFOs shared by
several queues.  A MAC software reset that does not complete now fails
the bring-up; its timeout covers the PHY receive clock start-up, and the
RCC reset is read back first.  RX replacement buffers are invalidated
for the D-cache.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: raiden00pl <raiden00@railab.me>
A dribble bit error sets the RX error summary although the CRC of the
frame is good.  The LAN8742A RMII link of the Nucleo-N657X0-Q shows it
on a few percent of the frames, which were all dropped.  Drop only
frames with a CRC, receive, overflow, watchdog or giant packet error.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: raiden00pl <raiden00@railab.me>
STM32N6 GPIOs can delay the input or the output path of a pin, which
RGMII needs to skew the transmit clock from the data.  A pinset now
carries the delay and its path, and stm32_configgpio() programs the
DELAYR and ADVCFGR registers on chips that have them.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: raiden00pl <raiden00@railab.me>
Select the common Ethernet v2 driver for ETH1 and add its pins, clocks
and RGMII interface selection.  ETH1 gets RIF access to Secure memory.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: raiden00pl <raiden00@railab.me>
The RJ45 port is the RTL8211F PHY on ETH1 over RGMII.  The netnsh
configuration adds networking with DHCP, ping, telnetd and mdio.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: raiden00pl <raiden00@railab.me>
Add the RMII pins of the LAN8742A PHY and a netnsh configuration.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: raiden00pl <raiden00@railab.me>
Add the RMII pins of the LAN8742A PHY and a netnsh configuration.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: raiden00pl <raiden00@railab.me>
@github-actions github-actions Bot added Area: Documentation Improvements or additions to documentation Arch: arm Issues related to ARM (32-bit) architecture Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. Board: arm labels Nov 17, 2026
@github-actions

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm Issues related to ARM (32-bit) architecture Area: Documentation Improvements or additions to documentation Board: arm Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants