Commit graph

774 commits

Author SHA1 Message Date
Dean Sellers ca7a66d787 drivers: ethernet: enc28j60: Prevent infinate loop on driver init
In the case that there is a situation where the controller
oscillator start-up timer doesn't expire, or the SPI can't
read the CLKRDY bit the driver would hang during init.
The config option ETH_ENC28J60_CLKRDY_INIT_WAIT_MS sets
the time that the driver will wait for OST before returning
an ETIMEDOUT error.

Signed-off-by: Dean Sellers <dsellers@evos.com.au>
2023-05-10 11:56:59 +02:00
TOKITA Hiroshi b2cf407c50 drivers: ethernet: enc28j60: Allow to create multiple instances
Allow defining multiple instances of enc28j60.
Remove the ETH_ENC28J60_0 Kconfig option along with this.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-05-05 16:17:29 +02:00
TOKITA Hiroshi 5e2cbd5184 drivers: ethernet: enc28j60: Add full-duplex property for devicetree
Add the `full-duplex` property for the `microchip,enc28j60` node.
Replace ETH_ENC28J60_0_FULL_DUPLEX Kconfig option with this property.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-05-05 16:17:29 +02:00
TOKITA Hiroshi 8a2f5c97f0 drivers: ethernet: enc28j60: Enable specific options only when selected
Enable enc28j60-specific options only when selecting ETH_ENC28J60.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-05-05 16:17:29 +02:00
Stefan Petersen 92a42d8f90 drivers: ethernet: eth_stm32_hal: Fix cppcheck warning
When running cppcheck on eth_stm32_hal.c it generated a warning for
shiftTooManyBitsSigned.

The solution is to make sure that the numeric value shifted is unsigned.

Updated to use BIT() macro as suggested by GeorgeGCV.

Fixes: #57336

Signed-off-by: Stefan Petersen <spe@ciellt.se>
2023-05-05 11:26:29 +02:00
Ryan McClelland 272c4e9a8d drivers: ethernet: eth_mcux: fix double-promotion warnings
Some single-precision float constants were being compared against
double-precision floats. Make the constants doubles.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-05-02 12:35:14 +02:00
Marek Vedral 86842dbab5 drivers: ethernet: xlnx_gem: fix PHY_MRVL_MODE_CONFIG_MASK
According to the datasheet for Marvell PHY [1], the mode field of the
General Control Register 1 Page 18 occupies bits [2:0]. However, the macro
PHY_MRVL_MODE_CONFIG_MASK specifies the mask as 0x3, which would
correspond only to [1:0]. The code in phy_xlnx_gem_marvell_alaska_cfg()
uses the mask to set the mode field to 0 to set "RGMII (System mode) to
Copper" mode. Unfortunately, different chips have different reset values
(111 or 000) and in first case, the code would set the field to 100,
instead of 000.

Without this change, ethernet on Avnet MicroZed (Marvel Alaska 88E1512 PHY)
does not work.

Signed-off-by: Marek Vedral <vedrama5@fel.cvut.cz>

[1]: https://www.marvell.com/content/dam/marvell/en/public-collateral/phys-transceivers/marvell-ethernet-phys-alaska-88e151x-datasheet.pdf
2023-04-28 14:48:52 +02:00
Brandon Del Bel 83fc732019 drivers: ethernet: sam0: Increase RX buffer count by one
The SAM GMAC driver is not able to use all of the receive buffers
concurrently. Frames larger than (buffer size) * (buffer count - 1) are
silently dropped. Fix it by adding one to MAIN_QUEUE_RX_DESC_COUNT.

Fixes #55701

Signed-off-by: Brandon Del Bel <delbel@umn.edu>
2023-04-27 09:50:39 +02:00
Erwan Gouriou 1ea132d95d drivers: ethernet: stm32: Set API V2 as default
Set STM32CubeHAL ethernet version in use as V2 by default, on series
supporting it (H7, F7, F4). Not yet available on F2 series.

Add a choice symbol to explicit V1 version as deprecated.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-04-25 12:20:30 +02:00
Brandon Del Bel 5beb86865e drivers: ethernet: sam0: Fix receive buffer initialization
The SAM GMAC driver is not utilizing the entire receive buffer, causing
large packets to be dropped. Fix it by setting Receiver Packet Buffer
Memory Size Select to Full (RXBMS = 3) in the GMAC_DCFGR register.

Fixes #55701

Signed-off-by: Brandon Del Bel <delbel@umn.edu>
2023-04-25 12:19:52 +02:00
Yves Vandervennet 788ba12137 nxp: hal: code update to reflect changes in SDK 2.13
HAL API changes in ethernet and pwm
SoC RT595 power management code change
west.yml update

Signed-off-by: Yves Vandervennet <yves.vandervennet@nxp.com>
2023-04-20 08:11:19 -05:00
Gerard Marull-Paretas 1eb683a514 device: remove redundant init functions
Remove all init functions that do nothing, and provide a `NULL` to
*DEVICE*DEFINE* macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-19 10:00:25 +02:00
Henrik Brix Andersen 407eedbafa drivers: ethernet: add dependency to CONFIG_ETH_INIT_PRIORITY
Add a dependency on CONFIG_NET_L2_ETHERNET for
CONFIG_ETH_INIT_PRIORITY. This hides the Ethernet driver initialization
priority option in menuconfig unless CONFIG_NET_L2_ETHERNET is selected.

CONFIG_ETH_INIT_PRIORITY cannot currently be moved inside the
CONFIG_ETH_DRIVER if-statement in Kconfig as it is used outside the
Ethernet driver source files.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-04-17 16:31:47 +02:00
Ibe Van de Veire 5fd08a3348 drivers: ethernet: eth_mcux: fixed sleep after carrier activation
The sleep after carrier activation was badly ported so the time
was 1000 ms instead of 1 ms.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@gmail.com>
2023-04-14 09:57:29 +02:00
Ibe Van de Veire 0927250fd2 drivers: ethernet: eth_mcux: fix phy_event state diagram sequence
When the phy_event state diagram ends up in the
eth_mcux_phy_state_read_status case, the eth carrier
is enabled. However, this step only happens when an
interface is available in the context.

Regardless of the state of the iface, the state machine
will switch to eth_mcux_phy_state_read_duplex in the next
iteration. Thus, the states diagram never returns to the
previous state. As a result, the eth carrier will never
be enabled in the future.

This problem is fixed by setting the wait state if the
iface is not available.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@gmail.com>
2023-04-14 09:57:29 +02:00
Huifeng Zhang 28ff3e1d8c drivers: eth_smsc91x: Add driver for SMSC91C111 aka LAN91C111 chip
Arm fvp_baser_aemv8r and fvp_base_revc_2xaemv8a boards are using
SMSC91C111 as their ethernet adapters.

Portions of the codes are based on FreeBSD code from its
'src/sys/dev/smc/if_smc.c' and 'src/sys/dev/smc/if_smcreg.h'.

This driver has two parts, one is the ethernet controller driver, which
is MAC layer driver. The other is the MDIO driver, which is the PHY
layer driver. Both of them are in the same source file due to that they
need to share the same reading and writing register functions and
the smsc object.

The mdio driver is needed by the existing 'phy_mii' driver, which is
a driver for the generic MII-compliant PHY.

This driver was developed under the fvp_base_revc_2xaemv8a target and
has been tested on the fvp_baser_aemv8r target.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2023-04-11 11:27:05 +02:00
Huifeng Zhang 3d58697d7d drivers: phy_mii: Remove the unneeded header file
Remove the 'soc.h' to fix the compiling error as the 'phy_mii.c'
doesn't need it.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2023-04-11 11:27:05 +02:00
Armin Brauns 82d6fe700c drivers: ethernet: stm32: avoid unnecessary casts, silence warnings
There is no need to use *_cmp_raw() functions here, all they do is cast the
pointers to in(6)_addr* and call the non-raw functions. Additionally, this
fixes a warning for the net_ipv6_addr_cmp_raw() call, which didn't cast the
arguments correctly.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-04-07 13:21:07 +02:00
Pieter De Gendt 6b532ff43e treewide: Update clock control API usage
Replace all (clock_control_subsys_t *) casts with (clock_control_subsys_t)

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-04-05 10:55:46 +02:00
Henrik Brix Andersen c41dd36de2 drivers: kconfig: unify menuconfig title strings
Unify the drivers/*/Kconfig menuconfig title strings to the format
"<class> [(acronym)] [bus] drivers".

Including both the full name of the driver class and an acronym makes
menuconfig more user friendly as some of the acronyms are less well-known
than others. It also improves Kconfig search, both via menuconfig and via
the generated Kconfig documentation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-28 15:06:06 +02:00
Rainer Paat 2d26baaeb1 drivers: ethernet: w5500: MAC change support
Devicetree local-mac-address and zephyr,random-mac-address support added.

Updated w5500_set_config() to support ETHERNET_CONFIG_TYPE_MAC_ADDRESS
and change the MAC address at runtime.

Signed-off-by: Rainer Paat <rapaat@gmail.com>
2023-03-24 12:55:49 +01:00
Rainer Paat 88c3fe894f drivers: ethernet: w5500: Fix promiscuous mode
Enabling MAC filtering by default on hw start and
disabling it when promiscuous mode is activated.

Signed-off-by: Rainer Paat <rapaat@gmail.com>
2023-03-24 12:55:49 +01:00
Gerson Fernando Budke 3c7988c52a drivers: eth: sam: Update to use clock control
This update Atmel SAM ethernet driver to use clock control drivers.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Fabio Baltieri d4c8de514f drivers: net: initialize logging for the slip module
This fixes a regression introduced in:

16a0e314ea drivers: net: Move Ethernet device definition for SLIP to
	   ethernet

Where the module would fail to build with:

log_core.h:153:20: error: '__log_level' undeclared (first use in this
function)

Registering a module fixes the build.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-02-20 16:44:23 +01:00
Robert Lubos 16a0e314ea drivers: net: Move Ethernet device definition for SLIP to ethernet
Currently, if CONFIG_SLIP_TAP is enabled (default for QEMU), and no
other Ethernet driver is enabled, the following warning is printed by
CMake:
    No SOURCES given to Zephyr library: drivers__ethernet

This happens because SLIP_TAP enabled Ethernet L2, but has no actual
sources in drivers/ethernet. This commit fixes this, by moving the
actual definition of the SLIP TAP Ethernet interface into a separate
file, within drivers/ethernet. Technically, in that configuration SLIP
defines a Ethernet device, implementing Ethernet API, so such a change
is justifiable, and prevents unwanted warning from being generated.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-02-20 10:52:20 +01:00
Björn Stenberg dcbc56cfe7 ethernet: stm32h7: Move DMA buffers from sram3 to sram2
PR #30403 implemented nocache regions for ethernet DMA buffers in sram3 to
fix issue #29915. Unfortunately, some STM32H7 variants do not have any
sram3 so they still suffer from #29915.

All H7 variants have sram2 though, so use that for targets without sram3.

Signed-off-by: Björn Stenberg <bjorn@haxx.se>
2023-02-09 22:14:07 +09:00
Marc Desvaux 7851c3c26b drivers: ethernet: eth_stm32_hal.c ETH_MAC_config issue
ETH MAC config for STM32H7X and STM32_HAL_API_V2
too late and fails #54409
call HAL_ETH_SetMACConfig before HAL_ETH_Start_IT()
check the return of HAL_ETH_SetMACConfig()

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-02-09 13:18:21 +01:00
Armin Brauns a0026d1589 drivers: ethernet: stm32: fix multicast filter configuration
With CONFIG_ETH_STM32_MULTICAST_FILTER=n, MACFFR was being set to 0 instead
of ETH_MULTICASTFRAMESFILTER_NONE, blocking all multicast traffic.

Instead, reset all the relevant bits first, then set either
ETH_MULTICASTFRAMESFILTER_HASHTABLE or ETH_MULTICASTFRAMESFILTER_NONE
depending on Kconfig.

This issue was introduced in #53850, `git diff a5f9fc2~2 a5f9fc2` (the
total diff of that PR) shows what happened - the
`tmp |= ETH_MULTICASTFRAMESFILTER_NONE;` line was removed completely
instead of being gated by `!defined(CONFIG_ETH_STM32_MULTICAST_FILTER)`.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-02-08 11:24:02 +01:00
Chamira Perera da3e3d3ed3 drivers: ethernet: stm32: Enabling stats for the driver.
The change enables the ethernet driver to save statistics in a
structure in the ethernet driver API structure. In addition, the
change also attempts to update error statistics based on errors
reported in the STM32 ethernet HAL API.

Fixes #53995

Signed-off-by: Chamira Perera <chamira.perera@audinate.com>
2023-01-27 00:56:06 +09:00
Benjamin Kyd ee1e514b3b driver: ethernet: cvsx remove ugly whitespace
Remove the ugly whitespace in drivers/ethernet/eth_cyclonev.c

Signed-off-by: Benjamin Kyd <benjamin.kyd@intel.com>
2023-01-24 17:46:17 -06:00
Benjamin Kyd f3a610fffe drivers: ethernet: cvsx change bit label
Change the bit label to include the BIT() macro to tidy up the code.

Signed-off-by: Benjamin Kyd <benjamin.kyd@intel.com>
2023-01-24 17:46:17 -06:00
Benjamin Kyd aad76523e1 drivers: ethernet: bugfix for Cyclone V Ethernet
bugfix for Cyclone V Ethernet Phy error and timeout overflow.
 - p->instance was incorrectly assumed to be a reference to
   the emac device, this is ammended
 - the volatile uint16_t timeout would often overflow
 - code cleanup and added more macros for housekeeping

Signed-off-by: Benjamin Kyd <benjamin.kyd@intel.com>
2023-01-24 17:46:17 -06:00
Marc Desvaux d72f65f358 drivers: ethernet: PTP clock CONFIGURATED
Set PTP Configuration done on ETH_STM32_HAL_API_V2

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-01-24 14:34:34 +00:00
Manuel Arguelles 8d2778f326 drivers: ethernet: add support for NXP S32 NETC
Introduce Ethernet low-level driver for NXP S32 Network Controller
(NETC). Current driver allows to manage from Zephyr a Physical Station
Interface (SI) and/or a Virtual SI. The NETC has an integrated Ethernet
Switch. Currently the Switch is initialized from this driver with a
default configuration, and all ports are enabled and transparent for
the user. A separate Switch driver should be addressed in future patches.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-24 14:37:20 +01:00
Manuel Arguelles 642303ac7e drivers: eth: phy_mii: support Gigabit ethernet
Advertise Gigabit Ethernet if the PHY supports it. As with the
other speeds, it is assumed the PHY supports both duplex modes.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-24 14:37:20 +01:00
Erwan Gouriou b8917cdbf6 drivers: ethernet: stm32f7: Enable use of HAL V2 API
Point to the modified version of hal_stm32 which allow to use
ETH HAL V2 on stm32F7.
Update zephyr driver to allow it.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-20 13:03:27 +00:00
Chamira Perera a5f9fc2382 drivers: ethernet: stm32: Updated original multicast hash filter change
- Applied changes on the most recent version of the driver
 - Using CONFIG_ETH_MULTICAST_FILTER to enable/disable the hash filter
 - Using read-modify-write the hash table for a single address
when joining
 - When leaving rebuild the entire hash table and ensure that multicast
addresses used for the hash calcuation doesn't have the joined flag set

I have tested these conditions:
 - IGMP enabled and disabled on my ethernet network
 - Observed the network utilisation on a STM32H7 device running these
changes with the hash filter enabled and disabled while the device is
on a ethernet network with high rate multicast traffic
 - When the application closes a socket for a multicast receive, ensure
it doesn't affect the receiption of existing sockets as well as IGMP

Fixes #53773

Signed-off-by: Chamira Perera <chamira.perera@audinate.com>
2023-01-18 16:17:27 +01:00
Markus Fuchs c76aaf3818 drivers: ethernet: stm32: Enable multicast address filter
Use the MAC's hash table to filter incoming multicast frames that are
targeted to subscribed multicast groups and discard all others.

Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>

# Conflicts:
#	drivers/ethernet/eth_stm32_hal.c
2023-01-18 16:17:27 +01:00
Erwan Gouriou 3b92034b57 drivers: ethernet: stm32_hal: Rework data provisionning style
Use more concise and readable style.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-11 17:07:20 +01:00
Erwan Gouriou 8eee0afa1f drivers: stm32_hal: Add option to enable HW checksum
Provide a Kconfig option to enable HW RX and TX checksum, which
can increase throughput performances.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-11 17:07:20 +01:00
Marc Desvaux ae2cf06f0b drivers: ethernet: fix error UDP server on STM32
With ETH_STM32_HAL_API_V2 avoid log error message
if error log report:
we have problems if the traffic is high


Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-01-11 09:42:00 +01:00
Erwan Gouriou 773f96b763 drivers: stm32: stm32_hal: Generate device id based mac address
In case user didn't set mac address in any way (locally defined or
randomly generated), define mac address using device unique id.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 19:22:54 +01:00
Erwan Gouriou 179963899e drivers: ethernet: stm32_hal: Move mac address configuration to dt
Deprecate Kconfig mac address related symbols and replace by existing
device tree properties:
- local-mac-address
- zephyr,random-mac-address

User who wants to keep using deprecating method of defining random
MAC address using Kconfig should set CONFIG_ETH_STM32_HAL_RANDOM_MAC=y.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 19:22:54 +01:00
Erwan Gouriou eee1d7fc66 drivers: ethernet: stm32_hal: Centralize mac address configuration
Get the mac address be set in a central function rather than split
between 2 places.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 19:22:54 +01:00
Erwan Gouriou ddb457a8d9 drivers: ethernet: stm32_hal: Make MAC address setting method a K choice
In order to ease deprecation of these methods (in favor of dt based
configuration), introduce a choice for MAC address configuration method.

Default to random method (no change).

User wanting to still use ETH_STM32_HAL_MACX symbols should define
CONFIG_ETH_STM32_HAL_USER_STATIC_MAC=y

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 19:22:54 +01:00
Pawel Czarnecki d45cd9afea drivers: eth: gecko: fix GPIO configuration
This fixes errors in samples/net/sockets/big_http_download for SiLabs
platforms.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-21 23:32:57 +09:00
Erwan Gouriou 66d4c64966 all: Fix "#if IS_ENABLED(CONFIG_FOO)" occurrences
Clean up occurrences of "#if IS_ENABLED(CONFIG_FOO)" an replace
with classical "#if defined(CONFIG_FOO)".

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-21 10:09:23 +01:00
Pawel Czarnecki e8d3673c13 soc: arm: silabs: remove soc_gpio_configure wrapper
It would be better to use GPIO_PinModeSet() functions directly
in the drivers.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Bartosz Bilas e077fb73ec drivers: tests: replace usage of spi_is_ready with spi_is_ready_dt
`spi_is_ready` function is being deprecated in favor of
`spi_is_ready_dt` so let's replace the old usage in the tree.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-12-07 09:40:23 -06:00
Bjarne von Horn e24e6454e9 drivers: ethernet: stm32: initialization routine for the new driver
Setup has to be adapted, too

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00