Re: [RFC PATCH net-next v3 19/20] net: dsa: qca8k: pass switch_revision info to phy dev_flags

From: Russell King - ARM Linux admin
Date: Fri May 07 2021 - 05:44:44 EST

On Wed, May 05, 2021 at 12:29:13AM +0200, Ansuel Smith wrote:
> +static u32 qca8k_get_phy_flags(struct dsa_switch *ds, int port)
> +{
> + struct qca8k_priv *priv = ds->priv;
> +
> + pr_info("revision from phy %d", priv->switch_revision);

Should this be a "pr_info" ?

> +
> + /* Communicate to the phy internal driver the switch revision.
> + * Based on the switch revision different values needs to be
> + * set to the dbg and mmd reg on the phy.
> + * The first 2 bit are used to communicate the switch revision
> + * to the phy driver.
> + */
> + if (port > 0 && port < 6)
> + return priv->switch_revision;

We had some discussion back in February about the PHY flags argument
("Rework of phydev->dev_flags") as there is a need to generically
identify whether a PHY is on a SFP module or not. This discussion
hasn't progressed to any changes (yet) but some of the points remain
valid: if we do go down the route of needing to have generic PHY flags
in dev_flags, then we need vendor specific stuff to avoid those bits.
So, rather than introduce a new case of passing some undefined data
through the flags argument, can we come up with some sort of proposal
for this.

It may also be a good idea if we document it. Maybe something like
"low 16 bits are free for driver use, upper 16 bits are reserved
for generic use"?

RMK's Patch system:
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!