summaryrefslogtreecommitdiff
path: root/drivers/net/airoha_eth.c
AgeCommit message (Collapse)Author
11 daysnet: airoha: probe airoha switch mdio on airoha_eth probingMikhail Kshevetskiy
Airoha switch mdio maybe used not only by GDM1, but also by other GDM ports (ex: as21xxx phy connected to GDM2 port). So it's better probe airoha switch mdio a bit early in the airoha_eth_probe() code. Also remove useless eth_phy_set_mdio_bus() call and related code. Signed-off-by: Mikhail Kshevetskiy <[email protected]>
2026-03-12net: airoha: use mt7531 mdio for GDM1Mikhail Kshevetskiy
Current code just bind mt7531 mdio with it's driver, so mdio device may not be probed and hense not usable. This patch: * Forces probing of mt7531 mdio for GDM1 port * Renames the mt7531 mdio bus interface to 'mt7531-mdio'. We may have multiple available MDIO, so the name 'mdio' isn't descriptive enough. * Sets mdio bus for the GDM port device Signed-off-by: Mikhail Kshevetskiy <[email protected]>
2026-03-12net: airoha: makes PCS support optionalMikhail Kshevetskiy
It's not possible to disable PCS support just now, an7581 u-boot will not compile. This patch fixes an issue. Signed-off-by: Mikhail Kshevetskiy <[email protected]>
2026-03-12net: airoha: fill in support for PCS/PHY in Airoha Ethernet driverChristian Marangi
Add required changes to call PCS function to configure the Serdes Port. The Ethernet driver is adapted following Upstream Kernel node structure. Function calling order is the same of Phylink upstream kernel. With the PCS support, also add support for attaching PHY. With "in-band-status" set in DT for the managed property, a rudimental support for SFP module is present. Signed-off-by: Christian Marangi <[email protected]>
2026-03-12net: airoha: init switch before GDM port initializationMikhail Kshevetskiy
Call airoha_switch_init() before creating GDM instances, so if allocation of GDM port fails, early created GDM instances will work normally. Signed-off-by: Mikhail Kshevetskiy <[email protected]>
2026-03-12net: airoha: do not call airoha_fe_init() from GDM port independent codeMikhail Kshevetskiy
We should not call airoha_fe_init() from GDM port independent code, because it do a GDM specific things. Makes airoha_fe_maccr_init() and airoha_fe_init() port dependent and call them from airoha_eth_port_probe() Signed-off-by: Mikhail Kshevetskiy <[email protected]>
2026-03-12net: airoha: declare airoha_eth_port as U_BOOT_DRIVER()Mikhail Kshevetskiy
Declare airoha_eth_port as U_BOOT_DRIVER(), fix airoha_alloc_gdm_port() to lookup a driver instead of direct airoha_eth_port usage. Signed-off-by: Mikhail Kshevetskiy <[email protected]>
2026-03-12net: airoha: avoid out of boundary writing/access to gdm_port_str[] arrayMikhail Kshevetskiy
In the case of an7581 possible GDM port id are: 1, 2 and 4. Initialization of port GDM4 will lead to out of boundary writing to gdm_port_str[] array. Let's increase the array size by 1 to avoid it. Signed-off-by: Mikhail Kshevetskiy <[email protected]>
2026-03-12net: airoha: add initial support for multiple GDM portChristian Marangi
Rework the driver to support multiple GDM port. The driver is split to main driver as a MISC driver with forced probe (by using the DM_FLAG_PROBE_AFTER_BIND) and each GDM port register a ETH driver. This permit a 1:1 implementation with the linux kernel driver and permit to use the same exact DT nodes. Signed-off-by: Christian Marangi <[email protected]>
2026-02-06net: airoha_eth: use proper switch node for en7523 caseMikhail Kshevetskiy
Commit d2145a89bcf6 ("net: airoha: bind MDIO controller on Ethernet load") uses "airoha,en7581-switch" dts node for finding MDIO childs. This is wrong for EN7523 SoC. The correct node name should be used instead. Fixes: d2145a89bcf6 ("net: airoha: bind MDIO controller on Ethernet load") Signed-off-by: Mikhail Kshevetskiy <[email protected]>
2026-02-06net: airoha_eth: fix mdio binding to switch deviceMikhail Kshevetskiy
Commit d2145a89bcf6 ("net: airoha: bind MDIO controller on Ethernet load") refers to non-present CONFIG_MDIO_MT7531 and non-present "mt7531-mdio" driver. It should use CONFIG_MDIO_MT7531_MMIO and "mt7531-mdio-mmio" instead. Fixes: d2145a89bcf6 ("net: airoha: bind MDIO controller on Ethernet load") Signed-off-by: Mikhail Kshevetskiy <[email protected]>
2025-12-01net: airoha: bind MDIO controller on Ethernet loadChristian Marangi
Bind MDIO controller on Ethernet Controller load. The Airoha AN7581 SoC have an integrated Switch based on MT7531 (or more saying MT7988). Attach it to the mdio node in the switch node to support scanning for MDIO devices on the BUS with DM API. Signed-off-by: Christian Marangi <[email protected]>
2025-11-07net: airoha: add support for airoha en7523 SoC familyMikhail Kshevetskiy
Add support for Ethernet controller present in Airoha en7523/en7529/en7562. Signed-off-by: Mikhail Kshevetskiy <[email protected]>
2025-11-07net: airoha: unify code using SCU regmap helperMikhail Kshevetskiy
This allow us remove some an7581/an7583 specific code and use a common code instead. Signed-off-by: Mikhail Kshevetskiy <[email protected]>
2025-10-22net: airoha: simplify rx/free packet logic a bitMikhail Kshevetskiy
The commit 997786bbf473 ("drivers/net/airoha_eth: fix stalling in package receiving") can be improved. Instead of returning previous descriptor it's possible: * do nothing in even descriptor case * return 2 descriptor to the queue (current and previous) in the odd descriptor case. This patch: * implements above approach * remove logic not required within new approach * adds note that PKTBUFSRX must be even and larger than 7 for reliable driver operations Signed-off-by: Mikhail Kshevetskiy <[email protected]>
2025-07-15drivers/net/airoha_eth: enable hw padding of short tx packetsMikhail Kshevetskiy
Transmission of short packets does not work good for XFI (GDM2) and HSGMII (GDM3) interfaces. The issue can be solved with: - padding of short packets to 60 bytes - setting of PAD_EN bit in the corresponding REG_GDM_FWD_CFG(n) register. The issue should present for the lan switch (GDM1) as well, but it does does not appear due to unknown reason. This patch set PAD_EN bit for the used GDM. Signed-off-by: Mikhail Kshevetskiy <[email protected]>
2025-07-15drivers/net/airoha_eth: fix stalling in package receivingMikhail Kshevetskiy
ARCH_DMA_MINALIGN is 64 for ARMv7a/ARMv8a architectures, but RX/TX descriptors are 32 bytes long. So they may not be aligned on an ARCH_DMA_MINALIGN boundary. In case of RX path, this may cause the following problem 1) Assume that a packet has arrived and the EVEN rx descriptor has been updated with the incoming data. The driver will invalidate and check the corresponding rx descriptor. 2) Now suppose the next descriptor (ODD) has not yet completed. Please note that all even descriptors starts on 64-byte boundary, and the odd ones are NOT aligned on 64-byte boundary. Inspecting even descriptor, we will read the entire CPU cache line (64 bytes). So we read and sore in CPU cache also the next (odd) descriptor. 3) Now suppose the next packet (for the odd rx descriptor) arrived while the first packet was being processed. So we have new data in memory but old data in cache. 4) After packet processing (in arht_eth_free_pkt() function) we will cleanup the descriptor and put it back to rx queue. This will call flush_dcache_range() function for the even descriptor, so the odd one will be flushed as well (it is in the same cache line). So the old data will be written to the next rx descriptor. 5) We get a freeze. The next descriptor is empty (so the driver is waiting for packets), but the hardware will continue to receive packets on other available descriptors. This will continue until the last available rx descriptor is full. Then the hardware will also freeze. The problem will be solved if the previous descriptor will be put back to the queue instead of the current one. If the current descriptor is even (starts on a 64-byte boundary), then putting the previous descriptor to the rx queue will affect the previous cache line. To be 100% ok, we must make sure that the previous and the one before the previous descriptor cannot be used for receiving at this moment. If the current descriptor is odd, then the previous descriptor is on the same cache line. Both (current and previous) descriptors are not currently in use, so issue will not arrise. WARNING: The following restrictions on PKTBUFSRX must be held: * PKTBUFSRX is even, * PKTBUFSRX >= 4. The bug appears on 32-bit airoha platform, but should be present on 64-bit as well. The code was tested both on 32-bit and 64-bit airoha boards. Signed-off-by: Mikhail Kshevetskiy <[email protected]>
2025-07-15drivers/net/airoha_eth: fix packet transmission errorsMikhail Kshevetskiy
The dma_map_single() function calls one of the functions * invalidate_dcache_range(), * flush_dcache_range(). Both of them expect that 'vaddr' is aligned to the ARCH_DMA_MINALIGN boundary. Unfortunately, RX/TX descriptors are 32-byte long. Thus they might not be aligned to the ARCH_DMA_MINALIGN boundary. Data flushing (or invalidating) might do nothing in this case. The same applies to dma_unmap_single() function. In the TX path case the issue might prevent package transmission (filled TX descriptor was not flushed). To fix an issue a special wrappers for * dma_map_single(), * dma_unmap_single() functions were created. The patch fix flushing/invalidatiog for the RX path as well. The bug appears on 32-bit airoha platform, but should be present on 64-bit as well. The code was tested both on 32-bit and 64-bit airoha boards. Signed-off-by: Mikhail Kshevetskiy <[email protected]>
2025-07-15drivers/net/airoha_eth: add missing terminator for compatible devices listMikhail Kshevetskiy
Compatible device list must have a terminator. If terminator is missed the u-boot driver subsystem will access random data placed after the list in the memory. The issue can be observed with the "dm compat" command. Signed-off-by: Mikhail Kshevetskiy <[email protected]>
2025-04-16net: airoha: Add Airoha Ethernet driverChristian Marangi
Add airoha Ethernet driver for Airoha AN7581 SoC. This is a majorly rewritten and simplified version of the Linux airoha_eth.c driver. It's has been modified to support a single RX/TX ring to reflect U-Boot implementation with recv and send API. The struct and the define are kept as similar as possible to upstream one to not diverge too much. The AN7581 SoC include an Ethernet Switch based on the Mediatek MT753x but doesn't require any modification aside from setting the CPU port and applying the Flood configuration hence it can be handled entirely in the Ethernet driver. Signed-off-by: Christian Marangi <[email protected]>