linux/drivers/net/ethernet/stmicro/stmmac
Yao Zi 6d6714bf0c net: stmmac: thead: Enable TX clock before MAC initialization
The clk_tx_i clock must be supplied to the MAC for successful
initialization. On TH1520 SoC, the clock is provided by an internal
divider configured through GMAC_PLLCLK_DIV register when using RGMII
interface. However, currently we don't setup the divider before
initialization of the MAC, resulting in DMA reset failures if the
bootloader/firmware doesn't enable the divider,

[    7.839601] thead-dwmac ffe7060000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[    7.938338] thead-dwmac ffe7060000.ethernet eth0: PHY [stmmac-0:02] driver [RTL8211F Gigabit Ethernet] (irq=POLL)
[    8.160746] thead-dwmac ffe7060000.ethernet eth0: Failed to reset the dma
[    8.170118] thead-dwmac ffe7060000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed
[    8.179384] thead-dwmac ffe7060000.ethernet eth0: __stmmac_open: Hw setup failed

Let's simply write GMAC_PLLCLK_DIV_EN to GMAC_PLLCLK_DIV to enable the
divider before MAC initialization. Note that for reconfiguring the
divisor, the divider must be disabled first and re-enabled later to make
sure the new divisor take effect.

The exact clock rate doesn't affect MAC's initialization according to my
test. It's set to the speed required by RGMII when the linkspeed is
1Gbps and could be reclocked later after link is up if necessary.

Fixes: 33a1a01e3a ("net: stmmac: Add glue layer for T-HEAD TH1520 SoC")
Signed-off-by: Yao Zi <ziyao@disroot.org>
Reviewed-by: Drew Fustini <fustini@kernel.org>
Link: https://patch.msgid.link/20250815104803.55294-1-ziyao@disroot.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-08-19 18:15:53 -07:00
..
chain_mode.c
common.h net: stmmac: remove pcs_get_adv_lp() support 2025-06-16 14:58:49 -07:00
descs_com.h
descs.h
dwmac4_core.c net: stmmac: replace ioaddr with stmmac_priv for pcs_set_ane() method 2025-06-19 15:11:25 -07:00
dwmac4_descs.c
dwmac4_descs.h
dwmac4_dma.c
dwmac4_dma.h
dwmac4_lib.c
dwmac4.h net: stmmac: Refactor VLAN implementation 2025-05-09 17:29:43 -07:00
dwmac5.c
dwmac5.h
dwmac100_core.c
dwmac100_dma.c
dwmac100.h
dwmac1000_core.c net: stmmac: replace ioaddr with stmmac_priv for pcs_set_ane() method 2025-06-19 15:11:25 -07:00
dwmac1000_dma.c
dwmac1000.h net: stmmac: fix dwmac1000 ptp timestamp status offset 2025-04-24 11:50:20 +02:00
dwmac_dma.h
dwmac_lib.c
dwmac-anarion.c net: stmmac: anarion: use devm_stmmac_pltfr_probe() 2025-04-15 08:36:02 -07:00
dwmac-dwc-qos-eth.c net: stmmac: dwc-qos: fix clk prepare/enable leak on probe failure 2025-08-11 20:11:48 -07:00
dwmac-generic.c
dwmac-imx.c net: stmmac: imx: use stmmac_pltfr_probe() 2025-04-15 08:36:19 -07:00
dwmac-ingenic.c net: stmmac: ingenic: convert to devm_stmmac_pltfr_probe() 2025-04-15 08:36:54 -07:00
dwmac-intel-plat.c net: stmmac: intel-plat: remove eee_usecs_rate and hardware write 2025-04-14 17:12:41 -07:00
dwmac-intel.c net: stmmac: intel: populate entire system_counterval_t in get_time_fn() callback 2025-07-15 16:21:59 -07:00
dwmac-intel.h net: stmmac: intel: convert speed_mode_2500() to get_interfaces() 2025-05-02 18:25:08 -07:00
dwmac-ipq806x.c net: stmmac: ipq806x: remove of_get_phy_mode() 2025-03-18 15:53:15 +01:00
dwmac-loongson1.c net: stmmac: loongson1: get ls1b resource only once 2025-06-19 15:26:01 -07:00
dwmac-loongson.c net: stmmac: dwmac-loongson: Add new GMAC's PCI device ID support 2025-04-28 13:37:26 -07:00
dwmac-lpc18xx.c net: stmmac: lpc18xx: use plat_dat->phy_interface 2025-06-23 11:57:33 -07:00
dwmac-mediatek.c net: stmmac: mediatek: stop initialising plat->mac_interface 2025-04-17 18:58:32 -07:00
dwmac-meson8b.c net: stmmac: meson8b: remove of_get_phy_mode() 2025-03-18 15:53:15 +01:00
dwmac-meson.c net: stmmac: meson: switch to use set_clk_tx_rate() hook 2025-02-28 10:20:48 -08:00
dwmac-qcom-ethqos.c net: stmmac: replace ioaddr with stmmac_priv for pcs_set_ane() method 2025-06-19 15:11:25 -07:00
dwmac-renesas-gbeth.c net: stmmac: dwmac-renesas-gbeth: Add PM suspend/resume callbacks 2025-07-21 16:58:56 -07:00
dwmac-rk.c net: stmmac: rk: put the PHY clock on remove 2025-08-11 20:11:23 -07:00
dwmac-rzn1.c
dwmac-s32.c net: stmmac: s32: use generic stmmac_set_clk_tx_rate() 2025-02-28 10:20:47 -08:00
dwmac-socfpga.c net: stmmac: dwmac-socfpga: Add xgmac support for Agilex5 2025-07-25 16:55:38 -07:00
dwmac-sophgo.c net: stmmac: dwmac-sophgo: Add support for Sophgo SG2042 SoC 2025-07-10 15:26:55 -07:00
dwmac-starfive.c net: stmmac: starfive: use PHY capability for TX clock stop 2025-03-19 18:06:32 +01:00
dwmac-sti.c net: stmmac: sti: convert to stmmac_pltfr_pm_ops 2025-04-16 18:31:06 -07:00
dwmac-stm32.c net: stmmac: stm32: simplify clock handling 2025-04-11 09:38:49 +01:00
dwmac-sun8i.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-05-22 09:42:41 -07:00
dwmac-sunxi.c net: stmmac: sunxi: use devm_stmmac_pltfr_probe() 2025-04-17 18:41:40 -07:00
dwmac-tegra.c
dwmac-thead.c net: stmmac: thead: Enable TX clock before MAC initialization 2025-08-19 18:15:53 -07:00
dwmac-visconti.c net: stmmac: visconti: make phy_intf_sel local 2025-06-17 16:25:20 -07:00
dwxgmac2_core.c net: stmmac: dwxgmac2: Add support for HW-accelerated VLAN stripping 2025-05-09 17:29:43 -07:00
dwxgmac2_descs.c net: stmmac: dwxgmac2: Add support for HW-accelerated VLAN stripping 2025-05-09 17:29:43 -07:00
dwxgmac2_dma.c net: stmmac: Fix interrupt handling for level-triggered mode in DWC_XGMAC2 2025-07-08 18:09:34 -07:00
dwxgmac2.h net: stmmac: dwxgmac2: Add support for HW-accelerated VLAN stripping 2025-05-09 17:29:43 -07:00
dwxlgmac2.h
enh_desc.c
hwif.c net: stmmac: stmmac_vlan: rename VLAN functions and symbol to generic symbol. 2025-05-09 17:29:43 -07:00
hwif.h net: stmmac: replace ioaddr with stmmac_priv for pcs_set_ane() method 2025-06-19 15:11:25 -07:00
Kconfig Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 2025-04-23 18:31:55 -07:00
Makefile net: stmmac: Refactor VLAN implementation 2025-05-09 17:29:43 -07:00
mmc_core.c
mmc.h
norm_desc.c
ring_mode.c
stmmac_est.c net: stmmac: make sure that ptp_rate is not 0 before configuring EST 2025-05-30 19:33:29 -07:00
stmmac_est.h
stmmac_ethtool.c net: stmmac: replace ioaddr with stmmac_priv for pcs_set_ane() method 2025-06-19 15:11:25 -07:00
stmmac_fpe.c net: ethtool: mm: extract stmmac verification logic into common library 2025-04-18 08:43:09 -07:00
stmmac_fpe.h net: ethtool: mm: extract stmmac verification logic into common library 2025-04-18 08:43:09 -07:00
stmmac_hwtstamp.c net: stmmac: fix multiplication overflow when reading timestamp 2025-04-24 11:50:20 +02:00
stmmac_main.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-07-26 11:49:45 -07:00
stmmac_mdio.c net: stmmac: Call xpcs_config_eee_mult_fact() only when xpcs is present 2025-03-24 13:26:02 -07:00
stmmac_pci.c stmmac: Replace deprecated PCI functions 2025-03-25 10:36:45 -07:00
stmmac_pcs.h net: stmmac: remove pcs_get_adv_lp() support 2025-06-16 14:58:49 -07:00
stmmac_platform.c net: Fix typos 2025-07-25 10:29:07 -07:00
stmmac_platform.h net: stmmac: provide stmmac_pltfr_find_clk() 2025-04-10 18:31:53 -07:00
stmmac_ptp.c net: stmmac: make sure that ptp_rate is not 0 before configuring timestamping 2025-05-30 19:33:28 -07:00
stmmac_ptp.h
stmmac_selftests.c net: phy: Support speed selection for PHY loopback 2025-03-20 08:45:08 +01:00
stmmac_tc.c
stmmac_vlan.c net: stmmac: dwxgmac2: Add support for HW-accelerated VLAN stripping 2025-05-09 17:29:43 -07:00
stmmac_vlan.h net: stmmac: stmmac_vlan: rename VLAN functions and symbol to generic symbol. 2025-05-09 17:29:43 -07:00
stmmac_xdp.c
stmmac_xdp.h
stmmac.h net: stmmac: convert to ndo_hwtstamp_get() and ndo_hwtstamp_set() 2025-05-15 18:05:05 -07:00