Commit graph

1,620 commits

Author SHA1 Message Date
Stanislav Poboril
0c7edb88e8 drivers: eth_nxp_enet_qos: default to 10 Mbps half-duplex at MAC init
The MAC_CONFIGURATION register was unconditionally OR'ed with the FES
(speed) and DM (duplex) bits, forcing 100 Mbps full-duplex during MAC
initialization. The PHY link callback later updates these bits to match
the actual link state, but on 10BASE-T1S (PLCA) links the temporary
100 Mbps/full-duplex setting causes the MAC to ignore the COL signal
from the internal TENBASET_PHY block. As a result the MAC transmits
during another node's transmit opportunity, producing collisions and
lost data.

Initialize MAC_CONFIGURATION with FES and DM cleared (10 Mbps,
half-duplex, which is also the register's reset value) and let the PHY
callback set the correct speed/duplex once the link is up. Read-modify-
write is done via a local variable so both the set and clear masks are
applied in a single register write.

Fixes #109682

Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
2026-05-29 22:11:11 +02:00
Måns Ansgariusson
dd85c65b7e drivers: ethernet: sam_gmac: replace private ring_buffer with sys_ringq
Remove the driver-local struct ring_buffer in favour of sys_ringq.
Pointers are stored directly in the ring queues, which removes the need
for the POINTER_TO_UINT casts and fixes a potential platform-specific
pointer truncation issue on 64-bit architectures.

gmac_desc_list rings are unchanged as they require
in-place DMA descriptor access.

closes: #21155
Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
2026-05-29 22:06:36 +02:00
Arayik Gharibyan
513e98118e drivers: ethernet: enc424j600: support multiple instances
Convert the ENC424J600 Ethernet driver from a single hardcoded
devicetree instance to the standard Zephyr multi-instance pattern using
DT_INST_FOREACH_STATUS_OKAY().

Before this change, only instance 0 was registered, so boards with
multiple microchip,enc424j600 nodes could only create one Ethernet
interface.

This allows all status = "okay" ENC424J600 devicetree instances to be
registered.

Fixes #109849

Signed-off-by: Arayik Gharibyan <arayik.gharibyan.1999@gmail.com>
2026-05-29 07:44:33 +02:00
Ching Ping Sun
9ef4c82c0f drivers: ethernet: dm9051: Fix buffer size for 4-byte CRC
The DM9051 IC automatically appends a 4-byte CRC to each frame
stored in internal SRAM. The original driver did not account for
this, causing potential buffer overflow for large frames.

Add ETH_DM9051_CRC_SIZE constant and increase TX/RX buffer sizes
accordingly. Use IN_RANGE macro for RX length validation and
sizeof(data->rx_buf) for length checks.

Fixes: buffer overflow when receiving frames close to MTU (1500 bytes)
Fixes: potential RX length check issues with hardcoded values
Fixes: missing minimum frame size validation

Suggested-by: jukkar
Signed-off-by: Ching Ping Sun <tom_sun@davicom.com.tw>
2026-05-27 15:13:48 +01:00
Tony Han
acfb59ebde drivers: ethernet: sam_gmac: handle the GMAC register with device MMIO
Handle GAMC register with device memory-mapped input/output management.
As the MMIO is used, remove the MMU configurations for GMAC accordingly.

Signed-off-by: Tony Han <tony.han@microchip.com>
2026-05-26 15:23:38 +02:00
Tony Han
19c9d0d842 drivers: ethernet: mdio: mdio_sam: handle register with device MMIO
Handle GAMC register with device memory-mapped input/output management.

Signed-off-by: Tony Han <tony.han@microchip.com>
2026-05-26 15:23:38 +02:00
Manjae Cho
8d4b54cc78 drivers: ethernet: add WIZnet W6300 support
Add a driver for the WIZnet W6300 stand-alone Ethernet controller
with SPI interface. The driver operates in MACRAW mode using Socket 0
to send and receive raw Ethernet frames via Zephyr's Ethernet L2 layer.

PHY link state is monitored via the W6300 interrupt pin combined with
a periodic polling thread. The SPI protocol uses a 4-byte command
frame (instruction + address high + address low + dummy) for both
read and write operations, as required by the W6300 hardware.

Signed-off-by: Manjae Cho <manjae.cho@samsung.com>
2026-05-26 15:18:02 +02:00
Fin Maaß
6834dc4e0b drivers: ethernet: phy: move genphy_*_plca_* function
These functions are from phy_oa_tc14_plca.c, which
is only a helper for phys to implement the set_plca_cfg,
get_plca_cfg and get_plca_sts functions of the ethernet_phy
api, therefore they should be internal.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-22 18:23:46 +02:00
Shan Pen
ee4b636d5c eth: phy: rtl8211f: make RGMII delay configurable
Follow the pattern used by other PHY drivers and expose the
RTL8211F RGMII clock delay mode in devicetree.

Some MAC drivers, such as Renesas RA RMAC, can provide part of
the RGMII delay themselves. Boards then need a way to avoid
enabling the same delay in the PHY.

Keep the fallback at RX and TX delay enabled, matching the old
driver behavior for existing users.

Signed-off-by: Shan Pen <bricle031@gmail.com>
2026-05-20 14:09:01 +02:00
Tim Pambor
a9afaa246e drivers: ptp_clock: Add native_sim PTP clock driver
Add a new PTP clock driver for the native_sim board, allowing
it to simulate a PTP clock for testing and development purposes.

This replaces the previous implementation of the PTP clock
functionality that was integrated into the eth_native_tap ethernet
driver.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-05-20 14:08:19 +02:00
Bartosz Bilas
22ebd56407 drivers: ethernet: esp32: guard eth_esp32_iomux_rmii_clk_input
Add a guard for `eth_esp32_iomux_rmii_clk_input` function to fix the
following error:

error: 'eth_esp32_iomux_rmii_clk_input' defined but not used
[-Werror=unused-function] 245 | static void
eth_esp32_iomux_rmii_clk_input(void)

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2026-05-18 15:24:45 +01:00
Fin Maaß
d692931947 cmake: qemu: move qemu network interface selection
move qemu network interface selection, because it fits better in
cmake/emu/qemu.cmake than in cmake/modules/kernel.cmake.
It is also put at the end because for usb network cards, the usb bus
must be created before the network interface can be added. Also true
for other network cards on buses. Currently we don't have usb network
cards in zephyr, but it is better to be prepared for that.

Also use the separate netdev and device option.
The combined command line option didn't work for "usb-net" for example.
For the riscv qemu the -nic option is broken acording to the qemu issue
(https://gitlab.com/qemu-project/qemu/-/work_items/691), so we need to
use the -netdev and -device options.

Because of the change to -netdev and -device options, we need a new
Kconfig option to specify the extra arguments for the network device,
so we add NET_QEMU_DEVICE_EXTRA_ARGS option.
this can be used to customise the network device, like the mac address,
or more device specific options like setting f.e. the addresss/slot of
a pci card.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-15 12:29:28 -05:00
Fin Maaß
66b211e5a2 ethernet: dsa: use net_eth_mac_load
use the net_eth_mac_load function
to load a mac address.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-14 15:15:06 +02:00
Fin Maaß
aac7dd590f ethernet: litex: depend on NET_L2_ETHERNET
the litex ethernet driver uses NET_IF_DT_INST_GET,
therefore we need to depend on NET_L2_ETHERNET, so
it can't be used with ETH_DRIVER_RAW_MODE.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-13 21:21:15 +01:00
Yangbo Lu
a35506460b drivers: eth_nxp_enet_qos: support timestamping for Ethernet PTP packets
Added timestamping support for Ethernet PTP packets for gPTP.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-05-13 09:14:32 +02:00
Muhammad Waleed Badar
f58d1e5246 drivers: ethernet: dwc_xgmac: use NET_PKT_FRAG_FOR_EACH() macro
Replace open-coded fragment loop with NET_PKT_FRAG_FOR_EACH() macro
in eth_dwc_xgmac_send().

Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
2026-05-12 17:18:52 +02:00
Muhammad Waleed Badar
bbf062089c drivers: ethernet: intel: igc: use NET_PKT_FRAG_FOR_EACH() macro
Replace open-coded fragment loop with NET_PKT_FRAG_FOR_EACH() macro
in eth_intel_igc_tx_data().

Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
2026-05-12 17:18:52 +02:00
Muhammad Waleed Badar
aa62497273 drivers: ethernet: stm32: use NET_PKT_FRAG_FOR_EACH() macro
Replace open-coded fragment loop with NET_PKT_FRAG_FOR_EACH() macro
in eth_stm32_tx().

Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
2026-05-12 17:18:52 +02:00
Gal Raifen
fe88cd598c drivers: ethernet: eth_nxp_s32_gmac: fix start/stop function declaration
Building mr_canhubk3 fails due to improper function declaration.
Fix issue by fixing declaration of eth_nxp_s32_start & eth_nxp_s32_stop.
Fixes issue #108630.

Signed-off-by: Gal Raifen <galraifen15@gmail.com>
2026-05-11 11:02:01 +02:00
Fabian Blatz
b017626ca6 drivers: ethernet: eth_wch: pass iface to start/stop callbacks
Align eth_wch with updated ethernet API by passing net_if to
and eth_wch_stop/start() from PHY link state change handling.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
2026-05-11 04:05:51 +02:00
Philipp Steiner
a108ce1085 drivers: ethernet: nxp_enet_qos: fix PTP over L2
Fix ENET QoS behavior needed for IEEE 802.3 PTP transport.

Strip received Ethernet FCS bytes before packets reach upper layers,
enable store-and-forward mode for reliable PTP timestamps, and only use
RX timestamp context descriptors when the normal RX descriptor reports a
valid timestamp. Also update the PTP clock callback signature to match
the current Ethernet API.

Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
2026-05-11 04:04:52 +02:00
Laurent Varone
32e68a279d drivers: eth_nxp_enet_qos: add net_if *iface to get_ptp_clock()
add struct net_if *iface to eth_nxp_enet_qos_get_ptp_clock() function

Signed-off-by: Laurent Varone <laurent.varone@me.com>
2026-05-11 04:04:42 +02:00
Fin Maaß
4a1916eba4 drivers: ethernet: ivshmem: set ETH_NIC_MODEL
Even though the ivshmem ethernet driver can't be
directly run in the regular qemu, with west build -t run
we set this here, as we otherwise would get a build error.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-07 18:10:17 -05:00
Egill Sigurdur
16ac4a5b78 kernel: mem_slab: add K_MEM_SLAB_DEFINE_TYPE for automatic alignment
Introduces K_MEM_SLAB_DEFINE_TYPE() and K_MEM_SLAB_DEFINE_STATIC_TYPE()
helpers to allow the user to declare slabs for types without having to
manually ensure the alignment is correct.

Manual slab alignment was very error-prone and this change fixes several
instances of misalignment that would be trapped by the undefined
behavior sanitizer when running on 64-bit targets.

Signed-off-by: Egill Sigurdur <egill@egill.xyz>
2026-05-07 18:09:41 -05:00
Fin Maaß
73a0004d6e ethernet: litex: move iface into config struct
move the pointer to the iface to the config
struct

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-07 09:21:51 +02:00
Fin Maaß
9e2a2e5752 ethernet: litex: flush pending irq before enable
flush pending irq before enable

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-07 09:21:51 +02:00
Fabio Baltieri
80a6968ada drivers: eth_nxp_imx_netc: add missing netc_eth_get_ptp_clock argument
Fix build error:

eth_nxp_imx_netc.c:304: error: too few arguments to function
'netc_eth_get_ptp_clock'

Add the missing argument tested with:

west build -p -b imx943_evk/mimx94398/m33/ddr
samples/net/ethernet/tsn-switch

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2026-05-06 12:01:12 +01:00
Yangbo Lu
0e8bd58ef6 drivers: ethernet: dsa_nxp_imx_netc: configure QoS to handle VLAN PCP/DE
Configured QoS for switch to handle VLAN PCP/DE.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-05-06 09:56:48 +01:00
Yangbo Lu
2bbe7e8380 drivers: ethernet: dsa_nxp_imx_netc: use ptp_clock when needs timestamping
Used ptp_clock only when NETC_PTP_TIMESTAMPING_SUPPORT is true.
This is to keep same with driver timestamping operations code in
other places, and also to keep same with dsa core driver which uses
ptp_clock when NET_L2_PTP is true.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-05-06 09:56:48 +01:00
Tim Pambor
edd50151b7 drivers: ethernet: dwmac: Implement zero-copy transmit
Avoid copying (cloning) the data to be transmitted and
just increase the reference count of the original buffer.
This is more efficient and reduces memory and CPU usage.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-05-06 07:07:55 +02:00
Fin Maaß
4d594e59fc drivers: ethernet: nxp: enet: move pinctrl to parent
move pinctrl to parent, for some phys it is needed,
that the pinctrl happens before their init.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-06 07:06:26 +02:00
Fin Maaß
38463022d1 drivers: ethernet: phy: add condition for the plca related api functions
the plca related api functions are only needed
for T1S ethernet phys, therefore hide them
behind a Kconfig, that is selected from the phy,
so we don't include these if they are not needed.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-04 22:07:16 +02:00
Fin Maaß
0a58c2a1d6 drivers: ethernet: e1000: select PCIE
devices on the pcie bus should select PCIE,
just like SPI devices select SPI.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-04 21:59:21 +02:00
Fin Maaß
db984ee196 net: l2: ethernet: add struct net_if to arguments
add struct net_if to arguments

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-04 14:55:03 +02:00
Michael Zimmermann
c98321cbfe drivers: ethernet: adin2111: increase OA buffer size
The comment is correct, the code was wrong. Each chunk can be 64 bytes of
data, but they also have 4 byte headers. So to be able to read 255 chunks
with 64 bytes of data each, The buffer has to be 255 * 68.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2026-05-01 16:22:55 -05:00
Michael Zimmermann
158df8d088 drivers: ethernet: adin2111: reset state when the read packet it too big
Add a bounds check to prevent a chunk from being written outside the
buffer.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2026-05-01 16:22:43 -05:00
Fin Maaß
e5b97204af drivers: ethernet: remove ETHERNET_CONFIG_TYPE_T1S_PARAM
In #90652 we removed phy related config from eth api,
unfortunatly ETHERNET_CONFIG_TYPE_T1S_PARAM was forgotten
to be removed.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-04-30 14:06:31 -04:00
Fin Maaß
0f5c36e112 drivers: ethernet: dwmac: mdio: add mdio controller
add mdio controller for the dwmac
ethernet controller.

Assisted-by: Github Copilot:GPT-5.4
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-04-30 14:02:30 -04:00
Fin Maaß
3fefff8f0d drivers: ethernet: dwmac: implement get_phy function
implement get_phy function of the ethernet api.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-04-30 14:02:30 -04:00
Fin Maaß
a24eb92639 drivers: ethernet: dwmac: use mmio api
use mmio api, also use dev as the reference.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-04-30 14:02:30 -04:00
Aiman Mazlan
a6b035fd2e drivers: ethernet: eth_w5500: add multi instances support
Add support for multi instances.

Signed-off-by: Aiman Mazlan <mohammad.aiman@stratusauto.com>
2026-04-30 14:02:00 -04:00
Alberto Escolar Piedras
1b381e71d3 drivers: ethernet: lan9250: Add log.h include
Add logging/log.h include instead of relaying on it being included
indirectly from other headers

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-04-29 16:33:37 -04:00
Alberto Escolar Piedras
2b1fc98328 drivers: ethernet: enc424j600: Add log.h include
Add logging/log.h include instead of relaying on it being
included indirectly from other headers

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-04-29 16:33:37 -04:00
Julien Racki
9baa42e68f drivers: ethernet: Introduce the eth_stm32_hal2 driver
Introduce eth_stm32_hal2 driver based on HAL2.

Signed-off-by: Julien Racki <julien.racki-ext@st.com>
2026-04-29 16:29:40 -04:00
Julien Racki
94c46e7b1d drivers: mdio: Introduce new driver for HAL2 MDIO
Introduce a new MDIO driver for STM32 HAL2.

Signed-off-by: Julien Racki <julien.racki-ext@st.com>
2026-04-29 16:29:40 -04:00
Fin Maaß
15e565514f drivers: ethernet: wifi: remove redundant net_if_carrier_on()
For ethernet and wifi drivers the carrier
is on by default, no need to set it up in the
iface init again.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-04-29 11:55:10 -05:00
Julien Racki
79ce80e73c drivers: ethernet: stm32: Remove the list of enabled variants
Remove the list of supported boards from the ETH_STM32_HAL
menuconfig description.

Signed-off-by: Julien Racki <julien.racki-ext@st.com>
2026-04-28 22:08:10 +02:00
Hake Huang
a4cd6a3ba4 drivers: ethernet: harden DTCM DMA handling on Cortex-M7
Combine the Cortex-M7 ENET workaround updates into one commit.

- clear CACHE_ENET on i.MX RT11xx Cortex-M7 for ERR050396
- disable ETH_NXP_ENET_USE_DTCM_FOR_DMA_BUFFER by default on Cortex-M7
- keep the final Kconfig condition independent of
  DT_HAS_NXP_ENET1G_ENABLED

This avoids touching the same Kconfig and SoC files in follow-up
commits while preserving the intended behavior for PR #106679.

Validation:
- branch history squashed so workaround files are updated once
  in the series

Signed-off-by: Hake Huang <hake.huang@nxp.com>
2026-04-27 19:03:54 +01:00
Hake Huang
99bb98e561 drivers: ethernet: handle ENET RX buffer interrupts
Handle both RX frame and RX buffer interrupts in the NXP ENET driver.
This matches the MCUX HAL interrupt handling and avoids leaving RX work
queued behind an unhandled RX buffer interrupt source.

Validation:
- built samples/net/dhcpv4_client for mimxrt1170_evk@B/mimxrt1176/cm7
  with boards/nxp/mimxrt1170_evk/dts/nxp,enet1g.overlay
- verified MCUX HAL uses RX frame and RX buffer interrupts together

Signed-off-by: Hake Huang <hake.huang@nxp.com>
2026-04-27 19:03:54 +01:00
Fin Maaß
070ff02620 net: slip: refactor MAC address handling
We don't need to save the MAC address in the data
struct, therfore use a local var in the iface init for it.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-04-27 14:17:31 +02:00