Remove parts of the legacy implementation in eth_stm32_hal_common.c for
the loading of the MAC address when the device-tree is used. Use
net_eth_mac_load() for all these cases that were not destined for
production-ready products.
When cfg->mac_cfg.type == NET_ETH_MAC_DEFAULT, it means that neither
"zephyr,random-mac-address", "local-mac-address" or "nvmem-cells" were
used. For this case, keep the legacy property-less implementation to
avoid compilation errors and have a default, backward-compatible case.
Warning: this commit causes backward compatibility breakage for
implementations using "zephyr,random-mac-address" or "local-mac-address"
properties.
Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
This commit adds support for the Xilinx AXI Ethernet Lite device,
also known as the emaclite.
The emaclite is a light-weight 10/100 MII Ethernet device.
It foregoes a DMA to reduce chip area.
Instead, it uses memory-mapped transmit/receive buffers.
A selection of features can optionally be enabled:
- a second ("pong") RX/TX Buffer
- MDIO support
- Interrupt support
This driver handles the MAC functionality of the core;
a driver for the MDIO part is introduced separately
as an MDIO driver.
Signed-off-by: Eric Ackermann <eric.ackermann@cispa.de>
Add a 'U' suffix to the interrupt status mask passed to
lan9250_write_sys_reg() to make the constant explicitly unsigned.
This avoids signed/unsigned ambiguity and addresses a SonarQube
static analysis warning.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
The lan9250_thread() function declares a local variable that may be
used without being initialized, triggering a -Wmaybe-uninitialized
warning when building with -Werror.
Initialize the variable at declaration to ensure deterministic
behavior and avoid build failures.
No functional change intended.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
Several LAN9250 helper functions ignored return values from register
access and wait routines, potentially hiding SPI or timeout
failures.
Propagate error codes from read/write/wait helpers throughout the
driver so failures are detected and handled by callers.
This improves robustness and makes error conditions visible during
initialization, PHY access, RX/TX paths, and MAC configuration.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
The ethernet DMA driver code was causing the silent dropping of packets
with length 125, 126 and 127. The root cause of the problem is that the
DMA engine performs an extra four bytes transfer corresponding to the
Receive Status Word. For those particular packet lengths, the previous
code incorrectly calculated the last fragment size.
The new code avoids that pitfall by decrementing the total frame size as
the fragments are being collected, while avoiding the creation of an
extra fragment on the extracted network packet.
Signed-off-by: Marcelo Roberto Jimenez <marcelo.jimenez@gmail.com>
This new API handles if the MAC address should be fetched from NVMEM,
is static or be randomly generated. Use it so that the driver can
fetch the MAC address from the OTP fuses, when possible.
Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
The DSA tag protocol driver should be native for packet
tagging and untagging. There is possibility other vendors/IPs
use it. So, just defined DSA tag structures in header file
instead of using hal header file.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Renamed DSA_NXP_NETC_GCL_LEN to DSA_NXP_IMX_NETC_GCL_LEN for
naming consistency, and wrapped it in DSA_DRIVERS condition.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
ierb_init() never reports an error and cannot fail in practice.
Returning an int led to a dead error.
Convert ierb_init() to a void function, drop the unused return value
checks, and provide a no-op implementation for SoCs that do not
require IERB initialization.
This simplifies the control flow and removes an unnecessary error
condition.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
The return value of gpio_pin_set_dt() and
gpio_pin_interrupt_configure_dt() was not stored before being
checked, causing the error condition to always evaluate to false.
Store the return value and properly handle potential GPIO errors
during PHY reset.
No functional change intended.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
phy_tja11xx_get_link_state() always returns 0, making callers' error
checks ineffective.
Remove the unused return variable and drop the dead conditional in
invoke_link_cb() to silence static analysis warnings and simplify
the code.
No functional change.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
Handle both multicast packets and promiscuous mode in the driver. This
will allow the lan9250 to be added to a bridge as well as process
multicast packets being received.
Signed-off-by: Charles Hardin <ckhardin@gmail.com>
remove redunant tx mutex, as the networking
subsystem already provides one since
f65ac5effb02bdc4cb70b205545971e70c53c282
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Factorize STM32 interface clocks configuration in a single array.
This change eases later integration of other SoCs with different
clocks names while the driver only has to enable (possibly disable)
the clocks on a single sequence.
Suggested-by: Fin Maaß <f.maass@vogl-electronic.com>
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Remove helper macro used to transition from MAC clocks defined
by the MAC node to definition in the controller (parent) node.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Prepare move of STM23 ethernet MAC clocks to the controller node (parent
node). For sake of simplicity, define a filed for all possible clocks in
struct eth_stm32_hal_dev_cfg, a later change will replace the whole
with a single STM32 clock instance (struct stm32_pclken) array pointer.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Update STM32 ethernet driver to use STM32_DT_INST_CLOCK_INFO_BY_NAME()
helper macro to always get all clock information, not only the bus ID
and bit position.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Remove the unused variable tid_int and lock. Also, match the other drivers
by dropping the back reference to the device structure and just pass
in the dev for the thread and dereference the context from there.
Signed-off-by: Charles Hardin <ckhardin@gmail.com>
Replace some manually-defined DT_COMPAT_<> Kconfig macro variables with
their automatically generated counterparts. In most cases, this is
straightforward as the manually defined macro is named identically to the
one generated by the build system.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
ETHERNET_CONFIG_TYPE_FILTER is not supported
in the set_config, therefore remove
ETHERNET_HW_FILTERING from the
ethernet_hw_caps of this driver.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
the enum ethernet_config_type for the
multicast filter is ETHERNET_CONFIG_TYPE_FILTER.
ETHERNET_HW_FILTERING is only the according
ethernet_hw_caps.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
DWMAC driver was no longer selectable for stm32h7
series because of CONFIG_ETH_DWMAC dependency on
DT_HAS_SNPS_DESIGNWARE_ETHERNET_MMU_ENABLED, which
is only used for MMU based platforms.
Restructure Kconfig to have user-selectable options
for the platform-specific DWMAC drivers and select
the common DWMAC driver accordingly. This way
platform-specific dependencies can be tracked on
these options, simplifying the logic.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Remove a NULL check on the device pointer that occurs after the
pointer has already been dereferenced.
This check can never be true and is therefore misleading.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
Implement read_c45 and write_c45 functions to support clause 45
register access. This enhancement allows to access C45 registers
even when the MDIO controller does not natively support clause 45.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Use clause 45 MDIO access by default and only fallback to the phy
internal clause 45 bridge if the MDIO controller does not support
clause 45 transactions.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Adds CONFIG_ETH_NET_IF_NO_AUTO_START to allow
pre-configuration of Ethernet interfaces (e.g., filters, mac)
before they become operational. When enabled, net_if_up() must be
explicitly called by the application.
Signed-off-by: Jeremy Truttmann <jetstreeam.code@outlook.com>
In e6daacf3c9 the mayority of the
ethernet drivers code was changed to use the Zephyr native net_
prefixed symbols, but some were forgotten.
Without this fix/change the code still builds as we are by now setting
CONFIG_NET_NAMESPACE_COMPAT_MODE. But when this is not set, things
fail to build.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Since the w5500 is used in arduino shields it should use the current
code patterns since it will be examined as a reference for other
drivers. So, this is just trying to catch up to the changes that have
been made in the microchip, litex, and virtio drivers.
Use the net_eth_mac_load code pattern from those other drivers and
update a few things to the code guidelines as well.
Signed-off-by: Charles Hardin <ckhardin@gmail.com>
From the prior change b38a46bade adding
in the mac configuration in the device tree it is appropriate to
remove the local mac address bindings. This is done in this commit.
There is no intended functional change
Signed-off-by: Charles Hardin <ckhardin@gmail.com>
Remove duplicated #include directives within the same
preprocessor scope across the Zephyr tree.
Duplicates inside different #ifdef branches are preserved
as they may be intentional.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
the phy is already configured by the phy driver in zephyr
and we don't want to overwrite it in the HAL_ETH_Init
function in the stm32 HAL.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
The reset pin, like most reset pins, is active low. Fix the driver to
treat it as active low and simplify the pin control logic while at it.
Fix all current boards using the wrong pin definition and add a note for
out of tree users.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
In e6daacf3c9 the mayority of the
Zephyr ethernet drivers were changed to use the Zephyr native
net_ prefixed types, but this one was forgotten.
Without this fix/change the code still builds as we are by now setting
CONFIG_NET_NAMESPACE_COMPAT_MODE. But when this is not set, things
fail to build.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
zephyr,random-mac-address defaults to 0 or 1, which is always
available in generated code. so we can use the value itself.
Signed-off-by: Sven Ginka <s.ginka@sensry.de>
remove `imply MDIO` from the
ethernet drivers, that don't directly use mdio
and only use the ethernet phy api, now that the
phys select MDIO.
in 648c8252b575879c2e926d0b051febf2cb1672d1 the
`select MDIO` ones were remove, unfortunatly I forgot
the implyed ones.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>