Commit graph

1211 commits

Author SHA1 Message Date
Jiafei Pan
f498644106 drivers: eth: phy: add AR8031 PHY driver
Add PHY driver support for Qualcomm AR8031, it can use fixed link
or use auto negotiation.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2024-08-12 12:43:54 +02:00
Fin Maaß
e6235f49a7 drivers: ethernet: eth_xmc4xxx: fix get_phy
This fixes the eth_xmc4xxx_get_phy function.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-08-12 12:43:24 +02:00
Lukasz Majewski
b0e0bbfe5d drivers: ethernet: tc6: Combine read chunks into continuous net buffer
Up till now the size of net buffer chunk was set to only 64B. This
approach was acceptable for IPv4 support as all headers would fit into
64B of allocated continuous memory.

With enabled support for IPv6 one would observe following errors when
Neighbor Discovery [ND] is performed:

net_pkt: Uncontiguous data cannot be linearized
net_ipv6_nd: DROP: NULL NA header
net_icmpv6: ICMPv6 handling failure (-5)

As some IPv6 headers span on multiple 64B net_pkt buffer instances.

To fix this error - the received chunks are stored to large enough single
net_pkt buffer fragment.

Signed-off-by: Stefan Bigler <linux@bigler.io>
Signed-off-by: Lukasz Majewski <lukma@denx.de>
2024-08-08 20:21:58 -04:00
Stefan Bigler
52a35edb49 drivers: ethernet: Continue transmission when setting mac or promisc mode
To change mac or enable/disable promiscous mode transmit/receive does not
need to be disabled.
Disabling and enabling again leads to not transmitting anything afterwards.

Signed-off-by: Stefan Bigler <linux@bigler.io>
Signed-off-by: Lukasz Majewski <lukma@denx.de>
2024-08-08 20:21:58 -04:00
Stefan Bigler
fef277af42 drivers: ethernet: lan865x: Enable all multicast MAC addr for IPv6
Up till now the configuration of LAN865x was NOT allowing any
multicast frames to be received.

However, those are required for correct handling of IPv6's Neighbor
Discovery [ND] protocol.

This patch - by setting all bits in hash enable register - allows
all muticast MAC addresses to be recived.

Of course - more granular approach to specify set of addresses to
be allowed would be better and will be added in the future.

Signed-off-by: Stefan Bigler <linux@bigler.io>
[Cleanup + modified comment]
Signed-off-by: Lukasz Majewski <lukma@denx.de>
2024-08-08 20:21:58 -04:00
Lukasz Majewski
155fa2e9c9 drivers: ethernet: tc6: Add comment regarding RFA bit set in OA_CONFIG0
Add extra information regarding the case when ZAREFE (0b01) combination
is set for RFA in OA_CONFIG0 register.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2024-08-08 20:21:58 -04:00
Lukasz Majewski
209093d28e drivers: ethernet: lan865x: Update SPEC_ADD1_BOTTOM register comment
The current commit required some clarification.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2024-08-08 20:21:58 -04:00
Fin Maaß
c0396a9c5c drivers: ethernet: litex: add phy
add phy for litex liteeth ethernet.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-08-05 16:29:06 +02:00
Matthias Alleman
931628a78a drivers: ethernet: nxp_enet: Fused MAC address fixes
Add required initialisation of OCOTP. The IMXRT10XX
variants don't support fuseWords to be greater than 1.
MAC0 fuse map address is 0x22 instead of 0x620.
Fill in mac_addr buffer correctly.

Signed-off-by: Matthias Alleman <matthias.alleman@basalte.be>
2024-08-02 18:47:10 -05:00
Maksim Salau
eeb24400e1 drivers: eth: nxp,enet-qos: Fix MAC address check
Switch from `DT_INST_NODE_HAS_PROP(n, zephyr_random_mac_address)`
to `DT_INST_PROP(n, zephyr_random_mac_address)` since the property
is always present and we are interested in its value.

Signed-off-by: Maksim Salau <maksim.salau@gmail.com>
2024-08-02 18:36:11 -05:00
Fin Maaß
aeea701b2b dts: bindings: litex: rename eth comatible
Rename it from litex,eth to litex,liteeth
to reflect the new name of the driver.

Zero got removed from the litex
ethernet compatible, as it now supports
multiple instances.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-08-01 08:59:37 +01:00
Fin Maaß
239df9ce69 drivers: ethernet: litex: more instances
be able to use multiple instances of the
litex ethernet (liteeth) driver.

add support for vlan.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-08-01 08:59:37 +01:00
Fin Maaß
6ba5f6db60 drivers: ethernet: litex: rename driver
For more consistency, rename the liteeth driver to litex.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-08-01 08:59:37 +01:00
Rahul Arasikere
6c4136812c drivers: ethernet: Update STM32 Ethernet driver to support MDIO if enabled.
Moved the definition of the phy device from depending on stm32hx
series SOC to its own #if...#else...#endif. This way mdio support
can be enabled on any stm32 soc that supports it by defining the
mdio node in the devicetree.

I have tested this in a custom board.

Signed-off-by: Rahul Arasikere <arasikere.rahul@gmail.com>
2024-07-30 18:31:02 +01:00
Dean Sellers
dfe7cb58cb drivers: ethernet: enc28j60: Add DT property to set random mac
Use the DT property zephyr,random-mac-address to set a boot time
random mac address.

Signed-off-by: Dean Sellers <dsellers@evos.com.au>
2024-07-28 07:30:39 +03:00
Kacper Dalach
52197b515a drivers: eth: native_posix: if_name from cmd line
Iface name which is used by native posix ethernet driver can only be
specified at compile-time. I wanted to run two instances of the same
program on native posix but did not want to make two separate builds only
to change the iface name. I have implemented getting the iface name from
command line.

Signed-off-by: Kacper Dalach <dalachowsky@gmail.com>
2024-07-28 07:30:02 +03:00
Pieter De Gendt
ad63ca284e kconfig: replace known integer constants with variables
Make the intent of the value clear and avoid invalid ranges with typos.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-07-27 20:49:15 +03:00
Fin Maaß
da090f1cb9 drivers: ethernet: phy: phy_mii: use no-reset option
the dts binding of the ethernet-phy has the option
"no-reset" and the according driver already has the
right logic to make use of it, but unfortunately
the connection between them was missing.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-07-27 15:12:49 +03:00
Fin Maaß
27aa4bc988 drivers: ethernet: add get_phy function
add get_phy function to the ethernet drivers.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-07-27 15:07:26 +03:00
Declan Snyder
6ac0d8bf84 drivers: mdio_nxp_enet: Fix busy wait
Fix the busy wait in the MDIO driver that was causing timing
problems in systems with real time requirements performing tasks
more frequently than about a millisecond.

Restructure the code to be less redundant and change the busy wait
kconfig to microseconds instead of millliseconds. Also actually signal
to the mdio driver that it can use the interrupt instead of busy
waiting, this seems to have been forgotten.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-07-10 19:13:27 -04:00
Sylvio Alves
5196bdf964 drivers: eth: esp32: fix build to enable statistics
When CONFIG_NET_STATISTICS=y is enabled, build fails
due to wrong interface pointer.

Fixes #75515

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-07-08 14:55:47 -04:00
Benjamin Bigler
81556d6150 drivers: ethernet: phy_mii: check if there is a mdio config
In fixed-link mode, mdio remains unconfigured. This results in a null
pointer dereference, triggering a bus fault

Signed-off-by: Benjamin Bigler <benjamin.bigler@securiton.ch>
2024-07-02 14:18:46 +02:00
Benjamin Cabé
f19446f35d drivers: ethernet: stm32: fix PTP on STM32F7
As of recent update of stm32f7 HAL to cube version V1.17.2
the workaround for misspelled HAL_ETH_PTP_CONFIGURATED macro
is not needed anymore, and causes PTP support to fail to compile.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-07-01 09:04:43 -04:00
Jukka Rissanen
3b72fe557e drivers: eth: e1000: Use double with PTP clock
Instead of mixing floats and doubles, convert the code to
use double so that we avoid float->double conversion warning
from compiler.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-06-29 05:50:04 -04:00
Declan Snyder
3f59cf9439 drivers: nxp_enet: Fix CID 363724
This addresses the coverity issue ID 363724.
This issue seems to have been a false positive, but the root complaint
from coverity was that within the callstack of ENET_Up, some functions
use the buffer config pointer as an array, whereas in the zephyr driver
it is declared as a singleton. Address it by redeclaring this as an
array of size 1 instead of a singleton.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-06-26 13:06:14 -04:00
Declan Snyder
b05d719107 drivers: nxp_enet: Fix CID 392512
This commit fixes coverity issue 392512.
The issue was that the return value of clock_control_on was not being
checked. Fix by checking the return value.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-06-26 13:06:14 -04:00
Lingao Meng
302422ad9d everywhere: replace double words
import os
import re

common_words = set([
    'about', 'after', 'all', 'also', 'an', 'and',
     'any', 'are', 'as', 'at',
    'be', 'because', 'but', 'by', 'can', 'come',
    'could', 'day', 'do', 'even',
    'first', 'for', 'get', 'give', 'go', 'has',
    'have', 'he', 'her',
    'him', 'his', 'how', 'I', 'in', 'into', 'it',
    'its', 'just',
    'know', 'like', 'look', 'make', 'man', 'many',
    'me', 'more', 'my', 'new',
    'no', 'not', 'now', 'of', 'one', 'only', 'or',
    'other', 'our', 'out',
    'over', 'people', 'say', 'see', 'she', 'so',
    'some', 'take', 'tell', 'than',
    'their', 'them', 'then', 'there', 'these',
    'they', 'think',
    'this', 'time', 'two', 'up', 'use', 'very',
    'want', 'was', 'way',
    'we', 'well', 'what', 'when', 'which', 'who',
    'will', 'with', 'would',
    'year', 'you', 'your'
])

valid_extensions = set([
    'c', 'h', 'yaml', 'cmake', 'conf', 'txt', 'overlay',
    'rst', 'dtsi',
    'Kconfig', 'dts', 'defconfig', 'yml', 'ld', 'sh', 'py',
    'soc', 'cfg'
])

def filter_repeated_words(text):
    # Split the text into lines
    lines = text.split('\n')

    # Combine lines into a single string with unique separator
    combined_text = '/*sep*/'.join(lines)

    # Replace repeated words within a line
    def replace_within_line(match):
        return match.group(1)

    # Regex for matching repeated words within a line
    within_line_pattern =
	re.compile(r'\b(' +
		'|'.join(map(re.escape, common_words)) +
		r')\b\s+\b\1\b')
    combined_text = within_line_pattern.
		sub(replace_within_line, combined_text)

    # Replace repeated words across line boundaries
    def replace_across_lines(match):
        return match.group(1) + match.group(2)

    # Regex for matching repeated words across line boundaries
    across_lines_pattern = re.
		compile(r'\b(' + '|'.join(
			map(re.escape, common_words)) +
			r')\b(\s*[*\/\n\s]*)\b\1\b')
    combined_text = across_lines_pattern.
		sub(replace_across_lines, combined_text)

    # Split the text back into lines
    filtered_text = combined_text.split('/*sep*/')

    return '\n'.join(filtered_text)

def process_file(file_path):
    with open(file_path, 'r', encoding='utf-8') as file:
        text = file.read()

    new_text = filter_repeated_words(text)

    with open(file_path, 'w', encoding='utf-8') as file:
        file.write(new_text)

def process_directory(directory_path):
    for root, dirs, files in os.walk(directory_path):
        dirs[:] = [d for d in dirs if not d.startswith('.')]
        for file in files:
            # Filter out hidden files
            if file.startswith('.'):
                continue
            file_extension = file.split('.')[-1]
            if
	file_extension in valid_extensions:  # 只处理指定后缀的文件
                file_path = os.path.join(root, file)
                print(f"Processed file: {file_path}")
                process_file(file_path)

directory_to_process = "/home/mi/works/github/zephyrproject/zephyr"
process_directory(directory_to_process)

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2024-06-25 06:05:35 -04:00
Sylvio Alves
6b4beb9494 drivers: eth_esp32: fix function call as from hal
When external PHY has crystal, ESP32 can be configured
to use custom GPIO as clock source for it. However, due to
latest clock subsystem and hal updates, current driver
fails to build and blocks its usage.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-06-24 14:49:16 -04:00
Sylvio Alves
cc29fc1182 driver: eth_esp32: fix shared clock check
Both MDIO and Ethernet drivers share the same clock subsystem.
After clock control update in #73807, clock_control_on()
now returns -EALREADY for already initialized clock subsystem.
As a result, ethernet driver won't initialize as needed.

Fixes #74440

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-06-24 14:49:16 -04:00
Georgij Cernysiov
bb3737bde6 drivers: ethernet: adin2111: minor code style correction
Use tabs instead of spaces.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2024-06-24 12:44:04 -04:00
Georgij Cernysiov
104a019913 drivers: ethernet: adin2111: move OA buffers out from device data
Move OA-related TX and RX buffers out from the device data.
Don't define the buffers without the `spi-oa` property. That
saves ~32KB when using generic spi protocol.

Rearrange device data fields to reduce byte holes found with
Pahole.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2024-06-24 12:44:04 -04:00
Yong Cong Sin
3e4a9b9ec7 drivers: ethernet: stm32: remove deprecated MAC address Kconfigs
The following Kconfigs:

- `CONFIG_ETH_STM32_HAL_RANDOM_MAC`
- `CONFIG_ETH_STM32_HAL_USER_STATIC_MAC`
- `CONFIG_ETH_STM32_HAL_MAC3`
- `CONFIG_ETH_STM32_HAL_MAC4`
- `CONFIG_ETH_STM32_HAL_MAC5`

have been deprecated for more than 2 releases, user should
have switched to the devicetree method now, remove them.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:33:58 -04:00
Jiafei Pan
f985e75ba1 drivers: eth_nxp_enet: fix MMIO mapping issue
Fixed #74370, the issue is caused by the update to introduce MMIO
mapping, after MMIO mapping, should use data->base for device
base memory address.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2024-06-18 15:52:21 +02:00
Pisit Sawangvonganan
ebb75b38dd drivers: ethernet: stm32: replace reverse with intrinsic __RBIT
Replaced the software `reverse` function, used for bit reversal, with
the intrinsic `__RBIT` function.

This utilizes the hardware bit-reversal instruction for improved
efficiency.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-06-17 17:46:29 -04:00
Jiafei Pan
cca390d243 drivers: ethernet: eth_enet: add MMIO mapping
Adding MMIO mapping support in ENET module driver before MDIO, MAC
and PTP drivers initialization, so that they can reuse this mapping.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2024-06-14 19:21:18 +02:00
Jiafei Pan
0c958ae212 drivers: ethernet: eth_enet: remove building error
Don't block building in case of there is no unique ID provided.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2024-06-14 19:21:18 +02:00
Jiafei Pan
f1aa5d9391 drivers: eth_nxp_enet: fix cache maintain
Need to disable cache maintain by driver in case of
using noncache DMA buffer.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2024-06-14 19:21:18 +02:00
Yangbo Lu
b77dab6199 drivers: ethernet: phy_realtek_rtl8211f: enable RGMII TX/RX delay
The RGMII specifies output TXC/RXC and TXD/RXD without any clock skew.
Need to add skew on clock line to make sure the other side sample
right data. This can also be done in PCB traces.
This patch is to enable RGMII TX/RX delay to ensure timing.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2024-06-14 15:36:39 +02:00
Yangbo Lu
e5f6cee9fb drivers: ethernet: phy_realtek_rtl8211f: fix monitor work schedule
Monitor work should be scheduled for non-interrupt mode.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2024-06-14 15:36:39 +02:00
Adam Wojasinski
34c1fcc939 drivers: eth: native: Align to support ptp_clock driver for PTP subsys
Add conditions to enable ptp_clock driver implementation
for native_posix when PTP subsystem is enabled.

Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2024-06-13 05:40:41 -04:00
Adam Wojasinski
50cfe12f90 drivers: eth: eth_stm32_hal: Add support for rx/tx timestamping
Add handling of net_pkt flags that can be used to indicate that the
network packet should be timestamped.

Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2024-06-13 05:40:41 -04:00
Daniel Leung
db9d3134c5 kernel: mm: rename Z_MEM_PHYS/VIRT_ADDR to K_MEM_*
This is part of a series to move memory management functions
away from the z_ namespace and into its own namespace. Also
make documentation available via doxygen.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-06-12 21:13:26 -04:00
Daniel Leung
552e29790d kernel: mm: rename z_phys_un/map to k_mem_*_phys_bare
This renames z_phys_map() and z_phys_unmap() to
k_mem_map_phys_bare() and k_mem_unmap_phys_bare()
respectively. This is part of the series to move memory
management functions away from the z_ namespace.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-06-12 21:13:26 -04:00
Declan Snyder
a5a2dbacbd drivers: nxp_enet: Support RW6XX series
Support RW6xx series in NXP ENET driver.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-06-12 18:24:48 -04:00
Declan Snyder
572433538d drivers: nxp_enet: Fix Kconfig dependency DCACHE
The NOCACHE symbol should be dependent on CPU_HAS_DCACHE here.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-06-12 18:24:48 -04:00
Declan Snyder
45d3eb27b8 drivers: nxp_enet: Add fuse map address
Add functionality to use fused mac address

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-06-11 20:05:50 +03:00
Declan Snyder
f203a8b193 drivers: nxp_enet: Fix nxp,unique-mac
nxp,unique-mac actually is not meant to be universally
unique, the LAA bit should therefore be set, and fix the
description of the property in the binding to clarify
the intended usage of this property.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-06-11 20:05:50 +03:00
Declan Snyder
2e4e9a9494 dts: bindings: Fix KSZ8081 property names
Fix KSZ8081 binding properties:
- reset-gpios and interrupt-gpios are generally standard
  properties and therefore should not be using a special name
- mc, is not the correct vendor prefix for microchip

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-06-10 21:03:35 -04:00
Francois Ramu
f55391745b drivers: ethernet: stm32 eth hal driver align PTP Config Status
Align the name of the ETH PTP Config Status values
depending on the stm32HAL serie
to be the HAL_ETH_PTP_NOT_CONFIGURATED/HAL_ETH_PTP_CONFIGURATED
or HAL_ETH_PTP_NOT_CONFIGURED/HAL_ETH_PTP_CONFIGURED

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-06-07 13:00:44 +02:00
Stanislav Poboril
d124eec3c9 drivers: ethernet: phy: Add Realtek RTL8211F PHY driver
Add driver for Realtek RTL8211F 10/100/1000M ethernet PHY.
This driver implements vendor specific behaviour like
detecting link state change by GPIO interrupt, which is not
present in the generic MII driver.

Fixes: #66348

Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
2024-06-06 20:08:27 -04:00