From patchwork Tue Feb 16 21:17:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12090617 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9A79C433E6 for ; Tue, 16 Feb 2021 21:19:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9843764E2B for ; Tue, 16 Feb 2021 21:19:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230384AbhBPVTF (ORCPT ); Tue, 16 Feb 2021 16:19:05 -0500 Received: from mx0d-0054df01.pphosted.com ([67.231.150.19]:29162 "EHLO mx0d-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230199AbhBPVSw (ORCPT ); Tue, 16 Feb 2021 16:18:52 -0500 Received: from pps.filterd (m0209000.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 11GL6cwL010488; Tue, 16 Feb 2021 16:18:01 -0500 Received: from can01-to1-obe.outbound.protection.outlook.com (mail-to1can01lp2053.outbound.protection.outlook.com [104.47.61.53]) by mx0c-0054df01.pphosted.com with ESMTP id 36pcj9gyqf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Feb 2021 16:18:01 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jnekAv20qJiwhAyw+l8244GoEg8V47H1w6QbnKvLP5lqK5CpS5IjERUAr2weFtz8dVScEexjq+zei7tWGn6MkFjIPvUzMIKS9a5WIB8Nz8evoM8eBCt/4rfjunWklphI6E9dtuRY37WnBp+u1fDq0qTh/nrDBwaYN5KGacsutP0vtcngW55W4sCbdYNw6/kjYYR/0HxdzNaRG6MY9FPvLt9C9TL/T3zSwnSKsg0l1cWyClx1WMs3pGIhZ5fgS0dpTtv08TR7E6DbpqkUC2Oe34g9jr4Q/P7mW83mPeQ5ZwjtWMWoIdafCQtbyhW6JGpp87NixVnHGdcILkTXnujGIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=icEjO0IsopSKN8QUbaC3WVcRX1Z4IJrC6j2EPST1Kt4=; b=cAOsagd2Xv8WtfH/TA9jsSBG/n0g6vbq3hodZoyWETAZw/L9jdVPrKqnfX9Q1Lbc75e+61HqS+lc+j95NdNzd/iHgLPNRxaglzUUSh0RcmLINzt1+OT9e0OhkPoCQMolVw585y4hjMqNUH28wIidF0533fJw909KrabSrxLOhbfLav/zBzPIA//OQXdHeQBc4fmsBM6uCDBnBBKERE+2XODRNBF68DhKad/Dr/j+j4QHl7vaeg4BLOfiLEhM4tfWcMxlXUSZLysb+PZr3I4iBJdl7cnD+QCw0iASnQW49CKVbviyu5ANXtXaAH521HNMUqntt/lJYEnEkrw6JQ+eTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=icEjO0IsopSKN8QUbaC3WVcRX1Z4IJrC6j2EPST1Kt4=; b=FG9lyuVuLc0TbQoms5LgS/R4oes7Ra4n/E4XRbGH4Nj6yshA4SsaSX5SuXvjUmrtTDOMI9m6BP5tGXM7o7tRLmWPMPb7uu305Qu4PHdtaEoTonNeicleDHdC+cuDQV5p87+x71+nTvHzpsxokWX0zzTONVHR0m9Mh2S9UYbR5Tk= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=calian.com; Received: from YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:f::20) by YTXPR0101MB0879.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b00:6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.39; Tue, 16 Feb 2021 21:17:57 +0000 Received: from YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM ([fe80::3172:da27:cec8:e96]) by YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM ([fe80::3172:da27:cec8:e96%7]) with mapi id 15.20.3846.038; Tue, 16 Feb 2021 21:17:57 +0000 From: Robert Hancock To: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net, kuba@kernel.org Cc: f.fainelli@gmail.com, linux@armlinux.org.uk, bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org, Robert Hancock Subject: [PATCH net-next v3 1/3] net: phy: broadcom: Set proper 1000BaseX/SGMII interface mode for BCM54616S Date: Tue, 16 Feb 2021 15:17:19 -0600 Message-Id: <20210216211721.2884984-2-robert.hancock@calian.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210216211721.2884984-1-robert.hancock@calian.com> References: <20210216211721.2884984-1-robert.hancock@calian.com> X-Originating-IP: [204.83.154.189] X-ClientProxiedBy: DM3PR14CA0128.namprd14.prod.outlook.com (2603:10b6:0:53::12) To YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:f::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (204.83.154.189) by DM3PR14CA0128.namprd14.prod.outlook.com (2603:10b6:0:53::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Tue, 16 Feb 2021 21:17:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cc98e2ec-7925-4c0c-2871-08d8d2c054c8 X-MS-TrafficTypeDiagnostic: YTXPR0101MB0879: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /uBZXGqTcmX6Ze/C2aRcyjftgT5OuXDUXpyiFWNRliOgy5YsnEBwZVpeujGPxArBvzs/yxbGvT5dCElUCulLFC88QUbuKQvpyYhrrkR7HDi/hibZP7SxzkBNI4MRN2HIOPdJNERzbXqoZXy6xruX+qHmzfchM2ZF3MaPXa81rVXjm4+fDQtWgPIOd+Jh7XM8+UoNocpeo/0/B6Spgnkqy+UDLaeTolRNzEQIJMY+0JTvDstfP9fDQxT3jeOczVdyGxKbSDjARnhCi5PvJfjfKutlYSZfHjUCb9IIPsrcf0vvZhYprIcf2xJXSV3dmkW4d7Xp4ctTNxX3yQnkJwBJu15sPuXdX32awZR/jyw8Cqbk0JZNhu9NrX3DvlqQUAW+ajgSHuEeUYVw6KDgJIR6m7LFuw1pZrTv+xKFcMswgkziZnyXlDtdAF66gBKr/fDHXa4UsvZPuv5fpSoK2GtUUStoghqk0XdGD3uJYOarrM8bXwxYHQnNXbo/QbBESErYdCWZK9VJvcoucvj9ny/UycxytW2Ube6hfiVzQX+6YCotheAn0eh25A0hdm03rLQ7aAxxvonTNKKtLy6Avc3VPkCdLJ/rLkFhxa20ijKW0wFBLE/5Oygof6AwVhlaHj16HXCL5eOJQojq6XHh1Fw8Hg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(136003)(396003)(376002)(39850400004)(366004)(346002)(8936002)(8676002)(956004)(6486002)(66476007)(1076003)(66946007)(316002)(186003)(4326008)(6666004)(2616005)(6506007)(16526019)(36756003)(478600001)(966005)(5660300002)(69590400012)(52116002)(107886003)(83380400001)(66556008)(26005)(2906002)(44832011)(6512007)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Cd4Kp0q7PQScR7ZQ9OqoFqc4TpY72MRGwwxUutCI252vZfakJRke34v/lr0rN20h7NbfOkhdVzyiCpe03xzk5qRLx+B2GnPYghox1nF3qxuNuIyTTCrzS142WiV9Uo6rsb3L0kU2wmedewcfXDPFGXeJHVt3AxwTYByqIx+BlZfUKCw08rJV3R0ha7tz00roKxiJ4rapkf6/ia4ePzBJANd6By7t/SvvWPpiMqblxA0qIF5m4pWoZqTbiKkIQIbStQe6sTHxBnKIK1LQdQV6C3PLLy6iIRqeWJ73/yBw2Q0vSoSyrcydhp8eejxfxlXZmWdMI7yfK484dqiWZp4IkjTS22nFmulx0/MnR9zr5iK/DEEU1YP7mxflH+8ruvllWxC0Fc3bFTSBxk91x7xqerVfNPHOhq7S2Us+soFHZOqRtDm36b6HRTHM1FYsgg3k8nRmoyxDCEODhYl8STQiQd7keErmJjhXuiXmjwSxi5Kev6paEGT0QAeySEjA7UWeyRDGI7xnTIxiIZnRW60vIfxghYMFPxNJrQQEOPW02uWpI7OVfVd8eWbNJ6DRw7AeqRsR3JVgyaA4p0GZZZMXkgHSPhNT6MZWJYZGRNT57Ib27H1772IFWgsgYnQRWDed5WRg25u1YJhFWJGtrVu+z9r45gKuO09fiKwSGrzmImpWAU63RDC8qY4P5skbQwEJH/BJC4fxUrmlxVVERiBdIqoBxBKmGFi+7mpQJHT+ZUsFt6gUpMsxoSVPDlN3hY4vDE060ThHK6Vk2J7okFgOn+mwxwKNcE48/TGTzfuX5Ke7n8WXE4CdpcvYLxooeWLL6klPLDOdVtszqVbEJ/3ZAJJPjiMAWFbdgG1790tcwWC/xurbl+avNaawwsXV0poXntj+XU0z853G3XZUurUHsivzEF+eg4ywMI3JexA+5C6iKjsA41igzbaJnvPntu267vyKbooSuE+0ToseIiLcQh7aHA0AAncaIHn+kwTkr5kWw6vhNUfD6vJjbgw/TafC0dDOdJOKovlwRXy8yvjFG3+q7caNXZ+3RMZhCZmSp+akhNJDE10UQ6lnvA+p1u57CX4Bp1pqDWmz8N4XLt/c6z2QjUbC1V8IHX6Gum6xz5sVgJFFzTsoUavS2WNvQY9xvBEE/UBAV7mkydif9TTm03tuLKVb9R/z+aifn/zMgyZp4b1Vdq50HuMjLWpWEUdTpbPpICxpNKah9/Es6yjVBeWTjAmycOqTD5Jmc+FhEZDbU3engGrDy7nR/yspXzEe2hdEBDrHKvkqUDKICmZ6bulE4YZS0ZFtVpiv6o0FzCezOpyowMNSv0GVelKoS3O4 X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc98e2ec-7925-4c0c-2871-08d8d2c054c8 X-MS-Exchange-CrossTenant-AuthSource: YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2021 21:17:57.2611 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bP/0AmcUl5+RX6/yYUS/m/TkKYsB585MfJuF+J9oB91NhTUF6OIS84HbLIm8yO5M2y3CUaa1gVc0y0JjDm2XAfbNkkAj64mHh1k4MrXmSRw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTXPR0101MB0879 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-02-16_12:2021-02-16,2021-02-16 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 bulkscore=0 impostorscore=0 clxscore=1015 phishscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102160172 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The default configuration for the BCM54616S PHY may not match the desired mode when using 1000BaseX or SGMII interface modes, such as when it is on an SFP module. Add code to explicitly set the correct mode using programming sequences provided by Bel-Fuse: https://www.belfuse.com/resources/datasheets/powersolutions/ds-bps-sfp-1gbt-05-series.pdf https://www.belfuse.com/resources/datasheets/powersolutions/ds-bps-sfp-1gbt-06-series.pdf Signed-off-by: Robert Hancock Acked-by: Florian Fainelli --- drivers/net/phy/broadcom.c | 84 ++++++++++++++++++++++++++++++++------ include/linux/brcmphy.h | 4 ++ 2 files changed, 76 insertions(+), 12 deletions(-) diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index 91fbd26c809e..8e7fc3368380 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -103,6 +103,64 @@ static int bcm54612e_config_init(struct phy_device *phydev) return 0; } +static int bcm54616s_config_init(struct phy_device *phydev) +{ + int rc, val; + + if (phydev->interface != PHY_INTERFACE_MODE_SGMII && + phydev->interface != PHY_INTERFACE_MODE_1000BASEX) + return 0; + + /* Ensure proper interface mode is selected. */ + /* Disable RGMII mode */ + val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC); + if (val < 0) + return val; + val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_EN; + val |= MII_BCM54XX_AUXCTL_MISC_WREN; + rc = bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, + val); + if (rc < 0) + return rc; + + /* Select 1000BASE-X register set (primary SerDes) */ + val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_MODE); + if (val < 0) + return val; + val |= BCM54XX_SHD_MODE_1000BX; + rc = bcm_phy_write_shadow(phydev, BCM54XX_SHD_MODE, val); + if (rc < 0) + return rc; + + /* Power down SerDes interface */ + rc = phy_set_bits(phydev, MII_BMCR, BMCR_PDOWN); + if (rc < 0) + return rc; + + /* Select proper interface mode */ + val &= ~BCM54XX_SHD_INTF_SEL_MASK; + val |= phydev->interface == PHY_INTERFACE_MODE_SGMII ? + BCM54XX_SHD_INTF_SEL_SGMII : + BCM54XX_SHD_INTF_SEL_GBIC; + rc = bcm_phy_write_shadow(phydev, BCM54XX_SHD_MODE, val); + if (rc < 0) + return rc; + + /* Power up SerDes interface */ + rc = phy_clear_bits(phydev, MII_BMCR, BMCR_PDOWN); + if (rc < 0) + return rc; + + /* Select copper register set */ + val &= ~BCM54XX_SHD_MODE_1000BX; + rc = bcm_phy_write_shadow(phydev, BCM54XX_SHD_MODE, val); + if (rc < 0) + return rc; + + /* Power up copper interface */ + return phy_clear_bits(phydev, MII_BMCR, BMCR_PDOWN); +} + /* Needs SMDSP clock enabled via bcm54xx_phydsp_config() */ static int bcm50610_a0_workaround(struct phy_device *phydev) { @@ -283,15 +341,17 @@ static int bcm54xx_config_init(struct phy_device *phydev) bcm54xx_adjust_rxrefclk(phydev); - if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54210E) { + switch (BRCM_PHY_MODEL(phydev)) { + case PHY_ID_BCM54210E: err = bcm54210e_config_init(phydev); - if (err) - return err; - } else if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54612E) { + break; + case PHY_ID_BCM54612E: err = bcm54612e_config_init(phydev); - if (err) - return err; - } else if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) { + break; + case PHY_ID_BCM54616S: + err = bcm54616s_config_init(phydev); + break; + case PHY_ID_BCM54810: /* For BCM54810, we need to disable BroadR-Reach function */ val = bcm_phy_read_exp(phydev, BCM54810_EXP_BROADREACH_LRE_MISC_CTL); @@ -299,9 +359,10 @@ static int bcm54xx_config_init(struct phy_device *phydev) err = bcm_phy_write_exp(phydev, BCM54810_EXP_BROADREACH_LRE_MISC_CTL, val); - if (err < 0) - return err; + break; } + if (err) + return err; bcm54xx_phydsp_config(phydev); @@ -390,7 +451,7 @@ struct bcm54616s_phy_priv { static int bcm54616s_probe(struct phy_device *phydev) { struct bcm54616s_phy_priv *priv; - int val, intf_sel; + int val; priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -408,8 +469,7 @@ static int bcm54616s_probe(struct phy_device *phydev) * RGMII-1000Base-X is properly supported, but RGMII-100Base-FX * support is still missing as of now. */ - intf_sel = (val & BCM54XX_SHD_INTF_SEL_MASK) >> 1; - if (intf_sel == 1) { + if ((val & BCM54XX_SHD_INTF_SEL_MASK) == BCM54XX_SHD_INTF_SEL_RGMII) { val = bcm_phy_read_shadow(phydev, BCM54616S_SHD_100FX_CTRL); if (val < 0) return val; diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h index 16597d3fa011..70303c94763f 100644 --- a/include/linux/brcmphy.h +++ b/include/linux/brcmphy.h @@ -132,6 +132,7 @@ #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x07 #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_WIRESPEED_EN 0x0010 +#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_EN 0x0080 #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN 0x0100 #define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX 0x0200 #define MII_BCM54XX_AUXCTL_MISC_WREN 0x8000 @@ -219,6 +220,9 @@ /* 11111: Mode Control Register */ #define BCM54XX_SHD_MODE 0x1f #define BCM54XX_SHD_INTF_SEL_MASK GENMASK(2, 1) /* INTERF_SEL[1:0] */ +#define BCM54XX_SHD_INTF_SEL_RGMII 0x02 +#define BCM54XX_SHD_INTF_SEL_SGMII 0x04 +#define BCM54XX_SHD_INTF_SEL_GBIC 0x06 #define BCM54XX_SHD_MODE_1000BX BIT(0) /* Enable 1000-X registers */ /* From patchwork Tue Feb 16 21:17:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12090619 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE400C433E0 for ; Tue, 16 Feb 2021 21:19:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B178664E57 for ; Tue, 16 Feb 2021 21:19:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230391AbhBPVTN (ORCPT ); Tue, 16 Feb 2021 16:19:13 -0500 Received: from mx0d-0054df01.pphosted.com ([67.231.150.19]:2376 "EHLO mx0d-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230388AbhBPVTH (ORCPT ); Tue, 16 Feb 2021 16:19:07 -0500 Received: from pps.filterd (m0209000.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 11GL6a1T010454; Tue, 16 Feb 2021 16:18:18 -0500 Received: from can01-to1-obe.outbound.protection.outlook.com (mail-to1can01lp2057.outbound.protection.outlook.com [104.47.61.57]) by mx0c-0054df01.pphosted.com with ESMTP id 36pcj9gyqh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Feb 2021 16:18:18 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hVOddVzgmND+Fy6uF8QrNMusTityRsmfeTrzLUW7LVb5O1d+gj7OhrSeMUxw0CUrulCanFJwciqe9x6azvLnpxbC2GDcYM7y64DhFxD88q3mZMatq/m4AdZCJnnFFwqfVXtRVSethadfixYqm7/IEJImzRqqZEEzxsZRHKq+9tRQjWdyrkMGWDFH+uJjA5N+C7pnp4g6k7u4WGlrSpo73dpX26PebOcvekEjRa+9XxE/x0jyu/kkf270l57kIM2WrPCZMrq/gDPm/NjPCu9lrUep8+z9kRBnNCVXJnPeKwpb0w5ky4mwSiOoOIMzjZ0wISKZAubbdXvome5zGUsGUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PRE2w+tyqjdyKuxeLZwmm2YsB/ZFGer0b1ibIJ2mExM=; b=B6qgssvPQSIKBpwcgAItXn/RP+6l3vYCGSScCjSS4AcTLPIBdTTyIjR8AxdiWLCakyTb0xChFHDJ5NCQJkej8EXxJI1uk9WaBmz3cHe5ofxS6uN3UgnOchl6BBHPpQ9BFn50GK+y9gGrjrrk6g5SIeE78UgBu1UCZGqgrGGgPKKrL72BlgiWEjiYl35PFHiNhxcw0mcBAqYbpXqIfikkyrs2YF61D203fW+QnoxiJ4mOM/BfuBMdXuq9LuUVkdNoHFdxw9SMfeMtRoTbIxu3/Odg9jz3V+g5dLkYy/9rYWx7leqyO8lxwASaOnDVcEA8UKYEmVXUBkm1lSpfbtzl1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PRE2w+tyqjdyKuxeLZwmm2YsB/ZFGer0b1ibIJ2mExM=; b=iR2Ipnv93KYyUizlq+pKcoQEn8pCL4UZqZL4KQWc41Eyg0p2SDmH3II0Ii7WRTvpxl4qUOmGxDdJrVhPWOJbFMZ0o/bMcvvg4pR9pHOXNDfocQ8EJSsdRXswcWoJt+HbPHsAusiSNzj+XWAQDRRLds7wUQ/HvYRdKNf/6aUpnDs= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=calian.com; Received: from YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:f::20) by YTXPR0101MB0879.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b00:6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.39; Tue, 16 Feb 2021 21:18:06 +0000 Received: from YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM ([fe80::3172:da27:cec8:e96]) by YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM ([fe80::3172:da27:cec8:e96%7]) with mapi id 15.20.3846.038; Tue, 16 Feb 2021 21:18:06 +0000 From: Robert Hancock To: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net, kuba@kernel.org Cc: f.fainelli@gmail.com, linux@armlinux.org.uk, bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org, Robert Hancock Subject: [PATCH net-next v3 2/3] net: phy: Add is_on_sfp_module flag and phy_on_sfp helper Date: Tue, 16 Feb 2021 15:17:20 -0600 Message-Id: <20210216211721.2884984-3-robert.hancock@calian.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210216211721.2884984-1-robert.hancock@calian.com> References: <20210216211721.2884984-1-robert.hancock@calian.com> X-Originating-IP: [204.83.154.189] X-ClientProxiedBy: DM3PR14CA0128.namprd14.prod.outlook.com (2603:10b6:0:53::12) To YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:f::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (204.83.154.189) by DM3PR14CA0128.namprd14.prod.outlook.com (2603:10b6:0:53::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Tue, 16 Feb 2021 21:18:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 92760bfd-ddd8-4ff3-57cb-08d8d2c05a14 X-MS-TrafficTypeDiagnostic: YTXPR0101MB0879: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PgTQ3/ioRyL/DzM6P0nDBKEDz7K/CZ/F0lFqNRb2fmtQpkJ5CIGf3bDc5a/cd1RiNsMLSBdA0O/FMCf7BifOS/HJXwL1XhBZ+3oWVN5yothGw2zFaV61Y255h2aQwWcxPRhqs56AHYYs0iO/JJ3dU/4QoJpnTMFjYIzMMSK+CZIjg1YexRLjoHiVl+Cm5XQp5SXDqz8h63ua7kWVZ+kXjwaqojgaIE28cgKxCKS8iWViiJd1EpaoZHGq062EaBXYLEsjMpgMn7KGnBSrxG8Qdwu4/wYFWcBd4ErQrS4ZB5j9Xakj6vhKEmpKPOMlSirABh6tnwjQsUl4mX4y0qaEx4bcyuqIoj08lQkt0N2aArfrdFwOHjURJvGPmeFt0kndoKwOWw9YONMzKMHksjGi1rz7P4OtZjXReKFM+ICqLGKawCYV0vzTx465Gfk2t+EC6Si9mfnqL0zagDaeXJnv5RPdowpUPORhq8HBChyJOU1UQuwqTGZ8fDUxUXNoWYZ78PzZ3fik/RnCXQUpYgwdcsQ6OYm8EJf/zdfViEXbLoWS2NVF6hzVzVk0lGO6rrE9X+NXH72S0bM6Cb34tJJxvQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(136003)(396003)(376002)(39850400004)(366004)(346002)(8936002)(8676002)(956004)(6486002)(66476007)(1076003)(66946007)(316002)(186003)(4326008)(6666004)(2616005)(6506007)(16526019)(36756003)(478600001)(5660300002)(69590400012)(52116002)(107886003)(83380400001)(66556008)(26005)(2906002)(44832011)(6512007)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: SwlRol5+F/1OHThj2SsjhYaHba710DSNCkjOKzM8aOpy+aq1eqce39PIIm2cyOQGsd8GhF4uyhFfbj59zpASSdJvM7W8cNhh50uHkGTbo+4ZKJCs/N1ZS3hhfTMV+h6b3lJrZgtMAGrlWP1xgMqYM6QcEiSlPnOqlAwULj4+V2W/4c8Io7rzYBxOsv0F2PWCOWNasg9KgF4ss3aTbsNJ/vdpecIK7i4bMf3488Ov/gHc02TssEZuRLCoMt56/T72e8TjR6HwJnGao5VMTkE+yLSgodvdIpYvYw1OiCPs/sB6E03zBv25GjrXThno0HgfeNC9yms0BW84DyjbPFT3OkfgE7zde70KVs+7koQqqp1IjBXHUevwNDRh2d6zl77/PeRitnQ9f/PYvS0hDqC7E2RkXe++u1Wfaf5tb+RI5yqfU5I/bfd8YnTJXGYti7uErY8WUvE7VQ2E2l2jMJH7IjxbMENLxvdxpEDUPgSWFeItINmeSvbR/HB6jM5TqmH2bwtH00MpJQfV76RbHzFKdM8d7L4WvDu0Ah7FssOxEeLVuHmeCVUTuiip9FpX8GTCVHYSbGNLF3IRunD1BDxDoKWsBLr74MBujXD7lDkcOhGqtLLOq5sQxAVOmOAEAnW74t/lmNEFNIArzIXelDkq67Gcr+DxGU5SU7sMgDtewquhOMPdNAaFTyKJNLvc7c8+U29DLqvt0rNkJ2IGxGUbJCCZoYxZZ/oKVyF478ugbn4pFa0MVOkorRfLlD0tn9tJ3+2lauoe+tWIDmSvh7YHj50bQbZ7syzr5ea/2I3klXfjHXgStKzsfgIzfpyo/8k/RjySf14DdBY/7wgp2YKvL6Im3n3a8ZI79wuUSJuwoHD4wYHKm4nVXrnA1QPySz3yGCStw1SiA935zwmDc5C9vcHkMb+B73pl3S3ZxaYiHdtQNCXjuMEBb7C/nBZfoyBfsf74QXQSRUh/qR6oemCLZXKyyY269gc3IpYh+cRCMXEDWrlA5xQWn5b9GzYR1GVJwjiAoga1U0k7diJ8p81teTp1i++vdrojR+tOV94w7+z8TI2HF+VnNa2orjOGl+45uZ/l49oV1uTjoen5zJVz7OwUMkM5l0SUUY3oAqsuu0j0JvxlAYa7F/kr4aL/5fufqgwSvKwFmCg6H8Veejwxpc/lXFQp6PNlXIRvNnppVwFsovsIEilSwavLYBTOkAdTFeJLT/6+RsQjE2tsE7MWKA+Hq4pyN6gg+LJdECryev8nVhAgSCVkfOhzFtLbnSQosR/HBpnJMAzxgMRWCMQtOLvfd5cHru7Rtg423FY0+Ob2UgbCmyGnGbBQ0z9Xwbbp X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92760bfd-ddd8-4ff3-57cb-08d8d2c05a14 X-MS-Exchange-CrossTenant-AuthSource: YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2021 21:18:06.1300 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gu7c3waMOZK6YfpAzvQ6UApcm5d6OQNKQMw6tR1T6svUirvp9qcJcqQB8kXey1jlkR8UAnZ1qJRWH0s9VMeo5QevfvQoJm5AbQ8weP2ppQA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTXPR0101MB0879 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-02-16_12:2021-02-16,2021-02-16 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 mlxlogscore=769 spamscore=0 suspectscore=0 bulkscore=0 impostorscore=0 clxscore=1015 phishscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102160172 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add a flag and helper function to indicate that a PHY device is part of an SFP module, which is set on attach. This can be used by PHY drivers to handle SFP-specific quirks or behavior. Signed-off-by: Robert Hancock --- drivers/net/phy/phy_device.c | 2 ++ include/linux/phy.h | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 05261698bf74..d6ac3ed38197 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1377,6 +1377,8 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, if (phydev->sfp_bus_attached) dev->sfp_bus = phydev->sfp_bus; + else if (dev->sfp_bus) + phydev->is_on_sfp_module = true; } /* Some Ethernet drivers try to connect to a PHY device before diff --git a/include/linux/phy.h b/include/linux/phy.h index 5d7c4084ade9..eb48c686c423 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -488,6 +488,7 @@ struct macsec_ops; * @sysfs_links: Internal boolean tracking sysfs symbolic links setup/removal. * @loopback_enabled: Set true if this PHY has been loopbacked successfully. * @downshifted_rate: Set true if link speed has been downshifted. + * @on_sfp_module: Set true if PHY is located on an SFP module. * @state: State of the PHY for management purposes * @dev_flags: Device-specific flags used by the PHY driver. * @irq: IRQ number of the PHY's interrupt (-1 if none) @@ -561,6 +562,7 @@ struct phy_device { unsigned sysfs_links:1; unsigned loopback_enabled:1; unsigned downshifted_rate:1; + unsigned is_on_sfp_module:1; unsigned autoneg:1; /* The most recently read link state */ @@ -1292,6 +1294,15 @@ static inline bool phy_is_internal(struct phy_device *phydev) return phydev->is_internal; } +/** + * phy_on_sfp - Convenience function for testing if a PHY is on an SFP module + * @phydev: the phy_device struct + */ +static inline bool phy_on_sfp(struct phy_device *phydev) +{ + return phydev->is_on_sfp_module; +} + /** * phy_interface_mode_is_rgmii - Convenience function for testing if a * PHY interface mode is RGMII (all variants) From patchwork Tue Feb 16 21:17:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12090621 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09088C433E9 for ; Tue, 16 Feb 2021 21:19:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D6DB264E08 for ; Tue, 16 Feb 2021 21:19:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230427AbhBPVTp (ORCPT ); Tue, 16 Feb 2021 16:19:45 -0500 Received: from mx0d-0054df01.pphosted.com ([67.231.150.19]:35297 "EHLO mx0d-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230397AbhBPVTe (ORCPT ); Tue, 16 Feb 2021 16:19:34 -0500 Received: from pps.filterd (m0209000.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 11GL6cwQ010488; Tue, 16 Feb 2021 16:18:39 -0500 Received: from can01-to1-obe.outbound.protection.outlook.com (mail-to1can01lp2051.outbound.protection.outlook.com [104.47.61.51]) by mx0c-0054df01.pphosted.com with ESMTP id 36pcj9gyqm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Feb 2021 16:18:39 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PS1IZzkVtI4s+0jy60gQrKKMWnFkInQeuJkRa8BfJQrj3zoLJgHzWkILecSx+RjG8IRvBzN5dBtEG7wa4QAQqPn13z91Gh84SEfaGHUWHnhSVXICF0osjwA1TpQXShUYslms+7NkyswdcZPIfEwCymD82c1t5CCpz7PdtDSbjpvfDzeG1+Kb/ZFlVJRNjf0S3CVQd6UIr0ZfZnKhfo6J2M0X5w+7CA7Z0KxBkpp2CTR7hJyGwvyh6s7WmOxpQuZjCKMqr1tlxKyVAXsKkTS4I+QfKa/5cnEC7kLuLNPg4lhEGkPpMydTureDMC3oDN/em+1/csrWEWudZGKVXfk7nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6nFOq1csAjfFW/nwE1+C/MkA0Es58sSVAIEU642mTt4=; b=LoHOzyfWmmgfret0Y/Ff26I1Dni4g2pg365dQFRaRXgFyrosgvnpBbo+z9rPVP4X4pX9T2WuSG8PJuqd7XA7TCpDaZib0TOYVhtjRPz7AScxBPVlhyFut54lO2/Y/v6TS47eDqb/VgSORs1JtGx658AHPLjdht4uqhCzd9kaYPLYzyxTqm5cZM/uKXP5qbvbCbmyrNnkUf+AJABc3WiZIQTJeJRbomy+27c8ejs3otFp1T2dKYoqZPVjbB1aQZNnPr9b7AaCw+ePHBezJq31n77UOS4NraMOu8/fFGzJhG4cHYPiKWvMMk5CknnvuGnwdXZ1qKzzIvKQckLutK0rGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6nFOq1csAjfFW/nwE1+C/MkA0Es58sSVAIEU642mTt4=; b=XV/5d2wuCYJqiOGM5O67xtj6gabG8NlCgvJ6mU/nKMa110MRl3f7EGUECoboAsqr3VxwSiT8IGwZE78LWX5ZM3HYIN21xvdc1LFeC2fML5cL3MNlU10OP0CwcD7DnYbaeXbuZPoGXrP0FNpmGprVAGokSPniKnU9PJPDaPdlo8Y= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=calian.com; Received: from YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:f::20) by YTXPR0101MB0879.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b00:6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.39; Tue, 16 Feb 2021 21:18:18 +0000 Received: from YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM ([fe80::3172:da27:cec8:e96]) by YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM ([fe80::3172:da27:cec8:e96%7]) with mapi id 15.20.3846.038; Tue, 16 Feb 2021 21:18:18 +0000 From: Robert Hancock To: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net, kuba@kernel.org Cc: f.fainelli@gmail.com, linux@armlinux.org.uk, bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org, Robert Hancock Subject: [PATCH net-next v3 3/3] net: phy: broadcom: Do not modify LED configuration for SFP module PHYs Date: Tue, 16 Feb 2021 15:17:21 -0600 Message-Id: <20210216211721.2884984-4-robert.hancock@calian.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210216211721.2884984-1-robert.hancock@calian.com> References: <20210216211721.2884984-1-robert.hancock@calian.com> X-Originating-IP: [204.83.154.189] X-ClientProxiedBy: DM3PR14CA0128.namprd14.prod.outlook.com (2603:10b6:0:53::12) To YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:f::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (204.83.154.189) by DM3PR14CA0128.namprd14.prod.outlook.com (2603:10b6:0:53::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Tue, 16 Feb 2021 21:18:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81e5c8e1-93a4-47b9-2faa-08d8d2c05bd1 X-MS-TrafficTypeDiagnostic: YTXPR0101MB0879: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YjhoJQ/BYpabF8GGWN8Ic8SCZs/gcgMwDpxvp6haMVeVTqZO++yX0xNEZj+3tK2QP/BsANXELpX4dOw0mE7znVj5bI7d6BWbAw1GqdLB7u5KwcNfskiN1OiYzh4yMQ3nZW0EAJbG73USQhe/umN14gNxUgumREcg34lsmz+YSWFSfBocZuRw9SNAOjr9W+j57jo5MKYkle30s7915eo3V0Z7MMTn1B/WSsVguThG4L8exi9cr8hQ+f6Jmlf9+j0Bmw7+cYoKobxqr8D3WhgwEzEOURR57DMqqOHZV03OYgWN9RuT6lPTgb/84SRoinvP3VQxOBiAIcMRSsvcaauAadqy3TnQwK8gakrFedHhkCfyoNwtJV0pO52txZak6q3YrT1jTf1cuZWkOuKLeciNCzXeTyufLkzVsllqhIBlLkzIUN7UR99u3G9hML5eJGAUQe05wLvRr5YXDcIaIWPaDrNSoUPy/6CbtyJOe+0/J+9eYUHAoQpLaupa4ORmTrEAQYR4rPZDjDVKXfwlQS73/ed38L4xwx3T0gsZYcb4niPHS8b82Jy6tduqOnTdF0950bYynu191AigC8PtfZjEXg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(136003)(396003)(376002)(39850400004)(366004)(346002)(8936002)(8676002)(956004)(6486002)(66476007)(1076003)(66946007)(316002)(186003)(4326008)(6666004)(2616005)(6506007)(16526019)(36756003)(478600001)(5660300002)(69590400012)(52116002)(107886003)(83380400001)(66556008)(26005)(2906002)(44832011)(6512007)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 9eMHvxbbbfJl4Zbo//YEX1IPcMXXOfexMlUa9m5RJa84oGw97mi+dGF5GbwQhLIGaBW4d8DjShQFYfxgKJNKazzX6twTApaAAbChA6M82mOCcq1jD7aO0d3dkKZEjDbCprmVmyAJbL3g3d8YVXAWWAO2846E5cgkWhl/sOL3XsGm2XnbAjTIhsh/mLIYh7r93L0fLnsIEhZ89uSifVtB2jqqhJWsu5B+BeDb6TGU5rBDgPJrCyu20qQ2b00vWUEygXYJfXpG/+kWpjEy2aIEZmh3FPl7KNm4lZPHkQmb/OAcCoBxFWBTrIb7wMCJ3HIzQ7Sv0jDZzFu5SJ7H4bi/TFqH1At3yZSgNgCMxsTpTewViVbO9a+2ZGV6ddEpg1yFEbZoCvOezS3EqD3Oi0XGD/SfjF6zNO/i8gtf9XlJzUwyVuPzGWQmfTPWfBxmVhOpmszA+jJlUf+3W8+Z3+aLKW7uiotLRqrqKXPKfCthNj28t8bh9tbLPwuVq2ai1mnqWfpFzbiC25s8H5eaRGZHv1JfVoRFbwk6noQcrU0oD42GcmA008UAQEFhomUwCS4Eb8IweWVU1be5BZ5bX0qRQ8FrFntukZ4OoZBlwCgd+B6G7EijJ4P9W4YICNQ4XXZZilrAQXabDTGQV9FjhTfPd25vhuInkPC2rt/SbRklXNysl8En7wbPuGXrqgcwL4XPv/vRLbBjEVTqpcqb3K8Hi2WnTmtVSdKz9C0sh2mqcPGGfBh2q/BjShYi4Ew8gMdg++odwsi22PLj/QVO1+peGHwkzr6sfx5ekODd5xX+gleco0AL6gSP5NT5zykO08ntEYgfaUERLMcLThbD9904dCPpvzq87OSvgNwGwH4Qad7igi+qNFXH23X1IkobJhD4A++aa4vVgQKng+G4ol+GXFJlkwfUnJKEVIAjh91loykV2/DBCFWB3SdY8/rwELBJEUFTLpVlXK700jq2bdc9B7ruIZEQDhvH05DmbfaS0SMC0nXSAqesVyPQwkDSz8qtCqCjawku1EwI7XhXpFONRJVdVDbF0YK9keja/EXDK9Y1t0Rn3kig8xBhA/FJ/AcrKTZAoh9oqYYAwjHy+ewlzZdp8559akYA4jZ+WQiB7K0lOWG3Mfr0Ly4tqK1VCfesEeQhSU33MCCi2UefrIJ73YKmygNPZHjcaxknDhcevBJbRymP2iLTqvdhJpyu8+eq9dXQcMeCn9u+vpmz6UoDJlwPV5QGvsWPjImHoR/0gigEJkQ7SkU2AxP5d7bPdNhwCeqD3Kh55+HjnRbRe6nqihQeptt/QoMYN1d+W5c79d1wihgKmOdjn+KPAHdJhGTP X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81e5c8e1-93a4-47b9-2faa-08d8d2c05bd1 X-MS-Exchange-CrossTenant-AuthSource: YT1PR01MB3546.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2021 21:18:09.0423 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AJtnjDskHcMCCk1tE4qqWC6AK8ZljAWhvtYO27kw601uLw0AE40Kyx0n4jKQ4iWiT2ItiflmVWQr1JmKB1VDIjXffBbhyZMmQPeEE2QLtA0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTXPR0101MB0879 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-02-16_12:2021-02-16,2021-02-16 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 bulkscore=0 impostorscore=0 clxscore=1015 phishscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102160172 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org bcm54xx_config_init was modifying the PHY LED configuration to enable link and activity indications. However, some SFP modules (such as Bel-Fuse SFP-1GBT-06) have no LEDs but use the LED outputs to control the SFP LOS signal, and modifying the LED settings will cause the LOS output to malfunction. Skip this configuration for PHYs which are bound to an SFP bus. Signed-off-by: Robert Hancock --- drivers/net/phy/broadcom.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index 8e7fc3368380..fa0be591ae79 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -366,18 +366,24 @@ static int bcm54xx_config_init(struct phy_device *phydev) bcm54xx_phydsp_config(phydev); - /* Encode link speed into LED1 and LED3 pair (green/amber). + /* For non-SFP setups, encode link speed into LED1 and LED3 pair + * (green/amber). * Also flash these two LEDs on activity. This means configuring * them for MULTICOLOR and encoding link/activity into them. + * Don't do this for devices on an SFP module, since some of these + * use the LED outputs to control the SFP LOS signal, and changing + * these settings will cause LOS to malfunction. */ - val = BCM5482_SHD_LEDS1_LED1(BCM_LED_SRC_MULTICOLOR1) | - BCM5482_SHD_LEDS1_LED3(BCM_LED_SRC_MULTICOLOR1); - bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1, val); - - val = BCM_LED_MULTICOLOR_IN_PHASE | - BCM5482_SHD_LEDS1_LED1(BCM_LED_MULTICOLOR_LINK_ACT) | - BCM5482_SHD_LEDS1_LED3(BCM_LED_MULTICOLOR_LINK_ACT); - bcm_phy_write_exp(phydev, BCM_EXP_MULTICOLOR, val); + if (!phy_on_sfp(phydev)) { + val = BCM5482_SHD_LEDS1_LED1(BCM_LED_SRC_MULTICOLOR1) | + BCM5482_SHD_LEDS1_LED3(BCM_LED_SRC_MULTICOLOR1); + bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1, val); + + val = BCM_LED_MULTICOLOR_IN_PHASE | + BCM5482_SHD_LEDS1_LED1(BCM_LED_MULTICOLOR_LINK_ACT) | + BCM5482_SHD_LEDS1_LED3(BCM_LED_MULTICOLOR_LINK_ACT); + bcm_phy_write_exp(phydev, BCM_EXP_MULTICOLOR, val); + } return 0; }