Commit graph

1211 commits

Author SHA1 Message Date
Fin Maaß
1e3b106435 drivers: ethernet: phy_mii rename functions
rename internal reg_* functions.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-11-26 00:11:43 +01:00
Ahmed Zamouche
305ceba920 drivers: eth: enc28j60: Misc fixes
- Bank select mask should be 0x03:

| b7    | b6    | b5    | b4     | b3    | b2   | b1     | b0     |
|------:|------:|------:|-------:|------:|-----:|-------:|-------:|
| TXRST | RXRST | DMAST | CSUMEN | TXRTS | RXEN | BSEL1  | BSEL0  |

See  **REGISTER 3-1: ECON1: ETHERNET CONTROL REGISTER 1**

- ENC28J60_BIT_PHCON2_HDLDIS should be 0x0100

|b15| b14   |b13   |b12|b11|b10    |b9|b8     |b7|b6|b5|b4|b3|b2|b1|b0|
|--:|------:|-----:|--:|--:|------:|-:|------:|-:|-:|-:|-:|-:|-:|-:|-:|
| - |FRCLNK |TXDIS |r  |r  |JABBER |r |HDLDIS |r |r |r |r |r |r |r |r |

see **REGISTER 6-5: PHCON2: PHY CONTROL REGISTER 2**

- remove duplicate definitions

ENC28J60Data Sheet:
https://ww1.microchip.com/downloads/en/DeviceDoc/39662c.pdf

Signed-off-by: Ahmed Zamouche <ahmed.zamouche1@assaabloy.com>
2024-11-25 17:43:57 +01:00
Yangbo Lu
962b0bcac4 drivers: ethernet: phy_mii: add link down log
It's expected there is log info for both link up and link down.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2024-11-25 12:16:28 +01:00
Erwan Gouriou
2d81351517 drivers: ethernet: stm32: Use MDIO API only if enabled by DTS
Not all STM32 series support Zephyr MDIO API yet, while the API is enabled
by default.
To preserve compatibility, put MDIO API related code under the condition
of "st,stm32-mdio" compatible enablement.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2024-11-21 11:02:14 +00:00
Declan Snyder
9863dc9fd8 drivers: nxp_enet: Add get_config for ipv6 chksum
Previously, ipv6 being disabled was a dependency of the hw acceleration
of the checksums for the nxp enet driver, because this ethernet has an
errata causing icmpv6 checksum to not be supported. Now, there is a new
config type in ethernet api for checksum types, so we can re-enable
hardware acceleration for ipv6 by implementing this type in the
get_config api in this driver.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-20 15:58:47 -05:00
cyliang tw
355d032baa boards: nuvoton: numaker: Drop PINCTRL from board defconfig
To remove CONFIG_PINCTRL from board side for numaker boards.
The Drivers using Pinctrl should be turning Pinctrl on
instead of the responsibility of the board.

Fixes #78619

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2024-11-20 08:23:58 -05:00
Pisit Sawangvonganan
d81a8d452e drivers: ethernet: w5500: improve type consistency
Improve type safety and consistency by adjusting variable and
parameter types to avoid signed/unsigned comparisons and implicit casts.

Moreover, explicit casts were applied when converting from
`size_t` to `uint16_t`.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-11-19 17:50:58 -05:00
Pisit Sawangvonganan
82e2709ed8 drivers: ethernet: w5500: make ethernet_api as const
This change marks `w5500_api_funcs`, an instance of
the `ethernet_api`, as `const`.

By using `const`, we ensure immutability, leading to usage of only
`.rodata` and a reduction in the `.data` area.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-11-19 17:50:58 -05:00
Lukasz Majewski
835cbad6cc drivers: ethernet: lan865x: Avoid writing PLCA node count when nodeID not 0
The newest AN1760 application note - Revision F (DS60001760G - June 2024)
is recommending to not write the node count to PLCA_CTRL1 register when
the node is not the PLCA coordinator (i.e. its ID is not zero).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2024-11-16 15:27:45 -05:00
Lukasz Majewski
3ea491cb1c drivers: ethernet: lan865x: Update initial setup guidelines (from AN1760)
This patch brings update of the procedure to initially configure the
LAN865x devices. It follows setup guidelines from newest AN1760 [*].

The values from "TABLE1" on the [*] must be written to the device in the
indicated order with recommended values.

This was not the case previously, as first values from in-flash allocated
(const) table were written and only afterwards calculated configuration
parameters (cfgparams) were updated.

With this patch the lan865x_conf[] table is allocated in-RAM, so
placeholder values can be updated and it can be written at once at the
end of configuration process.
Its single entry has been reduced from 8B to only 4B. Moreover, moving
it out of flash saves 512B of flash memory.

Note:
[*] - AN1760 Revision F (DS60001760G - June 2024)

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2024-11-16 15:27:45 -05:00
IBEN EL HADJ MESSAOUD Marwa
db6589f780 Revert "drivers: ethernet: eth_stm32_hal"
This reverts commit 0036b8bf21.

The reverted commit causes a compile error with the STM32F2 because
there are some variables used in the file eth_stm32_hal that are
not defined in the HAL module of the STM32F2 series,
such as 'ETH_RX_DESC_CNT' and 'HAL_ETH_MII_MODE'

Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
2024-11-13 09:13:23 -06:00
IBEN EL HADJ MESSAOUD Marwa
1721454266 Revert "drivers: ethernet: eth_stm32_hal_priv.h"
This reverts commit fbeda5959d.

Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
2024-11-13 09:13:23 -06:00
Declan Snyder
c1398250e9 drivers: nxp_enet: Check link state in iface init
Still mark the iface as down after ethernet_init, but then actually
check the link state and initialize carrier appropriately

This fixes the case where, the phy driver doesn't give a callback after
iface init due to the link already being up, there was no change from
the phy driver perspective, so callback  wouldn't happen, and therefore
the interface could remain marked as down after boot even if carrier is up.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-13 09:07:59 -06:00
Declan Snyder
0da16f7ec6 drivers: nxp_enet: put phy cb before iface init
This commit moves one function before another, to make the diff of the
next commit clearer of what it's doing.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-13 09:07:59 -06:00
Declan Snyder
6984fd87a3 drivers: eth_nxp_enet: use net_if_carrier_off init
Use net_if_carrier_off during iface init instead of net_eth_carrier_off,
to immediately mark net if as down

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-07 18:04:18 -06:00
Kevin ORourke
4690689a36 drivers: ethernet: eth_stm32_hal: fix bus error after disconnect
In some circumstances the struct eth_stm32_tx_context object that was
allocated on eth_tx's stack is still referenced after the function exits.
This usually happens when the network is disconnected, depending on the
PHY hardware.

When the network is reconnected there will eventually be a call to
HAL_ETH_ReleaseTxPacket, which calls HAL_ETH_TxFreeCallback with the
(now invalid) pointer to the tx context. When HAL_ETH_TxFreeCallback
tries to dereference that pointer we get a bus error.

Fix this by allocating struct eth_stm32_tx_context objects from a
static array, similarly to how the buffers are allocated. This ensures
that they remain valid until the HAL is finished with them.

Fixes: #79037

Signed-off-by: Kevin ORourke <kevin.orourke@ferroamp.se>
2024-11-05 10:54:16 -06:00
Gerson Fernando Budke
0cc8f93e8a soc: atmel: Drop PINCTRL from Kconfig.defconfig
This Kconfig has wrongly been added to defconfig files. It is not the
right place for it. It has never been the right place for it. Drivers
that need it should select the symbol in their Kconfig entries. Drop
PINCTL from Kconfig.defconfig and add proper select at Kconfig.sam*.

Fixes #78619

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2024-11-04 13:43:26 -06:00
Declan Snyder
495a374a0d drivers: ethernet: ksz8081: RMII override RNB part
I for the life of me do not know what is going on here with the RNB chip
but it seems this override must be set in order for the chip to work,
regardless of strap-in configuration, and if not set explicitly, the
value after a reset for these two bits will be seemingly random and
inconsistent. And it was working before by luck before removing a second
redundant reset in a recent commit, because apparently the register
was getting the opposite of the reset value according to the datasheet
which makes it work. The result of these bits after reset seem to vary
depending on host mcu, board, debugger, number of times reset, type of
reset, and with a pinch of random chance after keeping all variables
seemingly the same, so let's just set it to the value that works
explicitly, even if it doesn't make sense. The bit here doesn't have
clear documentation but it seems it's for using RMII regardless of the
strap in option, which is what we want to do anyways if we know the
interface type from DT, so I think it's fine, considering it is making
this driver work again.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-01 13:54:00 -05:00
Declan Snyder
96877736e4 drivers: ethernet: ksz8081: Fix reset times
500 ms reset time is only for software reset and comes from IEEE spec.
Datasheet mentions for hardware reset the assertion of the signal should
only need to be 500 us, and 100 us after deassert to wait to access
programming interface.

Also remove an unused macro.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-11-01 13:54:00 -05:00
Cla Mattia Galliard
6f99b6d0e4 drivers: ethernet: phy: phy_mii: log remove excess newlines
Remove excess newlines from log output in phy_mii.

Signed-off-by: Cla Mattia Galliard <cla-mattia.galliard@zuehlke.com>
2024-10-25 12:50:38 -05:00
IBEN EL HADJ MESSAOUD Marwa
cf367686f6 drivers: ethernet: eth_stm32_hal: Correct indentation
Adjusted indentation to follow consistent coding standards.

Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
2024-10-24 22:04:21 +01:00
IBEN EL HADJ MESSAOUD Marwa
eff9a87a7a drivers: ethernet: eth_stm32_hal: Use the compatible st_stm32h7_ethernet
Replace "CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X"
by the compatble st_stm32h7_ethernet

Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
2024-10-24 22:04:21 +01:00
IBEN EL HADJ MESSAOUD Marwa
ca768581c8 drivers: ethernet: eth_stm32_hal: Remove V1 code for H7/H5 series
Remove the V1 code for STM32H7 and STM32H5 series

Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
2024-10-24 22:04:21 +01:00
Janco Kock
2ed67e9841 drivers: ethernet: enc424j600: change mac addr runtime
Add ability to change mac address at runtime using net mgmt config call

Signed-off-by: Janco Kock <jancokock@gmail.com>
2024-10-24 17:54:08 +02:00
TOKITA Hiroshi
96a17e2a0f drivers: ethernet: Add dummy driver for vnd,ethernet
Add dummy driver for "vnd,ethernet" to use in build_all tests.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-10-22 20:42:05 +02:00
Georgij Cernysiov
daf116a73d drivers: ethernet: adin2111: minor corrections of is_adin2111
* Make `is_adin2111` a const.
* Check `is_adin2111` before processing port 2 related events.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2024-10-18 14:15:42 +02:00
Georgij Cernysiov
fd9a947311 drivers: ethernet: adin2111: add is_adin2111 check for oa port 2
Skip RX check for port 2 in the OA path for ADIN1110.
As the 2nd port doesn't exist.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2024-10-18 14:15:42 +02:00
Georgij Cernysiov
32cf1f7df2 drivers: ethernet: adin2111: oa: fix thread termination
If OA read fails, then the essential thread is terminated.
Correct the behavior so that the driver re-tries the read and
continues to work.

Refactor offload thread OA and Generic SPI parts into
if/else statement.

Add missing `is_adin2111` to OA port 2 RX status check.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2024-10-18 14:15:42 +02:00
Yangbo Lu
553079350c drivers: ethernet: add NXP i.MX NETC driver
Added NXP i.MX NETC driver based on NXP MCUX SDK driver APIs.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2024-10-16 10:00:32 +02:00
Emilio Benavente
82a192c8a9 boards: nxp: Removing CONFIG_PINCTRL from the boards defconfig
The Drivers using Pinctrl should be turning Pinctrl on
this should not be the responsibility of the board. This
commit removes CONFIG_PINCTRL from the boards side for nxp boards.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2024-10-15 19:09:45 -04:00
Bernhard Krämer
6ea04441f9 drivers: ethernet: Add DP83825 phy driver
Includes dt binding

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>
2024-10-15 04:10:06 -04:00
Dean Sellers
43897a4e60 drivers: ethernet: enc28j60: Fix carrier on race on init
If there is a carrier (cable plugged in) on device initialisation
there is a race between the interrupt service and the L2 init.

Signed-off-by: Dean Sellers <dsellers@evos.com.au>
2024-10-15 04:05:50 -04:00
Alexander Kozhinov
fbeda5959d drivers: ethernet: eth_stm32_hal_priv.h
Remove unused missleading definition.

Signed-off-by: Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
2024-10-11 09:28:05 +02:00
Alexander Kozhinov
0036b8bf21 drivers: ethernet: eth_stm32_hal
Drop preprocessor redefinitions

Some preprocessor defines were redefined to follow
stm32 hal naming conventions.
People seems to be confused by redefines and use
them with alternating names.
This PR does not change code behaviour,
but shall increase it's readability.

Signed-off-by: Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
2024-10-11 09:28:05 +02:00
Declan Snyder
e904743152 ethernet: phy_mc_ksz8081: Don't reset in cfg link
No need to reset in cfg link, this was blocking system workqueue during
phy callbacks that call cfg link, since this happens from monitor work
handler which is in the system workqueue.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-10-08 18:09:26 -04:00
Yong Cong Sin
52a202309b zephyr: bulk update to DT_NODE_HAS_STATUS_OKAY
Change instances of:

DT_NODE_HAS_STATUS(<node_id>, okay)

to

DT_NODE_HAS_STATUS_OKAY(<node_id>)

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-10-03 17:06:52 +01:00
Georgij Cernysiov
d8c0a67d7b drivers: ethernet: adin2111: fix generic spi frame reception
Fixes a bug that results in double RX buffer read from ADIN
when generic SPI protocol is used.

Actual frame size to be read must be RX_FSIZE - HEADER.
If we read less amount of bytes, then ADIN raises an IRQ or
signals via Pn_RX_RDY that there is another frame available, as
we fail to read the whole frame.

The fix for "Still some length to go 2" is still present, we drop
the CRC32 bytes from the frame prior allocation and network
stack pass.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2024-10-02 13:40:42 -05:00
Declan Snyder
b29190c314 drivers: nxp_enet: Fix tx error handling
The code path for error handling and timestamping in tx path
was meant to be identical in function to old eth_mcux driver,
but there is actually a discrepancy causing no error handling
for timestamped frames, fix it.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-09-25 04:05:07 -04:00
Alexander Kozhinov
0f576b047f copyright: change email
Change my email copyright address since unavailability of old one

Signed-off-by: Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
2024-09-25 04:04:03 -04:00
IBEN EL HADJ MESSAOUD Marwa
ec08e1c0e8 drivers: ethernet: Modify RX thread creation and update KConfig
This change will allow users to configure the Ethernet RX thread
according to their specific real-time requirements.
Adding preemptive threading helps to reduce jitter and
the impact of Ethernet traffic on real-time performance.

Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
2024-09-16 20:19:16 +02:00
Jukka Rissanen
98a21a823c drivers: eth: native_sim: Fix error output when creating interface
The return value already contains the errno so use it when printing
the error message.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-13 13:42:20 +02:00
Pisit Sawangvonganan
847a4eaad2 style: drivers: comply with MISRA C:2012 Rule 15.6
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-11 07:40:35 -04:00
Santosh Male
8467c10447 drivers: ethernet: dwc_xgmac: Added dwc-xgmac
ethernet driver

This driver is capable of supporting basic features
of synposys dwc-xgmac ethernet MAC IP. Basic features
includes,
1. Tx and Rx, multiple Tx and Rx DMA channels, multiple
   Tx and Rx queues
2. Check Sum Offloading on Tx and Rx for IPv4, IPv6,
   TCP, UDP and ICMP packets
3. 10M/100M/1G speeds, Autonegotiation, Link speed
   configuration, Promiscuous mode, Full/Half
   duplex configuration
4. Added source files for synopsys dwc xgmac mdio driver.
   synopsys dwc xgmac mdio driver fetures includes:
   It supports clause 22 of IEEE 802.3 for ethernet PHY devices
   management.
5. Extended mdio shell support for dwcxgmac mdio driver.

Signed-off-by: Santosh Male <santosh.male@intel.com>
2024-09-05 17:03:05 -04:00
Erwan Gouriou
d13f9d9b9b drivers: stm32: Select PINCTRL when required
Select PINCTRL subsystem by drivers which require it.
Prevent the need from enabling this symbol at board or soc level.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2024-09-03 14:40:55 +01:00
Sergio R. Caprile
360522a403 drivers: eth: fix stm32_hal PHY address resolution
Fixes: #77705

Fix wrong macro.
Tested with all the boards mentioned in that issue, build now works.

Signed-off-by: Sergio R. Caprile <scaprile@gmail.com>
2024-09-03 10:42:07 +02:00
Raffael Rostagno
90c6106926 drivers: esp32: Interrupts flags configuration
Allows configuring interrupts flags in the device tree for
ESP32 devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Raffael Rostagno
0b3a34cdca drivers: esp32: Interrupts priority configuration
Allows configuring interrupts priority in the device tree for
ESP32 devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Pisit Sawangvonganan
1bcae0ea9f style: drivers: comply with MISRA C:2012 Rule 15.6
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-20 10:33:51 +02:00
Ha Duong Quang
0135e7433b drivers: nxp_s32_netc_psi_vsi: update to RTD 2.0.0
Config to enable VLAN promiscuous and untagged.

Config to enable SI message interrupt.

Fix the build warning.

Signed-off-by: Ha Duong Quang <ha.duongquang@nxp.com>
2024-08-20 10:32:32 +02:00
Alex Fabre
84889d4783 drivers: eth: fix stm32_hal PHY address resolution
When the PHY is hardware designed to communicate on address '1', the mdio
node of the device tree is labeled 'ethernet-phy@1'.
Therefore, STM32 HAL must adapt to resolve the appropriate DT node:
'ethernet_phy_1'.

Signed-off-by: Alex Fabre <alex.fabre@rtone.fr>
2024-08-14 15:50:24 -05:00