Re: [PATCH 1/8] net: phy: realtek: rtl8221: allow to configure SERDES mode

From: Daniel Golle
Date: Thu May 11 2023 - 07:56:03 EST


On Thu, May 11, 2023 at 02:41:07AM +0200, Andrew Lunn wrote:
> > +#define RTL8221B_MMD_SERDES_CTRL MDIO_MMD_VEND1
> > +#define RTL8221B_MMD_PHY_CTRL MDIO_MMD_VEND2
>
> I suggest you don't do this. Use MDIO_MMD_VEND[1|2] to make it clear
> these are vendor registers.

Ack, I will not introduce new macros to label them, but just use
MDIO_MMD_VEND1 and MDIO_MMD_VEND2 then.

>
> > + case RTL8221B_SERDES_OPTION_MODE_2500BASEX_SGMII:
> > + case RTL8221B_SERDES_OPTION_MODE_2500BASEX:
> > + phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6a04, 0x0503);
> > + phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6f10, 0xd455);
> > + phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6f11, 0x8020);
> > + break;
> > + case RTL8221B_SERDES_OPTION_MODE_HISGMII_SGMII:
> > + case RTL8221B_SERDES_OPTION_MODE_HISGMII:
> > + phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6a04, 0x0503);
> > + phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6f10, 0xd433);
> > + phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x6f11, 0x8020);
> > + break;
> > + }
>
> Is there anything in the datasheet to indicate register names and what
> the values mean? It would be good to replace these magic values with
> #defines.

Unfortunately they are only mentioned as magic values which have to be
written to magic registers also in the datasheet :(