Commit graph

1211 commits

Author SHA1 Message Date
Declan Snyder
fe809c8b24 drivers: ethernet: Add NXP ENET Driver
Add driver for NXP ENET which is a rework of the old
eth_mcux.c driver which had become unmaintainable due to
fundamental problems with the lack of PHY abstraction.

eth_mcux.c and the corresponding compatible nxp,kinetis-ethernet
will be deprecated and this new driver will be supported instead.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-11-28 14:34:02 -06:00
Declan Snyder
5724ce78fc drivers: ethernet: phy: Add KSZ8081 PHY Driver
Add Driver for KSZ8081 Ethernet PHY. The Generic MII Driver
is not sufficient to use for this PHY chip which has special
vendor implemented behaviors.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-11-28 14:34:02 -06:00
Declan Snyder
7e88ab54e2 dts: bindings: ethernet-controller: Add phy mode
Add a property to the ethernet controller binding
indicating what type of connection the MAC has with
the PHY device.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-11-28 14:34:02 -06:00
Benjamin Perseghetti
0fa204b9fd drivers: net: phy: add tja1103
Adds the tja1103 enet phy for setting phy options on the mr_canhubk3.

Co-authored-by: Manuel Argüelles <manuel.arguelles@nxp.com>
Co-authored-by: Peter van der Perk <peter.vanderperk@nxp.com>
Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
2023-11-28 08:07:44 -06:00
Lukasz Majewski
b0b57dac72 drivers: net: tc6: Provide separate function to check IC status
The code to handle OA TC6 compliant device's status is generic and can
be moved to device agnostic driver (oa_tc6.c).

Moreover, the original code has been augmented with LOG_WRN() messages.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2023-11-27 19:58:13 +01:00
Lukasz Majewski
8df4482f4c drivers: net: lan865x: Fix initialization of semaphores
This change fixes semaphores' definition. To be more specific - the
limit was wrongly set to UINT_MAX. With those changes - the 'tx_rx_sem'
now assures that only one execution path (i.e. receiving or sending
data) is executed at a time.

Moreover, the change in 'int_sem' now assures that this semaphore limit,
when reached, is saturated.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2023-11-27 19:58:13 +01:00
Lukasz Majewski
ecfe5f1167 drivers: net: lan865x: Fix use of RX/TX semaphore in read chunks function
This commit ensures that whole receive function (called from interrupt
handler) is protected by the RX/TX semaphore.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2023-11-27 19:58:13 +01:00
Lukasz Majewski
c2f5a9d67c drivers: net: lan865x: Do not read chunks if protected read error detected
The oa_tc6_update_buf_info() function returns error code when read
(protected or not) of OA_BUFSTS has been detected.

In that situation - one shall re-start the interrupt thread handling
(and hence correctly re-read value of this register) than use old
(stalled) RCA(RBA) data to read chunks (which may result in lockup).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2023-11-27 19:58:13 +01:00
Lukasz Majewski
aa733d789f drivers: net: tc6: Avoid sending packet when no data provided
This commit adds check if the packet to be sent has any data.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2023-11-27 19:58:13 +01:00
Lukasz Majewski
cceeba3f42 drivers: net: tc6: Do not send extra last chunk when not required
Current code sends extra, last chunk, when packet's size is a multiple
of chunk size (i.e. 64 bytes).

This patch fixes this issue by checking this corner case - i.e. if
the modulo division equals to zero.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2023-11-27 19:58:13 +01:00
Lukasz Majewski
59980d5c98 drivers: net: tc6: Saturate RCA and RBA when read directly from OA_BUFSTS
The RCA and RBA fields in OA_BUFSTS register are stored with 8 bits each.

On the other hand, when one receives those values in footer, the value
is saturated to 5 bits due to 32 bit size constrain of the footer itself.

To avoid any mismatches - the values read from OA_BUFSTS are saturated
as well.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2023-11-27 19:58:13 +01:00
Lukasz Majewski
d378e64508 drivers: net: Force LAN865x to start received frames at first chunk word
Zephyr's network stack has issues with network IP header split across
fragments.
To alleviate this problem, the frame would be now aligned to first byte
of the chunk. This would ensure that the header is stored at one network
buffer fragment (as we explicitly set its size to 64B).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2023-11-27 19:58:13 +01:00
Lukasz Majewski
6c8c0f57f9 drivers: net: tc6: Add read,modify and write operation on control regs
The OA TC6 driver requires some bits manipulations in control registers.
Up till now - it has been implemented as an explicit set of read and write
registers' operations.
One good example would be the oa_tc6_set_protected_ctrl() implementation,
which used such scheme.

This patch brings dedicated function for this operation; oa_tc6_reg_rmw().
The aforementioned oa_tc6_set_protected_ctrl() function now uses it
internally.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2023-11-27 19:58:13 +01:00
Bartosz Bilas
08a4829682 drivers: ethernet: esp32: fix Kconfig
Add the missing dependency of the node status value
and enable the driver by default when they are met.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2023-11-27 12:22:02 +00:00
Grant Ramsay
82644a31c2 drivers: ethernet: Fix eth_ivshmem shared memory mapping
This driver assumed the ivshmem-v2 output sections would be mapped
contiguously, which is no longer true.

Modify eth_ivshmem to treat each output section independently

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-11-27 12:15:43 +00:00
David Leach
23408ac538 drivers: eth_mcus: Conditionally wrap IPV4/6 code
Regression failure introduced problem where driver code was not properly
wrapping code that only existed when compiled for IPv4/v6 applications.

Fixes #65549

Signed-off-by: David Leach <david.leach@nxp.com>
2023-11-21 21:36:22 -06:00
Daniel Leung
c972ef1a0f kernel: mm: move kernel mm functions under kernel includes
This moves the k_* memory management functions from sys/ into
kernel/ includes, as there are kernel public APIs. The z_*
functions are further separated into the kernel internal
header directory.

Also made a quick change to doxygen to group sys_mem_* into
the OS Memory Management group so they will appear in doc.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-11-20 09:19:14 +01:00
Ibe Van de Veire
22d470e6a5 drivers: eth_mcux: Add net_if_mcast_cb for IPv4
Added ability to receive mcast callbacks for both IPv4 and IPv6 instead of
only IPv6.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
2023-11-17 09:23:39 +01:00
Manuel Argüelles
24c1b42741 drivers: ethernet: nxp_s32: include soc.h
The SoC header already includes the necessary device headers for
all SoC variants supported.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-11-16 17:53:43 +01:00
Manuel Argüelles
1a05cfc03a soc: nxp_s32: consolidate part number options
Currently, the NXP S32 SoCs have three redundant Kconfig hidden
options to define the part number. To streamline this, we will
retain `CONFIG_SOC_PART_NUMBER` to store the part number as a
string and `CONFIG_SOC_PART_NUMBER_<part>` that can be selected
by the boards.

Furthermore, for drivers requiring conditional code compilation
based on the target SoC, they should utilize the series or SoC
config option as applicable, instead of the part number config.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-11-15 10:25:43 -06:00
Marcin Niestroj
c30c9b97b4 drivers: eth: cmake: narrow scope of 'native_posix_source_files'
'native_posix_source_files' is used only when CONFIG_NATIVE_APPLICATION=y,
but it was set unconditionally regardless of this Kconfig option.

Set 'native_posix_source_files' under CONFIG_NATIVE_APPLICATION=y to narrow
scope of this variable.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-11-13 09:52:21 +01:00
Lukasz Majewski
12665a0dc1 driver: eth: Support for lan8651 T1S ETH
This patch set provides support for T1S ethernet device - LAN8651.

For SPI communication the implementation of Open Alliance TC6
specification is used.

The driver implementation focuses mostly on reducing memory footprint,
as the used SoC (STM32G491) for development has only 32 KiB RAM in total.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2023-11-09 15:35:01 +01:00
Lukasz Majewski
1cef7f3250 driver: eth: Implementation of Open Alliance's TC6 T1S communication
Those files provide generic functions to handle transmission between chip
conforming OA TC6 standard and Zephyr's network stack represented by
struct net_pkt.

The communication is performed via SPI and is focused on reduced memory
footprint (works with SOC equipped with 32 KiB of RAM) and robustness of
operation.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2023-11-09 15:35:01 +01:00
Dat Nguyen Duy
09be84eb77 drivers: nxp_s32_netc: remove dependency to NET_TEST
There is no require to prevent building nxp s32 netc
shim driver if NET_TEST is set, so just remove this
unnecessary dependency

Fix #64944

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-11-08 10:10:50 +01:00
Georgij Cernysiov
3be2956b86 drivers: ethernet: fix adin set_config lock
Use correct argument to lock/unlock the MAC.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2023-11-07 16:22:58 -06:00
Alberto Escolar Piedras
8b456ea2a1 treewide: Replace all uses of CONCAT with _CONCAT
One of the ARM architure files, defined since long ago
CONCAT having the exact same purpose as Zephyr's _CONCAT.
Unfortunately this header is included almost always
and the macro defined in all ARM based platforms,
which seems to have lead to many uses of this macro
instead of _CONCAT.

Fix it by using _CONCAT instead.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-07 11:55:51 +01:00
cyliang tw
8ba8c188a0 drivers: ethernet: support for Nuvoton numaker series
Add Nuvoton numaker series EMAC controller feature.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2023-11-03 12:11:33 +00:00
Benedikt Schmidt
fbef0edb99 drivers: ethernet: fix thread function signatures
Fix thread function signatures to avoid stack corruption on thread exit.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-10-30 12:24:34 +01:00
Ali Hozhabri
154023f754 drivers: spi: update drivers that were using spi cpol and cpha
Modified files (yaml, dts, overlay, and c) which were using spi-cpol
and spi-cpha to be compatible with the new structure.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2023-10-25 18:30:28 -07:00
Georgij Cernysiov
e364f29bff drivers: ethernet: fix adin set_config
Corrects set_config to allow MAC config
at runtime.

* Add missing device lock
* Use correct mac argument

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2023-10-25 17:36:37 +02:00
Aleksandr Senin
d8b153e00f drivers: eth: eth_stm32_hal: Add DSA support
This commit adds DSA functionality support to the Ethernet driver
for the STM32 SoC.

Signed-off-by: Aleksandr Senin <al@meshium.net>
2023-10-25 09:55:42 -05:00
Jason Murphy
38f8a4db28 drivers: ethernet: fix adin2111 devicetree init to work with adin1110
The initialisation of the device data struct was giving a build error
when using the adi,adin1110 devicetree compatible.
Fixed to allow both adi,adin2111 and adi,adin1110 devices to
be defined.

Signed-off-by: Jason Murphy <jason.murphy@analog.com>
2023-10-25 09:57:37 +02:00
Jukka Rissanen
c345f59910 drivers: eth: native: Add native-sim support to posix Ethernet driver
This will enable Ethernet driver to be used when compiling
for native-sim board.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-10-20 15:00:41 +02:00
Jukka Rissanen
28bd5423ff drivers: eth: native: Remove automatic start script support
As the automatic start requires that the zephyr exe is run as
a root user, it is somewhat cumbersome to use. Remove the script
support and require that the zeth device is created beforehand
by the net-setup.sh script found in net-tools zephyr project.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-10-20 15:00:41 +02:00
Declan Snyder
7d5d4ed907 drivers: eth_mcux: cache must be dcache
Currently the Kconfig for eth_mcux selects nocache if
HAS_MCUX_CACHE is set. But, for platforms that have a flexspi
cache but not a CPU cache, this is invalid, so clarify this
in the Kconfig definition.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-10-13 10:06:33 +01:00
Daniel Leung
04a0cf7d79 kernel: deprecate K_THREAD_STACK_MEMBER
The macro K_THREAD_STACK_MEMBER has actually been deprecated
since v2.4.0 in the macro doxygen description, but it was
never marked with __DEPRECATED_MACRO. Since this was being
used in various drivers, make it follow the deprecation
process.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-10-12 11:07:00 +01:00
Stefan Petersen
416dde7dd1 drivers: ethernet: eth_stm32_hal.c Fix mixup of DMA error and MAC error
There seems to be a copy-paste error where GetDMAError() et al is used
twice. The comment states that it is actually getMACError() et al that
should be used in the second instance.

Signed-off-by: Stefan Petersen <spe@ciellt.se>
2023-10-10 15:26:52 +02:00
Flavio Ceolin
e7bd10ae71 random: Rename random header
rand32.h does not make much sense, since the random subsystem
provides more APIs than just getting a random 32 bits value.

Rename it to random.h and get consistently with other
subsystems.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-10 14:23:50 +03:00
Thomas Chiantia
4ebc963ed5 drivers: eth: gmac: Fixed ethernet startup when fixed-link
When upgrading to version 3.4, our hardware lost ethernet connectivity.
Our hardware assumes a fixed link and does not communicate with the
underlying phy via the mdio bus.

I confirmed that the atsame54_xpro board also will lose ethernet
functionality when the atsame54_xpro configures the phy via to use a
fixed link...

The eth_sam_gmac driver changed the initialization behavior to call
net_if_carrier_off and notes to wait until phy link is up (via
callback.)  However, when in a fixed link configuration, the callback is
never called. So the net_if_carrier_on event never occurs.

This patch adds a check to see if link is up already before calling
net_if_carrior_off. This check works because in fixed-link mode, link-up
is set synchronously during phy driver initialization.

I tested that atsame54_xpro with fixed-link configuration will now work
after this patch.

Signed-off-by: Thomas Chiantia <thomas.chiantia@gmail.com>
2023-10-08 11:16:39 +01:00
Maureen Helm
aab537c8e2 drivers: ethernet: Decouple generic MII PHY and adin2111 driver Kconfigs
Decouples the generic MII PHY driver from the adin2111 driver by making
it depend on an ethernet-phy compatible devicetree node rather than the
adin2111 driver not being enabled. This makes it possible to add the
adin2111 driver to tests/drivers/build_all/ethernet

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2023-10-03 15:10:12 +01:00
Maureen Helm
66a03e6a38 drivers: ethernet: Remove CONFIG_ETH_ADIN2111_INIT_PRIORITY
Simplifies the adin2111 ethernet driver to use the generic driver class
initialization priority instead of a driver-specific priority.

Suggested-by: Georgij Cernysiov <geo.cgv@gmail.com>
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2023-10-03 15:10:12 +01:00
Maureen Helm
e503ec4064 drivers: ethernet: Fix adin2111 multiple compatibles support
The adin2111 ethernet driver supports both adi,adin2111 and adi,adin1110
devicetree compatibles, however it failed to build when both compatibles
existed in the same devicetree. This may be an unusual configuration for
real systems, but was found when extending
tests/drivers/build_all/ethernet to cover both compatibles.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2023-10-03 15:10:12 +01:00
Maureen Helm
d5287578fe dts: bindings: boards: Update Ethernet PHY to use reg property
Updates Ethernet PHY devicetree bindings to be more consistent with
Linux by using the standard `reg` property for the PHY address instead
of a custom `address` property. As a result, MDIO controller bindings
now require standard `#address-cells` and `#size-cells` properties.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2023-09-29 09:47:15 +02:00
Maureen Helm
ce42ffcce0 dts: boards: Use ethernet-phy devicetree node name consistently
Some Ethernet PHYs used the devicetree node name `phy`, while others
used `ethernet-phy`. Be consistent and use `ethernet-phy` throughout.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2023-09-29 09:47:15 +02:00
Manuel Argüelles
280ddaef4a mdio: introduce Clause 45 APIs
Add `mdio_read_c45()`/`mdio_write_c45()` APIs for Clause 45 access
and remove the `protocol` MDIO binding property so that MDIO bus
controller can support more than one protocol.

A new MDIO header is introduced with generic opcodes, MMD and
registers addresses, to be used by MDIO and PHY drivers.

Existing MDIO drivers that support both Clause 22 and Clause 45
access are migrated to the new APIs.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-28 09:33:10 +02:00
Manuel Argüelles
ca3310145f drivers: select nocache only when supported
NOCACHE_MEMORY depends on ARCH_HAS_NOCACHE_MEMORY_SUPPORT, so
don't try to select the symbol if not supported.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-26 15:09:51 +02:00
Mahesh Mahadevan
24f2dd059e drivers: eth_mcux: Avoid using deprecated SDK function
The SDK function ENET_SetCallback is deprecated and has
been removed in the latest SDK.
Update the driver to set the callback during Init by using
the callback config param.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-09-19 13:36:13 -05:00
Gerard Marull-Paretas
691facc20f include: always use <> for Zephyr includes
Double quotes "" should only be used for local headers.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-14 13:49:58 +02:00
Robert Lubos
c7c86de621 drivers: wifi: Prevent CMake warnings for out-of-tree drivers
When Ethernet or Wi-Fi subsystems are enabled, but no driver source
files are provided in the Zephyr source tree (which is the case for
out-of-tree drivers), CMake throws warnings about empty libs, for
example:

  No SOURCES given to Zephyr library: drivers__ethernet
  No SOURCES given to Zephyr library: drivers__wifi

This commit sets ALLOW_EMPTY property for those libraries, to allow for
seamless out-of-tree drivers integration.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-09-02 15:09:24 +02:00
Fabio Baltieri
2a2b314fc4 drivers: fix few mismatched CONTAINER_OF
Fix few mismatched CONTAINER_OF, one missing k_work_delayable_from_work
conversion and few cases where the target should be pointing at the
first element explicitly.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-30 10:21:23 +02:00