Commit graph

959 commits

Author SHA1 Message Date
Nicola Ochsenbein e3654e045e drivers: eth: native_posix: Add Kconfig to Configure RX Timeout
Add Kconfig to set sleep timeout between empty read attempts in rx thread
for ethernet native posix driver.

Signed-off-by: Nicola Ochsenbein <Nicola.Ochsenbein@husqvarnagroup.com>
2023-08-22 18:06:18 +02:00
Grant Ramsay a6e1f89bda drivers: eth_e1000: Enable the correct IRQ for multi-instance
The code was always enabling DT INST 0 IRQ

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-08-18 10:13:12 +02:00
Grant Ramsay 8b703cab8c drivers: eth_e1000: Use IRQ "flags" if IRQ "sense" is not present in DT
Binding like "arm,gic" call these flags "flags" whereas binding like
"intel,ioapic" call them "sense". Allow either to work

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-08-18 10:13:12 +02:00
Anas Nashif 66b0472d6f drivers: imply CRC where applicable
Do not depend on CRC, imply it, as it is disabled by default now.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-18 08:52:16 +03:00
Fabio Baltieri 243e84d155 ethernet: phy_mii: get the MDIO bus with DT_INST_BUS
Now that all in-tree phys are declared under their mdio bus, drop the
`mdio` property and use DT_INST_BUS to find the bus.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-17 13:29:45 -05:00
Antoniu Miclaus a26a660e50 drivers: ethernet: adin2111: fix device assignment
`k_thread_create` function has the 'adin' device passed as 1st
entry pointer. Therefore the device configuration is obtained directly
from the `dev` structure.

Adujst the code accodringly.

Fixes: 75dde83 ("drivers: ethernet: adin2111: add adin1110 support")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
2023-08-17 16:51:28 +02:00
Antoniu Miclaus a6e3829252 drivers: ethernet: adin2111: add adin1110 support
Add support for ADIN1110 10BASE-T1L Ethernet MAC-PHY.

The ADIN1110 is an ultra low power, single port, 10BASE-T1L
transceiver design for industrial Ethernet applications and is com-
pliant with the IEEE® 802.3cg-2019™ Ethernet standard for long
reach, 10 Mbps single pair Ethernet (SPE). Featuring an integrated
media access control (MAC) interface, the ADIN1110 enables direct
connectivity with a variety of host controllers via a 4-wire serial
peripheral interface (SPI). This SPI enables the use of lower power
processors without an integrated MAC, which provides for the
lowest overall system level power consumption. The SPI can be
configured to use the Open Alliance SPI protocol or a generic SPI
protocol.

Documentation:
https://www.analog.com/en/products/adin1110.html

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
2023-08-16 20:45:03 +02:00
Fabio Baltieri f2e275639d ethernet: smsc91x: rework the device node hierarchy
Rework the devicetree definition for smsc91x to put the mdio and
ethernet device at the same level, and make the phy a child of the mdio
node.

This allows matching up the device initialization sequence with the
devicetree hierarchy.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-16 14:52:31 +02:00
Fabio Baltieri e9e111b513 ethernet: smsc91x: fix a build warning
Move few variable inside a case statement to avoid build warning for
unused variables in some specific configuration.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-16 14:52:31 +02:00
Fabio Baltieri acbb7a39bb ethernet: smsc91x: select MDIO
This driver implements an MDIO device. Enable the MDIO driver to avoid a
build error for:

orphan section `._device.static.3_CONFIG_MDIO_INIT_PRIORITY_'

Also set the proper compatible in mdio_shell so that the ethernet tests
build correctly.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-16 14:52:31 +02:00
Daniel Leung 35cda1d5cb ethernet: rename shadow variables
This renames the shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:43 +00:00
Manuel Argüelles ab346c08b5 drivers: nxp_s32_netc: fix init priorities
So far the init priories were:
enetc_psi0=60 < enetc_vsin=61 < emdio=70 < ethernet-phy=80
because the Ethernet PSI driver was doing global initialization for the
whole NETC complex, including enabling MDIO function (due to the way
the HAL works).

Change to use the default init priorities:
mdio=60 < phy=70 < eth=enetc_psi0=80 < enetc_vsin=81
by executing at an early stage the NETC global initialization. This also
allows to match the DT hierarchy representation of NETC with the
effective priorities assigned.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-08-04 13:55:45 +00:00
Manuel Argüelles 36f11627ce drivers: eth: add support for NXP S32 GMAC
Add initial support for NXP S32 GMAC/EMAC:
- it's a copy-implementation with DMA data buffers and buffer
  descriptors in non-cached memory (buf len and ring size configurable)
- PHY interface selection only implemented for S32K3 devices as it is
  SoC-specific
- no PHY driver integration, it works as a fixed link with speed/duplex
  configured through devicetree
- supports multicast hash filtering, promiscuous mode, MAC loopback

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-08-03 10:28:20 +02:00
Fabio Baltieri d7504ab474 ethernet: esp32: make phy a phandle of the ethernet device
Change the eth-phy definition so that the phy is pointed by a phandle
rather than a child node, make the phy device a child of mdio. This
makes more sense from a devicetree hirearchy where the phandles have to
be initialized before the device itself, allows keeping the priorities
in check with CHECK_INIT_PRIORITIES.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-02 18:12:14 -04:00
Fabio Baltieri 5037e3a902 ethernet: sam-gmac: make phy a phandle of the ethernet device
Make ethernet phys childs of the mdio device and move the mdio device up
a level on the tree. That makes the device hierarchy coherent with the
required initialization priority and allows keeping the sequence in
check with CHECK_INIT_PRIORITIES.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-01 15:37:59 +02:00
Fabio Baltieri dfeb2d9027 ethernet: eth_stm32_hal: fix unused variable build warning
Fix an unused variable build warning that was happening in certain
configurations. Move the variables in the only condition where they are
actually used.

west build -p -b nucleo_f429zi \
	-T samples/net/cloud/aws_iot_mqtt/sample.net.cloud.aws_iot_mqtt

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-31 10:11:52 +02:00
Fabio Baltieri c2f4200ad5 bindings: ethernet: replace phy-dev with phy-handle
Rename the phy-dev property with phy-handle to match the Linux
ethernet-controller binding and move it up to ethernet.yaml so that it
can be used by other drivers.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-31 10:09:16 +02:00
Huifeng Zhang 0cf26615db drivers: eth_smsc91x: Fix the missing of selecting bank 3
Fix the missing of selecting bank 3 at the beginning of the function
`smsc_miibus_writereg`.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2023-07-27 13:27:47 +02:00
Marek Matej 6b57b3b786 soc: xtensa,riscv: esp32xx: refactor folder structure
Refactor the ESP32 target SOCs together with
all related boards. Most braking changes includes:

- changing the CONFIG_SOC_ESP32* to refer to
  the actual soc line (esp32,esp32s2,esp32s3,esp32c3)
- replacing CONFIG_SOC with the CONFIG_SOC_SERIES
- creating CONFIG_SOC_FAMILY_ESP32 to embrace all
  the ESP32 across all used architectures
- introducing CONFIG_SOC_PART_NUMBER_* to
  provide a SOC model config
- introducing the 'common' folder to hide all
  commonly used configs and files.
- updating west.yml to reflect previous changes in hal

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2023-07-25 18:12:33 +02:00
Marc Desvaux 76ba68cd18 drivers: ethernet: stm32 generate_mac
Ethernet MAC addresses are not unique enough
use unique_device_ID full range (96 bits)
call crc32_ieee() to generate last 3 bytes of mac address

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-07-25 16:45:53 +02:00
Nicolas Pitre 531aa5786d drivers: move to timepoint API
Remove sys_clock_timeout_end_calc() usage.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-07-25 09:12:26 +02:00
Chen Caidy 90b322761a drivers: ethernet: mcux: improve receive timestamp accuracy
When ENET_ENHANCEDBUFFERDESCRIPTOR_MODE enabled,
MAC will automatic capture receive nanosecond from 1588TMR
and return back to ENET_ReadFrame. It is a highest accuracy
recv timestamp_ns, we do not need manually read from 1588TMR.

By this change, receive timestamp accuracy increase
from 20us to 200ns above.

Signed-off-by: Chen Caidy <chen@caidy.cc>
2023-07-19 21:42:05 -04:00
Ambroise Vincent b6af1ac66e drivers: eth_smsc91x: Implement promiscuous mode
Add the RCR_PRMS field to toggle the promiscuous mode in the Ethernet
controller.

Register a set_config function that can make use of the field when
CONFIG_NET_PROMISCUOUS_MODE is enabled.

Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
2023-07-10 15:14:33 +02:00
Marc Desvaux 2e4d7ec5a8 drivers : ethernet: add SOC_SERIES_STM32H5X
add Ethernet SOC_SERIES_STM32H5X

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-07-07 10:06:54 +00:00
Alberto Escolar Piedras abf6da6318 drivers for POSIX arch: Add external libc dependencies
Quite a few of the drivers meant for the POSIX arch
interacted with the host directly, and will not
work when we use an embedded libC.

Until we fix them, let's add the appropriate
kconfig dependencies to avoid users trying to build them.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-05 07:01:19 -04:00
Divin Raj 733a35864a drivers: ethernet: Fix typo in comment
Update typo in the code comments.

Signed-off-by: Divin Raj <divin.raj@arm.com>
2023-06-16 05:43:17 -04:00
Georgij Cernysiov b0acced124 drivers: phy: add adin2111
Adds PHY driver. Works via MDIO API and
exposed ADIN2111 MDIO Clause 45
functions.

Link status detection is triggered by
ADIN2111 driver within offloaded IRQ
handler.

Supports:
  - LED0, LED1 enable/disable
  - Fatal HW error detection
  - AN 2.4V tx mode enable/disable

The initialization order is important.
PHY 2 must be initialized after PHY1.
Therefore, it shall be defined after the 1st one
in the devicetree.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2023-05-26 09:50:09 -04:00
Georgij Cernysiov 9a15d72b32 drivers: ethernet: add adin2111
Adds initial ADIN2111 2-Port 10BASE-T1L (SPE)
switch support. Works over SPI.

The driver creates 2 interfaces, 1 per port (PHY).
Configures multicast and broadcast filters.
The same unicast is applied to both ports.

Supports:
  - Link state detection
  - CRC enable/disable
  - Ports config set
  - Ports ETH stats

Provides functions for MDIO driver.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2023-05-26 09:50:09 -04:00
Carlo Caione 2fa807bcd1 barriers: Move __DMB() to the new API
Remove the arch-specific ARM-centric __DMB() macro and use the new
barrier API instead.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Stefan Petersen 945d074ec0 drivers: ethernet: eth_stm32_hal: Configurable speed and duplex
Make it possible to be able to change speed and duplex for the
STM32H7xx and API_V2 from the configuration settings.

This exists for the non-STM32H7x already today, so this is basically
copying the code for the other STM32's.

Please note that ST has a series incompability. For F1 and F2,
the duplex settings are named ETH_MODE_FULLDUPLEX respective
ETH_MODE_HALFDUPLEX. For F4, H7 and F7 the duplex settings are named
ETH_FULLDUPLEX_MODE respective ETG_HALFDUPLEX_MODE.

This should really be queried from the PHY (as previous programmer have
written in the code). But while waiting for a proper PHY solution,
this is intended as a stop-gap solution.

Signed-off-by: Stefan Petersen <spe@ciellt.se>
2023-05-23 13:02:05 +02:00
Ole Morten Haaland 80bfed3b44 drivers: ethernet: stm32: Disable HW checksums by default
Without this change, there's a difference between what the V2 Ethernet
HAL claims to be its capabilities in eth_stm32_hal_get_capabilities()
and what is actually enabled when CONFIG_ETH_STM32_HW_CHECKSUM is
disabled. This difference somehow causes the checksum in outgoing
packets to become 0, and hence seems to break networking at least on
some PHYs.

This commit disables HW checksums by default even when V2 driver is in
use, and this hence fixes networking when CONFIG_ETH_STM32_HW_CHECKSUM
is disabled.

This fixes #57629.

Signed-off-by: Ole Morten Haaland <omh@icsys.no>
2023-05-22 15:25:29 +02:00
Sumit Batra 7dce14632d soc: arm: nxp_imx: support enet2 interface on RT106x series
This patch enables the PLL clock output and PLL ref clock
for second ethernet module in NXP's i.MxRT106x SoCs

Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
2023-05-18 14:08:06 -05:00
Luca Fancellu d36cbab7ae drivers: eth_smsc91x: Fix compilation error for assert
Fix a compilation error for the ethernet driver smsc91x that
prevents the build with asserts enabled.

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
2023-05-16 11:18:22 -05:00
Armin Brauns c5701ffa62 drivers: ethernet: eth_stm32: avoid race condition in interface init
rx_thread() is started by eth_initialize(), while dev_data->iface is
populated by eth_iface_init() (called by net_init()).

Usually eth_iface_init() has completed by the time rx_thread() hits its
idle timeout and accesses dev_data->iface, but in case of a time-intensive
SYS_INIT item between eth_initialize() and net_init(), this is not
necessarily the case, causing a NULL dereference. This can be forced by
putting a k_sleep(K_SECONDS(5)) at the top of eth_iface_init().

Start rx_thread() in eth_iface_init() instead (which runs after
eth_initialize() due to init priorities) to make sure everything is
initialized properly.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-05-15 09:17:11 +02:00
Grant Ramsay 6b5a994068 drivers: ethernet: Add Jailhouse IVSHMEM Ethernet support
Allows Ethernet communication between "cells"
in the Jailhouse hypervisor.

The vring queue deviates from a standard virtqueue
so is implemented separately.

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-05-14 18:17:33 -04:00
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
Bjarne von Horn aa5353a901 drivers: ethernet: stm32: Enable receiving with new driver
Use the new API in the receive method

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn 202abc9acc drivers: ethernet: stm32: Transmit frames larger than one buffer
Now, multiple tx buffers can be used to send packets,
so that the packet size can exceed tx buffer size.

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn 1a9420af8d drivers: ethernet: stm32: Enable transmitting with new driver
Use the new API in the transmit method

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn ac1821bb21 drivers: ethernet: stm32: Add Error Callback
The new HAL API provides a different error propagation method

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn 1771f58a5b drivers: ethernet: stm32: Add transmit callbacks
These callbacks are also used by the stm32cube HAL driver

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn 853bca1031 drivers: ethernet: stm32: Add receive callbacks
Callbacks which will be used by stm32cube driver

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn ae87d8c74f drivers: ethernet: stm32: Disable autonegation for new api
As it is not supported

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn ee43d13b77 drivers: ethernet: stm32: Make tx semaphore available for new api
The new HAL API also has a TxCpltCallback, so we need the semaphore too.

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn aa78951016 drivers: ethernet: stm32: Additional structures for new HAL driver
They allow managing the tx and rx buffers from both
driver parts (zephyr and stm32cube)

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn f9158ab5ea drivers: ethernet: stm32: Add Kconfig to select new HAL API
STM32H7X and STM32F4X ETH HAL Drivers now provide a new api.
This commit only adds a new Kconfig option

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn dcec4608d8 drivers: ethernet: stm32: check tx packet size before locking mutex
The transmit mutex is not needed while checking the packet size,
so we acquire the lock after checking the size and
return early if it is too big.

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Carlo Caione cc427b4bb0 cache: Fix libraries and drivers
Fix the usage to be compliant to the new cache API.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-12-01 13:40:56 -05:00
Andrei Emeltchenko c0440c4706 drivers: eth_e1000: Allow several instances
Allow to enable several e1000 instances.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-11-28 13:19:51 +01:00
Andrei Emeltchenko 54bb10cf20 drivers: eth_e1000: Remove zero hadrcoded TDBAH, RDBAH
Though at the moment the driver works with high registers initialized
to zeroes it does make sense to do it right way. The double 16 shifts
are used to suppress warnings with 32 bit shift.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-11-28 13:19:51 +01:00
Andrei Emeltchenko 18aee8703b drivers: eth_e1000: Fix build warning for x86_64
This patch allows to build Ethernet driver eth_e1000 for x86_64
boards.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-11-24 15:23:11 +01:00
Jan Krautmacher 6be9666ba2 drivers: eth: Enable LLDP on STM32
With the current LLDP implementation in Zephyr the support for it has to
be enabled in the ethernet driver. This commit adds exactly this
capability to the STM32 HAL based ethernet driver.

Signed-off-by: Jan Krautmacher <jan@krautmacher.org>
2022-11-22 14:28:46 +00:00
Robert Lubos 387a66131e net: pkt: Introduce minimum length requirement to net_pkt_get_frag()
net_pkt_get_frag() and a few other functions did not specify the
allocated fragment length, incorrectly assuming that fixed-sized
buffers are always used.

In order to make the function work properly also with variable-sized
buffers, extend the function argument list with minimum expected
fragment length parameter. This allows to use net_buf_alloc_len()
allocator in variable buffer length configuration, as well as verify if
the fixed-sized buffer is large enough to satisfy the requirements
otherwise.

Update the existing codebase to provide the expected fragment length,
based on the context.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-11-19 07:39:32 -05:00
Johan Hedberg c905b4dded drivers: eth_e1000: Convert to use dynamic BDF lookup
Use the new PCIe core infrastructure for looking up the BDF at runtime
based on the VID/DID values.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-16 11:18:43 +01:00
Andrei Emeltchenko 1f0a425622 drivers: e1000: Use lookup() instead of probe()
For PCI Ethernet driver it makes sense to use lookup(id) instead of
probe(bdf, id). Even when using different Qemu parameters we may get
different BDF for e1000 device.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-11-03 09:54:56 -05:00
Andrei Emeltchenko 1763ce7486 drivers: e1000: Add BUILD_ASSERT() for IRQ allocation
Add BUILD_ASSERT() to indicate that dynamic IRQ allocation is not
supported.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-11-03 09:54:56 -05:00
Andrei Emeltchenko b5fd1b22c0 drivers: e1000: Change PCIE BDF for Q35 qemu
Since moving to Qemu Q35 machine the drivers with hardcoded BDF stop
working. Correct e1000 BDF.

Fixes #51829

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-11-03 09:54:56 -05:00
Henrik Brix Andersen 3c99a1e015 drivers: pcie: reintroduce support for I/O BARs
Reintroduce support for accessing I/O BARs which was removed in
43d84147d9.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-11-01 15:22:31 -04:00
Paul Jans e35ce37443 drivers: ethernet: enc28j60: Added carrier status update functionality
Expanded the enc28j60 driver to update its carrier status
whenever the Ethernet cable is plugged in or out. I used the
enc424j600 driver as reference, as this driver already
included this functionality. The driver will now take
the interface offline whenever the cable is not plugged in
and stop sending packets. The respective events are also
generated for use in the application. I tested it locally
on my nRF52840 based gateway board using the enc28j60 network
chip. Everything worked as expected.

Signed-off-by: Paul Jans <paul.jans.1999@hotmail.com>

Fixes #51214
2022-10-31 17:03:18 +01:00
Robert Lubos b279bfd2dd net: ethernet: Align Ethernet drivers/L2 with iface state upgrade
Align Ethernet/Wi-Fi drivers/L2 with interface state handling update.

For drivers, that did not support carrier detection, no changes are
needed.

Driver that did support carrier detection, are updated to set the
carrier state to OFF by default, instead of setting the
NET_IF_NO_AUTO_START flag. This allows to postopne the actual
NET_EVENT_IF_UP notification until driver detects that carrier is ready.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-10-20 10:00:31 +02:00
Gerard Marull-Paretas 178bdc4afc include: add missing zephyr/irq.h include
Change automated searching for files using "IRQ_CONNECT()" API not
including <zephyr/irq.h>.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-17 22:57:39 +09:00
Pierre-Emmanuel Novac 105cca639d drivers/ethernet: stm32: Make PTP clock optional
STM32F107 has an Ethernet MAC but no PTP clock, so remove hard requirement
on PTP clock definition in preparation for STM32F107 Ethernet MAC support.

Signed-off-by: Pierre-Emmanuel Novac <piernov@piernov.org>
2022-10-12 18:40:49 +02:00
Gerard Marull-Paretas 6a0f554ffa include: add missing kernel.h include
Some files make use of Kernel APIs without including kernel.h, fix this
problem.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Immo Birnbaum 29a9ffe777 drivers: ethernet: xlnx_gem: fix dev data access missed by #41918
Fixes a compiler error in eth_xlnx_gem_stats() caused by the
automated replacement of device run-time data pointer accesses
by #41918. The device run-time data access in eth_xlnx_gem_stats()
was likely missed as this function is not usually compiled - its
existance depends on CONFIG_NET_STATISTICS_ETHERNET being set.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-10-11 11:15:20 +02:00
Gerson Fernando Budke 5c484e28f9 drivers: eth: sam0: Fix missing devicetree dependency
The #48905 introduce a regression on gmac ethernet driver. The GMAC
driver matches two compatibles. This add missing compatible for SAM0
variant.

Fixes: #50970.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-10-10 11:23:35 -05:00
Esteban Valverde c4be0c51de drivers: ethernet: adding support for Cyclone V SoC DK ethernet
Adding support for Cyclone V SoC ethernet device.

Signed-off-by: Esteban Valverde <esteban.valverde.vega@intel.com>
2022-10-06 20:19:43 -07:00
Grant Ramsay 897952370e drivers: ethernet: Add ESP32 Ethernet driver
This is to enable ESP32 Ethernet support

Signed-off-by: Grant Ramsay <grant.ramsay@hotmail.com>
2022-10-01 14:51:28 -04:00
Gerard Marull-Paretas 8081d7f2a4 drivers: s/DT_CHILD(DT_DRV_INST(n), ...)/DT_INST_CHILD(n, ...)
Use instance version of DT_CHILD when possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-06 08:45:25 -07:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Erwan Gouriou 680574f960 drivers: ethernet: stm32_hal: Rename flag.
Last HAL udpdates came with a fix on two ethernet flags:
- ETH_PTPTS*S*R_TSSARFE > ETH_PTPTS*C*R_TSSARFE
- ETH_PTPTS*S*R_TSSSR > ETH_PTPTS*C*R_TSSSR

Update driver to be aligned with these changes.

Fixes #49763

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-02 10:37:49 +00:00
TLIG Dhaou cc9b6bb0b4 drivers: ethernet: patch for the stm32 drivers
This commit is a patch to fix the ETH buffer redefined in many files.

Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-08-23 20:08:35 +02:00
Gerard Marull-Paretas a202341958 devices: constify device pointers initialized at compile time
Many device pointers are initialized at compile and never changed. This
means that the device pointer can be constified (immutable).

Automated using:

```
perl -i -pe 's/const struct device \*(?!const)(.*)= DEVICE/const struct
device *const $1= DEVICE/g' **/*.c
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-22 17:08:26 +02:00
Hari Haran Babu 470c447cd7 Revert "drivers: ethernet: w5500: Toggle reset gpio"
This reverts commit 17f8f62789.

Signed-off-by: Hari Haran Babu <hariharan@linumiz.com>
2022-08-15 17:48:57 +00:00
Kumar Gala d36125654e drivers: ethernet: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers
* Move to using 'select SPI' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-15 14:32:45 +02:00
Kumar Gala 150332be1a drivers: ethernet: remove duplicate CMake entry
Building for dsa_ksz8xxx.c was listed twice.  Remove duplicate.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-15 14:32:45 +02:00
Kumar Gala 6124ccfccf drivers: ethernet: provide Kconfig means to disable ethernet drivers
There are several test cases that create fake ethernet devices and
expect the fake device to be the only ethernet device enabled.  Some
tests handle this be explicitly disabling actual ethernet drivers,
but this doesn't scale well.

Change drivers/ethernet/Kconfig to utilze a menuconfig option that
wraps all the drivers.  This allows us for those test cases that
don't want any actual ethernet drivers to disable them with a
simple CONFIG_ETH_DRIVER=n.

Note, the fake ethernet devices utilize CONFIG_ETH_INIT_PRIORITY so
we have it outside of the 'if ETH_DRIVER' block.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 11:33:43 +02:00
Henrik Brix Andersen 5ade8908a7 drivers: ethernet: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Daniel DeGrasse d29e34c7c9 drivers: eth_mcux: remove interrupt clearing code
Remove code that clears spurious interrupt flags, as this step is
not required.

Performance change (as tested with iperf on RT1050)
TCP RX: 50.8Mbps->50.6Mbps
TCP TX: 46.2Mbps->49.5Mbps

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-09 12:29:18 +02:00
Daniel DeGrasse ee4a338bfd drivers: eth_mcux: move intermediate driver buffers into DTCM
move intermediate driver buffers into DTCM, to reduce copy latency

Performance change (as tested with iperf on RT1050)
TCP RX: 48.6Mbps->49.1Mbps
TCP TX: 40.7Mbps->40.8Mbps

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-09 12:29:18 +02:00
Daniel DeGrasse 5dd5fab2b6 drivers: eth_mcux: remove TX thread and allow for multiple TX buffers
remove the TX thread, as this thread can become starved and unable to
reclaim TX buffers from the hardware. Instead reclaim buffers in ISR.
Change eth_tx function to first take from the tx_buf_sem, so that multiple
TX buffer descriptors can be used effectively.

Performance change (as tested with iperf on RT1050)
TCP RX: 44.6Mbps->48.6Mbps
TCP TX: 38.1Mbps->40.7Mbps

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-09 12:29:18 +02:00
Daniel DeGrasse af62fbc105 drivers: eth_mcux: move dma buffers and buffer descriptors to DTCM
Move dma buffers and buffer descriptors to DTCM, to improve hardware
and software access speed during network TX/RX

Performance change (as tested with iperf on RT1050)
TCP RX: 40.6Mbps->44.6Mbps
TCP TX: 36.8Mbps->38.1Mbps

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-09 12:29:18 +02:00
Daniel DeGrasse f595279bd7 drivers: eth_mcux allow network buffers to be cached
Do not force network buffers into noncacheable memory, as these buffers
are internal to the driver and not used by the hardware.

Performance change (as tested with iperf on RT1050):
TCP RX: 23.7Mbps->40.6Mbps
TCP TX: 22.3Mbps->36.8Mbps

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-09 12:29:18 +02:00
Kumar Gala 3c35faae36 drivers: ethernet: sam_gmac: Convert to using dts for I2C EEPROM
Introduce a simple binding for atmel,24mac402 EEPROM that the SAM
GMAC ethernet driver can utilize to get MAC address out of.  We
introduce a 'mac-eeprom' phandle into GMAC ethernet devicetree
node that will provide a pointer to the MAC eeprom to utilize.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-02 13:02:42 +02:00
Simon Hein d0921018fc drivers: Fix coding guidelines MISRAC:2012 Rule 14.4 do-whiles/Zero checks
MISRA C:2012 Rule 14.4 (The controlling expression of an if statement
and the controlling expression of an iteration-statement shall have
essentially Boolean type.)

Use `do { ... } while (false)' instead of `do { ... } while (0)'.
Use comparisons with zero instead of implicitly testing integers.

The commit is a subset of the original auditable-branch commit:
5d02614e34a86b549c7707d3d9f0984bc3a5f22a

Signed-off-by: Simon Hein <SHein@baumer.com>
2022-07-26 15:30:24 -04:00
Johann Fischer 5e5ea9a21d drivers: use unsigned int for irq_lock()
irq_lock() returns an unsigned integer key.
Generated by spatch using semantic patch
scripts/coccinelle/irq_lock.cocci

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-07-14 14:37:13 -05:00
Daniel DeGrasse 5dcb5e0f67 drivers: ethernet: mcux: Increase available RX buffers
increase available RX buffers to MCUX ethernet driver.
improves measured performance on RT1050 EVK zperf download
from 500Kbps to 22Mbps.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-07-12 09:53:56 +02:00
Anas Nashif 49b36ead95 drivers: add mising braces to single line if statements
Following zephyr's style guideline, all if statements, including single
line statements shall have braces.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-06 11:00:45 -04:00
Kumar Gala 51b4df60a2 drivers: ethernet: eth_mcux: Replace use of DT_INST_LABEL
As we work to phase out devicetree 'label' properties, convert
driver to just use ETH_0/ETH_1 instead of DT_INST_LABEL for
logging purposes.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-05 22:24:09 -05:00
Henrik Brix Andersen ea433a4803 drivers: ethernet: xlnx: gem: do not lock/unlock the SLCRs
Do not lock/unlock the System Level Control Registers (SLCRs) in the Xilinx
GEM ethernet driver. The SLRCs are unlocked once at boot time.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-06-28 20:46:11 +02:00
Krzysztof Chruscinski 041f0e5379 all: logging: Remove log_strdup function
Logging v1 has been removed and log_strdup wrapper function is no
longer needed. Removing the function and its use in the tree.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-23 13:42:23 +02:00
Kumar Gala f78a081066 drivers: ethernet: dsa_ksz8xxx: use NET_DEVICE_DT_DEFINE_INSTANCE
Move to using NET_DEVICE_DT_DEFINE_INSTANCE instead of
NET_DEVICE_INIT_INSTANCE as the driver is devicetree based and it
lets us remove DT_LABEL usage in the driver itself.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-15 17:05:33 -05:00
Hari Haran Babu 17f8f62789 drivers: ethernet: w5500: Toggle reset gpio
add toggle reset gpio in w5500_init function

Signed-off-by: Hari Haran Babu <hariharan@linumiz.com>
Signed-off-by: Marcel Graber <marcel@clever.design>
2022-06-07 18:56:31 +02:00
Hari Haran Babu d8e3affe7b drivers: ethernet: w5500: keep thread blocking in command read-back
add changes for command read-back and change from k_sleep to k_busy_wait
which will allow other threads to wakeup

Signed-off-by: Hari Haran Babu <hariharan@linumiz.com>
Signed-off-by: Marcel Graber <marcel@clever.design>
2022-06-07 18:56:31 +02:00
Michal Sieron 17a2c6d647 drivers: ethernet: eth_liteeth: Update driver
Correct width when accessing LITEETH_RX_LENGTH register.

Also update register data in device tree to the 32-bit CSR variant.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-27 15:27:11 -07:00
Janco Kock d611284271 drivers: ethernet: w5500: Check W5500 int pin after processing interrupt
Check if W5500 int pin is still active after processing the interrupt.
If not doing correctly, the W5500 driver can deadlock because it is not
receiving any more interrupts.

Signed-off-by: Janco Kock <jancokock@gmail.com>
2022-05-25 21:46:17 +02:00
Gerard Marull-Paretas fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Michal Sieron bd892bd963 ethernet: eth_liteeth: Add and use register names
Adds addresses and names for individual CSR registers to device tree.
This way liteuart driver no longer depends on CSR data width being 8
bits.
Also when register names or their number changes, then overlay generated
by LiteX will be incompatible with one defined here.
This should make finding breaking changes easier.

I also appended `_ADDR` suffix to defines, to distinguish them from
normal values like `LITEETH_EV_RX`.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-06 11:31:54 +02:00
Michal Sieron e3db9a49c8 ethernet: eth_liteeth: Avoid bitwise operations
With universal LiteX HAL working, there is no need to perform multibyte
reads and writes using bitwise operations.
Just use appropriate `litex_read*` or `litex_write*` function.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Michal Sieron 0c738b7f79 ethernet: eth_liteeth: Use LiteX HAL
Use LiteX HAL functions instead of `sys_read*` or `sys_write*`
functions.
They use them inside, but choose which one to use according to
configured CSR data width.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Bartosz Bilas 1afccdf3f1 drivers: ethernet: stm32_hal: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Immo Birnbaum 673b79440f drivers: ethernet: xlnx_gem: remove unnecessary "EOF" comments
remove unnecessary EOF comment lines at the end of each file.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-04-14 14:43:52 -05:00
Daniel DeGrasse 0f939d350d drivers: ethernet: eth_mcux: add support for resetting phy
add support for resetting phy at boot via GPIO reset pin.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Gerson Fernando Budke be387aa1c2 drivers: eth: Update sam/sam0 eth drivers to use pinctrl
This update Atmel sam and sam0 ethernet gmac and mdio drivers to use
pinctrl driver and API. It updates all boards with new pinctrl groups
format.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Daniel DeGrasse 55f1d5ba73 drivers: enet: Enable pinctrl for eth_mcux driver
Enable pinctrl for ethernet mcux driver, and update kinetis DTS node to
include labelling for PTP node, to enable driver to access pinctrl
properties.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Alex Sergeev 49edd8558b drivers: ethernet: stm32: avoid segfault if cannot get RX buffer
Avoids segfault in situations when we can't acquire an RX buffer, and VLAN
or PTP code is enabled which tries to inspect packets by adding a pkt
check.

Signed-off-by: Alex Sergeev <asergeev@carbonrobotics.com>
2022-03-21 08:44:58 -05:00
Nazar Kazakov f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04:00
Tomasz Bursztyka 16062c2e5a drivers: constify all device instances
Run cocci script to constify device instances.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-03-16 12:33:12 +01:00
Hristo Mitrev b64a83822c drivers: eth_smsc911x_priv: Remove obsolete macros
Back with commit a1b77fd589 huge chunk of code was automatically
refactored using a script, which in turn left some macros meaningless

Signed-off-by: Hristo Mitrev <hr.mitrev@gmail.com>
2022-03-16 10:22:55 +01:00
Gerard Marull-Paretas 9953c194b9 drivers: remove redundant DEV_NAME helpers
Just use dev->name. This change follow same principles applied when
DEV_CFG and DEV_DATA macros were removed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-15 17:31:51 -04:00
Nazar Kazakov 9713f0d47c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-14 20:22:24 -04:00
MohanKumar Kumar a2e3774e54 drivers: eth: stellaris: Fix build error
Use the correct variable name in eth_stellaris, which fixes
the build error.

Signed-off-by: MohanKumar Kumar <mohankm@fb.com>
2022-03-14 11:28:41 +01:00
Bernd Weiberg fd8702474d drivers: fixed return code bug in eth_stm32_hal_set_config()
The function eth_stm32_hal_set_config() located in
drivers/ethernet/eth_stm32_hal.c always returns -ENOTSUP,
even if everything is fine. This commit fixes the return statement
so that the real result (ret) will be returned.

Signed-off-by: Bernd Weiberg <bernd.weiberg@siemens.com>
2022-03-10 13:44:48 -05:00
Henrik Brix Andersen e9c9caa80d net: remove unmaintained 6LoCAN implementation
Remove the unmaintained, experimental 6LoCAN (IPv6 over CAN bus)
implementation.

Fixes: #42559

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-09 18:07:31 +01:00
Gerard Marull-Paretas dffaf5375c kconfig: tweak Kconfig prompts
Tweak some Kconfig prompts after the removal of "Enable...".

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Gerard Marull-Paretas 95fb0ded6b kconfig: remove Enable from boolean prompts
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:

sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Krzysztof Chruscinski 47ae656cc1 all: Deprecate UTIL_LISTIFY and replace with LISTIFY
UTIL_LISTIFY is deprecated. Replacing it with LISTIFY.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-08 11:03:30 +01:00
Bartosz Bilas 718225dadf drivers: ethernet: dsa_ksz8xxx: fix spi bus initialization
spi_dt_spec structure initialization should not be done
in the runtime during spi bus initialization because it
causes kernel panic.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-03-07 09:54:21 -06:00
Immo Birnbaum 27cefa657f drivers: xlnx_gem: remove Zynq/ZynqMP distinction for DMA placement
With the unification of OCM declaration & assignment between Zynq-7000
and Ultrascale/ZynqMP, remove the distinction between those two SoC
families so that the DMA area is always set up in the OCM regardless
of the current SoC type.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-02-28 11:04:57 +01:00
Gerard Marull-Paretas 54177fd8ff drivers: ethernet: dsa_ksz8xxx: use DEVICE_DT_GET
Use DEVICE_DT_GET instead of device_get_binding, since the device
reference can be obtained at compile time.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas 6c11b6c9bf drivers: ethernet: dsa_ksz8xxx: use gpio_dt_spec
The reset GPIO information can be obtained at compile time, so use
gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Björn Stenberg a59ce01118 drivers: eth: native_posix: Add support for setting ethernet MAC address
If CONFIG_ETH_NATIVE_POSIX_RANDOM_MAC=n and
CONFIG_ETH_NATIVE_POSIX_MAC_ADDR="", the MAC address can be set with a
net_mgmt call before the driver is initialized.

Signed-off-by: Björn Stenberg <bjorn@haxx.se>
2022-02-21 21:54:05 -05:00
Hake Huang d517947de4 driver: eth_mcux: fixing build error on rt11xx
in rt11xx series the ringbuffer is > 1

fixing: #42793

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-02-14 10:16:01 -06:00
Xabier Marquiegui 52be66919e net: gptp: convert clock sync ratio from float to double
Using clock sync ratio as double instead of float improves
synchronization smoothness

Signed-off-by: Xabier Marquiegui <xmarquiegui@ainguraiiot.com>
2022-02-11 10:03:05 -06:00
Xabier Marquiegui 62db8ca0e6 driver: eth_mcux: gptp: limit rate_adjust range
Limit gptp range_adjust range for improved performance.

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
Signed-off-by: Xabier Marquiegui <xmarquiegui@ainguraiiot.com>
2022-02-11 10:03:05 -06:00
Xabier Marquiegui d4c4a14737 driver: eth_mcux: gptp: enable pps output
Enable pps output for gptp accuracy measurements.

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
Signed-off-by: Xabier Marquiegui <xmarquiegui@ainguraiiot.com>
2022-02-11 10:03:05 -06:00
Xabier Marquiegui 7454a92754 driver: eth_mcux: realtime optimizations
mcux enet driver updates:
a) add mutex to access the ptp timer variables
b) use thread for rx(cooperative) andfor tx cleanup(cooperative)
c) use a thread for ptp inner clock updater(pre-empty)

This patch fixes the following issue:

```
ENET_SendFrame error: 4004
```

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
Co-authored-by: Seb Laveze <sebastien.laveze@nxp.com>
Signed-off-by: Xabier Marquiegui <xmarquiegui@ainguraiiot.com>
2022-02-11 10:03:05 -06:00
Yong Cong Sin 731241f8d0 kernel: workq: Fix type errors in delayable work handlers
A common pattern here was to take the work item as the subfield of a
containing object. But the contained field is not a k_work, it's a
k_work_delayable.

Things were working only because the work field was first, so the
pointers had the same value. Do things right and fix things to
produce correct code if/when that field ever moves within delayable.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-02 18:43:12 -05:00
Piotr Mienkowski 072275217b drivers: eth_sam_gmac: fix eth_sam_gmac_set_config()
Fix handling of the return value by `eth_sam_gmac_set_config` function.
The function is used as a backend by
`net_mgmt(NET_REQUEST_ETHERNET_SET_MAC_ADDRESS, ...)` to change the
interface MAC address at run time.

Tested on sam_e70_xplained board.

Fixes #42151

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2022-01-28 10:06:41 +01:00
Alex Sergeev 205b7f24fd drivers: ethernet: stm32: Bugfix PTP clock read on second boundary
Current version of STM32 PTP clock reads current PTP time by querying
second and nanosecond registers sequentially. It is possible for second
to roll over between reading second and nanosecond registers, causing
returned time to be off by a second. This bugfix resolves that issue.

Signed-off-by: Alex Sergeev <asergeev@carbonrobotics.com>
2022-01-21 15:27:21 -05:00
Immo Birnbaum 99a6598b98 drivers: ethernet: xlnx_gem: update referenced SoC configuration items
Update the Kconfig configuration items used to determine if the current
target is based on the Zynq-7000 SoC family as part of the re-organi-
zation of the Zynq-7000 SoC configuration data.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@Weidmueller.com>
2022-01-21 11:34:09 -05:00
Gerard Marull-Paretas 435213a753 drivers: remove redundant data/config casts
Some drivers explicitely casted data/config from void * to the
corresponding type. However, this is unnecessary and, in many drivers it
has been misused to drop const qualifier (refer to previous commits).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas 6f6a178390 drivers: ethernet: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Anas Nashif 01b7800bc8 include: remove deprecated headers
Remove all deprecated headers which were moved to a different location.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-01-18 19:17:50 -05:00
Bartosz Bilas ca96286c22 drivers: ethernet: dsa_ksz8xxx: remove duplicated headers
drivers/spi.h header is included when CONFIG_DSA_SPI
is enabled so there is no necessity to do that once again.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-01-18 13:23:16 -05:00
Bartosz Bilas 8779972955 drivers: ethernet: dsa_ksz8xxx: convert to spi_dt_spec
Convert dsa_ksz8xxx driver to use `spi_dt_spec` helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-01-18 13:23:16 -05:00
Gerard Marull-Paretas ddc168fa78 pm: s/PM_DEVICE_(DT_(INST))_REF/PM_DEVICE_(DT_(INST))_GET
In order to align with macros used to obtain a device reference (e.g.
DEVICE_DT_GET), align the PM macros to use "GET" instead of "REF". This
change should have low impact since no official release has gone out yet
with the "REF" macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-18 12:14:06 -05:00
Daniel DeGrasse 0fddb3e458 soc: rt11xx: Enabled GPTP module clock
gPTP module clock is enabled for rt11xx. gPTP is not working correctly
on the RT10xx or RT11xx series, but this module clock needs to be
enabled

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-18 12:13:24 -05:00
Daniel DeGrasse 5fe5161721 drivers: eth_mcux: Update for RT11xx SOC
RT11xx soc has multi ring enet IP, which has different HAL functions.
Update eth_mcux driver to account for this

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-18 12:13:24 -05:00
Daniel DeGrasse 594e11a540 drivers: eth_mcux: Enable specifying PHY addr for enet module
PHY addr is not always 0 on boards with multiple PHYs. Allow specifying
via devicetree.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-18 12:13:24 -05:00
Gerard Marull-Paretas 5dc6ed3ce3 pinctrl: require ; after PINCTRL_DT_(INST_)DEFINE macros
The PINCTRL_DT_(INST_)DEFINE macros already defined the trailing ;,
making its usage inconsistent with other macros such as
DEVICE_DT_DEFINE.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-01 07:39:08 -05:00
Gerard Marull-Paretas 7a4d3f72f9 drivers: ethernet: phy_mii: use instance based DT macros
Replace usages of DT_DRV_INST(n) with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Alex Sergeev 40b81e6b76 drivers: ethernet: stm32: PTP L2 timestamping support
Add support for IEEE 1588-2008 (PTP L2) for STM32F7 and STM32H7
families.

Signed-off-by: Alex Sergeev <asergeev@carbonrobotics.com>
2021-12-13 22:19:25 -05:00
Brad Rushbrook 6d0e83f89e eth: Add promiscious mode support to stm32 ethernet abstraction
Simply adds the definitions in the stm32 hal to define ethernet
promiscious mode.

Signed-off-by: Brad Rushbrook <rushybrook@gmail.com>

Fixes error and resetting promisc mode, adds support for STM23H7x

Signed-off-by: Brad Rushbrook <rushybrook@gmail.com>

Co-authored-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>

Readability improvement; coding-style compliance

Signed-off-by: Brad Rushbrook <rushybrook@gmail.com>

Co-authored-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-12-09 19:32:25 -05:00
Mahesh Mahadevan 0a2464b89f drivers: ethernet: Add support for new PHY API
SDK 2.10 changed the PHY API. These updates are
needed as part of moving to SDK 2.10

1. add phy / mdio ops init
2. update PHY_Read/Write HAL call

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-12-09 09:18:10 -06:00
Lukasz Majewski 90f36ac16d net: dsa: ksz8794: Fix the port numbering for DSA tag setting
After the commit "dts: ksz8974: change port number to start at zero."
(SHA1: aa6217697e)

the lan ports are numbered starting from zero (not as previously from
one), so code assigning tags shall take this into account.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-12-01 13:58:08 -06:00
Lukasz Majewski cb4f7bc15c net: dsa: ksz8794: Fix the port numbering for this ETH switch IC
After the "dts: ksz8974: add support for ksz8863"
(SHA1: b0e4886dfa) commit the port numbering
for KSZ8794 was wrong.

This IC has 3 ETH ports (with linear offset), with port 4 being the
"master" with non linear offset (i.e. 0x50 instead of linear 0x40).

Such situation can be explained with similarity of this IC to ksz8795,
which has 4 LAN ports, and then the 0x40 offset is used.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-12-01 13:58:08 -06:00
Lukasz Majewski ab1f0b55d5 net: dsa: ksz8794: Use CONFIG_DSA_KSZ_TAIL_TAGGING in preprocessor macros
The name of macro to enable tail tagging support in DSA KSZ driver is
CONFIG_DSA_KSZ_TAIL_TAGGING, not DSA_KSZ_TAIL_TAGGING.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-12-01 13:58:08 -06:00
Lukasz Majewski 5b957e4e46 net: dsa: ksz8794: Remove check for CPU port in the switch setup
The check for CPU port on the KSZ8794 when the switch is initialized,
is not required as the last port number is always smaller than the CPU
port.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-12-01 13:58:08 -06:00
Gerard Marull-Paretas 89a4f36fc8 device: remove inclusion of pm/device.h
The device PM subsystem _depends_ on device, not vice-versa. Devices
only hold a reference to struct pm_device now, and initialize this
reference with the value provided in Z_DEVICE_DEFINE. This requirement
can be solved with a forward struct declaration, meaning there is no
need to include device PM headers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-29 11:08:38 +01:00
Erwan Gouriou 18ae799b73 drivers/ethernet: dwmac_stm32h7x: use new pinctrl API
Use the new pinctrl API to configure pins.

Additionally, rename eth0_pins to eth0_pcfg to better fit
new pinctrl API.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou 87438e4587 drivers/ethernet: stm32_hal: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00