netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: net: cpsw-phy-sel: add dev_warn() for unsupported PHY mode
@ 2016-02-13  0:45 David Rivshin (Allworx)
  2016-02-15  6:15 ` Mugunthan V N
  2016-02-17 15:51 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: David Rivshin (Allworx) @ 2016-02-13  0:45 UTC (permalink / raw)
  To: netdev
  Cc: Nicolas Chauvet, Mugunthan V N, linux-omap, David Miller,
	linux-arm-kernel

From: David Rivshin <drivshin@allworx.com>

The cpsw-phy-sel driver supports only MII, RMII, and RGMII PHY modes,
and silently handled any other values as if MII was specified. In a
case where the PHY mode was incorrectly specified, or a bug elsewhere,
there would be no indication of a problem. If MII was the correct mode,
then this will go unnoticed, otherwise the symptom will be a failure
to transmit/receive data over the RMII/RGMII link.

Add a dev_warn() to make this condition obvious and provide a
breadcrumb to follow.

Cc: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: David Rivshin <drivshin@allworx.com>
---

Dave,
 I'm not sure if you'd consider this net or net-next material, but it will
apply cleanly to either. Indeed, if you want it for -stable, it applies back
as far as 3.18.

 drivers/net/ethernet/ti/cpsw-phy-sel.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c b/drivers/net/ethernet/ti/cpsw-phy-sel.c
index e9cc61e..c3e85ac 100644
--- a/drivers/net/ethernet/ti/cpsw-phy-sel.c
+++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c
@@ -63,8 +63,12 @@ static void cpsw_gmii_sel_am3352(struct cpsw_phy_sel_priv *priv,
 		mode = AM33XX_GMII_SEL_MODE_RGMII;
 		break;
 
-	case PHY_INTERFACE_MODE_MII:
 	default:
+		dev_warn(priv->dev,
+			 "Unsupported PHY mode: \"%s\". Defaulting to MII.\n",
+			phy_modes(phy_mode));
+		/* fallthrough */
+	case PHY_INTERFACE_MODE_MII:
 		mode = AM33XX_GMII_SEL_MODE_MII;
 		break;
 	};
@@ -106,8 +110,12 @@ static void cpsw_gmii_sel_dra7xx(struct cpsw_phy_sel_priv *priv,
 		mode = AM33XX_GMII_SEL_MODE_RGMII;
 		break;
 
-	case PHY_INTERFACE_MODE_MII:
 	default:
+		dev_warn(priv->dev,
+			 "Unsupported PHY mode: \"%s\". Defaulting to MII.\n",
+			phy_modes(phy_mode));
+		/* fallthrough */
+	case PHY_INTERFACE_MODE_MII:
 		mode = AM33XX_GMII_SEL_MODE_MII;
 		break;
 	};
-- 
2.5.0

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

* Re: [PATCH] drivers: net: cpsw-phy-sel: add dev_warn() for unsupported PHY mode
  2016-02-13  0:45 [PATCH] drivers: net: cpsw-phy-sel: add dev_warn() for unsupported PHY mode David Rivshin (Allworx)
@ 2016-02-15  6:15 ` Mugunthan V N
  2016-02-17 15:51 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Mugunthan V N @ 2016-02-15  6:15 UTC (permalink / raw)
  To: David Rivshin (Allworx), netdev
  Cc: linux-arm-kernel, linux-omap, David Miller, Nicolas Chauvet

On Saturday 13 February 2016 06:15 AM, David Rivshin (Allworx) wrote:
> From: David Rivshin <drivshin@allworx.com>
> 
> The cpsw-phy-sel driver supports only MII, RMII, and RGMII PHY modes,
> and silently handled any other values as if MII was specified. In a
> case where the PHY mode was incorrectly specified, or a bug elsewhere,
> there would be no indication of a problem. If MII was the correct mode,
> then this will go unnoticed, otherwise the symptom will be a failure
> to transmit/receive data over the RMII/RGMII link.
> 
> Add a dev_warn() to make this condition obvious and provide a
> breadcrumb to follow.
> 
> Cc: Mugunthan V N <mugunthanvnm@ti.com>
> Signed-off-by: David Rivshin <drivshin@allworx.com>

Acked-by: Mugunthan V N <mugunthanvnm@ti.com>

Regards
Mugunthan V N

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

* Re: [PATCH] drivers: net: cpsw-phy-sel: add dev_warn() for unsupported PHY mode
  2016-02-13  0:45 [PATCH] drivers: net: cpsw-phy-sel: add dev_warn() for unsupported PHY mode David Rivshin (Allworx)
  2016-02-15  6:15 ` Mugunthan V N
@ 2016-02-17 15:51 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-02-17 15:51 UTC (permalink / raw)
  To: drivshin.allworx
  Cc: netdev, linux-arm-kernel, linux-omap, mugunthanvnm, kwizart

From: "David Rivshin (Allworx)" <drivshin.allworx@gmail.com>
Date: Fri, 12 Feb 2016 19:45:36 -0500

> From: David Rivshin <drivshin@allworx.com>
> 
> The cpsw-phy-sel driver supports only MII, RMII, and RGMII PHY modes,
> and silently handled any other values as if MII was specified. In a
> case where the PHY mode was incorrectly specified, or a bug elsewhere,
> there would be no indication of a problem. If MII was the correct mode,
> then this will go unnoticed, otherwise the symptom will be a failure
> to transmit/receive data over the RMII/RGMII link.
> 
> Add a dev_warn() to make this condition obvious and provide a
> breadcrumb to follow.
> 
> Cc: Mugunthan V N <mugunthanvnm@ti.com>
> Signed-off-by: David Rivshin <drivshin@allworx.com>

Applied to 'net', thanks.  I don't think I'll queue this up for -stable.

Thanks.

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

end of thread, other threads:[~2016-02-17 15:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-13  0:45 [PATCH] drivers: net: cpsw-phy-sel: add dev_warn() for unsupported PHY mode David Rivshin (Allworx)
2016-02-15  6:15 ` Mugunthan V N
2016-02-17 15:51 ` 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).