Re: [PATCH net-next 4/8] net: dsa: lan9645x: add basic dsa driver for LAN9645X
From: Andrew Lunn
Date: Thu Mar 05 2026 - 10:05:38 EST
> > > + /* 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.
So, the best thing to do is hard code the delays in the MAC to 0, and
pass phy-mode to the PHY.
Now, this is a switch, so there is one complexity. Some switches make
use of an RGMII port to connect to the host. You then have the host
RGMII MAC connected to the switch RGMII MAC. Delays have to be added
somewhere. Since the switch MAC is playing the role of the PHY, in the
eyes of the host, we allow such a port to add delays.
However, this is a multi-giga switch, with high speed SERDES ports. My
guess is, a SERDES port is used to connect to the host, not RGMII. So
i would not implement this, until somebody reports having a board with
RGMII connecting to the host. KISS.
Andrew