Commit graph

1211 commits

Author SHA1 Message Date
Yangbo Lu
f0b1cb578f net: dsa: introduce new DSA framework
The new DSA framework purpose and changes are as below.

- Aligned to Linux DSA framework which has been already mature framework
  for many years, For now in zephyr, the DSA components were splited
  as: switch, port, master(not need driver file for now), slave, and tag.
  Seperated drivers were used for maintaining and developing new
  features.

- The unified dts bindings (aligned to linux) were supported. The port
  driver would parse DTS to decide the port type (master port, slave
  port, or cpu port) to set up the switch. All the ports registered as
  standard ethernet devices. (dsa port and dsa switch tree was not
  supported.)

- How to add DSA device driver based on the framework? All the device
  driver needing to do is providing dsa_spi implementation and private
  data, and calling below initialization.

    DSA_INIT_INSTANCE(n, _dapi, data)

- For switch tag case, recv/xmit helpers in dsa_api could be used for
  taging/untagging. No modified ethernet drivers.
  For no-tag type case, ethernet driver of master port should support
  packet injection/extraction for slave ports leaving NULL recv/xmit.

The dsa_nxp_imx_netc.c driver will be the first example of the new DSA
framework.

The future work for DSA will be supporting bridge for ports. We may align
Linux to give users two options to use DSA device:

- Standalone mode: the switch ports work as regular ethernet ports.

- Bridge mode: switch mode with virtual bridge device which could be
  assigned IP address.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-04-24 01:26:46 +02:00
Yangbo Lu
b22db75cec include: ethernet: rename dsa master/slave to conduit/user
Renamed dsa master/slave to conduit/user for capabilities.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-04-24 01:26:46 +02:00
Yangbo Lu
018a718e12 net: dsa: make current DSA core driver obsolete
Current DSA TX/RX way was hard-coded in ethernet devices driver
with ETH_DSA_SUPPORT and NET_DSA.
This patch is to make such way obsolete, as we actually will support
a better DSA framework to handle this in NET/DSA core driver.
To make legacy devices not affected, below options are used instead.

- ETH_DSA_SUPPORT_DEPRECATED
- NET_DSA_DEPRECATED

Once the legacy devices are converted to new DSA framework, this code
could be removed.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-04-24 01:26:46 +02:00
Fin Maaß
3237fd2a54 drivers: ethernet: atmel_sam_gmac: move net_if_carrier_off()
move net_if_carrier_off() before
phy_link_callback_set() to ensure the carrier is
not truned off, when the link is already up.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-23 10:03:55 +02:00
Fin Maaß
ddfb3909f6 drivers: ethernet: nxp_imx_netc_psi: move net_if_carrier_off()
move net_if_carrier_off() before
phy_link_callback_set() to ensure the carrier is
not truned off, when the link is already up.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-23 10:03:55 +02:00
Fin Maaß
0e55a9565d drivers: ethernet: esp32: move net_if_carrier_off()
move net_if_carrier_off() before
phy_link_callback_set() to ensure the carrier is
not truned off, when the link is already up.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-23 10:03:55 +02:00
Fin Maaß
1ace896425 ethernet: dwc_xgmac: use phy api correctly
use phy_configure_link() instead of phy_api->cfg_link().

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-18 17:47:14 +02:00
Kevin ORourke
f68eefa6f7 drivers: ethernet: eth_stm32_hal: fix API_V2 multicast
After API_V2 auto-negotiation support was added by #86621
setup_mac_filter() was called before HAL_ETH_Init(), which resulted in
received multicast packets being discarded.

This moves the call to setup_mac_filter() to eth_iface_init(), after
HAL_ETH_Init() for both API_V1 and API_V2.

I've verified the problem and tested the fix on a Nucleo-H563ZI with a
simple application that just starts up and makes an mDNS query (which
depends on working multicast).

Signed-off-by: Kevin ORourke <kevin.orourke@ferroamp.se>
2025-04-11 17:31:43 +02:00
cyliang tw
ea1129ee1a drivers: ethernet: support for numaker m55m1x series
Add support for Nuvoton numaker m55m1x series EMAC controller.
Also include NOCACHE_MEMORY allocation.
Support to generate random mac address and remove emac data flash.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2025-04-10 14:43:43 +02:00
Fin Maaß
86a52d9254 drivers: ethernet: litex: use tx interrupt
use tx interrupt to check, if we can send something,
instead of checking the register periodically.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-08 14:23:38 +02:00
IBEN EL HADJ MESSAOUD Marwa
8db85916f2 drivers: ethernet: Integrate GRMII and RMII interfaces
- Added macros `STM32_ETH_PHY_MODE`
  to determine the PHY mode (RGMII, GMII, RMII, and MII)
  from the `phy_connection_type` property in the device tree.
- Removed previous definitions for ETH_MEDIA_INTERFACE_MII
  and ETH_MEDIA_INTERFACE_RMII.
- Updated STM32_ETH_PHY_MODE macro to use ETH_MII_MODE
  and ETH_RMII_MODE.

Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
2025-04-04 21:16:02 +02:00
Kevin ORourke
dfe2848aeb style: Fix formatting
CI compliance checks demanded reformatting.

Signed-off-by: Kevin ORourke <kevin.orourke@ferroamp.se>
2025-04-03 11:06:53 +02:00
Kevin ORourke
9e2752d9d8 drivers: eth: phy_mii: Don't block system workqueue
Looping while waiting for auto-negotiation to complete can block the
system workqueue for several seconds.

Signed-off-by: Kevin ORourke <kevin.orourke@ferroamp.se>
2025-04-03 11:06:53 +02:00
Ibe Van de Veire
d890630e02 drivers: eth: native_tap: Add MAC parameter input from cmd line
Add the ability to set the MAC address from the command line when
running a native sim build.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
2025-04-03 00:05:47 +02:00
Fin Maaß
36e830f446 drivers: ethernet: stm32: remove hal api v1 ptp code
Only STM32F1X and STM32F2X are using the hal api v1,
both of these soc don't support ptp, so ptp support
for hal api v1 can be dropped.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-02 13:04:48 +02:00
Fin Maaß
a806ddf488 drivers: ethernet: stm32: remove internal phy code
rewirte code and remove code that use internal phy functions.
A few Kconfig options got removed, that are now set by the
phy via the DT.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-02 10:31:34 +02:00
Fin Maaß
0f636ec2fa drivers: ethernet: mdio: stm32: move stmmaceth clock to parent
move stmmaceth clock to parent, so it can also be
used by mdio and rename it to ``stm-eth``.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-02 10:31:34 +02:00
Fin Maaß
d139d84338 drivers: ethernet: stm32: make mac a child like the mdio node
mac and mdio are now on the same level, this way
phy-handle can be used.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-02 10:31:34 +02:00
Fin Maaß
b8eda4d6e7 drivers: ethernet: litex: support more than 2 slots
This adds support for more than 2 slots in the LiteX liteeth
driver.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-03-28 16:10:23 +01:00
Fin Maaß
62cbfbcb27 drivers: ethernet: litex: add remove irq_lock on rx
It is already ensured in the fpga logic, that there is only one
interrupt per liteeth dev at a time. So we can remove the irq_lock on rx.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-03-28 16:10:23 +01:00
Fin Maaß
a080df5dfc drivers: ethernet: litex: add mutex for tx
This patch adds a mutex for the eth_tx() function to prevent multiple
threads from calling the function at the same time.
Also remove the unneded irq_lock in that function.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-03-28 16:10:23 +01:00
Fin Maaß
31648d5fcc drivers: ethernet: litex: correct return value
correct return value for litex liteeth driver in eth_tx().

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-03-28 16:10:23 +01:00
Yangbo Lu
605de63571 drivers: ethernet: eth_nxp_imx_netc: get irq from dts node
Added support to get irq from dts node, because some platforms may
use multi-level interrupts, and the system INTID may not be connected
directly to interrupt controller.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-03-25 05:59:30 +01:00
Eric Ackermann
4342d7108b drivers: ethernet: Add Xilinx AXI Enet driver
The Xilinx AXI Ethernet subsystem is commonly found in FPGA designs.
This patch adds a driver and device tree bindings for the Ethernet MAC
core and its MDIO controller.
The driver was tested on a RISC-V softcore in an FPGA design, with an
RGMII phy and Ethernet subsystem version 7.2 Rev. 14. Device tree
bindings match the device tree generated by Vitis hsi. Note that Vitis
generates one of the two included compatible strings depending on
version.

Signed-off-by: Eric Ackermann <eric.ackermann@cispa.de>
2025-03-24 09:53:43 +01:00
Mahesh Mahadevan
d4d81637fb drivers: nxp: Fix selection of NOCACHE_MEMORY
Update how NOCACHE_MEMORY Kconfig is selected to
be based on CPU_HAS_DCACHE Kconfig.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2025-03-21 06:31:56 +01:00
Ofir Shemesh
1be0d07b56 drivers: ethernet: phy_mii: Return -ENOTSUP for fixed-link config
Return -ENOTSUP in phy_mii_cfg_link when a fixed-link configuration is set,
indicating that MDIO read/write operations are not supported.

Signed-off-by: Ofir Shemesh <ofirshemesh777@gmail.com>
2025-03-19 18:51:42 -04:00
Ofir Shemesh
2eabbcc084 drivers: ethernet: nxp_enet: Handle -ENOTSUP for fixed-link in PHY config
Modified nxp_enet_phy_configure to handle -ENOTSUP returned by the PHY
driver, indicating a fixed-link setup. If -ENOTSUP is returned, a warning
is logged, and PHY configuration is skipped without causing initialization
to fail.

Signed-off-by: Ofir Shemesh <ofirshemesh777@gmail.com>
2025-03-19 18:50:55 -04:00
Ram Mahesh
66b2a6ad2d drivers: ethernet: stm32: Add get_config() support
Implementation of get_config() api added
Fixes: #84898

Signed-off-by: Ram Mahesh <rammaheshram1234@gmail.com>
2025-03-19 20:26:09 +01:00
Fin Maaß
fb43d75062 drivers: ethernet: phy: add zephyr-keep-sorted-start
add zephyr-keep-sorted-start to ethernet phy
CMakeLists.txt.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-03-19 17:16:17 +01:00
Fin Maaß
814421162f drivers: ethernet: dsa: move to own subdirectory
move dsa drivers to its own subdirectory

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-03-19 17:16:17 +01:00
IBEN EL HADJ MESSAOUD Marwa
30937d017b drivers: ethernet: eth_stm32_hal: Add stm32n6 ethernet support
-Update the ETH_STM32_HAL menu configuration to conditionally
 select USE_STM32_HAL_RIF if SOC_SERIES_STM32N6X is enabled.

-Align Ethernet descriptors to 32 bytes for STM32N6 to ensure
 efficient DMA operations and improve cache line efficiency
 and overall performance

-Add RISAF configuration in eth_initialize function for STM32N6
 series to set up master and slave security attributes
 for the Ethernet peripheral.

-Ensure RISAF configuration is done before enabling
 the Ethernet clock to maintain proper security attributes.

Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
2025-03-18 19:53:05 +01:00
Cla Mattia Galliard
59b02d1772 ethernet: stm32_hal: Allow to configure preemtiveness independent of tc
Allow to configure the preemtiveness of the ethernet rx-thread independent
of the traffic-class queue.

Signed-off-by: Cla Mattia Galliard <cla-mattia.galliard@zuehlke.com>
2025-03-18 16:43:37 +01:00
Ole Morten Haaland
160ae23cd6 drivers: ethernet: stm32: Allow disabling carrier checking
On Zephyr devices that has an Ethernet switch IC with the Zephyr device
connected to the CPU port, there aren't necessarilly any register to
check the link state on that port. If the check is kept on such devices,
Zephyr will believe the link disappears
CONFIG_ETH_STM32_CARRIER_CHECK_RX_IDLE_TIMEOUT_MS after last message was
received, until a new message is received. If the application tries to
send data while the link is considered gone, sending returns an error,
sometimes indicating that the interface is down.

It also seems conceptually meaningless to try determining link state on
such devices, since as long as both the microcontroller and the switch
IC is powered, the link should always be up.

This commit therefore introduces a new Kconfig to allow disabling the
entire checking of link state, so that on devices where there is no
relevant PHY register to read, the check can be disabled.

Signed-off-by: Ole Morten Haaland <omh@ixys.no>
2025-03-17 19:58:42 +01:00
Jukka Rissanen
ac3cb9dac0 net: Change the net_linkaddr struct to not use pointers
Previously the net_linkaddr struct had pointers to the link address.
This is error prone and difficult to handle if cloning the packet as
those pointers can point to wrong place. Mitigate this issue by
allocating the space for link address in net_linkaddr struct. This will
increase the size of the net_pkt by 4 octets for IEEE 802.15.4 where the
link address length is 8, but there no increase in size if link address
is 6 bytes like in Ethernet/Wi-Fi.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-03-17 16:25:22 +01:00
IBEN EL HADJ MESSAOUD Marwa
18277b48f1 drivers: ethernet: Add API_V2 auto-negotiation support
- Added definitions for LAN8742 PHY registers and bit masks
  to support auto-negotiation.
- The function `eth_init_api_v2` requires the Ethernet interface
  to be properly initialized. In auto-negotiation mode,
  it reads the speed and duplex settings to configure
  the driver accordingly.
- Implemented functions to get link state and configure speed
  and duplex mode based on auto-negotiation results.
- Ensured proper initialization of semaphores and MAC configuration
  for both auto-negotiation enabled and disabled scenarios.

Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
2025-03-14 09:16:59 +01:00
Ibe Van de Veire
200b886d3c drivers: eth: native_posix: Add IPv4 parameter input from cmd line
Added the abililty to set the IPv4 addres, gateway and netmask from the
command line when running a native_posix build.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
2025-03-10 21:31:27 +01:00
Fin Maaß
b0f603cfe5 drivers: ethernet: litex: check phy-handle property
Adds a check, that the phy device in the device tree, referenced
by the phy-handle property, is enabled.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-03-10 15:02:26 +01:00
Georgij Cernysiov
8b7bfd45c1 drivers: ethernet: phy: sort includes
* Sort includes by groups each alphabetically:
  - standard lib
  - zephyr
  - private
* Move log registration to be after all includes.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2025-03-08 03:38:50 +01:00
Georgij Cernysiov
b55940cc23 drivers: ethernet: phy: add missing private include
Adds missing private adin phy include.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2025-03-08 03:38:50 +01:00
Georgij Cernysiov
910e3f82f8 drivers: ethernet: phy: correct adin logger name
Use phy_adin instead of undefined DT_DRV_COMPAT.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2025-03-08 03:38:50 +01:00
Alberto Escolar Piedras
78f800642a drivers/ethernet/eth_native_posix: Rename to eth_native_tap
Rename this driver to eth_native_tap, including renaming all its
options.
The old options remain until v4.4, but as deprecated.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-07 20:10:38 +01:00
IBEN EL HADJ MESSAOUD Marwa
f0b58a92e6 drivers: ethernet: remove ETH_STM32_HAL_MII
Removed `ETH_STM32_HAL_MII` configuration option
from `Kconfig.stm32_hal`.

Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
2025-03-07 19:57:59 +01:00
IBEN EL HADJ MESSAOUD Marwa
c8672fa649 drivers: ethernet: Update Ethernet PHY mode and speed configuration
- Added macros `STM32_ETH_PHY_MODE` to determine
  the PHY mode and speed from the `phy_connection_type`
  property in the device tree.
- Updated the `eth0_data` structure to use `STM32_ETH_PHY_MODE`
  for setting the media interface.

Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
2025-03-07 19:57:59 +01:00
Florijan Plohl
f519e3e498 drivers: ethernet: Add TI DP83867 eth phy driver
Add initial driver for TI DP83867 Ethernet PHY. Includes dts binding.

Signed-off-by: Florijan Plohl <florijan.plohl@norik.com>
2025-03-07 19:51:02 +01:00
Ram Mahesh
72c0bea73c drivers: ethernet: stm32: Execute get_phy() only if mdio is supported
Add condition to execute get_phy() api if only mdio is supported.

Signed-off-by: Ram Mahesh <rammaheshram1234@gmail.com>
2025-03-07 19:48:28 +01:00
Ram Mahesh
0691f761f8 drivers: ethernet: stm32: add get_phy() support
implementation of get_phy() added.

Signed-off-by: Ram Mahesh <rammaheshram1234@gmail.com>
2025-03-07 19:48:28 +01:00
Khoa Nguyen
c768144002 drivers: Correct value of event macro for all Renesas SoC
Since the RA2L1 uses the macro "ICU_EVENT" instead of
"ELC_EVENT" (which is currently used) to input into
the IELSR register, the ek_ra2l1 board cannot assign
any interrupts for any driver.

This commit aim to correct the Event macro to input correct
value for IELSR register on all the Renesas SoC by using
"BSP_PRV_IELS_ENUM" macro.

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-02-28 18:29:17 +01:00
Declan Snyder
d46c382950 drivers: ethernet: Remove deprecated eth_mcux
This driver was deprecated and must be removed by Zephyr version
4.1 according to lifecycle/release guidelines.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-02-26 22:04:26 +00:00
Declan Snyder
2ba6ba8494 drivers: nxp_enet: Re-add EXT RMII CLK config
This config was missed when converting from eth_mcux to nxp_enet driver,
re-add it and use new one instead of old one.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-02-26 22:04:26 +00:00
Adib Taraben
8d368ff4bc eth_nxp_enet_qos_mac: test and return early
move the check inside the loop to return early

Signed-off-by: Adib Taraben <theadib@gmail.com>
2025-02-20 14:55:22 +00:00