summaryrefslogtreecommitdiff
path: root/drivers/net/dwc_eth_qos.c
AgeCommit message (Collapse)Author
2025-05-05net: dwc_eth_qos: add support of stm32mp2 platformChristophe Roullier
Add compatible "st,stm32mp25-dwmac" to manage STM32MP2 boards Signed-off-by: Christophe Roullier <christophe.roullier@foss.st.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2025-04-24net: dwc_eth_qos: Fix hang when freeing packet after stopSamuel Holland
If eqos_free_pkt() is called after eqos_stop(), eqos_stop_resets() will have been called already. This may prevent accessing the MMIO space to update the RX descriptor tail pointer, so we must skip the descriptor maintenance logic. This is okay because the descriptors and tail pointer will all be rewritten anyway during the next call to eqos_start(). This hang was observed after a failed TFTP transaction: eqos_recv(dev=000000047fb57330, flags=1): eqos_recv: *packetp=000000c3ffb5c080, length=151 TFTP error: 'file <FILE> not found for <IP>' (1) Not retrying... eqos_stop(dev=000000047fb57330): eqos_stop: OK eqos_free_pkt(packet=000000c3ffb5c080, length=151) <HANG> Fixes: ba4dfef1469f ("net: add driver for Synopsys Ethernet QoS device") Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
2025-04-23net: dwc_eth_qos_rockchip: Add support for RK3576Heiko Stuebner
Add rk_gmac_ops and other special handling that is needed for GMAC to work on RK3576. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2025-04-23net: dwc_eth_qos_rockchip: Add support for RK3528Jonas Karlman
Rockchip RK3528 has two Ethernet controllers based on Synopsys DWC Ethernet QoS IP. Add initial support for the RK3528 GMAC variant. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2025-03-12net: Add support for ADI SC5xx SoCs with DWC QoS ethernetGreg Malysa
The ADI SC598 includes a Designware QoS 5.20a IP block. This commit adds support for using the existing ethernet QoS driver with the SC598 SoC. Co-developed-by: Ian Roberts <ian.roberts@timesys.com> Signed-off-by: Ian Roberts <ian.roberts@timesys.com> Co-developed-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com> Signed-off-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com> Signed-off-by: Vasileios Bimpikas <vasileios.bimpikas@analog.com> Signed-off-by: Utsav Agarwal <utsav.agarwal@analog.com> Signed-off-by: Arturs Artamonovs <arturs.artamonovs@analog.com> Signed-off-by: Oliver Gaskell <Oliver.Gaskell@analog.com> Signed-off-by: Greg Malysa <malysagreg@gmail.com>
2024-10-29net: dwc_eth_qos: Remove obsolete imx8 includesErik Schumacher
They were added with commit 0e9d23945ce0 ("net: eqos: implement callbaks to get interface and set txclk rate") but were not removed with commit 5fc783b5d9c9 ("net: dwc_eth_qos: move i.MX code out") when i.MX specific code was moved to a separate file. Signed-off-by: Erik Schumacher <erik.schumacher@iris-sensing.com>
2024-10-29net: dwc_eth_qos: Add support for platform specific resetErik Schumacher
This patch adds support for optional platform specific reset logic in the dwc_eth_qos driver. This new function 'eqos_fix_soc_reset' is called after the EQOS_DMA_MODE_SWR is set and before the driver waits for this bit to clear. Signed-off-by: Erik Schumacher <erik.schumacher@iris-sensing.com>
2024-09-03net: dwc_eth_qos: Add glue driver for Intel MACPhilip Oberfichtner
Add dwc_eth_qos glue driver for the Intel Elkhart-Lake SOC. Signed-off-by: Philip Oberfichtner <pro@denx.de>
2024-09-03net: dwc_eth_qos: Implement bind() for PCI devicesPhilip Oberfichtner
PCI devices do not necessarily use a device tree. Implement a bind() function to assign unique device names in that case. Signed-off-by: Philip Oberfichtner <pro@denx.de>
2024-09-03net: dwc_eth_qos: Adapt probe() for PCI devicesPhilip Oberfichtner
PCI devices do not necessarily use a device tree. In that case, the driver currently fails to find eqos->config and eqos->regs. This commit factors out the respective functionality. Device tree usage remains default, but board specific implementations will be possible as well. Signed-off-by: Philip Oberfichtner <pro@denx.de>
2024-08-01net: dwc_eth_qos: mdio: Implement clause 45Philip Oberfichtner
Bevor this commit, only clause 22 access was possible. After this commit, clause 45 direct access will available as well. Note that there is a slight change of behavior: Before this commit, the C45E bit was set to whatever value was left in the register from the previous access. After this commit, we adopt the common practice of discerning C45 from C22 using the devad argument. Signed-off-by: Philip Oberfichtner <pro@denx.de> Reviewed-by: Marek Vasut <marex@denx.de>
2024-05-20Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"Tom Rini
As part of bringing the master branch back in to next, we need to allow for all of these changes to exist here. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-07net: Remove <common.h> and add needed includesTom Rini
Remove <common.h> from this driver directory and when needed add missing include files directly. Signed-off-by: Tom Rini <trini@konsulko.com>
2024-04-19net: dwc_eth_qos: Add support of STM32MP13xx platformChristophe Roullier
Add compatible "st,stm32mp13-dwmac" to manage STM32MP13 boards. Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Signed-off-by: Christophe Roullier <christophe.roullier@st.com> Signed-off-by: Marek Vasut <marex@denx.de> # Rebase, reshuffle, squash code Reviewed-by: Christophe ROULLIER <christophe.roullier@foss.st.com>
2024-04-19net: dwc_eth_qos: Rename eqos_stm32_config to eqos_stm32mp15_configMarek Vasut
The current glue code is specific to STM32MP15xx, the upcoming STM32MP13xx will introduce another entry specific to the STM32MP13xx. Rename the current entry to eqos_stm32mp15_config in preparation for STM32MP13xx addition. No functional change. Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Christophe ROULLIER <christophe.roullier@foss.st.com>
2024-04-19net: dwc_eth_qos: Split STM32 glue into separate fileMarek Vasut
Move STM32 glue code into separate file to contain the STM32 specific code outside of the DWMAC core code. No functional change. Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Christophe ROULLIER<christophe.roullier@foss.st.com>
2024-04-12net: dwc_eth_qos: Fix compilation warning in eqos_free_pkt()Patrice Chotard
Fix compilation warning: ../arch/arm/include/asm/io.h: In function 'eqos_free_pkt': ../arch/arm/include/asm/io.h:103:32: warning: 'rx_desc' may be used uninitialized [-Wmaybe-uninitialized] 103 | #define writel(v,c) ({ u32 __v = v; __iowmb(); __arch_putl(__v,c); __v; }) | ^~~ ../drivers/net/dwc_eth_qos.c:1220:27: note: 'rx_desc' was declared here 1220 | struct eqos_desc *rx_desc; | ^~~~~~~ Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
2024-04-10net: dw_eth_qos: Add missing \n in error messages.Heinrich Schuchardt
Missing line-feeds in error messages lead to output like: phy_startup() failed: -110FAILED: -110=> Output like the following is much easier to read: phy_startup() failed: -110 FAILED: -110 => Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-01-29treewide: Remove clk_freeSean Anderson
This function is a no-op. Remove it. Signed-off-by: Sean Anderson <seanga2@gmail.com> Link: https://lore.kernel.org/r/20231216193843.2463779-3-seanga2@gmail.com
2023-12-13net: dwc_eth_qos: add i.MX93 supportSébastien Szymanski
Add support for DWC EQoS MAC on i.MX93. Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com> Reviewed-by: Fabio Estevam <festevam@gmail.com>
2023-11-05net: dw_eth_qos: Add 64-bit addressingLey Foon Tan
Set upper 32bit address for DMA descriptors and buffer address to support 64-bit addressing. Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
2023-10-07net: dwc_eth_qos_rockchip: Add support for RK3588Jonas Karlman
Add rk_gmac_ops and other special handling that is needed for GMAC to work on RK3588. rk_gmac_ops was ported from linux commits: 2f2b60a0ec28 ("net: ethernet: stmmac: dwmac-rk: Add gmac support for rk3588") 88619e77b33d ("net: stmmac: rk3588: Allow multiple gmac controller") Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-10-07net: dwc_eth_qos: Add glue driver for GMAC on Rockchip RK3568Jonas Karlman
Add a new glue driver for Rockchip SoCs, i.e RK3568, with a GMAC based on Synopsys DWC Ethernet QoS IP. rk_gmac_ops was ported from linux commit: 3bb3d6b1c195 ("net: stmmac: Add RK3566/RK3568 SoC support") Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-10-07net: dwc_eth_qos: Stop spam of RX packet not available messageJonas Karlman
Remove spam of RX packet not available debug messages when waiting to receive a packet. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-10-07net: dwc_eth_qos: Return error code when start failsJonas Karlman
Return error code when phy_connect fails or no link can be established. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-10-07net: dwc_eth_qos: Drop unused rx_pkt from eqos_privJonas Karlman
rx_pkt is allocated and not used for anything, remove it. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-09-24common: Drop linux/printk.h from common headerSimon Glass
This old patch was marked as deferred. Bring it back to life, to continue towards the removal of common.h Move this out of the common header and include it only where needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-12net: dwc_eth_qos: Add StarFive ethernet driver glue layerYanhong Wang
The StarFive ETHQOS hardware has its own clock and reset,so add a corresponding glue driver to configure them. Signed-off-by: Yanhong Wang <yanhong.wang@starfivetech.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-05-05Let the EQoS in imx8mp handle fixed-phy too.Elmar Psilog
Without that patch it lost track to the node to scan speed and duplex. Patch was created by Marek Vasut, just tested by me. Signed-off-by: Elmar Psilog <epsi@gmx.de> Reviewed-by: Marek Vasut <marex@denx.de>
2023-03-30net: dwc_eth_qos: Set DMA_MODE SWR bit to reset the MACMarek Vasut
The driver currently only waits for DMA_MODE SWR bit to clear itself. This is insufficient e.g. on i.MX8M Plus, where the MAC must be reset before IOMUX GPR[1] content is latched into the MAC and used. Without the proper reset, the i.MX8M Plus MAC variant does not take the value in IOMUX GPR[1] into account, which makes it impossible e.g. to switch interface mode from RGMII to any other. Since proper reset is desired in general to put the block into defined state, always assert the DMA_MODE SWR bit before waiting for the bit to clear itself. Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Signed-off-by: Marek Vasut <marex@denx.de>
2023-03-30net: dwc_eth_qos: Staticize eqos_inval_buffer_tegra186()Marek Vasut
This function is only used within the driver, staticize it. Fixes: 149e80f74b6 ("net: dwc_eth_qos: public some functions") Signed-off-by: Marek Vasut <marex@denx.de>
2023-03-30net: dwc_eth_qos: Drop unused dm_gpio_free() on STM32Marek Vasut
The dm_gpio_free() is never called, because for stm32, the phy_reset_gpio pointer is never valid. This is because only tegra186 ever claims the phy_reset_gpio, all other platforms use the PHY framework to reset the PHY instead. Drop the dm_gpio_free() and dm_gpio_is_valid(). Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Signed-off-by: Marek Vasut <marex@denx.de>
2023-03-30net: dwc_eth_qos: Drop bogus return after gotoMarek Vasut
The return is never triggered due to the goto just above it. Drop it. No functional change. Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Signed-off-by: Marek Vasut <marex@denx.de>
2023-03-30net: Pull board_interface_eth_init() into common codeMarek Vasut
Move the board_interface_eth_init() into common ethernet uclass code, since this function could be shared by multiple drivers. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Marek Vasut <marex@denx.de>
2023-02-10net: dwc_eth_qos: Add Qcom ethernet driver glue layerSumit Garg
The Qualcom ETHQOS hardware supports an RGMII macro which needs to be configured according to following link speeds: - SPEED_1000 - SPEED_100 - SPEED_10 So add a corresponding glue driver to configure RGMII macro. Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-02-10net: dwc_eth_qos: Allow platform to override tx/rx_fifo_szSumit Garg
The GMAC controller on QCS404 SoC (support added by upcoming patch) fails to work with maximum tx/rx_fifo_sz supported by the hardware (16K). So allow platforms to override FIFO size using corresponding DT node properties. Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-02-10net: dwc_eth_qos: Make eqos_get_tick_clk_rate callback optionalSumit Garg
Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2022-11-28net: dwc_eth_qos: Add support for bulk RX descriptor cleaningMarek Vasut
Add new desc_per_cacheline property which lets a platform run RX descriptor cleanup after every power-of-2 - 1 received packets instead of every packet. This is useful on platforms where (axi_bus_width EQOS_AXI_WIDTH_n * DMA DSL inter-descriptor word skip count + DMA descriptor size) is less than cache line size, which necessitates packing multiple DMA descriptors into single cache line. In case of TX descriptors, this is not a problem, since the driver always does synchronous TX, i.e. the TX descriptor is always written, flushed and polled for completion in eqos_send(). In case of RX descriptors, it is necessary to update their status in bulk, i.e. after the entire cache line worth of RX descriptors has been used up to receive data. Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2022-11-28net: dwc_eth_qos: Split TX and RX DMA ringsMarek Vasut
Separate TX and RX DMA rings to make their handling slightly clearer. This is a preparatory patch for bulk RX descriptor flushing. Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2022-08-08net: dwc_eth_qos: Add eqos_get_enetaddr callback for stm32Patrice Chotard
Add .eqos_get_enetaddr callback defined as eqos_null_ops() to avoid illegal access. Fixes: a624251461bf ("net: dwc_eth_qos: introduce eqos hook eqos_get_enetaddr") Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2022-08-08net: dwc_eth_qos: Add eqos_get_enetaddr callback for tegra186Patrice Chotard
Add .eqos_get_enetaddr callback defined as eqos_null_ops() to avoid illegal access. Fixes: a624251461bf ("net: dwc_eth_qos: introduce eqos hook eqos_get_enetaddr") Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2022-08-08net: dwc_eth_qos: cosmetic: reorder include filesPatrick Delaunay
Reorder include files in the U-Boot expected order. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2022-08-08net: dwc_eth_qos: remove use of DWC_NET_PHYADDRRasmus Villemoes
Only two boards in the tree set the macro DWC_NET_PHYADDR. Both have CONFIG_DM_ETH_PHY=y, so should set the phy address in DT if necessary. The imx8mp_evk does set the correct address in device tree. The other board seems to be a copy-paste-adapt from an old version of the imx8mp_evk config header, given the "#ifdef CONFIG_DWC_ETH_QOS" block that has been removed from imx8mp_evk header in commit 127fb454955. Its device tree doesn't even enable (i.e., set 'status = "okay"') the &eqos node. But the other ethernet device, &fec, does get enabled, and does have a phy sitting at address 4 (and it also has a corresponding legacy #define CONFIG_FEC_MXC_PHYADDR 4). So I believe it should be completely safe to remove it from there as well. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> [trini: Re-apply to top of tree, update imx93_evk.h] Signed-off-by: Tom Rini <trini@konsulko.com>
2022-08-08net: dwc_eth_qos: lift parsing of max-speed DT property to common codeRasmus Villemoes
I have an iMX8MP with a ti,dp83867 phy in front of the eqos interface. The phy is Gbit capable - however, the C and D differential pairs are not physically routed to the RJ45 connector. So I need to prevent the phy from advertising 1000Mbps. The necessary code is almost already there in the form of a phy_set_supported() call in eqos_start(), but the max-speed DT property is currently only parsed in eqos_probe_resources_stm32(). Lift that parsing to eqos_probe(). Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2022-08-08net: dwc_eth_qos: fix double resource leak in eqos_remove()Rasmus Villemoes
Not only does eqos_remove() fail to free the buffers that have been allocated by eqos_probe_resources_core(), it repeats those allocations and thus drops twice as much memory on the floor. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2022-07-26net: dwc_eth_qos: introduce eqos hook eqos_get_enetaddrPeng Fan
i.MX has specific hook to get MAC address, so introduce a hook and move i.MX code to its own driver Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-07-26net: eqos: add function to get phy node and addressYe Li
Since new atheros PHY driver needs to access its PHY node through phy device, we have to assign the phy node in ethernet controller driver. Otherwise the PHY driver will fail to get some nodes and properties. Signed-off-by: Ye Li <ye.li@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-07-26net: dwc_eth_qos: move i.MX code outPeng Fan
Move i.MX code to a standalone file to make it easy for adding new platform support Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-07-26net: dwc_eth_qos: public some functionsPeng Fan
Move macros and structures to header file and make some functions public, so that could used by other files, this is to prepare split platform specific config to one file. Signed-off-by: Peng Fan <peng.fan@nxp.com>