Re: [PATCH net-next 4/8] net: dsa: lan9645x: add basic dsa driver for LAN9645X

From: Russell King (Oracle)

Date: Fri Mar 06 2026 - 09:28:23 EST


On Thu, Mar 05, 2026 at 03:58:16PM +0100, Andrew Lunn wrote:
> > > > + /* We configure delays on the MAC side. When the PHY is not responsible
> > > > + * for delays, the MAC is, which is why RGMII_TXID results in
> > > > + * rx_delay=true.
> > > > + */
> > > > + if (mode == PHY_INTERFACE_MODE_RGMII ||
> > > > + mode == PHY_INTERFACE_MODE_RGMII_TXID)
> > > > + rx_delay = true;
> > > > +
> > > > + if (mode == PHY_INTERFACE_MODE_RGMII ||
> > > > + mode == PHY_INTERFACE_MODE_RGMII_RXID)
> > > > + tx_delay = true;
> > >
> > > PHY_INTERFACE_MODE_RGMII means that the delays are provided by the
> > > board layout, so this seems wrong to me. Please review the phylib
> > > documentation concerning RGMII delays. I'd like Andrew to comment on
> > > this too.
> > >
> >
> > The idea with this was, if the PHY does not provide internal delay, then
> > we do it in the MAC.
>
> That is not really what we want. The default in Linux is that the PHY
> adds the delays. In general, MAC drivers read the phy-mode, and pass
> it directly to the PHY. The MAC does not add delays. There are a small
> number of boards which don't respect this. In the past, there was been
> claims that an RDK used a PHY which was not capable of adding the
> needed delays, so the MAC had to. In practice, all the PHY drivers in
> linux which supporting RGMII support all four configurations of
> delays.

Unfortunately, I've discovered another case - dwmac-qcom-ethqos::
ethqos_rgmii_macro_init():

/* Determine if the PHY adds a 2 ns TX delay or the MAC handles it */
if (ethqos->phy_mode == PHY_INTERFACE_MODE_RGMII_ID ||
ethqos->phy_mode == PHY_INTERFACE_MODE_RGMII_TXID)
phase_shift = 0;
else
phase_shift = RGMII_CONFIG2_TX_CLK_PHASE_SHIFT_EN;

This code was added by 164a9ebe9742 ("net: stmmac: dwmac-qcom-ethqos:
Respect phy-mode and TX delay") which doesn't have any acks from
phylib folk. However, before this commit, the driver always added the
transmit delay.

Sadly, too late to do anything about this now. :(

Should a regexp be added to MAINTAINERS phylib entry to detect patches
which contain PHY_INTERFACE_MODE_RGMII?

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!