Re: [PATCH 2/2] net: stmmac: Add Ingenic SoCs MAC support.

From: Andrew Lunn
Date: Tue Jun 08 2021 - 08:21:30 EST


> > > + case PHY_INTERFACE_MODE_RGMII:
> > > + val = FIELD_PREP(MACPHYC_TX_SEL_MASK, MACPHYC_TX_SEL_DELAY) |
> > > + FIELD_PREP(MACPHYC_TX_DELAY_MASK, MACPHYC_TX_DELAY_63_UNIT) |
> > > + FIELD_PREP(MACPHYC_RX_SEL_MASK, MACPHYC_RX_SEL_ORIGIN) |
> > > + FIELD_PREP(MACPHYC_PHY_INFT_MASK, MACPHYC_PHY_INFT_RGMII);
> > What exactly does MACPHYC_TX_DELAY_63_UNIT mean here? Ideally, the MAC
> > should not be adding any RGMII delays. It should however pass mode
> > through to the PHY, so it can add the delays, if the mode indicates it
> > should, e.g. PHY_INTERFACE_MODE_RGMII_ID. This is also why you should
> > be handling all 4 RGMII modes here, not just one.
>
>
> MACPHYC_TX_DELAY_63_UNIT means set MAC TX clk delay to 63 units (similar to the "tx-delay" in dwmac-rk.c). However, the manual does not clearly describe the time span of one unit, after consulting engineer of Ingenic, I learned that the value is recommended to be set to 63.
> I will change it to be similar to the way done in dwmac-rk.c.

Please wrap your text to around 75 characters per line.

I suspect you don't understand RGMII delays. As i said, normally, the
MAC does not add delays, the PHY does. Please take a closer look at
this.

Andrew