netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next RESEND 1/2] net: phy: export genphy_config_init()
@ 2014-04-16 15:19 Daniel Mack
  2014-04-16 15:19 ` [PATCH net-next RESEND 2/2] net: phy: at803x: use genphy_config_init() Daniel Mack
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Daniel Mack @ 2014-04-16 15:19 UTC (permalink / raw)
  To: netdev, f.fainelli; +Cc: davem, mugunthanvnm, ujhelyi.m, Daniel Mack

This enables other drivers to call this generic implementation, and then
only do specific details on top of it.

Signed-off-by: Daniel Mack <zonque@gmail.com>
---
Resending this after 3.15-rc1 has been released, assuming that the
net-next tree is now open again.

 drivers/net/phy/phy_device.c | 3 ++-
 include/linux/phy.h          | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 2f6989b..84485ea 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1029,7 +1029,7 @@ static int gen10g_read_status(struct phy_device *phydev)
 	return 0;
 }
 
-static int genphy_config_init(struct phy_device *phydev)
+int genphy_config_init(struct phy_device *phydev)
 {
 	int val;
 	u32 features;
@@ -1074,6 +1074,7 @@ static int genphy_config_init(struct phy_device *phydev)
 
 	return 0;
 }
+EXPORT_SYMBOL(genphy_config_init);
 
 static int gen10g_config_init(struct phy_device *phydev)
 {
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 565188c..dcf7f13 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -609,6 +609,7 @@ static inline int phy_read_status(struct phy_device *phydev)
 	return phydev->drv->read_status(phydev);
 }
 
+int genphy_config_init(struct phy_device *phydev);
 int genphy_setup_forced(struct phy_device *phydev);
 int genphy_restart_aneg(struct phy_device *phydev);
 int genphy_config_aneg(struct phy_device *phydev);
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next RESEND 2/2] net: phy: at803x: use genphy_config_init()
  2014-04-16 15:19 [PATCH net-next RESEND 1/2] net: phy: export genphy_config_init() Daniel Mack
@ 2014-04-16 15:19 ` Daniel Mack
  2014-04-16 19:14   ` Florian Fainelli
  2014-04-20 22:19   ` David Miller
  2014-04-16 19:14 ` [PATCH net-next RESEND 1/2] net: phy: export genphy_config_init() Florian Fainelli
  2014-04-20 22:19 ` David Miller
  2 siblings, 2 replies; 6+ messages in thread
From: Daniel Mack @ 2014-04-16 15:19 UTC (permalink / raw)
  To: netdev, f.fainelli; +Cc: davem, mugunthanvnm, ujhelyi.m, Daniel Mack

Use the generic bits from genphy_config_init() instead of implementing
the same functionality again.

Signed-off-by: Daniel Mack <zonque@gmail.com>
---
Resending this after 3.15-rc1 has been released, assuming that the
net-next tree is now open again.

 drivers/net/phy/at803x.c | 36 +++---------------------------------
 1 file changed, 3 insertions(+), 33 deletions(-)

diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index bc71947..850171f 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -141,41 +141,11 @@ static int at803x_resume(struct phy_device *phydev)
 
 static int at803x_config_init(struct phy_device *phydev)
 {
-	int val;
 	int ret;
-	u32 features;
-
-	features = SUPPORTED_TP | SUPPORTED_MII | SUPPORTED_AUI |
-		   SUPPORTED_FIBRE | SUPPORTED_BNC;
-
-	val = phy_read(phydev, MII_BMSR);
-	if (val < 0)
-		return val;
-
-	if (val & BMSR_ANEGCAPABLE)
-		features |= SUPPORTED_Autoneg;
-	if (val & BMSR_100FULL)
-		features |= SUPPORTED_100baseT_Full;
-	if (val & BMSR_100HALF)
-		features |= SUPPORTED_100baseT_Half;
-	if (val & BMSR_10FULL)
-		features |= SUPPORTED_10baseT_Full;
-	if (val & BMSR_10HALF)
-		features |= SUPPORTED_10baseT_Half;
-
-	if (val & BMSR_ESTATEN) {
-		val = phy_read(phydev, MII_ESTATUS);
-		if (val < 0)
-			return val;
-
-		if (val & ESTATUS_1000_TFULL)
-			features |= SUPPORTED_1000baseT_Full;
-		if (val & ESTATUS_1000_THALF)
-			features |= SUPPORTED_1000baseT_Half;
-	}
 
-	phydev->supported = features;
-	phydev->advertising = features;
+	ret = genphy_config_init(phydev);
+	if (ret < 0)
+		return ret;
 
 	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) {
 		ret = phy_write(phydev, AT803X_DEBUG_ADDR,
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next RESEND 1/2] net: phy: export genphy_config_init()
  2014-04-16 15:19 [PATCH net-next RESEND 1/2] net: phy: export genphy_config_init() Daniel Mack
  2014-04-16 15:19 ` [PATCH net-next RESEND 2/2] net: phy: at803x: use genphy_config_init() Daniel Mack
@ 2014-04-16 19:14 ` Florian Fainelli
  2014-04-20 22:19 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2014-04-16 19:14 UTC (permalink / raw)
  To: Daniel Mack; +Cc: netdev, David Miller, mugunthanvnm, ujhelyi.m

2014-04-16 8:19 GMT-07:00 Daniel Mack <zonque@gmail.com>:
> This enables other drivers to call this generic implementation, and then
> only do specific details on top of it.
>
> Signed-off-by: Daniel Mack <zonque@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

> ---
> Resending this after 3.15-rc1 has been released, assuming that the
> net-next tree is now open again.
>
>  drivers/net/phy/phy_device.c | 3 ++-
>  include/linux/phy.h          | 1 +
>  2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 2f6989b..84485ea 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -1029,7 +1029,7 @@ static int gen10g_read_status(struct phy_device *phydev)
>         return 0;
>  }
>
> -static int genphy_config_init(struct phy_device *phydev)
> +int genphy_config_init(struct phy_device *phydev)
>  {
>         int val;
>         u32 features;
> @@ -1074,6 +1074,7 @@ static int genphy_config_init(struct phy_device *phydev)
>
>         return 0;
>  }
> +EXPORT_SYMBOL(genphy_config_init);
>
>  static int gen10g_config_init(struct phy_device *phydev)
>  {
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index 565188c..dcf7f13 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -609,6 +609,7 @@ static inline int phy_read_status(struct phy_device *phydev)
>         return phydev->drv->read_status(phydev);
>  }
>
> +int genphy_config_init(struct phy_device *phydev);
>  int genphy_setup_forced(struct phy_device *phydev);
>  int genphy_restart_aneg(struct phy_device *phydev);
>  int genphy_config_aneg(struct phy_device *phydev);
> --
> 1.9.0
>



-- 
Florian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next RESEND 2/2] net: phy: at803x: use genphy_config_init()
  2014-04-16 15:19 ` [PATCH net-next RESEND 2/2] net: phy: at803x: use genphy_config_init() Daniel Mack
@ 2014-04-16 19:14   ` Florian Fainelli
  2014-04-20 22:19   ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2014-04-16 19:14 UTC (permalink / raw)
  To: Daniel Mack; +Cc: netdev, David Miller, mugunthanvnm, ujhelyi.m

2014-04-16 8:19 GMT-07:00 Daniel Mack <zonque@gmail.com>:
> Use the generic bits from genphy_config_init() instead of implementing
> the same functionality again.
>
> Signed-off-by: Daniel Mack <zonque@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

> ---
> Resending this after 3.15-rc1 has been released, assuming that the
> net-next tree is now open again.
>
>  drivers/net/phy/at803x.c | 36 +++---------------------------------
>  1 file changed, 3 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
> index bc71947..850171f 100644
> --- a/drivers/net/phy/at803x.c
> +++ b/drivers/net/phy/at803x.c
> @@ -141,41 +141,11 @@ static int at803x_resume(struct phy_device *phydev)
>
>  static int at803x_config_init(struct phy_device *phydev)
>  {
> -       int val;
>         int ret;
> -       u32 features;
> -
> -       features = SUPPORTED_TP | SUPPORTED_MII | SUPPORTED_AUI |
> -                  SUPPORTED_FIBRE | SUPPORTED_BNC;
> -
> -       val = phy_read(phydev, MII_BMSR);
> -       if (val < 0)
> -               return val;
> -
> -       if (val & BMSR_ANEGCAPABLE)
> -               features |= SUPPORTED_Autoneg;
> -       if (val & BMSR_100FULL)
> -               features |= SUPPORTED_100baseT_Full;
> -       if (val & BMSR_100HALF)
> -               features |= SUPPORTED_100baseT_Half;
> -       if (val & BMSR_10FULL)
> -               features |= SUPPORTED_10baseT_Full;
> -       if (val & BMSR_10HALF)
> -               features |= SUPPORTED_10baseT_Half;
> -
> -       if (val & BMSR_ESTATEN) {
> -               val = phy_read(phydev, MII_ESTATUS);
> -               if (val < 0)
> -                       return val;
> -
> -               if (val & ESTATUS_1000_TFULL)
> -                       features |= SUPPORTED_1000baseT_Full;
> -               if (val & ESTATUS_1000_THALF)
> -                       features |= SUPPORTED_1000baseT_Half;
> -       }
>
> -       phydev->supported = features;
> -       phydev->advertising = features;
> +       ret = genphy_config_init(phydev);
> +       if (ret < 0)
> +               return ret;
>
>         if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) {
>                 ret = phy_write(phydev, AT803X_DEBUG_ADDR,
> --
> 1.9.0
>



-- 
Florian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next RESEND 1/2] net: phy: export genphy_config_init()
  2014-04-16 15:19 [PATCH net-next RESEND 1/2] net: phy: export genphy_config_init() Daniel Mack
  2014-04-16 15:19 ` [PATCH net-next RESEND 2/2] net: phy: at803x: use genphy_config_init() Daniel Mack
  2014-04-16 19:14 ` [PATCH net-next RESEND 1/2] net: phy: export genphy_config_init() Florian Fainelli
@ 2014-04-20 22:19 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2014-04-20 22:19 UTC (permalink / raw)
  To: zonque; +Cc: netdev, f.fainelli, mugunthanvnm, ujhelyi.m

From: Daniel Mack <zonque@gmail.com>
Date: Wed, 16 Apr 2014 17:19:12 +0200

> This enables other drivers to call this generic implementation, and then
> only do specific details on top of it.
> 
> Signed-off-by: Daniel Mack <zonque@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next RESEND 2/2] net: phy: at803x: use genphy_config_init()
  2014-04-16 15:19 ` [PATCH net-next RESEND 2/2] net: phy: at803x: use genphy_config_init() Daniel Mack
  2014-04-16 19:14   ` Florian Fainelli
@ 2014-04-20 22:19   ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2014-04-20 22:19 UTC (permalink / raw)
  To: zonque; +Cc: netdev, f.fainelli, mugunthanvnm, ujhelyi.m

From: Daniel Mack <zonque@gmail.com>
Date: Wed, 16 Apr 2014 17:19:13 +0200

> Use the generic bits from genphy_config_init() instead of implementing
> the same functionality again.
> 
> Signed-off-by: Daniel Mack <zonque@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-20 22:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-16 15:19 [PATCH net-next RESEND 1/2] net: phy: export genphy_config_init() Daniel Mack
2014-04-16 15:19 ` [PATCH net-next RESEND 2/2] net: phy: at803x: use genphy_config_init() Daniel Mack
2014-04-16 19:14   ` Florian Fainelli
2014-04-20 22:19   ` David Miller
2014-04-16 19:14 ` [PATCH net-next RESEND 1/2] net: phy: export genphy_config_init() Florian Fainelli
2014-04-20 22:19 ` David Miller

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).