Re: 回覆: [net-next 2/4] ARM: dts: ast2600-evb: add default RGMII delay
From: Andrew Lunn
Date: Tue Mar 18 2025 - 10:06:46 EST
On Tue, Mar 18, 2025 at 11:00:27AM +0000, Jacky Chou wrote:
> Hi Andrew,
>
> Thank you for your reply.
>
> > > phy-mode = "rgmii";
> > > phy-handle = <ðphy2>;
> > >
> > > + tx-internal-delay-ps = <8>;
> > > + rx-internal-delay-ps = <4>;
> > > +
> >
> > Ideally you want:
> >
> > phy-mode = "rgmii-id";
> > tx-internal-delay-ps = <0>;
> > rx-internal-delay-ps = <0>;
> >
> > Since 'rgmii-id' correctly describes the hardware.
>
> I still confuse about ethernet-controller.yaml.
> It lists 'rgmi', 'rgmii-rxid', 'rgmii-txid' and 'rgmii-id'.
DT describes the board. Does the board add the 2ns delay via extra
long clock lines? If yes, use rgmii. If the MAC/PHY pair need to add
the 2ns delay, use rgmii-id.
If the MAC/PHY pair is adding the delay, the DT says nothing about how
they add the delay.
The general rule is the PHY adds the delay. If you look at
drivers/net/phy/*.c, every PHY that implements RGMII support both
PHY_INTERFACE_MODE_RGMII_ID and PHY_INTERFACE_MODE_RGMII. There is no
reason not to follow ever other MAC/PHY pair and have the PHY add the
delay. The MAC can then do fine tuning if needed, adding small delays.
Andrew