netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Calvin Johnson <calvin.johnson@oss.nxp.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Jeremy Linton <jeremy.linton@arm.com>, Jon <jon@solid-run.com>,
	Cristi Sovaiala <cristian.sovaiala@nxp.com>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Madalin Bucur <madalin.bucur@oss.nxp.com>,
	netdev@vger.kernel.org, linux.cj@gmail.com
Subject: Re: [PATCH v1 1/3] net: phy: Allow mdio buses to auto-probe c45 devices
Date: Mon, 22 Jun 2020 14:44:29 +0100	[thread overview]
Message-ID: <20200622134429.GK1551@shell.armlinux.org.uk> (raw)
In-Reply-To: <20200622132200.GB5822@lsv03152.swis.in-blr01.nxp.com>

On Mon, Jun 22, 2020 at 06:52:00PM +0530, Calvin Johnson wrote:
> On Wed, Jun 17, 2020 at 07:57:03PM +0100, Russell King - ARM Linux admin wrote:
> > On Wed, Jun 17, 2020 at 08:51:20PM +0200, Andrew Lunn wrote:
> > > > > +	/* bus capabilities, used for probing */
> > > > > +	enum {
> > > > > +		MDIOBUS_C22 = 0,
> > > > > +		MDIOBUS_C45,
> > > > > +		MDIOBUS_C22_C45,
> > > > > +	} probe_capabilities;
> > > > 
> > > > I think it would be better to reserve "0" to mean that no capabilities
> > > > have been declared.  We hae the situation where we have mii_bus that
> > > > exist which do support C45, but as they stand, probe_capabilities will
> > > > be zero, and with your definitions above, that means MDIOBUS_C22.
> > > > 
> > > > It seems this could lock in some potential issues later down the line
> > > > if we want to use this elsewhere.
> > > 
> > > Hi Russell
> > > 
> > > Actually, this patch already causes issues, i think.
> > > 
> > > drivers/net/ethernet/marvell/mvmdio.c contains two MDIO bus master
> > > drivers. "marvell,orion-mdio" is C22 only. "marvell,xmdio" is C45
> > > only. Because the capabilites is not initialized, it will default to
> > > 0, aka MDIOBUS_C22, for the C45 only bus master, and i expect bad
> > > things will happen.
> > > 
> > > We need the value of 0 to cause existing behaviour. Or all MDIO bus
> > > drivers need reviewing, and the correct capabilities set.
> > 
> > Yes, that's basically what I was trying to say, thanks for putting it
> > more clearly.
> 
> Prior to this patch, below code which is for C22 was executed in this path.
> 	phydev = get_phy_device(bus, addr, false);
> Doesn't this mean that MDIOBUS_C22 = 0, doesn't break anything?

Please re-read Andrew's email that you quoted above, and consider this
point: If bus->probe_capabilities == MDIOBUS_C22 for the Marvell XMDIO
device, as it _will_ be the case, because bus->probe_capabilities has
not been set, is this a sane situation?

Are you willing to do a full audit of all MDIO drivers and set their
bus->probe_capabilities correctly in every case in order to use
MDIOBUS_C22 = 0 ?

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2020-06-22 13:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-17 17:15 [PATCH v1 0/3] ACPI support for xgmac_mdio drivers Calvin Johnson
2020-06-17 17:15 ` [PATCH v1 1/3] net: phy: Allow mdio buses to auto-probe c45 devices Calvin Johnson
2020-06-17 17:44   ` Russell King - ARM Linux admin
2020-06-17 18:51     ` Andrew Lunn
2020-06-17 18:57       ` Russell King - ARM Linux admin
2020-06-22 13:22         ` Calvin Johnson
2020-06-22 13:44           ` Russell King - ARM Linux admin [this message]
2020-06-18 14:00     ` Calvin Johnson
2020-06-17 17:15 ` [PATCH v1 2/3] net/fsl: acpize xgmac_mdio Calvin Johnson
2020-06-17 17:24   ` Andy Shevchenko
2020-06-17 17:34   ` Andrew Lunn
2020-06-18 15:43     ` Jeremy Linton
2020-06-18 16:00       ` Andy Shevchenko
2020-06-18 17:42         ` Calvin Johnson
2020-06-18 17:55           ` Andy Shevchenko
2020-06-17 17:49   ` Russell King - ARM Linux admin
2020-06-17 17:54     ` Andy Shevchenko
2020-06-17 18:56       ` Russell King - ARM Linux admin
2020-06-19 14:59     ` Calvin Johnson
2020-06-19 15:02       ` Russell King - ARM Linux admin
2020-06-17 17:15 ` [PATCH v1 3/3] net/fsl: enable extended scanning in xgmac_mdio Calvin Johnson
2020-06-18 22:49   ` Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200622134429.GK1551@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=andy.shevchenko@gmail.com \
    --cc=calvin.johnson@oss.nxp.com \
    --cc=cristian.sovaiala@nxp.com \
    --cc=f.fainelli@gmail.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=jeremy.linton@arm.com \
    --cc=jon@solid-run.com \
    --cc=linux.cj@gmail.com \
    --cc=madalin.bucur@oss.nxp.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).