netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wong Vee Khee <vee.khee.wong@linux.intel.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC net-next 0/2] Introduce MDIO probe order C45 over C22
Date: Sat, 5 Jun 2021 08:37:22 +0800	[thread overview]
Message-ID: <20210605003722.GA4979@linux.intel.com> (raw)
In-Reply-To: <20210602235155.GA31624@linux.intel.com>

Hi Andrew,

On Thu, Jun 03, 2021 at 07:51:55AM +0800, Wong Vee Khee wrote:
> On Wed, Jun 02, 2021 at 05:03:52PM +0200, Andrew Lunn wrote:
> > > I took a look at how most ethernet drivers implement their "bus->read"
> > > function. Most of them either return -EIO or -ENODEV.
> > > 
> > > I think it safe to drop the return error type when we try with C45 access:
> > > 
> > > 
> > > diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> > > index 1539ea021ac0..282d16fdf6e1 100644
> > > --- a/drivers/net/phy/phy_device.c
> > > +++ b/drivers/net/phy/phy_device.c
> > > @@ -870,6 +870,18 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45)
> > >         if (r)
> > >                 return ERR_PTR(r);
> > > 
> > > +       /* PHY device such as the Marvell Alaska 88E2110 will return a PHY ID
> > > +        * of 0 when probed using get_phy_c22_id() with no error. Proceed to
> > > +        * probe with C45 to see if we're able to get a valid PHY ID in the C45
> > > +        * space, if successful, create the C45 PHY device.
> > > +        */
> > > +       if ((!is_c45) && (phy_id == 0)) {
> > > +               r = get_phy_c45_ids(bus, addr, &c45_ids);
> > > +               if (!r)
> > > +                       return phy_device_create(bus, addr, phy_id,
> > > +                                                true, &c45_ids);
> > > +       }
> > 
> > This is getting better. But look at for example
> > drivers/net/mdio/mdio-bcm-unimac.c. What will happen when you ask it
> > to do get_phy_c45_ids()?
> >
> 
> I will add an additional check for bus->probe_capabilities. This will ensure
> that only a MDIO bus that is capable for C45 access will go for the 'try getting
> PHY ID from C45 space' approach. Currently, only Freescale's QorIQ 10G MDIO
> Controller driver and STMMAC driver has a bus->probe_capabilities of > MDIOBUS_C45.
> So, I would say with this additional checking, it would not break most of the drivers:-
> 
> 
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 1539ea021ac0..460c0866ac84 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -870,6 +870,19 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45)
>         if (r)
>                 return ERR_PTR(r);
> 
> +       /* PHY device such as the Marvell Alaska 88E2110 will return a PHY ID
> +        * of 0 when probed using get_phy_c22_id() with no error. Proceed to
> +        * probe with C45 to see if we're able to get a valid PHY ID in the C45
> +        * space, if successful, create the C45 PHY device.
> +        */
> +       if ((!is_c45) && (phy_id == 0) &&
> +            (bus->probe_capabilities >= MDIOBUS_C45)) {
> +               r = get_phy_c45_ids(bus, addr, &c45_ids);
> +               if (!r)
> +                       return phy_device_create(bus, addr, phy_id,
> +                                                true, &c45_ids);
> +       }
> +
>         return phy_device_create(bus, addr, phy_id, is_c45, &c45_ids);
>  }
>  EXPORT_SYMBOL(get_phy_device);
> 

Can you take a look at the latest implementation and provide
feedback?

VK

  reply	other threads:[~2021-06-05  0:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25  5:58 [RFC net-next 0/2] Introduce MDIO probe order C45 over C22 Wong Vee Khee
2021-05-25 13:34 ` Andrew Lunn
2021-06-01 10:47   ` Wong Vee Khee
2021-06-01 13:04     ` Andrew Lunn
2021-06-01 15:44       ` Wong Vee Khee
2021-06-01 22:21         ` Andrew Lunn
2021-06-01 23:03           ` Wong Vee Khee
2021-06-02  2:19             ` Andrew Lunn
2021-06-02 14:15               ` Wong Vee Khee
2021-06-02 15:03                 ` Andrew Lunn
2021-06-02 23:51                   ` Wong Vee Khee
2021-06-05  0:37                     ` Wong Vee Khee [this message]
2021-06-05 18:36                       ` Andrew Lunn
2021-06-06  0:54                         ` Wong Vee Khee

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=20210605003722.GA4979@linux.intel.com \
    --to=vee.khee.wong@linux.intel.com \
    --cc=andrew@lunn.ch \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --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).