Commit graph

956 commits

Author SHA1 Message Date
Fin Maaß 2b496759eb drivers: ethernet: eth_liteeth: add set_config
Add set_config to set the mac address.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-05-15 16:07:21 +02:00
Matthias Alleman 8ae0934470 drivers: ethernet: ksz8863 Fix wrong register for tail tag enable
A wrong register address was used to enable tail tagging for
the ksz8863 device.

Signed-off-by: Matthias Alleman <matthias.alleman@basalte.be>
2024-05-07 15:23:01 -05:00
Angelo Dureghello dc376a8bd9 drivers: eth: phy: adin2111: add support for adin1100 phy
Add support for similar adin1100 phy, boath are 10Base-T1L,
only difference is that adin1100 connects through r/mii.

Signed-off-by: Angelo Dureghello <angelo@kernel-space.org>
2024-05-07 09:41:46 +02:00
Angelo Dureghello ac165f663e drivers: eth: eth_stm32: use phy api support for h5/h7
Use PHY apis to access the PHY, to avoid any kind of collisions
with other tasks using the PHY apis.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
2024-05-07 09:41:46 +02:00
Grant Ramsay c9a148882c drivers: ethernet: w5500: Tidy up
* Rename w5500_hw_reset to w5500_soft_reset.
This function performs a software reset, the GPIO reset is
hardware reset.
* Set thread name "eth_w5500".
* Simplify random MAC address code.
Remove unnecessary function pointer and wrapper function.
* Remove SPI read variable length array.
The VLA causes unnecessary stack usage and its max size changes
depending on CONFIG_NET_BUF_DATA_SIZE.
Split the SPI read into two transactions, a skip of the first 3
dummy bytes, then a read of the data directly into to given buffer.
* Remove unused variables config_func and full_duplex.

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2024-04-26 10:19:27 +03:00
Lukasz Majewski 24cbb74d46 net: dsa: Fix DSA driver for KSZ8xxx to correctly initialize LAN devices
The commit "drivers: ethernet: dsa_ksz8xxx: use
NET_DEVICE_DT_DEFINE_INSTANCE"
(SHA1: f78a081066) replaced
NET_DEVICE_INIT_INSTANCE() with NET_DEVICE_DT_DEFINE_INSTANCE() to
facilitate the removal of deprecated (from Zephyr's 3.2 release)
DT_LABEL() macro.

Unfortunately, the per LAN port initialization is necessary for correct
operation of the DSA driver - otherwise following errors were visible
when LLDP DSA sample (samples/net/dsa/src) was run on ip_k66f board:

<wrn> net_if: iface 0x20001440 is down
<inf> net_dsa_lldp_sample: LLDP pkt recv -> lan1
<inf> net_dsa_lldp_sample:   CHASSIS ID:     38:05:43:69:XX:ZZ
<inf> net_dsa_lldp_sample:   PORT ID:        38:05:43:69:XX:ZZ
<inf> net_dsa_lldp_sample:   TTL:            120s
<inf> net_dsa_lldp_sample:   SYSTEM NAME:    mtt
<err> net_dsa_lldp_sample: Failed to send, errno 115

The fix is to use again NET_DEVICE_INIT_INSTANCE() with "lan"X name
assigned (to avoid too long names when recommended DT_PROP() is
used instead of DT_LABEL()).

Fixes: f78a081066

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2024-04-22 06:50:32 -07:00
Declan Snyder 210df56f37 drivers: ethernet: Add ETH_DSA_SUPPORT
Make DSA dependent on ETH_DSA_SUPPORT which is selected by driver
kconfigs, rather than having a list of dependencies.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-18 11:18:31 +02:00
Declan Snyder fdbba0341c drivers: nxp_enet: Deprecate ETH_MCUX
Deprecate ETH_MCUX, by:

- Marking it as DEPRECATED in Kconfig, obviously.
- Unmarking the new driver as experimental.
- Putting the new and old drivers in the same folder.
- Reworking the menu appearance of the driver selection.
  Note that technically now it is possible to choose the wrong
  driver than what is enabled in DT, this is intentional, but
  the correct one will obviously be enabled by default.
- Convert all sample overlays to the new Kconfigs. This was
  part of the motivation for the shared overlays, as it was
  causing twister/CI logs to look ugly and misleading due
  to Kconfig warnings.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-18 11:18:31 +02:00
Declan Snyder 83bfcb1b30 drivers: ethernet: DSA supported on ETH_NXP_ENET
I have tested the DSA support with ETH_NXP_ENET driver and it
works, so marking it as supported by adding it to the dependency
list for the DSA feature.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-18 11:18:31 +02:00
Declan Snyder ac58f3abe6 drivers: nxp_enet: Generate MAC using eth.h
The MAC address macros are ridiculous in this driver.
Rewrite to be simpler and use eth.h common function.
Also, clarify the mac address generation on the DT overlays.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-18 11:18:31 +02:00
Declan Snyder 4be0439bed drivers: nxp_enet: Convert RX to workqueue
Convert from multiple threads for each instance to use
one workqueue for all instances. The benefit is to save
memory and use a kernel function that already exists
for a use case like this.

Also introduce the ETH_NXP_ENET_RX_THREAD_PRIORITY kconfig,
which makes the thread priority of the workqueue configurable.

Finally, remove the code enabling the RxBufferInterrupt, since
the meaning of it isn't used currently in this driver.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-18 11:18:31 +02:00
Declan Snyder bc785e076a drivers: nxp_enet: Add NET DEVICE PM function
Add functionality for when NET_POWER_MANAGEMENT (ie PM_DEVICE)
is enabled. This function code originally comes from the
old eth_mcux driver which was only tested on kinetis family SOCs,
so that family kconfig is a dependency for this feature for now.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-18 11:18:31 +02:00
Declan Snyder fe3aefe2ae drivers: nxp_enet: Remove unused interrupt codes
Remove code that does nothing, regarding unused interrupts.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-18 11:18:31 +02:00
Declan Snyder 02916828ab drivers: nxp_enet: Remove unnecessary comments
Some comments in this driver are just redundant - the code
spells out exactly what the comment says. And some comment
blocks are just unnecessary to have. Finally, remove the TODO
comment because this is flagged by static analysis and there
are already tracking issues for the zero copy enhancement.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-18 11:18:31 +02:00
Stanislav Poboril 6ead65bb2f drivers: ethernet: phy: KSZ8081 PHY Driver improvements
Added changes required for nxp_enet ethernet driver to work
with multiple PHYs and fixed few problems:

- The cfg_link API resets PHY before configuring link. It was moved
  here so the ethernet driver does not have to reset it - not all
  PHYs need reset before configuring link and moving the reset code
  here makes possible to have the reset done in a PHY specific way
  (for example to reset by toggling GPIO pin). It also avoids ethernet
  driver touching PHY registers without locking.
- When reset GPIO is not defined, reset is performed by setting reset
  bit in control register.
- The cfg_link API does not return error when autonegotiation fails.
  This fixes situation when the link is down at system start - ethernet
  driver then skipped setting link-change callback and link was never
  to be detected again.
- Added reset of excessive bits 16-31 when reading register values.
  As only 16 bits are read from PHY, but the API is supposed to read
  into uint32_t, the remaining bits contained previous data after
  a successful read.
- Fixed missing mutex unlock when querying link state and link was down.
- Added missing initializer to link state variables. This could result
  in link state change detection while link was still down, because
  the speed/duplex settings could be random and old and new state
  could be wrongly detected as different.
- Not logging link speed/duplex status when link is not up.

Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
2024-04-18 11:18:31 +02:00
Seppo Takalo 41d70de91e drivers: eth: stellaris: Fix build error
Apparently there was a typo in the last commit.
Looks like it was refactored without trying to build.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-04-10 15:55:13 +02:00
Lucas Tamborrino fe57a12cf2 drivers: esp32: update to hal_espressif v5.1
Modify necessary drivers to meet updated hal.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-04-05 13:39:53 +02:00
Fin Maaß 792cbb9a24 drivers: ethernet: use sys_rand_get directly
use sys_rand_get() directly.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-05 12:28:46 +02:00
Declan Snyder fd1a129a3e drivers: eth_nxp_enet_qos: Fixed unused variable
Fix warning caused by unused variable when
CONFIG_NET_STATISTICS_ETHERNET is disabled.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-04 10:14:30 +02:00
Declan Snyder 62b56bb313 drivers: ethernet: Add NXP ENET QOS Driver
Add driver for NXP ENET QOS Ethernet

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-02 21:02:25 -04:00
Jukka Rissanen c4a4506b4a drivers: ethernet: nxp_s32_netc: Remove VLAN code as it is no longer needed
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 7825ce2418 drivers: ethernet: e1000: Remove VLAN code as it is no longer needed
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen c5dc6542fd drivers: ethernet: xmc4xxx: Remove VLAN code as it is no longer needed
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen bcb34705bb drivers: ethernet: nxp_enet: Remove VLAN code as it is no longer needed
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 813af655c5 drivers: ethernet: nxp_s32_gmac: Remove VLAN code as it is no longer needed
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 4e7565dceb drivers: ethernet: mcux: Remove VLAN code as it is no longer needed
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen e45a8c9104 drivers: ethernet: enc28j60: Remove VLAN code as it is no longer needed
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 898a0d8ab8 drivers: ethernet: sam_gmac: Remove VLAN code as it is no longer needed
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen f9b8608d2b drivers: ethernet: stm32: Remove VLAN code as it is no longer needed
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen aca5f43ecc drivers: eth: native_sim: Remove VLAN handling
Virtual LAN logic is now done in Ethernet L2 so no need to manipulate
VLAN packets in the driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Declan Snyder 353c6a66cb dts: bindings: ethernet: Remove fixed link
Remove ethernet-fixed-link binding as it is redundant with the
phy bindings. Clearly, ethernet does not work without the L1
layer, which is a phy device, or an integrated mac/phy device,
and all of these things should be described properly in DT.
The schema did not even come with a compatible, meaning nodelabels
were hardcoded into the drivers, which is unacceptable.

- Remove the binding file for ethernet-fixed-link.yaml.
- Remove fixed link functionality from the nxp s32 gmac driver.
  Since this functionality is already covered by the phy support,
  it is redundant.
- Remove fixed link include from the s32 gmac binding.
- Remove fixed link include from the nuvoton numaker binding.
  As far as I can tell the corresonding driver does not even
  use it anyways, and I did not find any board with this device
  that describes a "fixed link".
- Move the definition into the nxp,kinetis-ethernet binding
  as the eth_mcux driver, which is already being deprecated,
  does use this, contain the debt to the legacy driver.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-03-27 15:18:54 +00:00
Angelo Dureghello e0a1e69262 drivers: ethernet: eth_adin2111: use NET_ETH_ADDR_LEN
Use new NET_ETH_ADDR_LEN definition.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
2024-03-27 14:31:21 +00:00
Angelo Dureghello 180c423c80 drivers: ethernet: eth_adin2111: fix port to port_idx
Fix all references of port to port_idx to be uniform.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
2024-03-27 14:31:21 +00:00
Angelo Dureghello 569ebc247a drivers: ethernet: eth_adin2111: enable promiscuous mode
Add promiscuous mode support.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
2024-03-27 14:31:21 +00:00
Angelo Dureghello 2cebc0f307 drivers: ethernet: eth_adin2111: extend api support
Extend api support with new functionalities.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
2024-03-27 14:31:21 +00:00
Angelo Dureghello dd8072abb3 drivers: ethernet: eth_adin2111: adjust multicast filter
Multicast rule as 01:00:00:00:00:00 is actually shadowing
broadcast rule, enabling broadcast packets to be received/forwarded
even if broadcast rule/filter is not set.

Set the multicast filter with an appropriate mask.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
2024-03-27 14:31:21 +00:00
Dean Sellers e193f922cd drivers: ethernet: enc28j60: Add DT property to set Rx filter
Byte value written to the device's
ERXFCON: ETHERNET RECEIVE FILTER CONTROL REGISTER
Sets the devices receive packet filter, optional. If not set
in device tree previous hard coded value`0xA3` is used.
Uni, multi and broadcast packets with valid CRC are accepted.

Signed-off-by: Dean Sellers <dsellers@evos.com.au>
2024-03-26 10:03:07 -04:00
Wafer Xie 2396b01b1e drivers: eth: stellaris: Fix driver poll all packets from ethernet
The number of interrupts received by the driver maybe less than
the number of data packets received by Ethernet,
so the driver should read the packets number
from the register REG_MACNP value.

Signed-off-by: Wafer Xie <wafer@jaguarmicro.com>
2024-03-21 12:07:35 +00:00
Pieter De Gendt 2ee4716091 drivers: ethernet: Build ethernet drivers with ETH_DRIVER_RAW_MODE
Allow building ethernet drivers without NET_L2_ETHERNET config symbol.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-03-20 08:05:55 -05:00
Pieter De Gendt e99b5228a1 drivers: ethernet: Introduce ETH_DRIVER_RAW_MODE option
Add a Kconfig symbol to allow building ethernet device driver without
an L2 layer.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-03-20 08:05:55 -05:00
Pieter De Gendt 78457c0499 drivers: ethernet: adin2111: Use ethernet init macro
Use the ethernet specific init macro.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-03-20 08:05:55 -05:00
Pieter De Gendt e1b132771e drivers: ethernet: nxp_s32_gmac: Imply MDIO
The ethernet driver will most likely require the MDIO device to be
enabled.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-03-20 08:05:55 -05:00
Pieter De Gendt 76cd676050 drivers: ethernet: eth_nxp_s32: Implement HW MAC address filtering
Replace the multicast monitor with a HW MAC filter configuration.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-03-18 10:14:34 +01:00
Pieter De Gendt f900bfc3de drivers: ethernet: eth_stm32: Rework HW MAC address filtering
Rework the driver to use HW MAC address filtering as an ethernet
capability.
Use a counter table for CRC indexes added/removed.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-03-18 10:14:34 +01:00
Pieter De Gendt 28e10630c2 drivers: ethernet: eth_enet: Implement HW MAC address filtering
Replace the multicast monitor with a HW MAC filter configuration.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-03-18 10:14:34 +01:00
Pieter De Gendt a3f74ac50e drivers: ethernet: eth_nxp_s32_gmac: Fix multicast filter
Update multicast filter with HW filtering and fix missing CONFIG_ prefix.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-03-18 10:14:34 +01:00
Pieter De Gendt d052822d5d drivers: ethernet: eth_mcux: Implement HW MAC address filtering
Replace the multicast monitor with a HW MAC filter configuration.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-03-18 10:14:34 +01:00
Angelo Dureghello 06df4b5ae9 drivers: ethernet: adin2111: fix real rx frame size
Fix issue related to "generic SPI" mode only, when a packet of
1512 bytes is received, net_pkt_write() fails and thrwos the error:

"Still some length to go 2".

This is due to net_pkt_rx_alloc_with_buffer() allocating a maximum
mtu/size of 1514, and driver is not removing 4 bytes of crc32 from
rx buffer, that comes to be 1516 (2 bytes over buffer limit).

Fix generic SPI rx frame size removing crc32 bytes.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
2024-03-08 18:04:06 +01:00
Angelo Dureghello 0ca8b0756b drivers: ethernet: adin2111: add Open Alliance SPI support
Add Open Alliance spi protocol support.

Open Alliance is a chunk-based SPI protocol, based on sending
over SPI an ethernet frame divided in smaller chunks, using a
specific 32-bit header for each chunk transferred. All chunks
can be sent or received by a single dma transfer.

Default mode is set to Open Alliance SPI without protection,
since the adin2111 dev. board comes shipped this way.

Tested:
- Open Alliance SPI, no protection (default board shipped)
- Open Alliance SPI, protection
- Generic SPI, no crc
- Generic SPI, with crc8

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
2024-03-08 18:04:06 +01:00
Angelo Dureghello 06c8460a9e drivers: ethernet: adin2111: remove unused header_len variable
Non functional change, removing unused variable producing
compilation warning in "Generic SPI without CRC8" mode.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
2024-03-08 18:04:06 +01:00