diff mbox

net/phy: tune get_phy_c45_ids to support more c45 phy

Message ID 1398246951-27303-1-git-send-email-Shengzhou.Liu@freescale.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Shengzhou Liu April 23, 2014, 9:55 a.m. UTC
As some C45 10G PHYs(e.g. Cortina CS4315/CS4340 PHY) have
zero Devices In package, current driver can't get correct
devices_in_package value by non-zero Devices In package.
so let's probe more with zero Devices In package to support
more C45 PHYs which have zero Devices In package.

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
---
Tested with CS4315 on T2080RDB, this patch have no impact on previous XAUI phy with verification. 

 drivers/net/phy/phy_device.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

Comments

Scott Wood April 23, 2014, 9:02 p.m. UTC | #1
On Wed, 2014-04-23 at 17:55 +0800, Shengzhou Liu wrote:
> As some C45 10G PHYs(e.g. Cortina CS4315/CS4340 PHY) have
> zero Devices In package, current driver can't get correct
> devices_in_package value by non-zero Devices In package.
> so let's probe more with zero Devices In package to support
> more C45 PHYs which have zero Devices In package.
> 
> Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
> ---
> Tested with CS4315 on T2080RDB, this patch have no impact on previous XAUI phy with verification. 
> 
>  drivers/net/phy/phy_device.c | 25 +++++++++++++++++++++----
>  1 file changed, 21 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index cfb5110..8fd777e 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c

You need to send this to the netdev list and maintainer.

-Scott
Shengzhou Liu April 24, 2014, 3:05 a.m. UTC | #2
> -----Original Message-----

> From: Wood Scott-B07421

> Sent: Thursday, April 24, 2014 5:02 AM

> To: Liu Shengzhou-B36685

> Cc: linuxppc-dev@lists.ozlabs.org; trini@ti.com

> Subject: Re: [PATCH] net/phy: tune get_phy_c45_ids to support more c45

> phy

> 

> On Wed, 2014-04-23 at 17:55 +0800, Shengzhou Liu wrote:

> > As some C45 10G PHYs(e.g. Cortina CS4315/CS4340 PHY) have zero Devices

> > In package, current driver can't get correct devices_in_package value

> > by non-zero Devices In package.

> > so let's probe more with zero Devices In package to support more C45

> > PHYs which have zero Devices In package.

> >

> > Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>

> > ---

> > Tested with CS4315 on T2080RDB, this patch have no impact on previous

> XAUI phy with verification.

> >

> >  drivers/net/phy/phy_device.c | 25 +++++++++++++++++++++----

> >  1 file changed, 21 insertions(+), 4 deletions(-)

> >

> > diff --git a/drivers/net/phy/phy_device.c

> > b/drivers/net/phy/phy_device.c index cfb5110..8fd777e 100644

> > --- a/drivers/net/phy/phy_device.c

> > +++ b/drivers/net/phy/phy_device.c

> 

> You need to send this to the netdev list and maintainer.

> 

> -Scott

> 

[Shengzhou] Sent to netdev list, but it seems there is no maintainer of drivers/net/phy in MAINTAINERS list.
diff mbox

Patch

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index cfb5110..8fd777e 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -244,12 +244,29 @@  static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id,
 			return -EIO;
 		c45_ids->devices_in_package |= (phy_reg & 0xffff);
 
-		/* If mostly Fs, there is no device there,
-		 * let's get out of here.
+		/* If mostly Fs, let's continue to probe more
+		 * as some 10G PHYs have zero Devices In package
+		 * e.g. Cortina CS4315/CS4340 PHY.
 		 */
 		if ((c45_ids->devices_in_package & 0x1fffffff) == 0x1fffffff) {
-			*phy_id = 0xffffffff;
-			return 0;
+			reg_addr = MII_ADDR_C45 | 0 << 16 | 6;
+			phy_reg = mdiobus_read(bus, addr, reg_addr);
+			if (phy_reg < 0)
+				return -EIO;
+			c45_ids->devices_in_package = (phy_reg & 0xffff) << 16;
+			reg_addr = MII_ADDR_C45 | 0 << 16 | 5;
+			phy_reg = mdiobus_read(bus, addr, reg_addr);
+			if (phy_reg < 0)
+				return -EIO;
+			c45_ids->devices_in_package |= (phy_reg & 0xffff);
+			/* If mostly Fs, there is no device there,
+			 * let's get out of here.
+			 */
+			if ((c45_ids->devices_in_package & 0x1fffffff) ==
+							0x1fffffff) {
+				*phy_id = 0xffffffff;
+				return 0;
+			}
 		}
 	}