From patchwork Sat Feb 13 00:45:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "David Rivshin (Allworx)" X-Patchwork-Id: 8299111 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C407AC02AA for ; Sat, 13 Feb 2016 00:47:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EC7DC20444 for ; Sat, 13 Feb 2016 00:47:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0F07E2045E for ; Sat, 13 Feb 2016 00:47:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752187AbcBMArn (ORCPT ); Fri, 12 Feb 2016 19:47:43 -0500 Received: from mail-qg0-f51.google.com ([209.85.192.51]:36570 "EHLO mail-qg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751965AbcBMAq7 (ORCPT ); Fri, 12 Feb 2016 19:46:59 -0500 Received: by mail-qg0-f51.google.com with SMTP id y9so75699368qgd.3; Fri, 12 Feb 2016 16:46:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=p1KbmBPKUWkmDAqffJLwGdaXfU5a8USTCBxzWyAwVZs=; b=ZuY6Q60oEiz8fkex9WIuimIEG2+aPQsfi5G6t5ZuW+49WNfjpv6URnNKuUqMWUeTiZ vfZBSmF4ghLQcjr3oF17RYb2PJUehasHHDqgrfm9G6RZPq++/f9gWhqdPN9+mPeopDLP 2Nz/WcWzJiQCf98PdIuUHZ6I3Ezr5XwANS5nUZEQuBJwZMnoLt9AL3368SqBoNnhFRZi j+DNHUN4/AI4+JhjaU+OQ1cI9Ef3PSdaEjvd9r3312KPktarN2RNRyzay1bCEgey6/FV T9vqrWnVVqO6AmT01LFNu7mj3emNOyTWZ3QJXRIOGqI/9jsXk9NRVxWtRsHfKaNvci8a 2xmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=p1KbmBPKUWkmDAqffJLwGdaXfU5a8USTCBxzWyAwVZs=; b=d64GmgdqcfKYuWPWqSWZq4gByfLjID5vfn0Q3DxLPpHCqWBIpEhMOEhX6FzKSgYikC SdiXTGlxdoEsxn+h79IEm3aRT3YF+sqZ/9hippIxsQZ5v8QddREDLQJ6sKzOhdwxPh4g /WTEtiinKo4/pncJ7PIb/scH5ugd4s8E/sAg+JJWtMfq3QDGiDqio0ghaGaWnWSmsfNC gNvUgetvnIxraCwQ/h7qGS7IrC+nWjjHAISsGEmVYNmtEtCzg+B117iCBzNkeE1I/ZYc NrVb35qJkUM0TZzIcQK7/zCfgevr0/SiG5m6NCfDL64bHt7tyce4/HH1SXIiBzCloC4T T6HQ== X-Gm-Message-State: AG10YOQnuFV9bHDnfRRmclPz2dbdcGZLtoj5sJcnrkwV468I+3TYk9qe9wFrlL4Xqb9Rww== X-Received: by 10.140.250.138 with SMTP id v132mr6130803qhc.0.1455324417910; Fri, 12 Feb 2016 16:46:57 -0800 (PST) Received: from drivshin-linux.crosskeys.inscitek.com ([24.213.148.66]) by smtp.gmail.com with ESMTPSA id y200sm6567355qka.48.2016.02.12.16.46.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Feb 2016 16:46:57 -0800 (PST) From: "David Rivshin (Allworx)" To: netdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, David Miller , Mugunthan V N , Nicolas Chauvet Subject: [PATCH] drivers: net: cpsw-phy-sel: add dev_warn() for unsupported PHY mode Date: Fri, 12 Feb 2016 19:45:36 -0500 Message-Id: <1455324336-3884-1-git-send-email-drivshin.allworx@gmail.com> X-Mailer: git-send-email 2.5.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: David Rivshin 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 Signed-off-by: David Rivshin Acked-by: Mugunthan V N --- 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; };