When setting the MAC address, the ethernet driver has to call
net_if_set_link_addr() with the updated address. This was missing and is
added now.
See e.g.
https://github.com/zephyrproject-rtos/zephyr/pull/28874
Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
Reworks the mcux ethernet driver to use DT_INST_FOREACH_STATUS_OKAY and
eliminate a lot of duplicate code between instance 0 and instance 1.
Renames the ERR_MISC interrupt to ERR due to an issue with the
underscore in the device tree preprocessor macros.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Add support for configuring Ethernet pins using DT pinctrl entries. Note
that F1 series pinctrl support is not handled as the driver does not
support F1.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
1. Merged the single/multiple ring(s) APIs, now these APIs
can handle both which requires passing a ring id.
2. Updated timestamp handling to match the new timestamp
implementation in the SDK driver.
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
With STM32Cube updates
https://github.com/zephyrproject-rtos/hal_stm32/pull/75
'..._hal_rcc.c' and '..._hal_rcc_ex.c' are now systematically
compiled, due to more and more dependencies from HAL IP on rcc.
So USE_STM32_HAL_RCC and USE_STM32_HAL_RCC_EX becomes useless.
Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
z_tick_get returns signed int. Adapt comparision
statement for remaining time computation.
Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
If neither a random address nor a specific local address is in the
device tree, then use the MAC address from the device information page.
Signed-off-by: Thorvald Natvig <thorvald@natvig.com>
Do not override OUI of the local MAC address in the devicetree.
Simplify the mac address assignment conditions. Each interface has
its own function. Code duplication will be eliminated with the
use of DT_INST_FOREACH_STATUS_OKAY in a later commit to completely
remove duplicated code.
The 3 possible MAC address assignment (local, random and unique)
are covered and have been tested.
Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
This fixes wrong value for i.MX RT.
This is one less hard-coded value in eth_N_context structures.
Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
This allows setting the MAC address at run time.
Signed-off-by: Antoine Zen-Ruffinen <antoine@riedonetworks.com>
Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
Replace all calls to the assert macro that comes from libc by calls to
__ASSERT_NO_MSG(). This is usefull as the former might be different
depending on the libc used and the later can be customized to reduce
flash footprint.
Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
Initialize device pointer in driver's context.
It was not done quite right in commit a1708cf2f2
("drivers: ethernet: Fix device instance const qualifier loss"),
and then completely removed in commit 113d9274ea
("drivers: ethernet: remove stray expression")'
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
The correct return value is -ENOBUFS if we run out of network
buffers when sending the packets.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
An unnecessary expression that doesn't compile was inadvertently
introduced in the device constification PR. Remove it.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Reduced the size of tx_buffer_def array to 1 to save
on function stack memory. Here only 1 buffer is
enough to call the transmit function.
Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
Modify the ethernet driver to use TX complete interrupts.
Adds HAL ethernet TX complete callback and locking semaphore.
Due to changing behavior/content of the TX DMA descriptors
on STM32H7 series, based on the state of the IP,
it is more reliable to wait for the TX complete interrupt to check
for DMA end of transmission event. This avoids polling the
DMA_DESC_OWN bit in the descriptors.
Improves reliability and performance of the ethernet peripheral.
Tested on CoapServer sample, Dumb HTTP server, telnet sample.
Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
These are all the case that coccinelle cannot find as they are inside
macro declarations.
Fixed via:
git grep -rlz -E "\(struct device \*" |
xargs -0 sed -i 's/(struct device/(const struct device/g'
Fixes#27399
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Passing driver's data to k_thread is sufficient for mcux.
On enc424j600, however, the device pointer is needed and thus is wrapped
into its data. But there seems to be a possible optimisation: all local
spi related function in fact only needs the device's data (context) and
so changing all spi related function to take the context would remove
the need to wrap the device pointer into its data.
Fixes#27399
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This is a working code, but it's harder to read. And for some reason
makes some semantic patches of coccinelle running forever.
So refactoring it.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.
A coccinelle rule is used for this:
@r_const_dev_1
disable optional_qualifier
@
@@
-struct device *
+const struct device *
@r_const_dev_2
disable optional_qualifier
@
@@
-struct device * const
+const struct device *
Fixes#27399
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Sleep minimum time in RX when gPTP is enabled. Typically we
receive constant stream of gPTP protocol data so no need to
wait very long in that case and cause timeouts.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Make sure that native_posix Ethernet driver is claiming to support
VLAN when the VLAN functionality is enabled.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Add gPTP multiport support to native_posix Ethernet driver.
This means that the driver is able to create more than one
network interface and enable gPTP to each of them. This requires
that net-tools is updated as it contains configuration file
for network interfaces in host side.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit adds support for setting fixed configuration, read
from device tree, for ENET ETH interface and PHY.
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Some ICs - like DSA switches (e.g. ksz8794) - do not use SMI to setup
and configure PHY.
This change introduces a new Kconfig define - CONFIG_ETH_MCUX_NO_PHY_SMI
- to allow replacing SMI communication with SPI or I2C.
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Update stm32 ethernet driver to get basic boot configuration from
device tree.
So far information are:
- Label
- Base address
- IRQ number and prio
- Clock settings
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
add DTCM caching management in KConfig for stm32h7
add NOCACHE_MEMORY support for stm32h7 M7 CPU series
add HAL_RCC_EX support for stm32h7 series
implemented stm32h7 support within stm32 eth driver
Signed-off-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>
added changes that apply to other than stm32h7 series
and prepares stm32h7 series integration:
eth_tx/eth_rx: changed type of total_len
added necessary defines for
tx_desc and own flag extractions
added read_eth_phy_register() function
and corresponding defines
added ETH_DMA_MEM and CACHE defines
following memory buffers declarations moved out of
its ifdef preprocessor macro:
dma_rx_desc_tab, dma_tx_desc_tab,
dma_rx_buffer, dma_tx_buffer
added hal_ret stm32 HAL status checks
Signed-off-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>
The ethernet driver no longer continues to try to initialize
itself if PCIe probing fails.
This device is always PCIe so we don't need to reserve ROM MMIO
storage.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Unit tests were failing to build because random header was included by
kernel_includes.h. The problem is that rand32.h includes a generated
file that is either not generated or not included when building unit
tests. Also, it is better to limit the scope of this file to where it is
used.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
The Atmel GMAC Ethernet driver may be used by both the SAM series
(e.g. SAM E70) and SAM0 series (e.g. SAM E54) SoCs.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Printing the file descriptor does not give any information when
the network interface creation fails, so print errno here instead.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Aligns MAC registers to the latest reference manual.
Replaces NULL buffers as some SPI drivers will fail.
Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
Enable VLAN support so that this driver can be used to test
the VLAN when using qemu_x86 board.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This option will configure MCUX block (by setting RMIISRC [19] bit to 1
in SIM_SOPT2 register) to use external clock source for RMII from
ENET_1588_CLKIN).
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Replace individual device instance definitions with the macro that
expands to the equivalent change.
F='struct device DEVICE_NAME_GET'
git grep -l "$F" \
| xargs sed -i -r \
-e "s@$F"'\(([^)]*)\);@DEVICE_DECLARE(\1);@'
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
User can now add extra Ethernet TAP parameters when starting QEMU.
This is useful if we want to set for example the MAC address
of the network interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The check for assertion on the "config_func" was added to
validate that the function pointer is valid. However, in
the code we are invoking the "config_func" and comparing
its output with NULL. This causes build failures with
CONFIG_ASSERT=1. Caused by PR-25393.
Tested on Nucleo F767Zi board.
Fixes#25427
Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
All initialization of the Ethernet interface is done in the
eth_initialize function which is invoked by the boot code.
This function sets up DMA, programs the Ethernet module and
enables IRQs. However, this function does not setup "netif"
interface info which is done when the ethernet device is
enumerated by the NET stack via the "iface_api.init" func.
However, after the eth_initialize func is called, it is
possible that the system receives RX interrupts, and the
"rx_thread" accesses the "netif" pointer to get iface info.
However, because the "netif" info is not necessarily
populated at this time, we get a crash (as OS does NULL
access).
Fixed by enabling Ethernet IRQ after the interface is
properly setup.
Tested on Nucleo F767Zi board.
Fixes#25408
Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
Several reviewers agreed that DT_HAS_NODE_STATUS_OKAY(...) was an
undesirable API for the following reasons:
- it's inconsistent with the rest of the DT_NODE_HAS_FOO names
- DT_NODE_HAS_FOO_BAR_BAZ(node) was agreed upon as a shorthand
for macros which are equivalent to
DT_NODE_HAS_FOO(node) && DT_NODE_HAS_BAR(node) &&
- DT_NODE_HAS_BAZ(node), and DT_HAS_NODE_STATUS_OKAY is an odd duck
- DT_NODE_HAS_STATUS(..., okay) was viewed as more readable anyway
- it is seen as a somewhat aesthetically challenged name
Replace all users with DT_NODE_HAS_STATUS(..., okay), which is
semantically equivalent.
This is mostly done with sed, but a few remaining cases were done by
hand, along with whitespace, docs, and comment changes. These special
cases include the Nordic SOC static assert files.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The driver-specific config_info structure referenced from the device
structure is marked const. Some drivers fail to preserve that
qualifier when casting the pointer to the driver-specific structure,
violating MISRA 11.8.
Changes produced by scripts/coccinelle/const_config_info.cocci.
Some changes proposed by the script are not included because they
reveal mutation of state through the const pointer, though the
code works as long as the driver-specific object is defined without
the const qualifier.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Instead of having a Kconfig property, if there is no local-mac-address
property in the devicetree than we'll generate a unique MAC address
based on unique ID registers on the SoC.
We remove the local-mac-address properties in the SoC dtsi files to
match the default behavior that existed before (ie, unique MAC address)
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Move from a Kconfig to select/initialize the MAC address to using the
"local-mac-address" property in devicetree. If the property is set the
drivers will initialize the mac-address from the devicetree (unless the
mac address is all 0's). The MAC address might get overwritten by
either a driver specific means or by the setting of
"zephyr,random-mac-address" in the devicetree.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Utilize the devicetree property "zephyr,random-mac-address" to determine
if a driver should use a random mac address and remove the associated
Kconfig options that enabled this feature.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Rather than having each driver have its own slightly different way of
generating a random mac address, add a helper function that they all can
call so we do it one way.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Use DT_INST_SPI_DEV_HAS_CS_GPIOS() in drivers to determine if we should
utilize CS_GPIO base SPI chipselect handling. This allows us to remove
Kconfig option for this feature.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Rename DT_HAS_NODE to DT_HAS_NODE_STATUS_OKAY so the semantics are
clear. As going forward DT_HAS_NODE will report if a NODE exists
regardless of its status.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Reworked sam_gmac driver to get pin ctrl/mux configuration information
from the device tree instead of via Kconfig and defines in soc_pinmap.h
We remove defines from soc_pinmap.h that are no longer needed due to
getting all that information from devicetree.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Use the new path access helpers to avoid hard-coding devicetree paths
in Kconfig, which is a bit messy.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Convert various DT_DTCM_* macros to use DT_CHOSEN(zephyr_dtcm) and
associated macros from devicetree.h.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Convert driver to use instance macro's instead of dts_fixup.h based
macros. This moves us closer to removing both dts_fixup.h and per
instance Kconfig symbols.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit adds a reference to the SAM E54 maximum queue count value
in the device tree for specifying the range of `ETH_SAM_GMAC_QUEUES`
configuration.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit adds the GMAC driver support for the Ethernet-capable SAM0
family devices (SAM E53 and E54 at this time).
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Fixed the ETH_SAM_GMAC_QUEUES config by adding if-statements per SoC
series.
Signed-off-by: Vincent van der Locht <vincent@vlotech.nl>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
This commit updates the Atmel SAM GMAC driver to select max frame size
value from the device tree. Now GMAC driver can operate with the three
different frame size options available.
The current supported values are: 1518, 1536 and 10240.
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
The current setup of physical layer forces RMII interface. The code was
refactored to have only one point to select proper phy interface. Now,
GMAC driver works with both RMII or MII interface. The phy connection
type is now selected by device tree. The default phy connection is RMII.
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
The NOCACHE_MEMORY can be enabled only for those MCU that support data
cache. The currently SoC that doesn't have data cache is SAM4E.
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Improve data cache conditional build. Now data cache code is build
only if device have support to it. This enables GMAC driver for use
with devices that don't have data cache instructions.
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
This cleans up DMA flags by separating the necessary flags for devices
with one or multiple RX/TX queues.
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Run the int_literal_to_timeout Coccinelle script to fix places where
it is clear that an integer duration is being passed where a timeout
value is required.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit updates the Atmel SAM GMAC driver to use the device tree
values for GMAC hardware configuration.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Replace all occurences of BUILD_ASSERT_MSG() with BUILD_ASSERT()
as a result of merging BUILD_ASSERT() and BUILD_ASSERT_MSG().
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
Convert older DT_INST_ macro use in litex drivers to the new
include/devicetree.h DT_INST macro APIs.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Just to get something to test for PM, via frdm_k64f board. So only this
board will get PM enabled.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
By changing the various *NET_DEVICE* macros. It is up to the device
drivers to either set a proper PM function or, if not supported or PM
disabled, to use device_pm_control_nop relevantly.
All existing macro calls are updated. Since no PM support was added so
far, device_pm_control_nop is used as the default everywhere.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
The Atmel DFP headers define two "component typedef styles": RFO and
NTO; where the latter makes use of bit field structs to access hardware
registers.
The default component typedef style assumed by the DFP headers (i.e.
when `COMPONENT_TYPEDEF_STYLE` is not explicitly defined) is "RFO" and
this is indeed the component typedef style used throughout the Zephyr
Atmel SAM drivers, except in the particular instance which this commit
addresses.
The use of `GMAC_TA_Type` bit field struct, which is an "NTO" style
construct, is no longer possible with the latest DFPs because
conditional compilation checks for the bit field struct definitions
were added to restrict the use of such constructs to only when the
global component typedef style is set to "NTO".
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Convert older DT_INST_ macro use in silab drivers to the new
include/devicetree.h DT_INST macro APIs.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Convert older DT_INST_ macro use in stellaris drivers to the new
include/devicetree.h DT_INST macro APIs.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>