From patchwork Wed Oct 27 09:03:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 12586743 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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3F8BC433F5 for ; Wed, 27 Oct 2021 09:03:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C460E60EB4 for ; Wed, 27 Oct 2021 09:03:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234129AbhJ0JGN (ORCPT ); Wed, 27 Oct 2021 05:06:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230350AbhJ0JGK (ORCPT ); Wed, 27 Oct 2021 05:06:10 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ABB6C061570 for ; Wed, 27 Oct 2021 02:03:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ABeyvAaibmSZCdZ3TMWtb2x84Fdq54DVLG3c2DYJZPM=; b=dgJSi6oA2rXk5ira8kIYcYu6Gg hxDEcvwZvAHo2gy2Bl8UY7jfFYRlWblgNnQ77FIsngFIoSnvlzK5D92Bg1cLWE0CIdgmwkMRZLm6T 9CHgocR+zG/F7pexoGdcT0eEsxzwfdQ58+I9z4FhkYAZ9p18i+QWvUAyeoddTBRkXnQJzMjDZ0Eui 82ptrMrGjVl84sE74H6vItBYMleduAB9J4/OjIeJeEdDUIsk0PalkBW/ucKSI4VcRdTDFVRnPo1SP AiLrWhig8638aJgm3E1FHM6eQdddXb2suST76aAY+LEEsBqCtB5clGFP5RBROUDZqb+QthsLLpz9L QJ39KX9Q==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:34110 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mfeqV-0006Ct-Iy; Wed, 27 Oct 2021 10:03:43 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1mfeqV-001Trr-5d; Wed, 27 Oct 2021 10:03:43 +0100 In-Reply-To: References: From: Russell King To: "David S. Miller" , Jakub Kicinski Cc: Thomas Petazzoni , netdev@vger.kernel.org Subject: [PATCH net-next 1/3] net: mvneta: populate supported_interfaces member MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 27 Oct 2021 10:03:43 +0100 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Populate the phy_interface_t bitmap for the Marvell mvneta driver with interfaces modes supported by the MAC. Signed-off-by: Russell King --- drivers/net/ethernet/marvell/mvneta.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index b6c636592dfa..7df923648bc4 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -5179,6 +5179,31 @@ static int mvneta_probe(struct platform_device *pdev) pp->phylink_config.dev = &dev->dev; pp->phylink_config.type = PHYLINK_NETDEV; + phy_interface_set_rgmii(pp->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_QSGMII, + pp->phylink_config.supported_interfaces); + if (comphy) { + /* If a COMPHY is present, we can support any of the serdes + * modes and switch between them. + */ + __set_bit(PHY_INTERFACE_MODE_SGMII, + pp->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_1000BASEX, + pp->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_2500BASEX, + pp->phylink_config.supported_interfaces); + } else if (phy_mode == PHY_INTERFACE_MODE_2500BASEX) { + /* No COMPHY, with only 2500BASE-X mode supported */ + __set_bit(PHY_INTERFACE_MODE_2500BASEX, + pp->phylink_config.supported_interfaces); + } else if (phy_mode == PHY_INTERFACE_MODE_1000BASEX || + phy_mode == PHY_INTERFACE_MODE_SGMII) { + /* No COMPHY, we can switch between 1000BASE-X and SGMII */ + __set_bit(PHY_INTERFACE_MODE_1000BASEX, + pp->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_SGMII, + pp->phylink_config.supported_interfaces); + } phylink = phylink_create(&pp->phylink_config, pdev->dev.fwnode, phy_mode, &mvneta_phylink_ops); From patchwork Wed Oct 27 09:03:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 12586745 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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1257BC433F5 for ; Wed, 27 Oct 2021 09:03:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 00A816109E for ; Wed, 27 Oct 2021 09:03:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237295AbhJ0JGQ (ORCPT ); Wed, 27 Oct 2021 05:06:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232233AbhJ0JGP (ORCPT ); Wed, 27 Oct 2021 05:06:15 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AA0BC061745 for ; Wed, 27 Oct 2021 02:03:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jk8dNVv5WQ4mUZVM6fRjbGGYew/ymvkSSRuyeBO5izw=; b=R7+0ld36cbLBc3cIhwXo/Wn8Oz grDJE+m94XFN+avKTxE+d7YV3EKf+iooEJOhOpC/koPkxgP7jQY+0sM24nKWXUL0Jk4o8JquTdhX+ zww9yZvzQGHuqmFhk9kpDVKGShCKWIzp81pN2Iw7wfvom+DjaS4azxlhESK6zXEblGMK4PcnHNZ1U hmw7PA9LcOJ+a+q8H/xGVuhnWLyAow+gsAAxG2OTLIMbQwoTeKWCtD4mgTPj5hOaMtfd4eE4Yj/q9 OZwKd3JZzQUx88zHSC1+5u5DJFu1tFVf532emankOh5QyoGKfNdXBkHEdDKJQUq9g4Owphswce++/ Fh8LNMdw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:34114 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mfeqa-0006D2-PB; Wed, 27 Oct 2021 10:03:48 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1mfeqa-001Trx-9W; Wed, 27 Oct 2021 10:03:48 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: "David S. Miller" , Jakub Kicinski Cc: Thomas Petazzoni , netdev@vger.kernel.org Subject: [PATCH net-next 2/3] net: mvneta: remove interface checks in mvneta_validate() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 27 Oct 2021 10:03:48 +0100 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org As phylink checks the interface mode against the supported_interfaces bitmap, we no longer need to validate the interface mode in the validation function. Remove this to simplify it. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/marvell/mvneta.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 7df923648bc4..446cdd496f1b 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -3832,15 +3832,8 @@ static void mvneta_validate(struct phylink_config *config, * "Bit 2 Field InBandAnEn In-band Auto-Negotiation enable. ... * When = 1 (1000BASE-X) this field must be set to 1." */ - if (phy_interface_mode_is_8023z(state->interface)) { - if (!phylink_test(state->advertising, Autoneg)) { - linkmode_zero(supported); - return; - } - } else if (state->interface != PHY_INTERFACE_MODE_NA && - state->interface != PHY_INTERFACE_MODE_QSGMII && - state->interface != PHY_INTERFACE_MODE_SGMII && - !phy_interface_mode_is_rgmii(state->interface)) { + if (phy_interface_mode_is_8023z(state->interface) && + !phylink_test(state->advertising, Autoneg)) { linkmode_zero(supported); return; } From patchwork Wed Oct 27 09:03:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 12586747 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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD8AFC433F5 for ; Wed, 27 Oct 2021 09:03:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 92D1661040 for ; Wed, 27 Oct 2021 09:03:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241175AbhJ0JGX (ORCPT ); Wed, 27 Oct 2021 05:06:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241167AbhJ0JGU (ORCPT ); Wed, 27 Oct 2021 05:06:20 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7751DC061570 for ; Wed, 27 Oct 2021 02:03:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3TgcIBweO7xVl6HKHrs1OzMT/Y39bKCY8oBWIWj+7Kg=; b=SetM8woIpXakNoRShSWf25IdUR s9aY6oIx3n92FtJ5rOjb8GXp5W2mOyi+H8PikvT0vdUuxnMyuNYWbU07NUPm5EkV5GScC2Y8ekqY1 rIqeAZNS/qKXo5bL0LC4CrCrvnu8MdyNMtZq527Ah6/uAdDGnmtKsu33duzXPK4JSo7ycwcwboPcL ql+0Q+dRCO63CFKgI+kuEV+VSWsN+v9pPrBxZnjKcsu0hZ/Ag1Gj044tAz/AfRPaIdpXaPIP8bojp snOFnYoB+cyYF/EYudeV+S7SBSqiMQ0hsKHOIpaxvsR8w9J+tc7AOW5rH7A0RNmWPYqoB1rjt8OPM JVc/Ylyw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:34116 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mfeqf-0006DB-SZ; Wed, 27 Oct 2021 10:03:53 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1mfeqf-001Ts3-FQ; Wed, 27 Oct 2021 10:03:53 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: "David S. Miller" , Jakub Kicinski Cc: Thomas Petazzoni , netdev@vger.kernel.org Subject: [PATCH net-next 3/3] net: mvneta: drop use of phylink_helper_basex_speed() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 27 Oct 2021 10:03:53 +0100 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Now that we have a better method to select SFP interface modes, we no longer need to use phylink_helper_basex_speed() in a driver's validation function, and we can also get rid of our hack to indicate both 1000base-X and 2500base-X if the comphy is present to make that work. Remove this hack and use of phylink_helper_basex_speed(). Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/marvell/mvneta.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 446cdd496f1b..5a7bdca22a63 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -3823,8 +3823,6 @@ static void mvneta_validate(struct phylink_config *config, unsigned long *supported, struct phylink_link_state *state) { - struct net_device *ndev = to_net_dev(config->dev); - struct mvneta_port *pp = netdev_priv(ndev); __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; /* We only support QSGMII, SGMII, 802.3z and RGMII modes. @@ -3846,11 +3844,12 @@ static void mvneta_validate(struct phylink_config *config, phylink_set(mask, Pause); /* Half-duplex at speeds higher than 100Mbit is unsupported */ - if (pp->comphy || state->interface != PHY_INTERFACE_MODE_2500BASEX) { + if (state->interface != PHY_INTERFACE_MODE_2500BASEX) { phylink_set(mask, 1000baseT_Full); phylink_set(mask, 1000baseX_Full); } - if (pp->comphy || state->interface == PHY_INTERFACE_MODE_2500BASEX) { + + if (state->interface == PHY_INTERFACE_MODE_2500BASEX) { phylink_set(mask, 2500baseT_Full); phylink_set(mask, 2500baseX_Full); } @@ -3865,11 +3864,6 @@ static void mvneta_validate(struct phylink_config *config, linkmode_and(supported, supported, mask); linkmode_and(state->advertising, state->advertising, mask); - - /* We can only operate at 2500BaseX or 1000BaseX. If requested - * to advertise both, only report advertising at 2500BaseX. - */ - phylink_helper_basex_speed(state); } static void mvneta_mac_pcs_get_state(struct phylink_config *config,