Skip to content

Commit a96ac8a

Browse files
u1f35cdavem330
authored andcommitted
net: ethernet: stmmac: Enable interface clocks on probe for IPQ806x
The ipq806x_gmac_probe() function enables the PTP clock but not the appropriate interface clocks. This means that if the bootloader hasn't done so attempting to bring up the interface will fail with an error like: [ 59.028131] ipq806x-gmac-dwmac 37600000.ethernet: Failed to reset the dma [ 59.028196] ipq806x-gmac-dwmac 37600000.ethernet eth1: stmmac_hw_setup: DMA engine initialization failed [ 59.034056] ipq806x-gmac-dwmac 37600000.ethernet eth1: stmmac_open: Hw setup failed This patch, a slightly cleaned up version of one posted by Sergey Sergeev in: https://forum.openwrt.org/t/support-for-mikrotik-rb3011uias-rm/4064/257 correctly enables the clock; we have already configured the source just before this. Tested on a MikroTik RB3011. Signed-off-by: Jonathan McDowell <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7a40a2d commit a96ac8a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,19 @@ static int ipq806x_gmac_probe(struct platform_device *pdev)
319319
/* Enable PTP clock */
320320
regmap_read(gmac->nss_common, NSS_COMMON_CLK_GATE, &val);
321321
val |= NSS_COMMON_CLK_GATE_PTP_EN(gmac->id);
322+
switch (gmac->phy_mode) {
323+
case PHY_INTERFACE_MODE_RGMII:
324+
val |= NSS_COMMON_CLK_GATE_RGMII_RX_EN(gmac->id) |
325+
NSS_COMMON_CLK_GATE_RGMII_TX_EN(gmac->id);
326+
break;
327+
case PHY_INTERFACE_MODE_SGMII:
328+
val |= NSS_COMMON_CLK_GATE_GMII_RX_EN(gmac->id) |
329+
NSS_COMMON_CLK_GATE_GMII_TX_EN(gmac->id);
330+
break;
331+
default:
332+
/* We don't get here; the switch above will have errored out */
333+
unreachable();
334+
}
322335
regmap_write(gmac->nss_common, NSS_COMMON_CLK_GATE, val);
323336

324337
if (gmac->phy_mode == PHY_INTERFACE_MODE_SGMII) {

0 commit comments

Comments
 (0)