Commit graph

1211 commits

Author SHA1 Message Date
Pieter De Gendt
817c0396b9 drivers: ethernet: phy: dm8806: Fix driver bindings
There were some driver bindings issues for the davicom dm8806 driver:
- Missing type for reg-switch binding
- Missing required: true for int/reset gpios
- Fix macro for reg-switch

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-02-20 11:47:21 +01:00
Maciej Panek
d611e28103 drivers: ethernet: adin2111: Add calculation of EBO in OA mode
Calculate the EBO properly, so the total frame written to TX FIFO
does not exceed maximum Ethernet frame length.
Makes the TCP stack to work properly, otherwise packets > 1472 are dopped,
as they would be padded by 64 more bytes
and hence exceed maximum Ethernet frame size.

Signed-off-by: Maciej Panek <panekmaciej@outlook.com>
2025-02-19 14:49:11 +00:00
Maciej Panek
158fe71a6d drivers: ethernet: adin2111: Refactor the code in offload thread
Refactors the code in adin2111_offload_thread
to improve its readability. Adds code to read RX FIFO
in OA mode until it is empty.

Signed-off-by: Maciej Panek <panekmaciej@outlook.com>
2025-02-19 14:49:11 +00:00
Aleksandr Senin
12ad8f0f6e drivers: eth: dsa_ksz8xxx: Add support for KSZ8463/KSZ8463F
This commit adds basic support for KSZ8463/KSZ8463F chips to the
dsa_ksz8xxx.c driver.

These chips have limited register compatibility with other members
of the KSZ8XXX family - their registers are 16 bits wide as opposed
to the 8-bit registers supported by the driver for KSZ8794 and
KSZ8863. Following the general logic of the existing code,
the 16-bit registers of KSZ8463 are split into 8-bit halves.

For the KSZ8463F chip, it is assumed that both ports are used
in Fiber mode.

A new configuration option, CONFIG_DSA_KSZ_PORT_ISOLATING, has been
added to isolate traffic between DSA slave ports.

The driver has been tested on a custom board with an STM32F7 SoC.

Signed-off-by: Aleksandr Senin <al@meshium.net>
2025-02-14 20:16:25 +01:00
Yangbo Lu
62a08e7961 drivers: ethernet: nxp_imx_netc: fix dt parsing of dsa port connection
Wrong functions were used for dsa port connection dt parsing.
Fixed it.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-02-13 20:13:25 +01:00
Sven Ginka
31024576fb drivers: mac: sy1xx add support for ethernet mac
Add basic ethernet mac support to the sensry soc sy1xx.

Signed-off-by: Sven Ginka <s.ginka@sensry.de>
2025-02-12 20:26:00 +01:00
Yangbo Lu
3aafce99b3 drivers: ethernet: eth_nxp_imx_netc: support handling pseudo MAC
This is to support handling pseudo MAC during initialization, but not
to support DSA master port. Current driver supports DSA with limitation
that only switch function is available without management via DSA master
port. DSA master port support is TODO work.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-02-11 22:03:48 +01:00
Yangbo Lu
9a7982f801 drivers: ethernet: eth_nxp_imx_netc: support getting phy mode from dts
Added support for getting phy mode from dts.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-02-11 22:03:48 +01:00
Yangbo Lu
7e7eb8cf32 drivers: ethernet: add DSA driver for NXP i.MX NETC
NXP i.MX NETC is a TSN capable Ethernet IP. It may support
ENETC MACs, or/and multiple ports switch.

The ENETC MAC was handled by eth_nxp_imx_netc driver.
This DSA driver is to support NETC switch device.
Current driver supports DSA with limitation that only switch
function is available without management via DSA master port.
DSA master port support is TODO work.

Take i.MX RT1180 NETC hardware as an example.

                +--------+                  +--------+
                | ENETC1 |                  | ENETC0 |
                |        |                  |        |
                | Pseudo |                  |  1G    |
                |  MAC   |                  |  MAC   |
                +--------+                  +--------+
                    | zero copy interface       |
+-------------- +--------+----------------+     |
|               | Pseudo |                |     |
|               |  MAC   |                |     |
|               |        |                |     |
|               | Port 4 |                |     |
|               +--------+                |     |
|           SWITCH       CORE             |     |
+--------+ +--------+ +--------+ +--------+     |
| Port 0 | | Port 1 | | Port 2 | | Port 3 |     |
|        | |        | |        | |        |     |
|  1G    | |  1G    | |  1G    | |  1G    |     |
|  MAC   | |  MAC   | |  MAC   | |  MAC   |     |
+--------+-+--------+-+--------+-+--------+     |
    |          |          |          |          |
NETC External Interfaces (4 switch ports, 1 end-point port)

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-02-11 22:03:48 +01:00
Yangbo Lu
12c2a9b357 drivers: ethernet: eth_nxp_imx_netc_psi: improve log info
Improved log info for MAC initialization and link event.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-02-11 22:03:48 +01:00
Yangbo Lu
83f835a31f drivers: ethernet: move i.MX NETC ethernet driver to subdirectory
Moved i.MX NETC ethernet driver to subdirectory. And DSA driver will be
added.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-02-11 22:03:48 +01:00
Duy Nguyen
633c5afb07 driver: eth: Fix phy-connection-type setting on RA8 ethernet
This commit fix the pin function configuration for mii and rmii
setting of Renesas RA8 ethernet driver
Correct pin function setting for mii is
PFENET = (uint8_t)(0x1 << R_PMISC_PFENET_PHYMODE0_Pos);
and rmii is:
R_PMISC->PFENET = (uint8_t)(0x0 << R_PMISC_PFENET_PHYMODE0_Pos);
Change code to intialize ping in driver init function, change
method of getting and checking via enum index of device tree.
Add build assert for invalid phy type.

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2025-02-05 08:16:02 +01:00
Fabio Baltieri
3a66b3853e drivers,test: use the new DT_FOREACH_PROP_ELEM_SEP
Use the new DT_FOREACH_PROP_ELEM_SEP macro instead of
DEVICE_DT_GET(DT_PHANDLE_BY_IDX(...)).

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-02-04 09:18:55 +01:00
Robert Slawinski
0d2e52e6b9 drivers: dm8806: dm8806: disable ethernet efficient mode
Energy efficient mode is the feature of the DM8806 described in the
EEE 802.3az Energy Efficient for reducing power consumption. For unknown
reason it seams to not working correctly with all endpoints and sometimes
the network randomly fails when this mode is on. Thus it is now possible to
turn off it in compile time by KConfig option:
PHY_DM8806_ENERGY_EFFICIENT_MODE if in case of network problems

Signed-off-by: Robert Slawinski <robert.slawinski.ext@indurad.com>
2025-01-27 17:11:24 +01:00
Pieter De Gendt
f1c4760304 drivers: Update APIs to use DEVICE_API macro
Some drivers APIs were not wrapped using the DEVICE_API macro.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-01-24 01:15:19 +01:00
Bas van Loon
e1ba85e9a2 drivers: ethernet: Fix DSA tag size for KSZ8863.
Allow DSA_TAG_SIZE to be set based on the size determined by Kconfig
and the enabled switch hardware.

This fixes support for the KSZ8863 which also has a tail tag of
one byte.

Signed-off-by: Bas van Loon <s.r.vanloon@ziggo.nl>
2025-01-22 05:40:58 +01:00
Robert Slawinski
f2f62b0dc3 drivers: dm8806: smi bus error check
SMI bus error check mechanism is preventing the host SMI bus to be
interferred by noise on board level. Current implementation is checking
if data which is writing to/reading from the PHY has correct CRC sum.
If not, then writing/rading process is repeated by the number of
attempts defined in the KConfig. If repeating transmission will fail
by the numbers of ettemps defined in KConfing, drivers returns an
error.

Signed-off-by: Robert Slawinski <robert.slawinski1@gmail.com>
2025-01-21 15:12:55 +01:00
Sven Ginka
e50645468c drivers: ethernet: vsc8541: add basic support for phy
add basic support for the microchip vsc8541 model phy.
as first starter, 1000MBit/s mode is implemented.

Signed-off-by: Sven Ginka <s.ginka@sensry.de>
2025-01-17 23:08:14 +01:00
Måns Ansgariusson
4772bfe710 drivers: ethernet: Rename struct ring_buf -> struct ring_buffer
The struct ring_buf is renamed to struct ring_buffer to be able to coexist
with the sys/ring_buffer.h header file.

Signed-off-by: Måns Ansgariusson <Mansgariusson@gmail.com>
2025-01-17 19:43:44 +01:00
Parthiban Veerasooran
5523e43a9a drivers: ethernet: lan865x: add internal PHY driver interface
Add phy driver probing part to activate the internal PHY driver support.

Signed-off-by: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
2025-01-16 22:45:03 +01:00
Parthiban Veerasooran
7cfa5bf6cf drivers: mdio: lan865x: add mdio driver support
Implement lan865x mdio driver to provide interface between lan865x MAC
driver and internal PHY driver phy_microchip_t1s.c. This driver is needed
to support the driver architecture followed.

Signed-off-by: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
2025-01-16 22:45:03 +01:00
Parthiban Veerasooran
757581e43a drivers: ethernet: oa_tc6: add c22/c45 registers read/write mdio APIs
Implement c22/c45 registers mdio read/write APIs for the lan865x mdio
driver to provide interface to the lan865x internal PHY driver.

Signed-off-by: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
Signed-off-by: Lukasz Majewski <lukma@denx.de>
2025-01-16 22:45:03 +01:00
Parthiban Veerasooran
edacd99c04 drivers: ethernet: oa_tc6: fix style issue using clang-format
Fix the style formatting of oa_tc6.c and oa_tc6.h files using
clang-format utility.

Signed-off-by: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
2025-01-16 22:45:03 +01:00
Parthiban Veerasooran
0b87a5469c drivers: ethernet: lan865x: remove internal PHY specific initialization
Remove internal PHY initialization part as the phy_microchip_t1s.c
driver will do the internal PHY initialization.

Signed-off-by: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
2025-01-16 22:45:03 +01:00
Parthiban Veerasooran
25edf1b46e drivers: ethernet: lan865x: fix style issue using clang-format
Fix the style formatting of eth_lan865x.c and eth_lan865x_priv.h files
using clang-format utility.

Signed-off-by: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
2025-01-16 22:45:03 +01:00
Parthiban Veerasooran
3bd39c2d1b drivers: ethernet: phy: Add Microchip's LAN867X Rev.C1/C2 PHY support
Add support for LAN8670/1/2 Rev.C2 as per the latest configuration note
AN1699 released (Revision E (DS60001699F - June 2024)) for Rev.C1 is also
applicable for Rev.C2. Refer hardware revisions list in the latest AN1699
Revision E (DS60001699F - June 2024).
https://www.microchip.com/en-us/application-notes/an1699

Signed-off-by: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
2025-01-16 22:45:03 +01:00
Parthiban Veerasooran
36c7feccf9 drivers: ethernet: phy: Add Microchip's LAN865X Rev.B0/B1 PHY support
Add support for LAN8650/1 Rev.B1. As per the latest configuration note
AN1760 released (Revision F (DS60001760G - June 2024)) for Rev.B0 is also
applicable for Rev.B1. Refer hardware revisions list in the latest AN1760
Revision F (DS60001760G - June 2024).
https://www.microchip.com/en-us/application-notes/an1760

Signed-off-by: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
2025-01-16 22:45:03 +01:00
Parthiban Veerasooran
2b8880cc38 drivers: ethernet: phy: Add OPEN Alliance TC14 PLCA generic lib support
10BASE-T1S PHYs can operate in either CSMA/CD or PLCA mode. PLCA mode
needs some set of parameters like node id, node count, max burst count,
burst timer and TO (Transmit Oppertunity) timer to be configured. OPEN
Alliance TC14 specification defined a set of PLCA registers to configure
PLCA mode. The below APIs are implemented for PLCA mode.

genphy_set_plca_cfg() - to configure PLCA settings.
genphy_get_plca_cfg() - to get the configured PLCA settings.
genphy_get_plca_sts() - to get the PLCA status like active or inactive.

These APIs are implemented as generic library so that all 10BASE-T1S
PHYs can use these APIs to configure/access PLCA settings to avoid
duplication of code.

Signed-off-by: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
2025-01-16 22:45:03 +01:00
Henrik Brix Andersen
7fec3d7f12 soc: atmel: samx7x: refactor SoC support for the Atmel SAM E70/V71
Refactor and merge the SoC support files for the Atmel SAM E70 and SAM V71
product series. These SoCs are part of a larger product family (SAM
E70/S70/V70/V71) and share a common set of peripherals.

Support for the two remaining product series (SAM S70/V70) is not part of
this refactoring as these will require further additions to the Atmel HAL.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2025-01-16 22:39:25 +01:00
Pisit Sawangvonganan
c96f236a1b drivers: ethernet: ksz8081: simplify gpio reset logic in reset
Simplifies GPIO reset logic in `phy_mc_ksz8081_reset()` by introducing
a dedicated function, `phy_ksz8081_reset_gpio`. If this function returns
`-ENODEV`, it will fall back to using a command-based reset instead.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-01-14 08:58:53 +01:00
Pisit Sawangvonganan
38ef52b1d4 drivers: ethernet: ksz8081: simplify error handling in get_link
Simplifies error handling in `phy_mc_ksz8081_get_link()` by
centralizing mutex unlocking with a `done` label.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-01-14 08:58:53 +01:00
Adib Taraben
cce082626e eth_nxp_enet_qos_mac: implement the nxp,unique-mac address feature
This implements to generate the MAC address of the device UUID.
The UUID is hashed to reduce the size to 3 bytes.
Ideas taken from eth_nxp_enet.c
Adding dependencies on: HWInfo and CRC

Signed-off-by: Adib Taraben <theadib@gmail.com>
2025-01-08 17:01:37 +01:00
Adib Taraben
7e2d020df5 eth_nxp_enet_qos_mac: enable pass through of multicasts
first check if the chip has a hosh module to futher filter MAC addresses
if not then enabling the pass through for all multicast protocols

Signed-off-by: Adib Taraben <theadib@gmail.com>
2025-01-07 15:57:34 +01:00
Balaji Srinivasan
a627ffc11e drivers: ethernet: Fix assert on receiving large PDUs
This patch fixes an assert in net_buf_simple_add() function when the
lan_9250 driver would add previously added data to the net buffer
on receiving large (>128 bytes) packat. This fix was to use the frags
field of the net_buf structure instead.

Tested with a nRF54L15 DK and eth3 click board (with nordic connect sdk
2.8.0 and this patch).

Signed-off-by: Balaji Srinivasan <balaji.srinivasan@autostoresystem.com>
2024-12-19 17:38:03 +01:00
Xavier Ruppen
06b7dc81a5 drivers: ethernet: enc28j60: disable/enable interrupts to avoid races
Currently, there is a small race window where we can miss an interrupt.
Right after we're done reading the RX buffer but just before decrementing
the RX counter to zero, the ENC28J60 may receive a packet. The chip will
raise an interrupt, but the line is still asserted. That means that the
callback will not be invoked since it is edge-triggered.

To avoid that, disable interrupts on the chip itself before processing
the RX buffer.

In fact, the ENC28J60 datasheet specifically says:

	"After an interrupt occurs, the host controller should
	clear the global enable bit for the interrupt pin before
	servicing the interrupt. Clearing the enable bit will
	cause the interrupt pin to return to the non-asserted
	state (high). Doing so will prevent the host controller
	from missing a falling edge should another interrupt
	occur while the immediate interrupt is being serviced.
	After the interrupt has been serviced, the global enable
	bit may be restored. If an interrupt event occurred while
	the previous interrupt was being processed, the act of
	resetting the global enable bit will cause a new falling
	edge on the interrupt pin to occur."

This is also what is being done in the Linux driver [1].

[1] https://elixir.bootlin.com/linux/v6.11.2/source/drivers/net/ethernet/microchip/enc28j60.c#L1126

Signed-off-by: Xavier Ruppen <xruppen@gmail.com>
2024-12-18 08:32:49 +01:00
Xavier Ruppen
7d95cc4ce3 drivers: ethernet: eth_enc28j60: do not check PKTIF on interrupt
The enc28j60 errata sheet says:

	"The Receive Packet Pending Interrupt Flag
	(EIR.PKTIF) does not reliably/accurately report
	the status of pending packets."

	"In the Interrupt Service Routine, if it is unknown if
	a packet is pending and the source of the interrupt
	is unknown, switch to Bank 1 and check the value
	in EPKTCNT.
	If polling to see if a packet is pending, check the
	value in EPKTCNT."

A workaround has already been implemented inside of eth_enc28j60_rx().
But checking PKTIF before calling eth_enc28j60_rx() completely defeats
the purpose of the workaround. Do not check it.

Moreover, clearing ENC28J60_BIT_EIR_PKTIF is useless since it is
automatically cleared once all packets are read. So remove that check
and clarify comment.

Also please refer to the Linux driver [1].

[1] https://elixir.bootlin.com/linux/v6.11.2/source/drivers/net/ethernet/microchip/enc28j60.c#L1090

Signed-off-by: Xavier Ruppen <xruppen@gmail.com>
2024-12-18 08:32:49 +01:00
Immo Birnbaum
63b65299df drivers: ethernet: xlnx_gem: enable querying of HW checksum support
Add a get_config function for this driver as specified in the
Ethernet subsystem API. The implementation supports querying
the hardware checksum generation capabilities of the specified
GEM device instance. This prevents the transmission of packages
without a valid checksum for protocols such as ICMP, as the
hardware only supports IPv4/IPv6 TCP and UDP checksum generation.

Signed-off-by: Immo Birnbaum <mail@birnbaum.immo>
2024-12-18 01:01:22 +01:00
Mario Paja
9dde4b97c0 drivers: ethernet: lan9250: implement set_config
Implements set_config api to set mac address

Signed-off-by: Mario Paja <mariopaja@hotmail.com>
2024-12-18 01:00:00 +01:00
TOKITA Hiroshi
ce03a8cbb0 drivers: gpio: phy: adin2111: Fix to allow the use of multiple models
Compilation will fail if both adin2111 and adin1100 are used
at the same time.
Changing to define different unique names for the symbols
to avoid conflicts.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-12-14 01:04:14 +01:00
Mario Paja
7abe775129 drivers: ethernet: add support for microchip lan9250
This PR adds support for LAN9250 spi ethernet controller.
This driver is tested on the Mikroe ETH Click 3
https://www.mikroe.com/eth-3-click

Signed-off-by: Mario Paja <mariopaja@hotmail.com>
2024-12-10 11:10:34 +01:00
Robert Slawinski
ef6f804d8f drivers: dm8806: link speed change interrupt handling
On the interrupt handling, one thread per driver instance is involved
into monitoring the semaphor, sends inside the gpio callback triggered
by the gpio interrupt. Each time, when the link parameters are change,
the DM8806 is generating the gpio interrupt. After getting semaphor,
the application callback function which was linked during initialization
process is called to get the new link parameters with standard API
calls

Signed-off-by: Robert Slawinski <robert.slawinski1@gmail.com>
2024-12-09 09:50:29 +01:00
Robert Slawinski
19e74f1ba0 drivers: dm8806: add new driver for davicom dm8806 phy mac
New driver for Davicom DM8806 PHY. Driver is using standar mdio API
to manage the DM8806 switch controller. Register access needs the
PHY addres or switch address to be one of five possible values, since
DM8806 has built-in five PHY's. These values should be defined in the
application .dts file. One DM8806 ethernet port must corresponds with
one ethernet PHY node with two properties for ethernet port: one for
PHY address and one for switch address - <reg> for register access from
Internal PHY Register area and <reg-switch> for register access from
Switch Per-Port Registers area. Device tree example below:

example device-tree:
  dm8806_phy: ethernet-phy@0 {
    reg = <2>;
    reg-switch = <8>;
    compatible = "davicom,dm8806-phy";
    status = "okay";
    davicom,interface-type = "rmii";
    reset-gpio = <&gpiod 2 GPIO_ACTIVE_LOW>;
    interrupt-gpio = <&gpioc 1 GPIO_ACTIVE_HIGH>;
  };

Signed-off-by: Robert Slawinski <robert.slawinski1@gmail.com>
2024-12-09 09:50:29 +01:00
Duy Nguyen
6b287b0e4e drivers: eth: Initial support for Renesas RA Ethernet driver
This commit is to enable Ethernet drivers support on Renesas RA
MCU, first target support is the Renesas RA8 series

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2024-12-05 07:45:19 +01:00
Duy Nguyen
f6715a7feb drivers: eth: phy_mii: Add BMSR second read in update_link state
The ICS1894 phy AN_COMPLETE bit is latched high, this make the
BMSR first read return incorrect status of the AN state, update
one more BMSR read to ensure all latched bit is clear and BMSR
return actual status of the phy chip

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2024-12-05 07:45:19 +01:00
Shrek Wang
3606b815d0 drivers: ethernet: Optimize RxBD buffer configuration
The _nxp_enet_dma_buffer_section is configured to __nocache area.
That makes the RxPkt performance very low (<= 50Mbps). By defining
it to the cacheable area, the RxPkt performance is >10x better.

Example with Zperf:
DUT command - zperf udp download 5001
PC command - iperf -u -c 192.0.2.1 -p 5001 -b 800M

Signed-off-by: Shrek Wang <shrek.wang@nxp.com>
2024-12-04 14:15:42 -05:00
McAtee Maxwell
3024392d35 SOC: Remove config PINCTRL from xmc4xxx soc
- Move selection of CONFIG_PINCTRL from soc to individual
	  drivers
	- in accordance with issue #78619

Signed-off-by: McAtee Maxwell <maxwell.mcatee@infineon.com>
2024-12-02 22:05:16 +00:00
Pieter De Gendt
d76d7115d5 drivers: ptp_clock: Place API into iterable section
Add wrapper DEVICE_API macro to all ptp_clock_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-02 23:04:22 +01:00
Pieter De Gendt
2376310fcb drivers: mdio: Place API into iterable section
Add wrapper DEVICE_API macro to all mdio_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-02 18:20:47 +01:00
Adib Taraben
1f067843d5 eth_nxp_enet_qos: implement set_config
implements  the set_config api for the eth_nxp_enet_qos_mac driver
as in FRDM_MCXN947

Signed-off-by: Adib Taraben <theadib@gmail.com>
2024-12-02 18:19:13 +01:00
Pieter De Gendt
190e3b9fe1 drivers: ethphy: Place API into iterable section
Add wrapper DEVICE_API macro to all ethphy_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-30 01:04:49 +01:00