From patchwork Sat Feb 13 03:46:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12086537 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 4B09CC433E9 for ; Sat, 13 Feb 2021 03:47:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0F94364E69 for ; Sat, 13 Feb 2021 03:47:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232166AbhBMDrW (ORCPT ); Fri, 12 Feb 2021 22:47:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231899AbhBMDrS (ORCPT ); Fri, 12 Feb 2021 22:47:18 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2363C061756; Fri, 12 Feb 2021 19:46:37 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id z15so747910pfc.3; Fri, 12 Feb 2021 19:46:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TBmeTOvvLEyeKvYi7UxAA6GFutE9ZvCzYPjuoJndh9A=; b=sKg7P3H4BvcFKh6hnMh3ob8p8CAFPVmd9b4JJ7WfTS4DpDGLL09W0CaLl3ddwnwy1r S+55w9ShjYEnBl7b9B+f5MUqlh4W8/Ws+NfZOOSlgNQNi8hA2ks3r2yJXLJweA9ceQR2 rb7JZ27moJPmxXGq9a1awJ+hKSV7KMuGen1cdYjrmica6iViMyOauR5cK213KTqBTHhT DoKc3pII1CpiisxXwK6z4bglY4F8b9RaQsCqZ+nzGw1VmIUYOsB7y43eJrKOzexWTVCI npNPrBEdHI8BrpaTdbteW5qwuiQ5y2T7igZnnCwsCddFwit0KjWjj6i+sR7N7lgjqrnj 7bEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TBmeTOvvLEyeKvYi7UxAA6GFutE9ZvCzYPjuoJndh9A=; b=uoGed/3vRI2vpJXD5KceBs8wvTi0jUIlBSr5yKNveMQFfGxeGCfHBlbIPyMZ0e5K1F eIjyAZEKjGGuUhoo84iyOjn06P3AmUkhHQOWxjJjvc8zkGkx3m+WVQ4DS8VS94AIg7yp a3kUkBBJfGHok67rDyKCQLEbjqWbIT9TZykiE1k4ganuu2lghksxgQBnJFJ2yyis29N6 h4k6O0Xt5AQ5JjyJd7bYkPFBoQol+alOuwcASU1lCSVepa7zZ0j1XRgteiPdPd0MDRJx UKcFLm/XzvOJ3w0kH0SRChkFgMN19OT4PnRGso9kwB/lgaMatVceqXj2wEzQhBFwpGTA BqHQ== X-Gm-Message-State: AOAM532Stsku5Zqn1bv6n5gHVyRr4Xbjl7C4cSptdZMCwSOF1ppyvnA7 /rL46NY8y1lh04L6ln4M2oiHndnjFfM= X-Google-Smtp-Source: ABdhPJx2rMPGpKigW1CofWSnKP32W1cZUGN7xIqXDdn+1mo93C5Awa99xg8TbLHze74kXRJXPWysTg== X-Received: by 2002:a63:4713:: with SMTP id u19mr5912488pga.209.1613187997023; Fri, 12 Feb 2021 19:46:37 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id y14sm10399057pfg.9.2021.02.12.19.46.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Feb 2021 19:46:36 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Jakub Kicinski , Michael Chan , bcm-kernel-feedback-list@broadcom.com (open list:BROADCOM ETHERNET PHY DRIVERS), linux-kernel@vger.kernel.org (open list), olteanv@gmail.com, michael@walle.cc Subject: [PATCH net-next v2 1/3] net: phy: broadcom: Avoid forward for bcm54xx_config_clock_delay() Date: Fri, 12 Feb 2021 19:46:30 -0800 Message-Id: <20210213034632.2420998-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210213034632.2420998-1-f.fainelli@gmail.com> References: <20210213034632.2420998-1-f.fainelli@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Avoid a forward declaration by moving the callers of bcm54xx_config_clock_delay() below its body. Signed-off-by: Florian Fainelli Reviewed-by: Vladimir Oltean --- drivers/net/phy/broadcom.c | 74 +++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index 0472b3470c59..4142f69c1530 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -26,44 +26,6 @@ MODULE_DESCRIPTION("Broadcom PHY driver"); MODULE_AUTHOR("Maciej W. Rozycki"); MODULE_LICENSE("GPL"); -static int bcm54xx_config_clock_delay(struct phy_device *phydev); - -static int bcm54210e_config_init(struct phy_device *phydev) -{ - int val; - - bcm54xx_config_clock_delay(phydev); - - if (phydev->dev_flags & PHY_BRCM_EN_MASTER_MODE) { - val = phy_read(phydev, MII_CTRL1000); - val |= CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER; - phy_write(phydev, MII_CTRL1000, val); - } - - return 0; -} - -static int bcm54612e_config_init(struct phy_device *phydev) -{ - int reg; - - bcm54xx_config_clock_delay(phydev); - - /* Enable CLK125 MUX on LED4 if ref clock is enabled. */ - if (!(phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED)) { - int err; - - reg = bcm_phy_read_exp(phydev, BCM54612E_EXP_SPARE0); - err = bcm_phy_write_exp(phydev, BCM54612E_EXP_SPARE0, - BCM54612E_LED4_CLK125OUT_EN | reg); - - if (err < 0) - return err; - } - - return 0; -} - static int bcm54xx_config_clock_delay(struct phy_device *phydev) { int rc, val; @@ -105,6 +67,42 @@ static int bcm54xx_config_clock_delay(struct phy_device *phydev) return 0; } +static int bcm54210e_config_init(struct phy_device *phydev) +{ + int val; + + bcm54xx_config_clock_delay(phydev); + + if (phydev->dev_flags & PHY_BRCM_EN_MASTER_MODE) { + val = phy_read(phydev, MII_CTRL1000); + val |= CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER; + phy_write(phydev, MII_CTRL1000, val); + } + + return 0; +} + +static int bcm54612e_config_init(struct phy_device *phydev) +{ + int reg; + + bcm54xx_config_clock_delay(phydev); + + /* Enable CLK125 MUX on LED4 if ref clock is enabled. */ + if (!(phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED)) { + int err; + + reg = bcm_phy_read_exp(phydev, BCM54612E_EXP_SPARE0); + err = bcm_phy_write_exp(phydev, BCM54612E_EXP_SPARE0, + BCM54612E_LED4_CLK125OUT_EN | reg); + + if (err < 0) + return err; + } + + return 0; +} + /* Needs SMDSP clock enabled via bcm54xx_phydsp_config() */ static int bcm50610_a0_workaround(struct phy_device *phydev) { From patchwork Sat Feb 13 03:46:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12086539 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 6D685C4332D for ; Sat, 13 Feb 2021 03:47:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4CC6D64E95 for ; Sat, 13 Feb 2021 03:47:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232242AbhBMDrf (ORCPT ); Fri, 12 Feb 2021 22:47:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231978AbhBMDrT (ORCPT ); Fri, 12 Feb 2021 22:47:19 -0500 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 311ABC0613D6; Fri, 12 Feb 2021 19:46:39 -0800 (PST) Received: by mail-pf1-x42c.google.com with SMTP id b145so747616pfb.4; Fri, 12 Feb 2021 19:46:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=I7/OiWQ7uKmbM6Wg07lX4shzHb0RXi59L/RFCz3mRC4=; b=glXfZHSDtuqjvOjobAXOc9eUg7nN8zjPSvWAHyAKPHHoomAV+IBLJrAbAgZQd9y1/u CT3goqFI5pjLusL5yFLNp5arcXm/DMTcFwcK+Tn2Fn06Q0JeooiG9slI18Z6lN2mTD1q Vq0bnTjK7dZFPfAluSSpV6QAGPciN1wAVF7Ajon05meTgp/+4BVQ+vqVdREvrKpR3oil zb2GVm+vZFZ4JN+qcQqJZFwA/MYGQb67PJ4wiZiqYDWz6FeuBnV8XpCUkhsfv2kPyPIe SbKNRMhwTWe7UVyN6FwyfYvqYT2fAmFcEtWkFjkMXjg8teNS9dku969O9WVjgqN4NWPL Iuaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=I7/OiWQ7uKmbM6Wg07lX4shzHb0RXi59L/RFCz3mRC4=; b=jd2Ci0VhmZgG8JlvHbXPm7gLIMRG7FoEqDG9snz9oKfNcrMfdOf6AYvP8nZifrXf32 Hs067PFeMUTq5p0r4f0M3stgqKc4tdTmLnLp7G9Q6ngGqqoCBCqBw5yXunx37TcmDGg/ TnK2am6Ar4Lkjly5I1wKQeU4j5tj+ZBnDm2zRB3S9Mxk8I6+ZhRkqzMXmnvrKh1+KuPt ehwCugskY8AVL+RltouADaWMCIdDyTS6rc/i2Fy2Zfhn9J76mHh0JQL85Lrackm1DW2P r2d33fiYMT4RHS/XTdREnM45bfLi5eaxoSI9HWgfr14tOnzpeDHoBN0Ae1pV3wQI0yfT lWFQ== X-Gm-Message-State: AOAM530NpEJVRRnNIJPCC4N9LZgcIVIggDjm7me/A3gP7gg2dmLbNoHd PNrjG2pFnIhQw/zCvCiulDYAU10ZlLM= X-Google-Smtp-Source: ABdhPJwTnFsTERtm8RsIDCqFJEF8WG6yL8zlABOixglufssDXGRYKK6RulOSK+RZwIqJRe7+oJ5qkw== X-Received: by 2002:a65:4083:: with SMTP id t3mr6075260pgp.150.1613187998355; Fri, 12 Feb 2021 19:46:38 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id y14sm10399057pfg.9.2021.02.12.19.46.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Feb 2021 19:46:37 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Jakub Kicinski , Michael Chan , bcm-kernel-feedback-list@broadcom.com (open list:BROADCOM ETHERNET PHY DRIVERS), linux-kernel@vger.kernel.org (open list), olteanv@gmail.com, michael@walle.cc Subject: [PATCH net-next v2 2/3] net: phy: broadcom: Remove unused flags Date: Fri, 12 Feb 2021 19:46:31 -0800 Message-Id: <20210213034632.2420998-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210213034632.2420998-1-f.fainelli@gmail.com> References: <20210213034632.2420998-1-f.fainelli@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org We have a number of unused flags defined today and since we are scarce on space and may need to introduce new flags in the future remove and shift every existing flag down into a contiguous assignment. PHY_BCM_FLAGS_MODE_1000BX was only used internally for the BCM54616S PHY, so we allocate a driver private structure instead to store that flag instead of canibalizing one from phydev->dev_flags for that purpose. Signed-off-by: Florian Fainelli Reviewed-by: Vladimir Oltean --- drivers/net/phy/broadcom.c | 19 ++++++++++++++++--- include/linux/brcmphy.h | 21 ++++++++------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index 4142f69c1530..3ce266ab521b 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -381,10 +381,21 @@ static int bcm5481_config_aneg(struct phy_device *phydev) return ret; } +struct bcm54616s_phy_priv { + bool mode_1000bx_en; +}; + static int bcm54616s_probe(struct phy_device *phydev) { + struct bcm54616s_phy_priv *priv; int val, intf_sel; + priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + phydev->priv = priv; + val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_MODE); if (val < 0) return val; @@ -407,7 +418,7 @@ static int bcm54616s_probe(struct phy_device *phydev) * 1000BASE-X configuration. */ if (!(val & BCM54616S_100FX_MODE)) - phydev->dev_flags |= PHY_BCM_FLAGS_MODE_1000BX; + priv->mode_1000bx_en = true; phydev->port = PORT_FIBRE; } @@ -417,10 +428,11 @@ static int bcm54616s_probe(struct phy_device *phydev) static int bcm54616s_config_aneg(struct phy_device *phydev) { + struct bcm54616s_phy_priv *priv = phydev->priv; int ret; /* Aneg firstly. */ - if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) + if (priv->mode_1000bx_en) ret = genphy_c37_config_aneg(phydev); else ret = genphy_config_aneg(phydev); @@ -433,9 +445,10 @@ static int bcm54616s_config_aneg(struct phy_device *phydev) static int bcm54616s_read_status(struct phy_device *phydev) { + struct bcm54616s_phy_priv *priv = phydev->priv; int err; - if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) + if (priv->mode_1000bx_en) err = genphy_c37_read_status(phydev); else err = genphy_read_status(phydev); diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h index de9430d55c90..844dcfe789a2 100644 --- a/include/linux/brcmphy.h +++ b/include/linux/brcmphy.h @@ -61,19 +61,14 @@ #define PHY_BCM_OUI_5 0x03625e00 #define PHY_BCM_OUI_6 0xae025000 -#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001 -#define PHY_BCM_FLAGS_MODE_1000BX 0x00000002 -#define PHY_BCM_FLAGS_INTF_SGMII 0x00000010 -#define PHY_BCM_FLAGS_INTF_XAUI 0x00000020 -#define PHY_BRCM_WIRESPEED_ENABLE 0x00000100 -#define PHY_BRCM_AUTO_PWRDWN_ENABLE 0x00000200 -#define PHY_BRCM_RX_REFCLK_UNUSED 0x00000400 -#define PHY_BRCM_STD_IBND_DISABLE 0x00000800 -#define PHY_BRCM_EXT_IBND_RX_ENABLE 0x00001000 -#define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000 -#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000 -#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000 -#define PHY_BRCM_EN_MASTER_MODE 0x00010000 +#define PHY_BRCM_AUTO_PWRDWN_ENABLE 0x00000001 +#define PHY_BRCM_RX_REFCLK_UNUSED 0x00000002 +#define PHY_BRCM_STD_IBND_DISABLE 0x00000004 +#define PHY_BRCM_EXT_IBND_RX_ENABLE 0x00000008 +#define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00000010 +#define PHY_BRCM_CLEAR_RGMII_MODE 0x00000020 +#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00000040 +#define PHY_BRCM_EN_MASTER_MODE 0x00000080 /* Broadcom BCM7xxx specific workarounds */ #define PHY_BRCM_7XXX_REV(x) (((x) >> 8) & 0xff) From patchwork Sat Feb 13 03:46:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12086541 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 9D504C433E0 for ; Sat, 13 Feb 2021 03:48:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7860364E8D for ; Sat, 13 Feb 2021 03:48:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232274AbhBMDrr (ORCPT ); Fri, 12 Feb 2021 22:47:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232080AbhBMDrU (ORCPT ); Fri, 12 Feb 2021 22:47:20 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97CE5C061786; Fri, 12 Feb 2021 19:46:40 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id d13so857337plg.0; Fri, 12 Feb 2021 19:46:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ycEZD6+lGycl7jzGlqgxg/WeXj7vcT8Oor6/VJW+6Uo=; b=sDXdUOIqZLgSJqhQUBczAKHhu+hl3H/sBr7LzBsLxZPXox9Xt7u85ytWM2OYL84gxz IcePSId8RJ0Jf/73iTEiLPuggDaQzSYs3qwnyfJuImPb0pg9l2MaIEdKLT/GPY6u6lPY hOtKhw1AJbJbmIs/zJV1aK/MaO2e2MqTVwXbrPgbtEP/fp1yEWKrQtszyGgO0ybrB+x9 +A+n5d33CuPHG27mRRS6hhoeNb2Ln2DAcB4KYE/8gp8BZoMnfV0NlfGltEymmRny6plZ z6YYt292YFru7e4g4OKn+Fg7bP+LIEDzrJrh9rVoNUoI9BHcxa6Mf8tQk5n7CjgE8Z2P Xq0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ycEZD6+lGycl7jzGlqgxg/WeXj7vcT8Oor6/VJW+6Uo=; b=WiIAJTxja4tjp4tpu0bvZsCS4ZGHvPblEgQCvqTrNLrXw96XielHkRM2koiS8BZK4P j78LJDzKbWCib/kHIq8Vm0iGwbT8L54X7fxlX8stxDv3NAxWoLwndFHdqvaYiC3j/Alu VcVtsFu1owfIOA/VdIhEjXDyHaB9cCf4OPpOARsHGj+BPWQuskN/hbRdkIENFn4vGK8x yDIQkjc+Qko92chvv5TT1aGC750yHV74xnFYgysZzHDmMSYqIF0L9bBKkM0nhkFhdQsX 5xkQyKR1NevpsTyySY2WdvP4733TPFbbv7WCF1sAFDnm9WEi96RQdQqw6+iQCvyU1tax JE8Q== X-Gm-Message-State: AOAM530dnTGueda5phSd1LIwlnFs4vb5azUwr05fI4w37m5JkPCJ8TPf lzbko1DudrwMA2qGtUopzKnk226Weqw= X-Google-Smtp-Source: ABdhPJye//t3e87Yz+o9cWwSYRA2jTLHXEzAfT7+CdXS/C7TF+jq+OKmtgiwTsR6xfSqFEX31ygKXw== X-Received: by 2002:a17:90a:4d88:: with SMTP id m8mr5605649pjh.45.1613187999699; Fri, 12 Feb 2021 19:46:39 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id y14sm10399057pfg.9.2021.02.12.19.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Feb 2021 19:46:39 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Jakub Kicinski , Michael Chan , bcm-kernel-feedback-list@broadcom.com (open list:BROADCOM ETHERNET PHY DRIVERS), linux-kernel@vger.kernel.org (open list), olteanv@gmail.com, michael@walle.cc Subject: [PATCH net-next v2 3/3] net: phy: broadcom: Allow BCM54210E to configure APD Date: Fri, 12 Feb 2021 19:46:32 -0800 Message-Id: <20210213034632.2420998-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210213034632.2420998-1-f.fainelli@gmail.com> References: <20210213034632.2420998-1-f.fainelli@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org BCM54210E/BCM50212E has been verified to work correctly with the auto-power down configuration done by bcm54xx_adjust_rxrefclk(), add it to the list of PHYs working. While we are at it, provide an appropriate name for the bit we are changing which disables the RXC and TXC during auto-power down when there is no energy on the cable. Signed-off-by: Florian Fainelli Reviewed-by: Vladimir Oltean --- drivers/net/phy/broadcom.c | 8 +++++--- include/linux/brcmphy.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index 3ce266ab521b..91fbd26c809e 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -193,6 +193,7 @@ static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev) if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 && BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 && BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M && + BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54210E && BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54810 && BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54811) return; @@ -227,9 +228,10 @@ static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev) val |= BCM54XX_SHD_SCR3_DLLAPD_DIS; if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) { - if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810 || - BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54811) - val |= BCM54810_SHD_SCR3_TRDDAPD; + if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54210E || + BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810 || + BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54210E) + val |= BCM54XX_SHD_SCR3_RXCTXC_DIS; else val |= BCM54XX_SHD_SCR3_TRDDAPD; } diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h index 844dcfe789a2..16597d3fa011 100644 --- a/include/linux/brcmphy.h +++ b/include/linux/brcmphy.h @@ -193,6 +193,7 @@ #define BCM54XX_SHD_SCR3_DEF_CLK125 0x0001 #define BCM54XX_SHD_SCR3_DLLAPD_DIS 0x0002 #define BCM54XX_SHD_SCR3_TRDDAPD 0x0004 +#define BCM54XX_SHD_SCR3_RXCTXC_DIS 0x0100 /* 01010: Auto Power-Down */ #define BCM54XX_SHD_APD 0x0a @@ -253,7 +254,6 @@ #define BCM54810_EXP_BROADREACH_LRE_MISC_CTL_EN (1 << 0) #define BCM54810_SHD_CLK_CTL 0x3 #define BCM54810_SHD_CLK_CTL_GTXCLK_EN (1 << 9) -#define BCM54810_SHD_SCR3_TRDDAPD 0x0100 /* BCM54612E Registers */ #define BCM54612E_EXP_SPARE0 (MII_BCM54XX_EXP_SEL_ETC + 0x34)