Commit graph zephyr/drivers/ethernet
Author SHA1 Message Date
Fin Maaß
a07235943d drivers: ethernet: mdio: stm32: make pinctrl optional
The MDC and MDIO pins can be part of the pinctrl state of the Ethernet
MAC node, which is applied when the MAC is initialized, before the
MDIO controller and the PHY. Make the pinctrl state of the mdio node
optional, like in the DWMAC MDIO driver.

Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-10-30 12:50:28 -04:00
Benjamin Cabé
812d8272e0 drivers: ethernet: wiznet: use LOG_ERR_DEVICE_NOT_READY
Report the SPI bus and GPIO ports that are not ready with
LOG_ERR_DEVICE_NOT_READY() instead of open-coded messages, which also
drops the "SPI master port" wording.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5.5
2026-10-30 10:13:40 -04:00
Fin Maaß
4edad168af drivers: ethernet: dwc_xgmac: Use the standard Ethernet MTU
The driver set the interface MTU to the max-frame-size devicetree
property. That property is a frame size including the 14 byte header
and the 4 byte FCS, so even the default of 1518 gave an MTU of 1518
instead of 1500, and the agilex5_socdk board value of 9018 made TCP and
IP fragmentation build jumbo packets, which the Ethernet L2 does not
support.

Register the interface with NET_ETH_MTU and drop the MTU config member
and the net_if_set_mtu() call.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-10-29 19:44:43 -04:00
Fin Maaß
a9248bb79d drivers: ethernet: wch: do not set link address from set_config
set_mac_addr() is used by the ETHERNET_CONFIG_TYPE_MAC_ADDRESS case of
set_config and also called net_if_set_link_addr(). The caller of
set_config, NET_REQUEST_ETHERNET_SET_MAC_ADDRESS, updates the link
address of the interface itself once set_config succeeded, and the
driver should only register the initial address.

Only program the hardware in set_mac_addr(), and call
net_if_set_link_addr() from iface_init after it.

Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-10-28 22:44:37 -04:00
Fin Maaß
8223076303 drivers: ethernet: phy: do not enable ETH_PHY_DRIVER by default
ETH_PHY_DRIVER is now selected by the Ethernet drivers that need a PHY
driver, so it no longer has to be enabled by default whenever
ETH_DRIVER is enabled.

This also makes the default of qemu_cortex_a9, which disabled the PHY
drivers without NET_QEMU_ETHERNET, redundant, so remove it.

Enable ETH_PHY_DRIVER in the Ethernet build_all test, as it builds the
PHY drivers without a MAC driver. On qemu_cortex_a9 delete the
zephyr,uart-pipe chosen node in the test, so that Ethernet instead of
SLIP networking is used and the GEM and its MDIO driver, needed by the
PHY driver, are built.

Built tests/drivers/build_all/ethernet for native_sim and
qemu_cortex_a9 and checked the resulting configuration of network
samples on nucleo_h753zi and qemu_cortex_a9.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-10-28 22:35:20 -04:00
Fin Maaß
23721a6cee drivers: ethernet: select ETH_PHY_DRIVER in drivers using a PHY
Select ETH_PHY_DRIVER in every Ethernet driver that uses a PHY device,
so that the drivers no longer rely on it being enabled by default.

For the DWC MAC drivers the select is placed in the two core symbols,
which all glue drivers select. The NETC DSA driver selects it as well,
as the DSA ports need a PHY device.

The WIZnet and DM9051 drivers define their PHY device themselves and do
not need a driver from drivers/ethernet/phy. They select it too, as the
net shell only shows the PHY link state and provides the set_link
command with ETH_PHY_DRIVER enabled.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-10-28 22:35:20 -04:00
Fin Maaß
6dd7715330 drivers: ethernet: xlnx_gem: do not warn about checksum offload on QEMU
The driver emits a preprocessor warning whenever it is built for a QEMU
target, as the checksum offloading is always disabled there. The
warning can not be acted upon and makes the build fail when warnings
are treated as errors, as twister does.

Only warn when the offloading is disabled through the devicetree.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-10-28 22:35:20 -04:00
Fin Maaß
063d1efcbc drivers: ethernet: dwc_mac: mmu: depend on CPU_HAS_MMU
Let ETH_DWMAC_MMU depend on CPU_HAS_MMU instead of MMU.

MMU is selected by the architecture MMU options, which makes it part of
long chains of reverse dependencies. A driver depending on it creates
a Kconfig dependency loop as soon as one of the DWC cores selects a
symbol that leads to PINCTRL or CLOCK_CONTROL.

Built tests/drivers/build_all/ethernet for qemu_cortex_a9 with
NET_QEMU_ETHERNET and NET_L2_ETHERNET enabled, which builds
ETH_DWMAC_MMU through the board overlay of the test.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-10-28 22:35:20 -04:00
Fin Maaß
8ce07b5628 drivers: ethernet: xilinx_axienet: select DMA
Select DMA instead of depending on DMA_XILINX_AXI_DMA. The DMA driver
is enabled by default once DMA is enabled and its devicetree node is
present, so the Ethernet driver no longer needs CONFIG_DMA=y to be set
by the application.

This also keeps the driver free of a dependency on DMA, which has a
long list of reverse dependencies and would create a Kconfig dependency
loop as soon as the driver selects a symbol that leads to PINCTRL.

Built samples/net/dhcpv4_client for cv64a6_genesys_2 with an overlay
adding the MAC, MDIO and PHY nodes.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-10-28 22:35:20 -04:00
Fin Maaß
9688c124ef drivers: ethernet: bcmgenet: Use the standard Ethernet MTU
The interface was registered with GENET_MAX_FRAME_LEN, the 1536 byte
frame length programmed into the MAC, as its MTU. That made TCP and IP
fragmentation build packets up to 1536 bytes of L3 payload, which
exceeds the Ethernet frame size the MAC is configured for.

Register the interface with NET_ETH_MTU. The MAC frame length register
keeps GENET_MAX_FRAME_LEN.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-10-22 18:26:43 +02:00
Fin Maaß
8a2d68e904 drivers: ethernet: nxp_imx_netc: vsi: don't set link addr in set_config
The ETHERNET_CONFIG_TYPE_MAC_ADDRESS case of set_config called
net_if_set_link_addr(). The caller of set_config,
NET_REQUEST_ETHERNET_SET_MAC_ADDRESS, updates the link address of the
interface itself once set_config succeeded, and the driver should only
register the initial address from iface_init. Only store the address
in the driver data.

Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-10-22 18:25:56 +02:00
Fin Maaß
1a0eebccc4 drivers: ethernet: stm32: hal2: use the new MAC address in set_config
The ETHERNET_CONFIG_TYPE_MAC_ADDRESS case programmed the address
already stored in the driver data instead of the one passed in the
config, so the hardware kept the old MAC address. Store the new
address before programming it.

Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-10-22 18:25:25 +02:00
Jukka Rissanen
67db4d6562 drivers: ethernet: nxp_enet: Clear checksums before TX insertion
With CONFIG_ETH_NXP_ENET_HW_ACCELERATION the ENET inserts the IPv4
header checksum and the TCP, UDP and ICMP checksum into every IP frame
it sends. It computes them over the checksum fields as they are, so the
fields must be zero.

The stack leaves them zero only when it offloads the checksum for the
interface the packet was built on. Two kinds of frames reach the ENET
with the checksums filled in: frames forwarded by an Ethernet bridge,
which carry the sender's checksums, and frames sent by the bridge
interface itself, which is a virtual interface and so gets software
checksums. The ENET then sent them with wrong IPv4 header and ICMP
checksums, and the receiver dropped them.

Clear the fields in the TX copy of the frame before handing it to the
ENET. Frames with an 802.1Q tag are handled the same way, as the ENET
inserts their checksums too. Frames whose checksums the stack offloaded
are unchanged. IPv4 fragments keep their protocol checksum, which the
stack computes in software before fragmenting.
ICMPv6 is left alone: the ENET does not insert its checksum.

Tested on mimxrt1170_evk@B/mimxrt1176/cm7 bridging ENET and ENET_1G
between two Linux hosts, capturing every frame the board sent. Before:
the bridge's own ICMP replies had IPv4 and ICMP checksums 0xffff, and
the receiving NIC dropped all forwarded IPv4 frames and the forwarded
IPv6 TCP and UDP frames; forwarded ICMPv6 and IPv6 fragments were fine.
After: forwarded ICMP, UDP and TCP over IPv4 and IPv6, ICMP to the
bridge address, and 3000 byte IPv4 and IPv6 fragmented pings all pass,
with no bad checksum in 547 frames. Forwarded ICMP, UDP and TCP frames
tagged with VLAN 100 had 0xffff checksums before and pass after.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-10-22 18:18:49 +02:00
Fin Maaß
fee25e9a47 drivers: ethernet: dwc_xgmac: unlock config mutex after MAC change
The ETHERNET_CONFIG_TYPE_MAC_ADDRESS case of set_config returned
while still holding dev_cfg_lock, so every later set_config call
from another thread blocked forever. Leave the switch with break so
the mutex is released.

Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-10-21 12:05:31 +02:00
Chao Liu
cf26603727 drivers: ethernet: virtio: fix frame buffer size for tagged frames
The TX and RX frame buffers are sized from the MTU plus the plain
Ethernet header, but the L2 layer can prepend a VLAN or a DSA tag to a
maximum-size frame. With CONFIG_NET_VLAN, a tagged frame is four bytes
longer than the buffers: it does not fit the receive buffer, and it
overruns the TX buffer.

Size the buffers from NET_ETH_MAX_FRAME_SIZE, which includes both tags.
The size is unchanged when neither option is enabled.

Fixes: 91ac587124 ("drivers: ethernet: Add VIRTIO Network Device")

Fixes #122778

Signed-off-by: Chao Liu <chao.liu@processmission.com>
2026-10-21 12:04:15 +02:00
Fin Maaß
a034509e4a drivers: ethernet: smsc91x: fix the set_config prototype
commit db984ee196 ("net: l2: ethernet: add struct net_if to
arguments") added the iface parameter to eth_smsc_set_config() without
the trailing comma, so the driver no longer compiles. Add it.

Found by building samples/net/zperf for fvp_base_revc_2xaem/v8a, no
board in CI builds this driver.

Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-10-16 15:51:15 -05:00
Tim Pambor
8327ea7970 drivers: ethernet: dwc_mac: ptp: fix PPS build on the QoS core
commit fe5660138c ("drivers: ethernet: dwc_mac: let pps pin one pulse
per second") reads DWMAC_MACVERR and writes DWMAC_PTP_PPSCR_PPSCTRL,
which are only defined for the ether_1000 core, so the PTP clock no
longer builds for the QoS core.

Fix compilation for QoS cores, which were missing these defines. The
QoS core selects the PPS output bit from the sub-second field the
same way, so apply the fix there too: add DWMAC_VERSION_REG pointing at
the version register of each core, share DWMAC_VERSION_SNPSVER,
DWMAC_CORE_3_70 and DWMAC_PTP_PPSCR_PPSCTRL between both cores, and use
them in the PPS setup.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-10-14 18:40:20 +02:00
Madhab Sharma
9bd6e07f99 drivers: ethernet: wch9120: use sizeof for lengths and validate recv args
Replace hard-coded buffer lengths with sizeof() and ARRAY_SIZE()
and add checks for handling invalid buf and len.

Signed-off-by: Madhab Sharma <madhabsharma94@gmail.com>
2026-10-14 13:48:34 +02:00
cyliang tw
fe5660138c drivers: ethernet: dwc_mac: let pps pin one pulse per second
In digital rollover of DWC ether_1000 v3.70, to avoid the reset
value of 0 never toggle bit 30.
So, select bit 29 to give one pulse per second.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2026-10-14 13:45:26 +02:00
Massimiliano Cialdi
670af5d17d drivers: ethernet: nxp_enet: Rate limit the RX error logs
Under an RX overload every errored or dropped frame logged an error. At
1 Gb/s that is tens of thousands of messages per second: the log buffer
overflows, and formatting them costs CPU time in the RX path exactly
when it is short.

Use the rate limited variant for the per-frame RX errors.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Massimiliano Cialdi <massimiliano.cialdi@powersoft.com>
2026-10-14 13:44:54 +02:00
Massimiliano Cialdi
a10b8b7417 drivers: ethernet: nxp_enet: Drain the RX ring past dropped frames
eth_nxp_enet_rx() returns -EIO after it dropped a frame (receive error,
oversized frame or no packet buffer available). The RX work handler
stopped there and left the remaining frames in the ring. The ISR has
already cleared the RX flags, so those frames stay unserviced until a
later frame raises the interrupt. If no later frame comes, RX stops.

Keep reading past a frame dropped for a receive error or for its size.
When no packet buffer is available, return -ENOMEM instead: stop, keep
the RX interrupt masked and resume one tick later from a delayed work
item. The RX work queue is cooperative, so the network stack, which
frees the buffers, only runs when the work queue thread blocks; a work
item that submits itself again at once would not let it run. Meanwhile
the MAC drops the frames that do not fit in the ring, at no CPU cost.

On an i.MX RT1170 EVK (ENET_1G, 6 RX descriptors) with the zperf UDP
server and iperf2 for 30 s, received data:
- 1470 byte datagrams at 1000 Mbit/s: main 0.07 to 11.2 Mbit/s,
  this change 183 Mbit/s
- 1470 byte datagrams at 300 Mbit/s: main 0.45 to 192 Mbit/s,
  this change 177 to 198 Mbit/s
- 1470 byte datagrams at 100 Mbit/s: 104.9 Mbit/s with both, same loss
- 64 byte datagrams at 500 kpps: main stops after 46 packets in 3 of 6
  runs, this change 0.39 to 1.32 million packets and never stops

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Massimiliano Cialdi <massimiliano.cialdi@powersoft.com>
2026-10-14 13:44:54 +02:00
Tim Pambor
fda20f6b31 drivers: ethernet: dwc_mac: ptp: support binary rollover mode
The PTP clock always selected digital rollover, where the sub-second
field counts nanoseconds. The 3.x core in STM32F1 predates that option:
its timestamp control register has no rollover select and its
sub-second field always counts in units of 2^-31 s, so the increment
was applied in the wrong unit and the values handed to the network
stack were off by a factor of about 2.15 and exceeded one second.

Digital rollover remains the default through the hidden KConfig option
PTP_CLOCK_DWC_MAC_DIGITAL_ROLLOVER, where the conversions are the
identity. The option is not offered on STM32F1, which therefore runs
in binary rollover mode.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-09-30 19:42:31 +02:00
Tomas Choat
51b320b1c2 drivers: ethernet: stm32: continue RX processing after frame drops
Distinguish dropped frames from an empty RX queue so the RX thread
continues processing after a drop. This allows HAL API v2 to rebuild
pending DMA descriptors and prevents reception from remaining stalled
after temporary packet exhaustion.

Signed-off-by: Tomas Choat <trc@ixys.no>
2026-09-30 12:56:28 +02:00
Youri Tils
b5ade0a83d drivers: ethernet: nxp_imx_netc: fix TX timestamp deadlock with DSA
netc_eth_tx() only entered the TX-timestamp wait loop when opt.flags
had kEP_TX_OPT_REQ_TS set. That flag is set only for endpoint
timestamps; a DSA conduit-port frame requests its timestamp via a
separate txDesc TSR_MASK flag. So a DSA-only timestamp request skipped
the wait loop, its TX descriptor was never reclaimed, the ring filled
up, and the driver blocked forever on tx_sem.

Track the request in a local req_ts flag set by either path, and use
it to enter the wait loop. The endpoint isTsAvail branch still checks
opt.flags so an endpoint timestamp is only reported when requested.

Signed-off-by: Youri Tils <youri.tils@nxp.com>
2026-09-30 12:39:58 +02:00
Tim Pambor
5b26def040 drivers: ethernet: dwc_mac: ptp: add optional pinctrl support
The DWC MAC PTP clock can drive a pulse-per-second output on a SoC pin.
That pin belongs to the PTP clock, not to the MAC, so boards need a way
to mux it only when the ptp-clock node is enabled.

Add pinctrl-device.yaml to the snps,dwmac-ptp-clock binding and let the
PTP clock driver apply the default pinctrl state during init. Pinctrl is
optional: the driver keeps building for nodes without pinctrl-0, and the
Kconfig symbol selects PINCTRL only when a ptp-clock node uses it,
following the pattern of the DWC MAC MDIO driver.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-09-30 11:07:25 +02:00
Tim Pambor
2731ce98d8 drivers: ethernet: dwc_mac: stm32: drop the untested note for STM32F1
The driver now works on the STM32F107, verified on an STM32F107VCT6 with
a DP83848 PHY in MII mode.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-09-30 11:04:38 +02:00
Tobias Aguiar
fe9b0ed824 drivers: mdio: decouple from NETC Ethernet driver
The NETC MDIO driver has no runtime dependency on the NETC Ethernet
driver. Requiring it prevented use cases where an external stack owns
the NETC Ethernet controller while Zephyr manages only the MDIO bus
and PHY drivers.

Drop the Ethernet driver dependency from the MDIO Kconfig. Relax the
NETC bring-up guards in board.c, soc.c, and the clock control driver to
cover MDIO_NXP_IMX_NETC as well, so the NETC clock roots and MII-mode
configuration run whenever either the Ethernet or the MDIO driver is
enabled. Extend the HAL netc component and its SoC sub-component to
build for MDIO-only configurations in the same way, by enabling
driver.netc and the SoC-specific sub-component when MDIO_NXP_IMX_NETC
is set.

Signed-off-by: Tobias Aguiar <tobias.aguiarsilvadealmeida@nxp.com>
2026-09-29 13:32:36 +02:00
Sven Ginka
fb4efd458d drivers: eth: sy1xx: handle RX metadata stripping
Add error handling for RX frames shorter than metadata
size and strip MAC-specific metadata (timestamp and
status) from RX frames before passing them to the
Ethernet stack.

Signed-off-by: Sven Ginka <s.ginka@sensry.de>
2026-09-29 13:31:34 +02:00
Fin Maaß
b8da0ed778 drivers: ethernet: dwc_mac: ptp: only timestamp gPTP frames with gPTP
With gPTP enabled, timestamp only PTPv2 frames carried over Ethernet
instead of all received frames.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-09-29 10:43:59 +02:00
Fin Maaß
3ab973cf7f drivers: ethernet: dwc_mac: ptp: timestamp all PTP event messages
When filtering for PTP frames, the snapshot type was left at 0, which
only timestamps Sync, Follow_Up, Delay_Req and Delay_Resp. The peer
delay messages Pdelay_Req and Pdelay_Resp were not timestamped, so the
peer-to-peer delay mechanism could not work.

Select the snapshot type that timestamps all PTP event messages, so
both the end-to-end and the peer-to-peer delay mechanisms are covered.
From core version 3.70 on this is type 1 with TSEVNTENA cleared, as the
Linux stmmac driver does. Older cores, such as the 3.50 in STM32F2, F4
and F7, use the field to select the clock node type instead, where only
the peer-to-peer transparent clock (3) covers all event messages.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-09-29 10:43:59 +02:00
Fin Maaß
73b04db034 drivers: ethernet: dwc_mac: ptp: make RX timestamp filtering configurable
Add Kconfig options selecting which received frames get timestamped:
either all frames, or only PTP frames with individually selectable
PTPv2 format and Ethernet, UDP/IPv4 and UDP/IPv6 transports.

The defaults match the previous behaviour, which derived the setup
from CONFIG_PTP and the PTP transport options.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-09-29 10:43:59 +02:00
Benjamin Cabé
3484454ac8 scripts: kconfig: hardenconfig: switch to YAML hardening database
Replace scripts/kconfig/hardened.csv with a distributed YAML database.
The CSV format could not carry any explanation for its recommendations,
had no validation (a malformed line was silently dropped), no notion of
profiles, no ownership story, and no way to extend it out of tree.

The database now lives where the code lives: the central
scripts/kconfig/hardening.yaml defines the hardening profiles (plus
rules for top-level Kconfig symbols), and per-subsystem hardening.yaml
fragments next to the relevant Kconfig files carry the rules, so each
rule is reviewed by the maintainers of the code it hardens. Every rule
has a required rationale and optional references, supports exact-value
and integer min/max recommendations (STACK_POINTER_RANDOM is now
'>=100' instead of '==100'), and belongs to a profile: 'base' (memory
protection and inherently insecure features) or 'strict' (extends base
with debug/observability feature removal). The default profile is
'strict', matching the rule set the CSV checked.

hardenconfig is restructured around a serializable HardeningReport
model so results can be consumed programmatically, and gains:

- a Rationale column in the report
- profile selection:
  west build -t hardenconfig -- -DHARDENCONFIG_PROFILE=base
- HARDENCONFIG_SHOW_ALL to also list PASS/NA results
- HARDENCONFIG_STRICT to exit non-zero on failures, for CI use
- HARDENCONFIG_JSON to write machine-readable results, including which
  database file each rule came from
- HARDENCONFIG_EXTRA_SOURCES to layer out-of-tree database files that
  may add profiles/rules and override in-tree ones

The EXPERIMENTAL/DEPRECATED/NOT_SECURE marker symbol detection is
preserved unchanged.

Three CSV entries are intentionally not carried over because they were
redundant: BT_CONN_DISABLE_SECURITY and BT_OOB_DATA_FIXED can only be
enabled together with BT_TESTING, and TIMER_RANDOM_GENERATOR together
with TEST_RANDOM_GENERATOR, all of which the database already
recommends disabling for the same profiles.

Behavioral fix: the CSV's DEBUG_COREDUMP line used '=' instead of ','
and was silently ignored, so CONFIG_DEBUG_COREDUMP was never actually
checked; it now is.

Also add tabulate to requirements-base.txt: hardenconfig has always
imported it, but it was only pulled in via other requirements files.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-09-29 10:40:32 +02:00
Yasushi SHOJI
0972ecb5d9 drivers: ethernet: phy: vsc8541: Use Linux edge-rate properties
The raw microchip,pad-edge-rate property duplicates the Linux devicetree
ABI for the same hardware control.

Replace it with vsc8531,vddmac and vsc8531,edge-slowdown. Convert the
voltage-dependent slowdown percentage to the register setting at compile
time using the datasheet table. Reject unsupported combinations at build
time and leave the pad edge-rate control register untouched when
edge-slowdown is absent.

Document the percentages as typical silicon measurements and add build
coverage for default and explicit settings.

Assisted-by: Codex:GPT-6
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2026-09-28 10:54:17 -04:00
Tony Han
e636a92d83 drivers: ethernet: sam_gmac: obtain MCK rate at runtime for SAMA7 SoCs
Adding code for obtaining the clock rate of MCK at runtime for Microchip
SAMA7 SoCs.

Signed-off-by: Tony Han <tony.han@microchip.com>
2026-09-28 07:38:15 -04:00
Tony Han
d8ab222afa drivers: ethernet: sam_gmac: update config for phy-connection-type
Update configutations for phy-connection-type for the following:

SAMA7G5 GMAC_UR_MIM:
  Value |  Name  | Description
  ------|--------|----------------------------------------------
    0   |  MII   | Selects MII mode when GMAC_NCR.MIIONRGMII=1.
    1   |  RMII  | Selects RMII mode when GMAC_NCR.MIIONRGMII=0.
    2   |  RGMII | Selects RGMII mode when GMAC_NCR.MIIONRGMII=0.

SAMA7D6 & SAM9X7 GMAC_UR_MIM:
  Value |  Name  | Description
  ------|--------|--------------------
    0   |  -     | Reserved
    1   |  RMII  | Selects RMII mode.
    2   |  RGMII | Selects RGMII mode.

SAMA5D2 GMAC_UR_RMII:
  Value | Description
  ------|--------------------------------
    0   | MII mode is selected (default).
    1   | RMII mode is selected.

Signed-off-by: Tony Han <tony.han@microchip.com>
2026-09-28 07:38:15 -04:00
Benjamin Cabé
dbe5e34495 cmake: emu: qemu: use -nic for on-board ethernet NICs
QEMU rejects -device for NICs built into the emulated machine (lan9118,
stellaris, cadence_gem), so QEMU failed to start on those boards with
networking enabled. Let these drivers select ETH_NIC_MODEL_ONBOARD and
configure such NICs with -nic instead.

Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-09-26 00:59:45 +02:00
Tim Pambor
bf539dc736 drivers: ethernet: dwc_mac: nxp: list the implemented MMC counters
List the MMC counters of the Ethernet controller found in the NXP MCX
E31 and S32K3 series so they are reported as vendor specific Ethernet
statistics.

The controller of the MCX N and MCX A series has no MMC counters.

Assisted-by: Claude:claude-fable-5.1
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-09-24 10:00:41 +02:00
Tim Pambor
fd198c5af3 drivers: ethernet: dwc_mac: rockchip: list the implemented MMC counters
List the MMC counters of the Ethernet controller found in the Rockchip
RK3588 so they are reported as vendor specific Ethernet statistics.

Assisted-by: Claude:claude-fable-5.1
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-09-24 10:00:41 +02:00
Tim Pambor
72a713cf21 drivers: ethernet: dwc_mac: rockchip: improve device macro readability
Separate the parts of RK3588_GMAC_DEFINE() with empty lines, put each
member of the struct dwmac_config initializer on a line of its own and
move the closing brackets of the multi-line initializers to their own
line. No functional change.

Assisted-by: Claude:claude-fable-5.1
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-09-24 10:00:41 +02:00
Tim Pambor
6f7a38fba5 drivers: ethernet: dwc_mac: stm32: list the implemented MMC counters
List the MMC counters of the Ethernet controller found in the STM32
series so they are reported as vendor specific Ethernet statistics.

The STM32F1, F2, F4 and F7 series implement six counters, the STM32C5,
H5, H7, H7R/S and MP13 series add the four LPI counters and the STM32N6
series further adds the six frame preemption counters.

Assisted-by: Claude:claude-fable-5.1
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-09-24 10:00:41 +02:00
Tim Pambor
d60563d325 drivers: ethernet: dwc_mac: xmc: list the implemented MMC counters
List the MMC counters of the Ethernet controller found in the Infineon
XMC series so they are reported as vendor specific Ethernet statistics.

Assisted-by: Claude:claude-fable-5.1
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-09-24 10:00:41 +02:00
Tim Pambor
be25e79113 drivers: ethernet: dwc_mac: qos: add MMC vendor statistics
Expose the MAC management counters of the QoS core as vendor specific
Ethernet statistics, the same way the 10/100/1000 core does: the
platform glue lists the counters it implements and platforms without a
list report no vendor statistics.

Implement get_stats_type instead of get_stats to avoid an expensive
read of all vendor statistics from the hardware: the Ethernet L2
fetches the common statistics for every packet, while the counter
registers only need to be read when the vendor specific statistics are
requested.

Assisted-by: Claude:claude-fable-5.1
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-09-24 10:00:41 +02:00
Tim Pambor
3aa28e3b56 drivers: ethernet: dwc_mac: 1000: add MMC vendor statistics
Expose the MAC management counters (MMC, also called RMON counters) of
the 10/100/1000 core as vendor specific Ethernet statistics. They are
available whenever CONFIG_NET_STATISTICS_ETHERNET_VENDOR is enabled.

Which counters exist depends on the IP version and its configuration,
so the platform glue lists them with DWMAC_MMC_COUNTERS_DEFINE().
Platforms without a list report no vendor statistics. The keys follow
the names the Linux stmmac driver reports through ethtool.

The counters are 32 bits wide like the reported values, so they are
read as they are and left to roll over; reset on read and the counter
interrupts are not used.

Implement get_stats_type instead of get_stats to avoid an expensive
read of all vendor statistics from the hardware: the Ethernet L2
fetches the common statistics for every packet, while the counter
registers only need to be read when the vendor specific statistics are
requested.

Assisted-by: Claude:claude-fable-5.1
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-09-24 10:00:41 +02:00
Tim Pambor
60472c7f67 drivers: ethernet: dwc_mac: qos: mask the MMC interrupts
The MAC management counters run from reset and their interrupt mask
registers reset to zero, that is unmasked. A counter reaching half or
full scale sets the MMC interrupt flag in MAC_Interrupt_Status. As that
flag has no enable bit in MAC_Interrupt_Enable, it drives the interrupt
line regardless and stays set until the counter is read.
dwmac_mac_irq() never reads the counters, so the interrupt would never
deassert.

Mask all MMC interrupts unconditionally.

Assisted-by: Claude:claude-fable-5.1
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-09-24 10:00:41 +02:00
Tim Pambor
7abdb54744 drivers: ethernet: dwc_mac: 1000: mask the MMC interrupts
The MAC management counters run from reset and their interrupt mask
registers reset to zero, that is unmasked. A counter reaching half or
full scale sets the MMC interrupt flag in DMASR. As that flag has no
enable bit in DMAIER, it drives the interrupt line regardless and stays
set until the counter is read. dwmac_isr() never reads the counters, so
the interrupt would never deassert.

Mask all MMC interrupts unconditionally.

Assisted-by: Claude:claude-fable-5.1
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-09-24 10:00:41 +02:00
Tim Pambor
fdcc8a8b79 drivers: ethernet: dwc_mac: add the MMC register definitions
Add the registers of the MAC management counters (MMC, also called RMON
counters): the control register, the interrupt status and mask registers
and the counters.

The block has the same layout in the 10/100/1000 core and in the QoS
core, at offset 0x100 and 0x700 respectively, so the registers are
defined once relative to a per core DWMAC_MMC_BASE.

Assisted-by: Claude:claude-fable-5.1
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-09-24 10:00:41 +02:00
Henrik Brix Andersen
e301f0bee8 Revert "drivers: ethernet: sam_gmac: update config for phy-connection-type"
This reverts commit af9951f3b6.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2026-09-23 14:35:19 +02:00
Henrik Brix Andersen
3b52e49daa Revert "drivers: ethernet: sam_gmac: obtain MCK rate at runtime for SAMA7 SoCs"
This reverts commit 9d8edaa42d.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2026-09-23 14:35:19 +02:00
Tony Han
9d8edaa42d drivers: ethernet: sam_gmac: obtain MCK rate at runtime for SAMA7 SoCs
Adding code for obtaining the clock rate of MCK at runtime for Microchip
SAMA7 SoCs.

Signed-off-by: Tony Han <tony.han@microchip.com>
2026-09-23 10:49:54 +01:00
Tony Han
af9951f3b6 drivers: ethernet: sam_gmac: update config for phy-connection-type
Update configutations for phy-connection-type for the following:

SAMA7G5 GMAC_UR_MIM:
  Value |  Name  | Description
  ------|--------|----------------------------------------------
    0   |  MII   | Selects MII mode when GMAC_NCR.MIIONRGMII=1.
    1   |  RMII  | Selects RMII mode when GMAC_NCR.MIIONRGMII=0.
    2   |  RGMII | Selects RGMII mode when GMAC_NCR.MIIONRGMII=0.

SAMA7D6 & SAM9X7 GMAC_UR_MIM:
  Value |  Name  | Description
  ------|--------|--------------------
    0   |  -     | Reserved
    1   |  RMII  | Selects RMII mode.
    2   |  RGMII | Selects RGMII mode.

SAMA5D2 GMAC_UR_RMII:
  Value | Description
  ------|--------------------------------
    0   | MII mode is selected (default).
    1   | RMII mode is selected.

Signed-off-by: Tony Han <tony.han@microchip.com>
2026-09-23 10:49:54 +01:00