Re: [PATCH net-next v7 3/3] net: stmmac: dwmac-nuvoton: Add dwmac glue for Nuvoton MA35 family

From: Andrew Lunn
Date: Mon Jan 13 2025 - 21:17:43 EST


> > +#define NVT_MISCR_RMII BIT(0)
> > +
> > +/* 2000ps is mapped to 0x0 ~ 0xF */
>
> Excuse my ignorance: What is ps?

picoseconds. An RGMII link needs a 2ns delay between the clock line
and the data lines. Some MACs allow you to tune the delay they can
insert, in this case in steps of 2ns / 16.

> > +#define NVT_PATH_DELAY_DEC 134
> > +#define NVT_TX_DELAY_MASK GENMASK(19, 16)
> > +#define NVT_RX_DELAY_MASK GENMASK(23, 20)
> > +
> > +struct nvt_priv_data {
> > + struct platform_device *pdev;
> > + struct regmap *regmap;
> > +};
> > +
> > +static struct nvt_priv_data *
> > +nvt_gmac_setup(struct platform_device *pdev, struct plat_stmmacenet_data *plat)
> > +{
> > + struct device *dev = &pdev->dev;
> > + struct nvt_priv_data *bsp_priv;
> > + phy_interface_t phy_mode;
> > + u32 tx_delay, rx_delay;
>
> Please append the unit to the variable name.

Which is trick, because they are in units of 2000/16 of a picosecond.

Andrew