[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YKxh/d2/SXfxVmr7@lunn.ch>
Date: Tue, 25 May 2021 04:33:33 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Vladimir Oltean <olteanv@...il.com>
Cc: Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
Florian Fainelli <f.fainelli@...il.com>,
Vivien Didelot <vivien.didelot@...il.com>,
Vladimir Oltean <vladimir.oltean@....com>,
Russell King <linux@...linux.org.uk>
Subject: Re: [PATCH net-next 12/13] net: dsa: sja1105: expose the SGMII PCS
as an mdio_device
> +static int sja1105_mdiobus_pcs_register(struct sja1105_private *priv)
> +{
> + struct sja1105_mdio_private *mdio_priv;
> + struct dsa_switch *ds = priv->ds;
> + struct mii_bus *bus;
> + int rc = 0;
> + int port;
> +
> + if (!priv->info->pcs_mdio_read || !priv->info->pcs_mdio_write)
> + return 0;
> +
> + bus = mdiobus_alloc_size(sizeof(*mdio_priv));
> + if (!bus)
> + return -ENOMEM;
> +
> + bus->name = "SJA1105 PCS MDIO bus";
> + snprintf(bus->id, MII_BUS_ID_SIZE, "%s-pcs",
> + dev_name(ds->dev));
> + bus->read = priv->info->pcs_mdio_read;
> + bus->write = priv->info->pcs_mdio_write;
> + bus->parent = ds->dev;
> + mdio_priv = bus->priv;
> + mdio_priv->priv = priv;
> +
> + /* We don't register this MDIO bus because there is no PHY on it */
Interesting. If you don't register it, you miss out on the stats in
/sysfs. I wonder if it makes more sense to set phy_mask to stop it
probing for PHYs and register it?
Andrew
Powered by blists - more mailing lists