From patchwork Sat Feb 13 00:28:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12086427 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,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 3C7D7C433DB for ; Sat, 13 Feb 2021 00:29:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E014C64E9C for ; Sat, 13 Feb 2021 00:29:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229918AbhBMA3q (ORCPT ); Fri, 12 Feb 2021 19:29:46 -0500 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]:35951 "EHLO mx0c-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229602AbhBMA3p (ORCPT ); Fri, 12 Feb 2021 19:29:45 -0500 Received: from pps.filterd (m0208999.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 11D0QYSK028661; Fri, 12 Feb 2021 19:28:55 -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 36hq424anc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Feb 2021 19:28:55 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BsJe4B4XaOOLd/nO4qj5inrQ5pHItbvjyS8vJo0xrLsBew24+emywr9u3cE3zTglICBjvn++9sbgW/cTp2JcJJryh7o7O7qX6whv49uDbJfbg8D+hYDNGevGCeicre6UX/MpDhe/PE9luVZF4haezL7JOpemMJuI8c8B1t3VvvkVju++dSUVgxxtA2kP4uK+HS/H/lSRiZkq3XCovHKs3FZe9HojCD7DVRCa7XGqBhonc8Yqg+hGe5LNhNBptx30Gp2c8svsCqw5DVqpFX+hr+OCl5GFJNTkJub6TtB1zmLsNc6mnaS4TE9ccvhk5r6VzNb/7nOH+1YnSAhl6GJMuw== 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=THCDourCgtXkQwsrIBj4gZLd/pDckroFVKtCrxEszK0=; b=dAVw3HMHorerz+689LBdRgMRSWnS3JahIfHHbCXpIQ07k5yQp6Ny6LLwzWNi3GayS2pugFOgCfMoD6+PSIyBbGH2OB4KLzxKMzULC07fcSUg6+IiNoDwqnH1By/kyFR1EXc4JkGwKnzT1HV4bNab9ZBC0c41AJtC6SXdO3Z/XKr2c0S6k2X0kcXG489LkP9jr2G13Tx0bICINCMcCc3Tw1pLGEmovFB5FSq4tGjvtYow8OcwT3/d6qyJSxgPQzKoryTEx8hWDMOAM/QEGhm+/xdnpjTchMNXB3V3BTRJHKJiJb1xoCsR1wQ5RaOHgr8OxTWTeexUJ55UHRVEDynQ6w== 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=THCDourCgtXkQwsrIBj4gZLd/pDckroFVKtCrxEszK0=; b=Yq4aqGyjUsuvuX7z23qUhdW3KcKBrnxbksWS3qTMjPK6iKDdIGA3Ujl/6N/4AVfSixaTk1le4NOU8SlUehTvAyFWrQ9ksozbDmPFzRMmsTnE3MhmJJAsk31QClfwhZuT/98N23qdG8sQJs6O3VV6Hl4Fp+2/0529ZYCPcn7Dl+8= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=calian.com; Received: from YTBPR01MB3551.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:1d::17) by YTOPR0101MB2091.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b00:1d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.30; Sat, 13 Feb 2021 00:28:53 +0000 Received: from YTBPR01MB3551.CANPRD01.PROD.OUTLOOK.COM ([fe80::3451:fadd:bf82:128]) by YTBPR01MB3551.CANPRD01.PROD.OUTLOOK.COM ([fe80::3451:fadd:bf82:128%6]) with mapi id 15.20.3825.034; Sat, 13 Feb 2021 00:28:53 +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 1/2] net: phy: broadcom: Set proper 1000BaseX/SGMII interface mode for BCM54616S Date: Fri, 12 Feb 2021 18:28:24 -0600 Message-Id: <20210213002825.2557444-2-robert.hancock@calian.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210213002825.2557444-1-robert.hancock@calian.com> References: <20210213002825.2557444-1-robert.hancock@calian.com> X-Originating-IP: [204.83.154.189] X-ClientProxiedBy: DM5PR11CA0010.namprd11.prod.outlook.com (2603:10b6:3:115::20) To YTBPR01MB3551.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:1d::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (204.83.154.189) by DM5PR11CA0010.namprd11.prod.outlook.com (2603:10b6:3:115::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Sat, 13 Feb 2021 00:28:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0969a72f-a47c-4a98-e492-08d8cfb65781 X-MS-TrafficTypeDiagnostic: YTOPR0101MB2091: 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: ZvZpKQaK45VGw302cDhF9UC++mEqPG1K9zFaGdXKIZfQ5av/F3E4LiNMiZbu7OGbTrCq6IskBiqQPwjUi/vi1Rg9j0s7Cg0Vs9wJoiFGXlkp4P2q/+46xBQiE+9OniyFGtDfn/cXtpYhGMrEbL9hIMCAjYvwOCK4+LkssI8wzKPfhjJARbZYphcuti4uZ63OJCDxY2xsdFSNGscvhvSQ7afs4m0NbAKpnjgLfd3LKKCgVF/c6xCXLbTGA/FdTm60bel2RfwssqYEuTvSWXINrNs31JyVI4mQBPq4RlVww/luifTDElBMlJPffhoXDObSPSsBah8GDFAOSnTHWyFTl0t6o6tNOe10hIWtJSnPKeZp5UDUqC8tqRZZWjyW9/MGszO8HQDP4OKZvrDz9BCVphY0dk6j2b469tz2jFGOAumLGw4GYjPddh8i/MyQLHm8le3jFTJO41wjqIBwOwVmzsBCjvrIjxRiyiop+/i89I2oP2rzHFAaD3ENGubLYcOWXYqNpZV0aLBkpJllYo7ttMcwox/3rckjWXc4MhyvuEPEjmGg8R9EF+EldABks47hZxkJY8xUboFg9ifoonYUZBRYYciR2QlFhe/qK70ZA7dPlbcHNPL3O+5kTufd4VHZfl3NNmNc4h5gO+CIi1MRIQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YTBPR01MB3551.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(136003)(39850400004)(366004)(346002)(376002)(396003)(478600001)(966005)(8936002)(36756003)(66476007)(16526019)(6666004)(4326008)(69590400012)(52116002)(6506007)(186003)(26005)(5660300002)(107886003)(66946007)(956004)(86362001)(2906002)(8676002)(6512007)(2616005)(6486002)(44832011)(316002)(83380400001)(66556008)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: i47r6bBGog7gDJFoLX/xABV/hEUEY+4FXGl7YdPN0OzDlIFVoqbpbh7O4iqbq0SG0CZWgxkd8nYkHfhZ4+uOrmmhsksLmaWAPtF8ACQwOWLi2q2g4dAGkMOjvrjknKb+M5ccPGDr5ZjOJgbdsX1bhFdJ4+XZoHCR8UX7M2Ed6eaNdexBXNTt4sL3DTaaDS9dBx5S1ot9TQ6pzv93fHRa8c6GGvx7opGFepoPXxqq0lj0PIPrDZVXZNLUCsRU1CJoStsbuO/7C/lGdNerY2OkjmwnS92SCII+7mHFMRsbrOu1ePEhEgs6bNYrApxP8nroGNOu2fF1+NU0553OlsLlgDRoVcdMhbi5o8BB/LPPLHUZdbHlKrYa0GqpdIYFopghemHec/yFUE3Dn1d9qmfrQG89TzP+TehHhXwxuFOUuutLmSICqHcjrP/t1nfQdr8palqOT4xE2rFlNm2f9r4TMe1GOAteaH3lbokFgonmxBrFyJ/DzHH+fAR6BmJVGT4yeEsX5zBbpn6exoa+z+z8N+AOFnCzVLNws62H0AWjyhOdFMBaALXWIVcoiKcYXZPU5DWseBFPTY2/UqKb4Z363pC+9xJbn7BO+eYJSuJF6WyDfDLttSUPcfkzwIVYSDlWanxcNJi5AxTrVktCiFHYX8KTd+X4tWPkJ/bUnMGtnB6uhboX9845oe1kgdXpBHhnKJ53yUPdm6+LslTovhuDkKq78/cTbBka2H8/hPLlYMoJWSFsBxDLjUTcRYy/9dYZAFGeTC71olCLigQPLXK1yKlxeSW9TWHBsoNBgDI7l4FQJ8jKzSw0Lhgyu1zQHXLlCTwjdJsTvFxgFBJ/UVomaLnJsEG1e2vjN+Aek/VNYxupCd3ejOKML1Zm9fDks9ya5qCLKptCUFgyS7F2PKaXMXVy+ayfDGwlVPnXPmaJ3k4hJgml6k9LKwVn43Ga4jx8xCh9RoFNk5buCaWoQ8aWxP477dKmZCHPnoz+4g7+szZba1ZdzLdVPRu9hpcwFM6I24GKx2LElFkaxy6yGaWWd3h3a+PnkdOOdduGu9pbl/MPBEWEj6jQ3uzeeKjWrv9srOdml1xy8qnWkXvjsj2mRRyT0fqI8KLaZrpdlZUVvw91r6abT/RBFBAxrgeNYt5KPsmB4yPaCqqjJQZrkCJeLVgM6wqNOnQNhDwQXHjRmzDm5IT4/STSSWLIqBTbU+e347vqwOGl5G1u/BMsjeMPTYBwiiMc7SZCH6r+HO9liJtL5L3zBtC9MWKpoeJoOZA+t+7UMt2tc4wD24P3yobEDIGaA4zrzLlGrvpkUzGz07tUE8H8e1olpnk34U5w/aod X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0969a72f-a47c-4a98-e492-08d8cfb65781 X-MS-Exchange-CrossTenant-AuthSource: YTBPR01MB3551.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2021 00:28:53.3642 (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: ucziP7Av6YAsIk8hbY3NP1PtTcsBQ/KwHtCE0wDLL6zbrV7SUubZaCFqZZ7cYnuVgIl8WNu9LBuGnd0JSXpBHqe9x38ct72H+GDfstOoyFI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTOPR0101MB2091 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.737 definitions=2021-02-12_10:2021-02-12,2021-02-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1015 impostorscore=0 adultscore=0 malwarescore=0 phishscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102130002 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 --- drivers/net/phy/broadcom.c | 83 ++++++++++++++++++++++++++++++++------ include/linux/brcmphy.h | 4 ++ 2 files changed, 75 insertions(+), 12 deletions(-) diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index 0472b3470c59..78542580f2b2 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -64,6 +64,63 @@ 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) { + /* 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; + 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); + } + return 0; +} + static int bcm54xx_config_clock_delay(struct phy_device *phydev) { int rc, val; @@ -283,15 +340,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 +358,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); @@ -385,7 +445,7 @@ static int bcm5481_config_aneg(struct phy_device *phydev) static int bcm54616s_probe(struct phy_device *phydev) { - int val, intf_sel; + int val; val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_MODE); if (val < 0) @@ -397,8 +457,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 de9430d55c90..b0a73b91d5ba 100644 --- a/include/linux/brcmphy.h +++ b/include/linux/brcmphy.h @@ -137,6 +137,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 @@ -223,6 +224,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 Sat Feb 13 00:28:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12086429 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,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 23A70C433E0 for ; Sat, 13 Feb 2021 00:29:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E0F0964E9A for ; Sat, 13 Feb 2021 00:29:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231175AbhBMA3u (ORCPT ); Fri, 12 Feb 2021 19:29:50 -0500 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]:25511 "EHLO mx0c-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229679AbhBMA3q (ORCPT ); Fri, 12 Feb 2021 19:29:46 -0500 Received: from pps.filterd (m0208999.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 11D0Qi7D028671; Fri, 12 Feb 2021 19:28:57 -0500 Received: from can01-qb1-obe.outbound.protection.outlook.com (mail-qb1can01lp2054.outbound.protection.outlook.com [104.47.60.54]) by mx0c-0054df01.pphosted.com with ESMTP id 36hq424ane-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Feb 2021 19:28:57 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M5AQDTXGCG4jJLMZPAiIPCaIZVVLS3wae1Wu3FDJcFeAX8e0izovJtJdcKrMw3sm1mHbMDnJcR804P8NprQIXhatFOYusw/gvjeIFQifRF1FsnTf7EQ7+GlL4oYDAf8RV6WReSsGKwaPk9dRgjERPFjhqVHDOv1iXrL1MyqTJ7DAvV2c+Mzg95FvB21V5BljTmorYwUUPHzyTQeUU7Pa7Zze4hljCyCDFSnpv/DX70Op73cYD7DArr2YmwgrvFGfJkb3zOOY0VFX+RBo6Je7mLsux2KsqxQKlNh380ikuH9O0ZNXyoxGpKKAOTmBJ4aRSAMqAG67pg0x3SX0icmVmQ== 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=4uqO2ZRtzFyTHRxfJQnddDdJ7hnA+j28UlVZv0QYWRk=; b=fqesnxO1MUD5p9KZU3aFJbYcy9rPvOy1lM/5zgk4xsIRCh4NJ1e9EINMEQwhykboSIA5c0xUIl8amyv56bDsDiW0k/sLYPstenfYTqfOo3q2hzjA1I4TUPHrpq3zx0fSx2oUe15eFb1nfzjKMpiQnAHtrz4SY/IBu4PVAjctMlUAwyub94EPT06O6k7VD2VyPKX4ZkSIPlbYJngU5EQ3H9wGLKJlCq3zmsmcoLIVflvcRe9s2WQSKXLTLZzC3ucAthQm635n3+tZVEWpLU5n1xgXOnskLG8JrpmtBXDjYnxxwdt+G1TvheE2Dvv+gH0bjXl+daS6NQCLgFLUjKfVAw== 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=4uqO2ZRtzFyTHRxfJQnddDdJ7hnA+j28UlVZv0QYWRk=; b=i2keec/LAgOVSFg3jeaC56NyaXcGWaPtjjjvfa7kVmWsrEcbmGsH1bW0WOqprPPppn2hbA8jvSZe+1iPabWwbyCmVbJF0MZoZ0iHTIEdXEXwdL1xybTQWFyXOMbiKb/y2LFJNgr2gRPyOdq8lVM/bCMQeUO/23gCTJbK3brHSS8= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=calian.com; Received: from YTBPR01MB3551.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:1d::17) by YTBPR01MB3264.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:21::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.30; Sat, 13 Feb 2021 00:28:55 +0000 Received: from YTBPR01MB3551.CANPRD01.PROD.OUTLOOK.COM ([fe80::3451:fadd:bf82:128]) by YTBPR01MB3551.CANPRD01.PROD.OUTLOOK.COM ([fe80::3451:fadd:bf82:128%6]) with mapi id 15.20.3825.034; Sat, 13 Feb 2021 00:28:55 +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 2/2] net: phy: broadcom: Do not modify LED configuration for SFP module PHYs Date: Fri, 12 Feb 2021 18:28:25 -0600 Message-Id: <20210213002825.2557444-3-robert.hancock@calian.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210213002825.2557444-1-robert.hancock@calian.com> References: <20210213002825.2557444-1-robert.hancock@calian.com> X-Originating-IP: [204.83.154.189] X-ClientProxiedBy: DM5PR11CA0010.namprd11.prod.outlook.com (2603:10b6:3:115::20) To YTBPR01MB3551.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:1d::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (204.83.154.189) by DM5PR11CA0010.namprd11.prod.outlook.com (2603:10b6:3:115::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Sat, 13 Feb 2021 00:28:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9cc4a3a2-5172-46f7-71db-08d8cfb658f6 X-MS-TrafficTypeDiagnostic: YTBPR01MB3264: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +14VNqwFVsqs30H/y/wCHKa819ivW9h+ZE1nHYhwZTfpAerkDj2CKNEjv1Ce0l7GpT52iUf+L9WMQdCU8Tn6VKH9TwOW67GxA57e7gsvoe2eO//vAiSI1hLTC39vl0HkSGc/PqVOpTiuR72gIK1ZGoMojAwLLdj8JND88Dhwm28xR17lMHJJlZ91jCOA8A0JWVrNVrueVkIxH2XlF4ow0C19O77+svty9mFtQuluLNgIjA3tFiKblo05I6E+Rwh0Ld3JDh69OTxZPKGkMXX7ApLWMeWC0at5BOdv3azTbijMMk/3OxYrWo/Bm3Xcyz+F/KID50UvZXXTAAkqPKilKYaqrR0fk6HrB+sAgRfly0/tDB5VD0PyEpJX3VEuroC5waMeUm67mfU71CKnK/NKjUZ8ejnBqJSzs4g96IuMPDjL4HU7ZdqqUqI0z4dYsOARTzNi9PQZP+ZJE4fXjwtISzP+NFCzSEj5HUUXeNXPwBe8pObUkNICuQM8AtO05+bu88UaGqHpTrBxj6/D5cCfe+3ssf1tMbmQDkgUTmz2RtWS/klbIkmEyZULgi58H/yxkkyEfzI0Mlrna1E8k2BKow== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YTBPR01MB3551.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(39850400004)(136003)(376002)(346002)(396003)(366004)(107886003)(6666004)(16526019)(478600001)(66476007)(66556008)(8936002)(36756003)(186003)(26005)(316002)(69590400012)(86362001)(52116002)(6506007)(8676002)(6512007)(44832011)(5660300002)(956004)(66946007)(83380400001)(1076003)(2906002)(6486002)(2616005)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: btTnqtAo5VpUAdWXA55+T+F8Q3dME8VbR06x5QFsQXH7bsJbHL0lmGacyu2mLh2VLLp3AgCPmpdxcwyOFja8mPYKQfEcdK/TY4rZcPPydxjIHWuWGgMs3oqsXtEUPaBcgfaHW6u6w3So4WDqE5O2D/F3e/eWxTy7xrJr0qh7i4lgiaJgNgp7VEIKvPGRu4rOLYeg2AyVUHBMaCnoU3hgj35k1ZdOjNl5j1tRUTcYYhJHQnDOWZSrOYJCUkr/6yC8zdtTv5NSVteyX/XVbc+kF/Ub3Hmdo+GbVf4kM6e0e+iyC5L6ZW+4vcPwCbQ6OWfMeea8UKfz4/JrX/8IZUC1OACwGy3gsq0dQnL46mTUSyX/cpzbOf+BfZAjcDzXz5ssEKOwjYd02wnlW8nPkWrt/BiCx8hYG76gydTaLc4nTG8WUnwDFzipOalnOiHorqei+VGDHHCT/wP64Op0XmJa3Q5vzUcUfHaLs1RZ/xjmoBER25WjCE5mSO5Stf8cykfvJGUl+ekxAVcNkiUSxe2sE12nLNjvI4VFbDraWaeHypBiqq0ogfXrOM7qF78idKRsmN2djUkNxnv/2BxEDhYS2J66KwhaKS5syig3zyCDhROBpkLVvoYenbvTc+VeMYSSqmlP0qS4VYEKaRgvoFZ3T6dtvjgFBIRSA34ogpAxxl3dNvPzzmIzaSmTbY8nWPiX2Vpnvhj3fZnQTM04sFOyjll5Q8S7GTW/lVCQ5RBTB2lQfO3TAtDPMldgBfww3jcTA42/81fmXkUdZs+A7uI4ozJ3DwtL+mjO1g2m3NSEvg30hp6ho1pPbisJx8eZZKc/7booB6UbxAnEFNQV13QNzjpRVsy1l9HPimSvpQNTD/Qpf4Md7sHHJ8th/mapmasYpdtrToQQvoFHGLD0ccvC/RctTtenDCM6cq+YwPKmN+dCqyo0sQt5ThdyYh37YWvu/CSna4BN1jLSm1OMvFOeN3xJvPusKkePtMNMvq4tCkWJLwSh1aMcE1HKmFJ4IxxNB+OVTBzAhCe3hPuNodUO4b9u6aIlES87IQPVtr2tZBESUZqhe1FmM/m46uCliLN7QBaRodtcplcBTbKdQo4h3nLwVpy4POMbq7UZQ68oYB1FdNVWF/I9wyAdR0ItLSS3ZC3dNDgTWCdROJZmBnX/iXKXGti1e1YS0ODejs3Y9C/9ItW5Q3UEfbuWUs4Dvbqn1if2kkRTgr6bCp7y10G6DgneQ7jQv4dRdMVekJU0Ib47xiYJgof7/PFGp8+kfp1AbDXeuN1lhvxrYI3u4MPT3hOxzvEVy/Amhd2be2zKRckZsljwHblrIbaR0XSZoOzx X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9cc4a3a2-5172-46f7-71db-08d8cfb658f6 X-MS-Exchange-CrossTenant-AuthSource: YTBPR01MB3551.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2021 00:28:55.7827 (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: 0IXNc+0HZHWrMjUDoXVNb6ACkVVvzq2Tzw4Jfp+4TWhXWCI+wIuER0c/QYEeguulUZU/qjBvZY8+Fl1lArjK//S1tRsgJ03g5SBxw0DZsOE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTBPR01MB3264 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.737 definitions=2021-02-12_10:2021-02-12,2021-02-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1015 impostorscore=0 adultscore=0 malwarescore=0 phishscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102130002 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 Acked-by: Florian Fainelli --- drivers/net/phy/broadcom.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index 78542580f2b2..81a5721f732a 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -12,6 +12,7 @@ #include "bcm-phy-lib.h" #include +#include #include #include #include @@ -365,18 +366,25 @@ 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 that may be 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 (!phydev->sfp_bus && + (!phydev->attached_dev || !phydev->attached_dev->sfp_bus)) { + 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; }