Re: [PATCH net-next v2 31/35] [RFT] net: dpaa: Convert to phylink

From: Sean Anderson
Date: Thu Jun 30 2022 - 11:56:41 EST


Hi Russell,

On 6/29/22 10:44 AM, Russell King (Oracle) wrote:
> On Tue, Jun 28, 2022 at 06:14:00PM -0400, Sean Anderson wrote:
>> +static void dtsec_mac_config(struct phylink_config *config, unsigned int mode,
>> + const struct phylink_link_state *state)
>> +{
>> + struct mac_device *mac_dev = fman_config_to_mac(config);
>> + struct dtsec_regs __iomem *regs = mac_dev->fman_mac->regs;
>> + u32 tmp;
>> +
>> + switch (state->interface) {
>> + case PHY_INTERFACE_MODE_RMII:
>> + tmp = DTSEC_ECNTRL_RMM;
>> + break;
>> + case PHY_INTERFACE_MODE_RGMII:
>> + case PHY_INTERFACE_MODE_RGMII_ID:
>> + case PHY_INTERFACE_MODE_RGMII_RXID:
>> + case PHY_INTERFACE_MODE_RGMII_TXID:
>> + tmp = DTSEC_ECNTRL_GMIIM | DTSEC_ECNTRL_RPM;
>> + break;
>> + case PHY_INTERFACE_MODE_SGMII:
>> + case PHY_INTERFACE_MODE_1000BASEX:
>> + case PHY_INTERFACE_MODE_2500BASEX:
>> + tmp = DTSEC_ECNTRL_TBIM | DTSEC_ECNTRL_SGMIIM;
>> + break;
>> + default:
>> + dev_warn(mac_dev->dev, "cannot configure dTSEC for %s\n",
>> + phy_modes(state->interface));
>> + }
>> +
>> + if (state->speed == SPEED_100)
>> + tmp |= DTSEC_ECNTRL_R100M;
>
> Please do not refer to state->speed here, it is meaningless. What are
> you trying to achieve here?

Well, it's part of ECNTRL, so I figured I might as well set it all at once.

> It looks like the old dtsec_adjust_link() used to set/clear this when
> the link comes up - so can it be moved to dtsec_link_up() ?

Sure.

---

I forgot to mention this in the commit description, but I touched on this
in our previous discussion: do you have a suggestion for the Aquantia stuff
in dpaa_phy_init? There's no direct access to the phy any more, so it's
harder to bodge it and say "we must enable flow control for this phy".

--Sean