From patchwork Tue Apr 23 18:33:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 13640550 X-Patchwork-Delegate: kuba@kernel.org Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.144.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2F0F22F00; Tue, 23 Apr 2024 18:33:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.19.144.209 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713897229; cv=none; b=tSS8F2th7ThZYwuAQNL5ZOxOd3OKhym0PV/dqDunQFwtNvGOFJKf/wz4bkDOd36pPJAKevnqjEMUvoC5/HQfIsli8XS6Hy7F6ONucei6M2uvSzFxxArH7R14+YulE88eH6dl/dY0tUDqgeif9HOMHupTkDZeSayZtlzVQS+9E/M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713897229; c=relaxed/simple; bh=W6upYFSbC/AtRfsSGseW2eq7TXbXu8gGNZXAsNYKnS4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sB5df5fQqw0q3KmF/T4engHk+WLHLUEwsux1DEsUCI43UL4hei7glOWy2LsqAtrPOrWp2sVaWJD7AzGV4wQiF8/vArLzYkyoqdMuwvYzwidBvIiEhyzoWSgt3TyNVQEzVhR2WsPQCL177LfotEYbFNugum/c8N2SkofZwVSR/CM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=t+CvzY17; arc=none smtp.client-ip=192.19.144.209 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="t+CvzY17" Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id EB5D4C002812; Tue, 23 Apr 2024 11:33:40 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com EB5D4C002812 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1713897221; bh=W6upYFSbC/AtRfsSGseW2eq7TXbXu8gGNZXAsNYKnS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t+CvzY17XndT/hK+dyqJz4NhWnjFZc0M1KoTMa2vEiuGb4kYVS4Z2TGxpQuhFMeM6 LjVoI6ucW+dKLXtPO8qnrC+Za/pftGZYMnBpNqMzhl5rUo8vUlrt+YSdtSlgDFdaRI Nu46B/JWmANstUV/zuO5088U4dQwGVuGczuHg0Js= Received: from fainelli-desktop.igp.broadcom.net (fainelli-desktop.dhcp.broadcom.net [10.67.48.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id 1BFE618041CAC6; Tue, 23 Apr 2024 11:33:39 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 1/8] net: dsa: b53: Stop exporting b53_phylink_* routines Date: Tue, 23 Apr 2024 11:33:32 -0700 Message-Id: <20240423183339.1368511-2-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423183339.1368511-1-florian.fainelli@broadcom.com> References: <20240423183339.1368511-1-florian.fainelli@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org They are not used outside of the b53_common.c file, no need to be exported. Signed-off-by: Florian Fainelli --- drivers/net/dsa/b53/b53_common.c | 27 ++++++++++++--------------- drivers/net/dsa/b53/b53_priv.h | 12 ------------ 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index b2eeff04f4c8..bd069439549f 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -1420,16 +1420,15 @@ static struct phylink_pcs *b53_phylink_mac_select_pcs(struct dsa_switch *ds, return dev->ops->phylink_mac_select_pcs(dev, port, interface); } -void b53_phylink_mac_config(struct dsa_switch *ds, int port, - unsigned int mode, - const struct phylink_link_state *state) +static void b53_phylink_mac_config(struct dsa_switch *ds, int port, + unsigned int mode, + const struct phylink_link_state *state) { } -EXPORT_SYMBOL(b53_phylink_mac_config); -void b53_phylink_mac_link_down(struct dsa_switch *ds, int port, - unsigned int mode, - phy_interface_t interface) +static void b53_phylink_mac_link_down(struct dsa_switch *ds, int port, + unsigned int mode, + phy_interface_t interface) { struct b53_device *dev = ds->priv; @@ -1445,14 +1444,13 @@ void b53_phylink_mac_link_down(struct dsa_switch *ds, int port, dev->ops->serdes_link_set) dev->ops->serdes_link_set(dev, port, mode, interface, false); } -EXPORT_SYMBOL(b53_phylink_mac_link_down); -void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, - unsigned int mode, - phy_interface_t interface, - struct phy_device *phydev, - int speed, int duplex, - bool tx_pause, bool rx_pause) +static void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, + unsigned int mode, + phy_interface_t interface, + struct phy_device *phydev, + int speed, int duplex, + bool tx_pause, bool rx_pause) { struct b53_device *dev = ds->priv; @@ -1473,7 +1471,6 @@ void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, dev->ops->serdes_link_set) dev->ops->serdes_link_set(dev, port, mode, interface, true); } -EXPORT_SYMBOL(b53_phylink_mac_link_up); int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering, struct netlink_ext_ack *extack) diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h index c13a907947f1..05141176daf5 100644 --- a/drivers/net/dsa/b53/b53_priv.h +++ b/drivers/net/dsa/b53/b53_priv.h @@ -352,18 +352,6 @@ int b53_br_flags(struct dsa_switch *ds, int port, struct netlink_ext_ack *extack); int b53_setup_devlink_resources(struct dsa_switch *ds); void b53_port_event(struct dsa_switch *ds, int port); -void b53_phylink_mac_config(struct dsa_switch *ds, int port, - unsigned int mode, - const struct phylink_link_state *state); -void b53_phylink_mac_link_down(struct dsa_switch *ds, int port, - unsigned int mode, - phy_interface_t interface); -void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, - unsigned int mode, - phy_interface_t interface, - struct phy_device *phydev, - int speed, int duplex, - bool tx_pause, bool rx_pause); int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering, struct netlink_ext_ack *extack); int b53_vlan_add(struct dsa_switch *ds, int port, From patchwork Tue Apr 23 18:33:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 13640560 X-Patchwork-Delegate: kuba@kernel.org Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.144.205]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB4C4136989; Tue, 23 Apr 2024 18:42:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.19.144.205 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713897735; cv=none; b=oj+T1CPURxGW+kygQ3oc7XwBLCzAUlzchOSNiGHM1gFd8IXl0GA2vB2PARVrQWx9GHkC6UyVx/uneX3k/ei0mBpS010gVPAj1WqVLEgi8QLWyOrdYtgtBl7VHffAaCKCFJmItK8ScgbS8K9imTOFTKyJPe2gNVVJcLrclEhaIwo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713897735; c=relaxed/simple; bh=sErawwCYvUHt0YL4Bze2yqUWXOhsq1yzz/3NhImhAnw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GO9/9LB755/PRobvVfBM6X+OK/b1iz69FSAPe9jkR/gEEoXVQ8/kJsyXTSKZ2gZlK0zJfht+uBggauZKGdPtjPhv6Hm3TY57F9Edi48UY/hBBFH9PXuUjSDjQDZv3X74oqtfMluVMZ1lo3yPhH0Z5UGv3yUuvnfj+8usIp2v/6A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=ogwTU74z; arc=none smtp.client-ip=192.19.144.205 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="ogwTU74z" Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id 1F244C0049BB; Tue, 23 Apr 2024 11:33:41 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 1F244C0049BB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1713897221; bh=sErawwCYvUHt0YL4Bze2yqUWXOhsq1yzz/3NhImhAnw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ogwTU74zlzGTjH/CcZyypXFgz5gJpWmuWxCY86v1S/fbzF3UPQnYi99Bnt/D8ZweQ 8Rs6EUSuEz4z9G0FhMNwk0Ana4KD5968IBI7bgcEydcNwxnmxYVq+kiOngxzmllUhm q4YuOe9CZWuGO32oyobEq091+ysPqTp/GZDp8mqY= Received: from fainelli-desktop.igp.broadcom.net (fainelli-desktop.dhcp.broadcom.net [10.67.48.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id 41C5518041CAC7; Tue, 23 Apr 2024 11:33:39 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 2/8] net: dsa: b53: Introduce b53_adjust_531x5_rgmii() Date: Tue, 23 Apr 2024 11:33:33 -0700 Message-Id: <20240423183339.1368511-3-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423183339.1368511-1-florian.fainelli@broadcom.com> References: <20240423183339.1368511-1-florian.fainelli@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Takes care of doing the 531x5 switch series specific RGMII programming and is called from b53_adjust_link() to allow the future removal of b53_adjust_link(). Signed-off-by: Florian Fainelli --- drivers/net/dsa/b53/b53_common.c | 84 +++++++++++++++++--------------- 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index bd069439549f..744567c465f7 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -1266,14 +1266,57 @@ static void b53_adjust_63xx_rgmii(struct dsa_switch *ds, int port, phy_modes(interface)); } +static void b53_adjust_531x5_rgmii(struct dsa_switch *ds, int port, + phy_interface_t interface) +{ + struct b53_device *dev = ds->priv; + u8 rgmii_ctrl = 0, off; + + if (port == dev->imp_port) + off = B53_RGMII_CTRL_IMP; + else + off = B53_RGMII_CTRL_P(port); + + /* Configure the port RGMII clock delay by DLL disabled and + * tx_clk aligned timing (restoring to reset defaults) + */ + b53_read8(dev, B53_CTRL_PAGE, off, &rgmii_ctrl); + rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC | RGMII_CTRL_DLL_TXC | + RGMII_CTRL_TIMING_SEL); + + /* PHY_INTERFACE_MODE_RGMII_TXID means TX internal delay, make + * sure that we enable the port TX clock internal delay to + * account for this internal delay that is inserted, otherwise + * the switch won't be able to receive correctly. + * + * PHY_INTERFACE_MODE_RGMII means that we are not introducing + * any delay neither on transmission nor reception, so the + * BCM53125 must also be configured accordingly to account for + * the lack of delay and introduce + * + * The BCM53125 switch has its RX clock and TX clock control + * swapped, hence the reason why we modify the TX clock path in + * the "RGMII" case + */ + if (interface == PHY_INTERFACE_MODE_RGMII_TXID) + rgmii_ctrl |= RGMII_CTRL_DLL_TXC; + if (interface == PHY_INTERFACE_MODE_RGMII) + rgmii_ctrl |= RGMII_CTRL_DLL_TXC | RGMII_CTRL_DLL_RXC; + rgmii_ctrl |= RGMII_CTRL_TIMING_SEL; + b53_write8(dev, B53_CTRL_PAGE, off, rgmii_ctrl); + + dev_info(ds->dev, "Configured port %d for %s\n", port, + phy_modes(interface)); +} + static void b53_adjust_link(struct dsa_switch *ds, int port, struct phy_device *phydev) { struct b53_device *dev = ds->priv; struct ethtool_keee *p = &dev->ports[port].eee; - u8 rgmii_ctrl = 0, reg = 0, off; bool tx_pause = false; bool rx_pause = false; + u8 reg = 0; if (!phy_is_pseudo_fixed_link(phydev)) return; @@ -1295,43 +1338,8 @@ static void b53_adjust_link(struct dsa_switch *ds, int port, if (is63xx(dev) && port >= B53_63XX_RGMII0) b53_adjust_63xx_rgmii(ds, port, phydev->interface); - if (is531x5(dev) && phy_interface_is_rgmii(phydev)) { - if (port == dev->imp_port) - off = B53_RGMII_CTRL_IMP; - else - off = B53_RGMII_CTRL_P(port); - - /* Configure the port RGMII clock delay by DLL disabled and - * tx_clk aligned timing (restoring to reset defaults) - */ - b53_read8(dev, B53_CTRL_PAGE, off, &rgmii_ctrl); - rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC | RGMII_CTRL_DLL_TXC | - RGMII_CTRL_TIMING_SEL); - - /* PHY_INTERFACE_MODE_RGMII_TXID means TX internal delay, make - * sure that we enable the port TX clock internal delay to - * account for this internal delay that is inserted, otherwise - * the switch won't be able to receive correctly. - * - * PHY_INTERFACE_MODE_RGMII means that we are not introducing - * any delay neither on transmission nor reception, so the - * BCM53125 must also be configured accordingly to account for - * the lack of delay and introduce - * - * The BCM53125 switch has its RX clock and TX clock control - * swapped, hence the reason why we modify the TX clock path in - * the "RGMII" case - */ - if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) - rgmii_ctrl |= RGMII_CTRL_DLL_TXC; - if (phydev->interface == PHY_INTERFACE_MODE_RGMII) - rgmii_ctrl |= RGMII_CTRL_DLL_TXC | RGMII_CTRL_DLL_RXC; - rgmii_ctrl |= RGMII_CTRL_TIMING_SEL; - b53_write8(dev, B53_CTRL_PAGE, off, rgmii_ctrl); - - dev_info(ds->dev, "Configured port %d for %s\n", port, - phy_modes(phydev->interface)); - } + if (is531x5(dev) && phy_interface_is_rgmii(phydev)) + b53_adjust_531x5_rgmii(ds, port, phydev->interface); /* configure MII port if necessary */ if (is5325(dev)) { From patchwork Tue Apr 23 18:33:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 13640559 X-Patchwork-Delegate: kuba@kernel.org Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.144.205]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB47D23741; Tue, 23 Apr 2024 18:42:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.19.144.205 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713897735; cv=none; b=HKzJKDFDXNObJJZUF0/LvrLKSNtA6VsJoQuXUCEa9Qc3cI14/xc9LSC4ra6COC8DRWshMNDSaQiKeOwUWRDCAomF0TV4rSt7JRLdOryTdnV2h0imNmXlSpYCFeVbv78NIpdTU2mpVGP5uOJpLCIebEs7lbBWB4QFZIlFY3amcm0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713897735; c=relaxed/simple; bh=4wCmUOm0XhENiAWT4g5nwDJ/9ACSGatVBuBMzSmBaqg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pcQ6zJPIa8Yn9uVqi34LlOinwRoEUlM+xU0bcn4sOeN7S32HeD7vaPbj4rVDAGK+MQBLtpclR+WncKaNCymLaIHY3a80wD1HI4GFZ31IWgRbFaWTQ92yX9iXuAH/xWtUIBUT2noDKnsyDaBJbyntxWGW4ddq3S0XMrL4DCvFQGY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=iA2ypVaD; arc=none smtp.client-ip=192.19.144.205 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="iA2ypVaD" Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id 4510BC0049BD; Tue, 23 Apr 2024 11:33:41 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 4510BC0049BD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1713897221; bh=4wCmUOm0XhENiAWT4g5nwDJ/9ACSGatVBuBMzSmBaqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iA2ypVaDTxQCRz/94GER6n/uGpnEXoC4NFukI6VeQrGjeL/qs7YJjxZfttSxwbNW+ 1Go6kXj+xTtkds5pKyN2BN8gzStFrdNDSNLqHcXXiCG1Pcv4bVWmobvmv3DSCqBQAb U0o5ynoAT1BMTXhmEJV5RBEGHLdkJomKGlE6Ni4U= Received: from fainelli-desktop.igp.broadcom.net (fainelli-desktop.dhcp.broadcom.net [10.67.48.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id 663A518041CAC8; Tue, 23 Apr 2024 11:33:39 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 3/8] net: dsa: b53: Introduce b53_adjust_5325_mii() Date: Tue, 23 Apr 2024 11:33:34 -0700 Message-Id: <20240423183339.1368511-4-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423183339.1368511-1-florian.fainelli@broadcom.com> References: <20240423183339.1368511-1-florian.fainelli@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Takes care of doing the 5325 switch series specific MII programming and is called from b53_adjust_link() to allow the future removal of b53_adjust_link(). Signed-off-by: Florian Fainelli --- drivers/net/dsa/b53/b53_common.c | 44 ++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index 744567c465f7..a127a17be11c 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -1309,6 +1309,29 @@ static void b53_adjust_531x5_rgmii(struct dsa_switch *ds, int port, phy_modes(interface)); } +static void b53_adjust_5325_mii(struct dsa_switch *ds, int port) +{ + struct b53_device *dev = ds->priv; + u8 reg = 0; + + b53_read8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL, + ®); + + /* reverse mii needs to be enabled */ + if (!(reg & PORT_OVERRIDE_RV_MII_25)) { + b53_write8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL, + reg | PORT_OVERRIDE_RV_MII_25); + b53_read8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL, + ®); + + if (!(reg & PORT_OVERRIDE_RV_MII_25)) { + dev_err(ds->dev, + "Failed to enable reverse MII mode\n"); + return; + } + } +} + static void b53_adjust_link(struct dsa_switch *ds, int port, struct phy_device *phydev) { @@ -1316,7 +1339,6 @@ static void b53_adjust_link(struct dsa_switch *ds, int port, struct ethtool_keee *p = &dev->ports[port].eee; bool tx_pause = false; bool rx_pause = false; - u8 reg = 0; if (!phy_is_pseudo_fixed_link(phydev)) return; @@ -1342,24 +1364,8 @@ static void b53_adjust_link(struct dsa_switch *ds, int port, b53_adjust_531x5_rgmii(ds, port, phydev->interface); /* configure MII port if necessary */ - if (is5325(dev)) { - b53_read8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL, - ®); - - /* reverse mii needs to be enabled */ - if (!(reg & PORT_OVERRIDE_RV_MII_25)) { - b53_write8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL, - reg | PORT_OVERRIDE_RV_MII_25); - b53_read8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL, - ®); - - if (!(reg & PORT_OVERRIDE_RV_MII_25)) { - dev_err(ds->dev, - "Failed to enable reverse MII mode\n"); - return; - } - } - } + if (is5325(dev)) + b53_adjust_5325_mii(ds, port); /* Re-negotiate EEE if it was enabled already */ p->eee_enabled = b53_eee_init(ds, port, phydev); From patchwork Tue Apr 23 18:33:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 13640548 X-Patchwork-Delegate: kuba@kernel.org Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.144.207]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 990181E53F; Tue, 23 Apr 2024 18:33:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.19.144.207 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713897228; cv=none; b=d92+5qR90x47ywVAfmaYlikOovi4ypHlY+lzPRgrXQuWdYWJSC/0Gn9/rNxkGa3RiACl7PSxmZLYLtidtELQEfRk50KuB7qIbKWGaXZlxljyn0kh+HM8ExxYIn5Ij8KFi/WVjCIo09czhOYft7t/ea/Y6H8O5eb878hSR2hB8Cw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713897228; c=relaxed/simple; bh=A406q/tAi4UZG/IcGrX9tzSqvoePKRA9IiSHVZtAsos=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ugdk1M+Iwk8KiMfwYAn9M1bBG3PYFKHhlAK7mXv1oloUen+78r24jJLCUZwUSoSGhkeGXA6n4x6kSWEah27a4S+9qtx5QMV03JLpxW0hVecVI+VeNgq1B7mkRwUFaaQTatSDKV/HoFGF71qCc0rtx+Gb1KU4TsTtg7jlP9h7yRg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=llPNQYid; arc=none smtp.client-ip=192.19.144.207 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="llPNQYid" Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id 6CAE8C00282D; Tue, 23 Apr 2024 11:33:41 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 6CAE8C00282D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1713897221; bh=A406q/tAi4UZG/IcGrX9tzSqvoePKRA9IiSHVZtAsos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=llPNQYid5I7ncsvky7UeA6ELxr9WskCvmPzOsIBHVpgqWp2cD4Zj1lTXVE7lPBBSk k0eEj92LPiiSsjUgOHJPXthctXCqLU3xhNb5lyIIjgGiVO9+HN8Yfvc7u4muB0ohrL qBxB+PUUJsoZFr2r6Xvr9dD2vUSovlaRQj+eeSp8= Received: from fainelli-desktop.igp.broadcom.net (fainelli-desktop.dhcp.broadcom.net [10.67.48.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id 8C4E318041CAC4; Tue, 23 Apr 2024 11:33:39 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 4/8] net: dsa: b53: Force flow control for BCM5301X CPU port(s) Date: Tue, 23 Apr 2024 11:33:35 -0700 Message-Id: <20240423183339.1368511-5-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423183339.1368511-1-florian.fainelli@broadcom.com> References: <20240423183339.1368511-1-florian.fainelli@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Just like what b53_adjust_link() does, force flow control for the BCM5301X CPU port(s) by forcing rx_pause and tx_pause in b53_phylink_mac_link_up(). Preparatory step for getting rid of b53_adjust_link(). Signed-off-by: Florian Fainelli --- drivers/net/dsa/b53/b53_common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index a127a17be11c..6277ab7dcb7f 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -1475,6 +1475,10 @@ static void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, return; if (mode == MLO_AN_FIXED) { + /* Force flow control on BCM5301x's CPU port */ + if (is5301x(dev) && dsa_is_cpu_port(ds, port)) + tx_pause = rx_pause = true; + b53_force_port_config(dev, port, speed, duplex, tx_pause, rx_pause); b53_force_link(dev, port, true); From patchwork Tue Apr 23 18:33:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 13640549 X-Patchwork-Delegate: kuba@kernel.org Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.144.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2EDC224F0; Tue, 23 Apr 2024 18:33:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.19.144.209 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713897229; cv=none; b=uqZKlhjHeSUBgxpUYIHe1a6NFH30+9vWjBuIWed3mKZHm2x5OPWdxjO79V4BPsKQETs5y3tuOJW9zJNCsETVw9kmUI9HMnVUKVvQJFD8tvY6535xTr8urtt1j5K8F/E72c53GHjCk9dFbVlrmIzRuPbBIOhC7njZ9KwT6U0cYXk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713897229; c=relaxed/simple; bh=5Rs4NDx0w9fZ2G6+ayoz5dB3lgt7R2tOgtEK4vnKs9A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lcbYhgcSSxA4BFFPjS0PLDzBPNXaRfOWuz35vqRtX+GLxbdPk5lxlaGbhgvquDzHwDkTNO52c2/3B8On6Ni3CHVti/HC6w8+aF5GmqBKZsROV5mypd4YxxJgz2LGF+rNu/Ee6JuIRSz4CEtuSs/Q/fMouJmaeDfyyfxkQ7WFMrw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=XmA1fUKM; arc=none smtp.client-ip=192.19.144.209 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="XmA1fUKM" Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id 86999C002816; Tue, 23 Apr 2024 11:33:41 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 86999C002816 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1713897221; bh=5Rs4NDx0w9fZ2G6+ayoz5dB3lgt7R2tOgtEK4vnKs9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XmA1fUKMY2dJWb488nPAXVhe06pqY5QoLWOwatXPdbsEM3h1+PPJUzgRO54ctIZen nBXRGFCU9pTTUyIiWx5m2NRRB0OE/s7MfoW4VWAVH1ePX1z1nEVk7oZSjmayrj5Ujl OsYWgxEta8/qn9YWpIJ+N8/3uEjBKnJQEEIZ44aU= Received: from fainelli-desktop.igp.broadcom.net (fainelli-desktop.dhcp.broadcom.net [10.67.48.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id AC72C18041CAC6; Tue, 23 Apr 2024 11:33:39 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 5/8] net: dsa: b53: Configure RGMII for 531x5 and MII for 5325 Date: Tue, 23 Apr 2024 11:33:36 -0700 Message-Id: <20240423183339.1368511-6-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423183339.1368511-1-florian.fainelli@broadcom.com> References: <20240423183339.1368511-1-florian.fainelli@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Call b53_adjust_531x5_rgmii() and b53_adjust_5325_mii() from b53_phylink_mac_config() when we have a fixed PHY in preparation for removing b53_adjust_link(). Also move b53_adjust_63xx_rgmii() to b53_phylink_mac_config() where it logically belongs. Signed-off-by: Florian Fainelli --- drivers/net/dsa/b53/b53_common.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index 6277ab7dcb7f..18b87e903943 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -1438,6 +1438,20 @@ static void b53_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, const struct phylink_link_state *state) { + phy_interface_t interface = state->interface; + struct b53_device *dev = ds->priv; + + if (is63xx(dev) && port >= B53_63XX_RGMII0) + b53_adjust_63xx_rgmii(ds, port, interface); + + if (mode == MLO_AN_FIXED) { + if (is531x5(dev) && phy_interface_mode_is_rgmii(interface)) + b53_adjust_531x5_rgmii(ds, port, interface); + + /* configure MII port if necessary */ + if (is5325(dev)) + b53_adjust_5325_mii(ds, port); + } } static void b53_phylink_mac_link_down(struct dsa_switch *ds, int port, @@ -1468,9 +1482,6 @@ static void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, { struct b53_device *dev = ds->priv; - if (is63xx(dev) && port >= B53_63XX_RGMII0) - b53_adjust_63xx_rgmii(ds, port, interface); - if (mode == MLO_AN_PHY) return; From patchwork Tue Apr 23 18:33:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 13640551 X-Patchwork-Delegate: kuba@kernel.org Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.144.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D47A023775; Tue, 23 Apr 2024 18:33:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.19.144.209 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713897229; cv=none; b=Nem7SzPdoWIc29fRYzdd2g9yOpNtpqvf+k7yjZbQXKrjYWirc6E7UL+PHJ8r8qz0y0t/XH4HZwKXiek0UzFqW8Zz+FRSQaVCl3ufBKoaE/NgxSBB9Tuyu/+kJJYWOkWHwxSDAkpgThAkB/xy071LEhsPZjwM7ILrDikszFQJJqs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713897229; c=relaxed/simple; bh=WXA2ZfSFb7CbPUJRrqZdpAtOjK+DU+4PHhQxaWIgaCo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LZ1W7i6EwjN5F1lE0tOEhB3FP0JQ4aiw/hWPigMq7wPwTwkMCpmQXRgfSHUjXsM98r84YRpeCB+de+QnyiHUrb3zA6fVU76JJFNmRzOuMPhjRFgFrixdQLwSjUzJzqvJBC7YcDGTnCtuXlpsw8gF+qtRHgEbiGiC7yiK+XA+3bA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=XGslnqNG; arc=none smtp.client-ip=192.19.144.209 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="XGslnqNG" Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id B8930C00281B; Tue, 23 Apr 2024 11:33:41 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com B8930C00281B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1713897221; bh=WXA2ZfSFb7CbPUJRrqZdpAtOjK+DU+4PHhQxaWIgaCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XGslnqNGknPdxUopqHaujYiNG7PSj7tAYSIJWW3hxfn1BvxoydIbxS0FMYcTR8H8q j71rzh++YAIEFODroVXXXmtIsr256j1MJ5UTXeCASix5AScNJYzGeqN9K45zuTAR7Q EE2j3zRl5LDTN6OViWWDwONQXRrfDqdVERxgf66w= Received: from fainelli-desktop.igp.broadcom.net (fainelli-desktop.dhcp.broadcom.net [10.67.48.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id D1E7C18041CAC7; Tue, 23 Apr 2024 11:33:39 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 6/8] net: dsa: b53: Call b53_eee_init() from b53_mac_link_up() Date: Tue, 23 Apr 2024 11:33:37 -0700 Message-Id: <20240423183339.1368511-7-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423183339.1368511-1-florian.fainelli@broadcom.com> References: <20240423183339.1368511-1-florian.fainelli@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org And make sure this is done for the MLO_AN_PHY case, where it actually makes sense, contrary to b53_adjust_link() which only did it for fixed-PHY configurations where it does not make sense. Signed-off-by: Florian Fainelli --- drivers/net/dsa/b53/b53_common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index 18b87e903943..a4b50ee97f87 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -1481,9 +1481,13 @@ static void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, bool tx_pause, bool rx_pause) { struct b53_device *dev = ds->priv; + struct ethtool_keee *p = &dev->ports[port].eee; - if (mode == MLO_AN_PHY) + if (mode == MLO_AN_PHY) { + /* Re-negotiate EEE if it was enabled already */ + p->eee_enabled = b53_eee_init(ds, port, phydev); return; + } if (mode == MLO_AN_FIXED) { /* Force flow control on BCM5301x's CPU port */ From patchwork Tue Apr 23 18:33:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 13640553 X-Patchwork-Delegate: kuba@kernel.org Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.144.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D47DF28DC9; Tue, 23 Apr 2024 18:33:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.19.144.209 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713897229; cv=none; b=UXi+wV5doc/CHD1iXAue/khy7q2iItFjgUrYqPjARk76VogQelohLYqkTVbJQ+HZSMv4S41lUWCoh/HWM5fdq/3fvi879Ea82qVP5DyWdHsrwB6cPY8db/fBIA0tGW53VtUpkngJO+0SXsKOxJdXDRoSahnMMtKK3CN+251SdWk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713897229; c=relaxed/simple; bh=2RgbMZJTXx6wWtzezoSyloI2BXtL889JrErm1lkgkiE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jQnt7Ab98oQAaE8Ljt0mjijiQKXxSaaSSExv858aSrQGquRnFwfcJ77GB97RcIn1wFCIM/PUkBzzzgP5YVBVSYJvKrlll8b8zmP+J7Cdhv5wf+FU3P3EvQ/fm7tPf9zLYYIb5Ph+3SSDXDaClTxLkP/p/YD6gXuX+d1pzcZOoRg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=jmXtYAl8; arc=none smtp.client-ip=192.19.144.209 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="jmXtYAl8" Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id D8434C00281F; Tue, 23 Apr 2024 11:33:41 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com D8434C00281F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1713897221; bh=2RgbMZJTXx6wWtzezoSyloI2BXtL889JrErm1lkgkiE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jmXtYAl80Gmbei5Xdt2iElv4Qu5g4Xc8xTn9n+LTaZm8kwVKWS52jz9SOVK7RjrA7 +uD2RxfWko0iPRVauByjoweWPsMO5GAriESYaJll2duba3Q69UV6QV1WUMcEh0Vn14 9/aR2POpIgpoYWFdl9611CBd0ZB9kRLF9bt0ix2c= Received: from fainelli-desktop.igp.broadcom.net (fainelli-desktop.dhcp.broadcom.net [10.67.48.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id 03ABF18041CAC8; Tue, 23 Apr 2024 11:33:40 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 7/8] net: dsa: b53: Remove b53_adjust_link() Date: Tue, 23 Apr 2024 11:33:38 -0700 Message-Id: <20240423183339.1368511-8-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423183339.1368511-1-florian.fainelli@broadcom.com> References: <20240423183339.1368511-1-florian.fainelli@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Only use the PHYLINK implementation from there on now that an equivalent configuration is applied to all of the switch ports. Signed-off-by: Florian Fainelli --- drivers/net/dsa/b53/b53_common.c | 40 -------------------------------- 1 file changed, 40 deletions(-) diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index a4b50ee97f87..e490ef0fd3f1 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -1332,45 +1332,6 @@ static void b53_adjust_5325_mii(struct dsa_switch *ds, int port) } } -static void b53_adjust_link(struct dsa_switch *ds, int port, - struct phy_device *phydev) -{ - struct b53_device *dev = ds->priv; - struct ethtool_keee *p = &dev->ports[port].eee; - bool tx_pause = false; - bool rx_pause = false; - - if (!phy_is_pseudo_fixed_link(phydev)) - return; - - /* Enable flow control on BCM5301x's CPU port */ - if (is5301x(dev) && dsa_is_cpu_port(ds, port)) - tx_pause = rx_pause = true; - - if (phydev->pause) { - if (phydev->asym_pause) - tx_pause = true; - rx_pause = true; - } - - b53_force_port_config(dev, port, phydev->speed, phydev->duplex, - tx_pause, rx_pause); - b53_force_link(dev, port, phydev->link); - - if (is63xx(dev) && port >= B53_63XX_RGMII0) - b53_adjust_63xx_rgmii(ds, port, phydev->interface); - - if (is531x5(dev) && phy_interface_is_rgmii(phydev)) - b53_adjust_531x5_rgmii(ds, port, phydev->interface); - - /* configure MII port if necessary */ - if (is5325(dev)) - b53_adjust_5325_mii(ds, port); - - /* Re-negotiate EEE if it was enabled already */ - p->eee_enabled = b53_eee_init(ds, port, phydev); -} - void b53_port_event(struct dsa_switch *ds, int port) { struct b53_device *dev = ds->priv; @@ -2308,7 +2269,6 @@ static const struct dsa_switch_ops b53_switch_ops = { .get_ethtool_phy_stats = b53_get_ethtool_phy_stats, .phy_read = b53_phy_read16, .phy_write = b53_phy_write16, - .adjust_link = b53_adjust_link, .phylink_get_caps = b53_phylink_get_caps, .phylink_mac_select_pcs = b53_phylink_mac_select_pcs, .phylink_mac_config = b53_phylink_mac_config, From patchwork Tue Apr 23 18:33:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 13640552 X-Patchwork-Delegate: kuba@kernel.org Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.144.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2F572AD2C; Tue, 23 Apr 2024 18:33:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.19.144.209 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713897229; cv=none; b=YmDijZE75fdSpQVZcOTO/pQzD5gM05ZRYrT5HqxQw8lDHgxeR6h9kFPRXeKS0/7n22UTKlNdyYZ/RhdHWne4QquIbyAS7pR/3dGc8kvZr3kJh5K5LBN3dQVz3WvW1kArS/Bpb2TVHgOC0kdisV+VfGlOObxlH9JLUWaAKp5uSk0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713897229; c=relaxed/simple; bh=c/Ah+ocoUmfGe7UtUQ0MIQIvcS0fCgxsUc5y7Y2Hzns=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nVvr60mDpmvvRKy3Z6AZk8Loq+0FNhmvBY8+gOqHJo/5o3KK7zFUkCZRT2Q9COnaVI1VRT8p+lgYpxeUHn6n3iWxZgKbd18lFeRWXeAKVSvLb9qRX1qChvtWub9mLApkeWkXNJuKNK72zrU/CT7Gx8WhKKo0+mxlF6jZ1IELxC0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=Df0U+Pwq; arc=none smtp.client-ip=192.19.144.209 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Df0U+Pwq" Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id 05FC0C002821; Tue, 23 Apr 2024 11:33:42 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 05FC0C002821 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1713897222; bh=c/Ah+ocoUmfGe7UtUQ0MIQIvcS0fCgxsUc5y7Y2Hzns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Df0U+PwqGWnGL6cz/LQi8FCGT4wMjX+C5bztz1J7ErXLmQiZEXlE967SpLHWGGKD5 7fF5HkIpDEt5gP5eUmPbyIJZC1Hnx640btl9YpitkpoOe1BZ/jz50QjO1kGdX5Dp34 MIJsgBh25ttg2sTd3FNoS1Vlh3DSKOzHGKM3be2Q= Received: from fainelli-desktop.igp.broadcom.net (fainelli-desktop.dhcp.broadcom.net [10.67.48.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id 29CE318041CAC4; Tue, 23 Apr 2024 11:33:40 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 8/8] net: dsa: b53: provide own phylink MAC operations Date: Tue, 23 Apr 2024 11:33:39 -0700 Message-Id: <20240423183339.1368511-9-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423183339.1368511-1-florian.fainelli@broadcom.com> References: <20240423183339.1368511-1-florian.fainelli@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Convert b53 to provide its own phylink MAC operations, thus avoiding the shim layer in DSA's port.c Signed-off-by: Florian Fainelli --- drivers/net/dsa/b53/b53_common.c | 40 +++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index e490ef0fd3f1..8f50abe739b7 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -1383,24 +1383,27 @@ static void b53_phylink_get_caps(struct dsa_switch *ds, int port, dev->ops->phylink_get_caps(dev, port, config); } -static struct phylink_pcs *b53_phylink_mac_select_pcs(struct dsa_switch *ds, - int port, +static struct phylink_pcs *b53_phylink_mac_select_pcs(struct phylink_config *config, phy_interface_t interface) { - struct b53_device *dev = ds->priv; + struct dsa_port *dp = dsa_phylink_to_port(config); + struct b53_device *dev = dp->ds->priv; if (!dev->ops->phylink_mac_select_pcs) return NULL; - return dev->ops->phylink_mac_select_pcs(dev, port, interface); + return dev->ops->phylink_mac_select_pcs(dev, dp->index, interface); } -static void b53_phylink_mac_config(struct dsa_switch *ds, int port, +static void b53_phylink_mac_config(struct phylink_config *config, unsigned int mode, const struct phylink_link_state *state) { + struct dsa_port *dp = dsa_phylink_to_port(config); phy_interface_t interface = state->interface; + struct dsa_switch *ds = dp->ds; struct b53_device *dev = ds->priv; + int port = dp->index; if (is63xx(dev) && port >= B53_63XX_RGMII0) b53_adjust_63xx_rgmii(ds, port, interface); @@ -1415,11 +1418,13 @@ static void b53_phylink_mac_config(struct dsa_switch *ds, int port, } } -static void b53_phylink_mac_link_down(struct dsa_switch *ds, int port, +static void b53_phylink_mac_link_down(struct phylink_config *config, unsigned int mode, phy_interface_t interface) { - struct b53_device *dev = ds->priv; + struct dsa_port *dp = dsa_phylink_to_port(config); + struct b53_device *dev = dp->ds->priv; + int port = dp->index; if (mode == MLO_AN_PHY) return; @@ -1434,15 +1439,18 @@ static void b53_phylink_mac_link_down(struct dsa_switch *ds, int port, dev->ops->serdes_link_set(dev, port, mode, interface, false); } -static void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, +static void b53_phylink_mac_link_up(struct phylink_config *config, + struct phy_device *phydev, unsigned int mode, phy_interface_t interface, - struct phy_device *phydev, int speed, int duplex, bool tx_pause, bool rx_pause) { + struct dsa_port *dp = dsa_phylink_to_port(config); + struct dsa_switch *ds = dp->ds; struct b53_device *dev = ds->priv; - struct ethtool_keee *p = &dev->ports[port].eee; + struct ethtool_keee *p = &dev->ports[dp->index].eee; + int port = dp->index; if (mode == MLO_AN_PHY) { /* Re-negotiate EEE if it was enabled already */ @@ -2259,6 +2267,13 @@ static int b53_get_max_mtu(struct dsa_switch *ds, int port) return JMS_MAX_SIZE; } +static const struct phylink_mac_ops b53_phylink_mac_ops = { + .mac_select_pcs = b53_phylink_mac_select_pcs, + .mac_config = b53_phylink_mac_config, + .mac_link_down = b53_phylink_mac_link_down, + .mac_link_up = b53_phylink_mac_link_up, +}; + static const struct dsa_switch_ops b53_switch_ops = { .get_tag_protocol = b53_get_tag_protocol, .setup = b53_setup, @@ -2270,10 +2285,6 @@ static const struct dsa_switch_ops b53_switch_ops = { .phy_read = b53_phy_read16, .phy_write = b53_phy_write16, .phylink_get_caps = b53_phylink_get_caps, - .phylink_mac_select_pcs = b53_phylink_mac_select_pcs, - .phylink_mac_config = b53_phylink_mac_config, - .phylink_mac_link_down = b53_phylink_mac_link_down, - .phylink_mac_link_up = b53_phylink_mac_link_up, .port_enable = b53_enable_port, .port_disable = b53_disable_port, .get_mac_eee = b53_get_mac_eee, @@ -2716,6 +2727,7 @@ struct b53_device *b53_switch_alloc(struct device *base, dev->priv = priv; dev->ops = ops; ds->ops = &b53_switch_ops; + ds->phylink_mac_ops = &b53_phylink_mac_ops; dev->vlan_enabled = true; /* Let DSA handle the case were multiple bridges span the same switch * device and different VLAN awareness settings are requested, which