* Rename w5500_hw_reset to w5500_soft_reset.
This function performs a software reset, the GPIO reset is
hardware reset.
* Set thread name "eth_w5500".
* Simplify random MAC address code.
Remove unnecessary function pointer and wrapper function.
* Remove SPI read variable length array.
The VLA causes unnecessary stack usage and its max size changes
depending on CONFIG_NET_BUF_DATA_SIZE.
Split the SPI read into two transactions, a skip of the first 3
dummy bytes, then a read of the data directly into to given buffer.
* Remove unused variables config_func and full_duplex.
Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
The commit "drivers: ethernet: dsa_ksz8xxx: use
NET_DEVICE_DT_DEFINE_INSTANCE"
(SHA1: f78a081066) replaced
NET_DEVICE_INIT_INSTANCE() with NET_DEVICE_DT_DEFINE_INSTANCE() to
facilitate the removal of deprecated (from Zephyr's 3.2 release)
DT_LABEL() macro.
Unfortunately, the per LAN port initialization is necessary for correct
operation of the DSA driver - otherwise following errors were visible
when LLDP DSA sample (samples/net/dsa/src) was run on ip_k66f board:
<wrn> net_if: iface 0x20001440 is down
<inf> net_dsa_lldp_sample: LLDP pkt recv -> lan1
<inf> net_dsa_lldp_sample: CHASSIS ID: 38:05:43:69:XX:ZZ
<inf> net_dsa_lldp_sample: PORT ID: 38:05:43:69:XX:ZZ
<inf> net_dsa_lldp_sample: TTL: 120s
<inf> net_dsa_lldp_sample: SYSTEM NAME: mtt
<err> net_dsa_lldp_sample: Failed to send, errno 115
The fix is to use again NET_DEVICE_INIT_INSTANCE() with "lan"X name
assigned (to avoid too long names when recommended DT_PROP() is
used instead of DT_LABEL()).
Fixes: f78a081066
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Make DSA dependent on ETH_DSA_SUPPORT which is selected by driver
kconfigs, rather than having a list of dependencies.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Deprecate ETH_MCUX, by:
- Marking it as DEPRECATED in Kconfig, obviously.
- Unmarking the new driver as experimental.
- Putting the new and old drivers in the same folder.
- Reworking the menu appearance of the driver selection.
Note that technically now it is possible to choose the wrong
driver than what is enabled in DT, this is intentional, but
the correct one will obviously be enabled by default.
- Convert all sample overlays to the new Kconfigs. This was
part of the motivation for the shared overlays, as it was
causing twister/CI logs to look ugly and misleading due
to Kconfig warnings.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
I have tested the DSA support with ETH_NXP_ENET driver and it
works, so marking it as supported by adding it to the dependency
list for the DSA feature.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
The MAC address macros are ridiculous in this driver.
Rewrite to be simpler and use eth.h common function.
Also, clarify the mac address generation on the DT overlays.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Convert from multiple threads for each instance to use
one workqueue for all instances. The benefit is to save
memory and use a kernel function that already exists
for a use case like this.
Also introduce the ETH_NXP_ENET_RX_THREAD_PRIORITY kconfig,
which makes the thread priority of the workqueue configurable.
Finally, remove the code enabling the RxBufferInterrupt, since
the meaning of it isn't used currently in this driver.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add functionality for when NET_POWER_MANAGEMENT (ie PM_DEVICE)
is enabled. This function code originally comes from the
old eth_mcux driver which was only tested on kinetis family SOCs,
so that family kconfig is a dependency for this feature for now.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Some comments in this driver are just redundant - the code
spells out exactly what the comment says. And some comment
blocks are just unnecessary to have. Finally, remove the TODO
comment because this is flagged by static analysis and there
are already tracking issues for the zero copy enhancement.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Added changes required for nxp_enet ethernet driver to work
with multiple PHYs and fixed few problems:
- The cfg_link API resets PHY before configuring link. It was moved
here so the ethernet driver does not have to reset it - not all
PHYs need reset before configuring link and moving the reset code
here makes possible to have the reset done in a PHY specific way
(for example to reset by toggling GPIO pin). It also avoids ethernet
driver touching PHY registers without locking.
- When reset GPIO is not defined, reset is performed by setting reset
bit in control register.
- The cfg_link API does not return error when autonegotiation fails.
This fixes situation when the link is down at system start - ethernet
driver then skipped setting link-change callback and link was never
to be detected again.
- Added reset of excessive bits 16-31 when reading register values.
As only 16 bits are read from PHY, but the API is supposed to read
into uint32_t, the remaining bits contained previous data after
a successful read.
- Fixed missing mutex unlock when querying link state and link was down.
- Added missing initializer to link state variables. This could result
in link state change detection while link was still down, because
the speed/duplex settings could be random and old and new state
could be wrongly detected as different.
- Not logging link speed/duplex status when link is not up.
Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
Apparently there was a typo in the last commit.
Looks like it was refactored without trying to build.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The VLAN packets are prepared in Ethernet L2 so no need to have
special handling in the driver.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Virtual LAN logic is now done in Ethernet L2 so no need to manipulate
VLAN packets in the driver.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Remove ethernet-fixed-link binding as it is redundant with the
phy bindings. Clearly, ethernet does not work without the L1
layer, which is a phy device, or an integrated mac/phy device,
and all of these things should be described properly in DT.
The schema did not even come with a compatible, meaning nodelabels
were hardcoded into the drivers, which is unacceptable.
- Remove the binding file for ethernet-fixed-link.yaml.
- Remove fixed link functionality from the nxp s32 gmac driver.
Since this functionality is already covered by the phy support,
it is redundant.
- Remove fixed link include from the s32 gmac binding.
- Remove fixed link include from the nuvoton numaker binding.
As far as I can tell the corresonding driver does not even
use it anyways, and I did not find any board with this device
that describes a "fixed link".
- Move the definition into the nxp,kinetis-ethernet binding
as the eth_mcux driver, which is already being deprecated,
does use this, contain the debt to the legacy driver.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Multicast rule as 01:00:00:00:00:00 is actually shadowing
broadcast rule, enabling broadcast packets to be received/forwarded
even if broadcast rule/filter is not set.
Set the multicast filter with an appropriate mask.
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Byte value written to the device's
ERXFCON: ETHERNET RECEIVE FILTER CONTROL REGISTER
Sets the devices receive packet filter, optional. If not set
in device tree previous hard coded value`0xA3` is used.
Uni, multi and broadcast packets with valid CRC are accepted.
Signed-off-by: Dean Sellers <dsellers@evos.com.au>
The number of interrupts received by the driver maybe less than
the number of data packets received by Ethernet,
so the driver should read the packets number
from the register REG_MACNP value.
Signed-off-by: Wafer Xie <wafer@jaguarmicro.com>
Rework the driver to use HW MAC address filtering as an ethernet
capability.
Use a counter table for CRC indexes added/removed.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Fix issue related to "generic SPI" mode only, when a packet of
1512 bytes is received, net_pkt_write() fails and thrwos the error:
"Still some length to go 2".
This is due to net_pkt_rx_alloc_with_buffer() allocating a maximum
mtu/size of 1514, and driver is not removing 4 bytes of crc32 from
rx buffer, that comes to be 1516 (2 bytes over buffer limit).
Fix generic SPI rx frame size removing crc32 bytes.
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Add Open Alliance spi protocol support.
Open Alliance is a chunk-based SPI protocol, based on sending
over SPI an ethernet frame divided in smaller chunks, using a
specific 32-bit header for each chunk transferred. All chunks
can be sent or received by a single dma transfer.
Default mode is set to Open Alliance SPI without protection,
since the adin2111 dev. board comes shipped this way.
Tested:
- Open Alliance SPI, no protection (default board shipped)
- Open Alliance SPI, protection
- Generic SPI, no crc
- Generic SPI, with crc8
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
After some debugging related to non-working "Generic SPI without CRC"
mode in eval_adin2111_ebz (CONFIG_ETH_ADIN2111_SPI_CFG0=n), noticed
that even after proper STATUS0 RESETC bit detection, registers,
for a certain period (some msecs) still reads as zero.
This patch fixes adin2111_await_device and with it the
"Generic SPI without CRC" mode.
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Enable appending of a crc32 at the end of the frame by the MAC,
always. This is always needed since the driver is not adding it.
This field has nothing to do with Generic SPI protocol-related
8-bit CRC, so this patch removes the CONFIG_ETH_ADIN2111_SPI_CFG0
choice related to this setting.
Testing without this flag set, packets are not forwareded in the
network, since the driver is not appending any crc32 header
to the frame.
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>