From patchwork Thu Mar 30 08:39:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sit, Michael Wei Hong" X-Patchwork-Id: 13193616 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3F7FC77B62 for ; Thu, 30 Mar 2023 08:41:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229957AbjC3IlC (ORCPT ); Thu, 30 Mar 2023 04:41:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229849AbjC3IlB (ORCPT ); Thu, 30 Mar 2023 04:41:01 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93A6E7683; Thu, 30 Mar 2023 01:40:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680165657; x=1711701657; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0DOTY4ZPGFZaHY/uWfGDuMYUQdXHlRV5Muct6oWwU3o=; b=H18LoIdyq7eMgWshI/xN15aFm3jl8yB4ZcbFMS/F67EkGkFfY7sAkA/1 ZqnTp2arjgaZDUgaGv5s0LR2sDZZZKgJS5cb/poLiPXhchS7FZPVtfYOm kpjX2L3ZyQTbMAuVmtvKSX/NtFv9UYS73vd1NxrD0YivkEVNvkQK/zno0 rAfwWxtxS1XLblux/SYk53HR0gLr9lyCKmILLi+m+iJOTB8oWcOfY1X/Y KMm4sR6uNF/FFUMobVFgOW9LOjLoyDOB/0V/S9+tCWkXYxrD7+6wVoHpF O4h30ixxF/zqUzLLShvdhhKk5Y+9VIGBNTSK8S4yEskePJbbuLdlCfqSu g==; X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="343559394" X-IronPort-AV: E=Sophos;i="5.98,303,1673942400"; d="scan'208";a="343559394" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2023 01:40:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="684618816" X-IronPort-AV: E=Sophos;i="5.98,303,1673942400"; d="scan'208";a="684618816" Received: from mike-ilbpg1.png.intel.com ([10.88.227.76]) by orsmga002.jf.intel.com with ESMTP; 30 Mar 2023 01:40:52 -0700 From: Michael Sit Wei Hong To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Ong Boon Leong , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux@armlinux.org.uk, hkallweit1@gmail.com, andrew@lunn.ch Cc: Looi Hong Aun , Voon Weifeng , Lai Peter Jun Ann Subject: [PATCH net v4 1/3] net: phylink: add phylink_expects_phy() method Date: Thu, 30 Mar 2023 16:39:58 +0800 Message-Id: <20230330084000.3292487-2-michael.wei.hong.sit@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230330084000.3292487-1-michael.wei.hong.sit@intel.com> References: <20230330084000.3292487-1-michael.wei.hong.sit@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Provide phylink_expects_phy() to allow MAC drivers to check if it is expecting a PHY to attach to. Since fixed-linked setups do not need to attach to a PHY. Provides a boolean value as to if the MAC should expect a PHY. returns true if a PHY is expected. Signed-off-by: Michael Sit Wei Hong Reviewed-by: Russell King (Oracle) --- drivers/net/phy/phylink.c | 17 +++++++++++++++++ include/linux/phylink.h | 1 + 2 files changed, 18 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 1a2f074685fa..4c080656e280 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1586,6 +1586,23 @@ void phylink_destroy(struct phylink *pl) } EXPORT_SYMBOL_GPL(phylink_destroy); +/** + * phylink_expects_phy() - Determine if phylink expects a phy to be attached + * @pl: a pointer to a &struct phylink returned from phylink_create() + * + * Fixed-link mode does not need a PHY, returns a boolean value to check if + * phylink will be expecting a PHY to attach. + */ +bool phylink_expects_phy(struct phylink *pl) +{ + if (pl->cfg_link_an_mode == MLO_AN_FIXED || + (pl->cfg_link_an_mode == MLO_AN_INBAND && + phy_interface_mode_is_8023z(pl->link_config.interface))) + return false; + return true; +} +EXPORT_SYMBOL_GPL(phylink_expects_phy); + static void phylink_phy_change(struct phy_device *phydev, bool up) { struct phylink *pl = phydev->phylink; diff --git a/include/linux/phylink.h b/include/linux/phylink.h index c492c26202b5..637698ed5cb6 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -574,6 +574,7 @@ struct phylink *phylink_create(struct phylink_config *, struct fwnode_handle *, phy_interface_t iface, const struct phylink_mac_ops *mac_ops); void phylink_destroy(struct phylink *); +bool phylink_expects_phy(struct phylink *pl); int phylink_connect_phy(struct phylink *, struct phy_device *); int phylink_of_phy_connect(struct phylink *, struct device_node *, u32 flags); From patchwork Thu Mar 30 08:39:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sit, Michael Wei Hong" X-Patchwork-Id: 13193617 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65EEDC6FD1D for ; Thu, 30 Mar 2023 08:41:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229869AbjC3IlQ (ORCPT ); Thu, 30 Mar 2023 04:41:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230012AbjC3IlE (ORCPT ); Thu, 30 Mar 2023 04:41:04 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 515895B8E; Thu, 30 Mar 2023 01:41:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680165661; x=1711701661; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=h7HA31Ype249VhePLWHGaLt81vSRMT92v7O/eTwjq3g=; b=VAWJm/ZL8ZPWgg5xkolKEarQn99rpgzVtU2agtiEfdlnRGbU0jgfGXDL bMZAWs9HUc933/CaZueJDssflpNEvogifOHwKz0kIzrqO15Lfkdewb6hs yK27b3k5auieHuiediUxR7flBkLSo7sWwNvKrTKhRy8rcxyUtjxXjL+aO y0MVQXOrTFtP/2OCI6QkAS8bzscQ1G0Psv9q3GuFGlawy5IY3uqKCqKYf Rkos5F+8uLDXPC+UBlvpW6TdL7oxvUXxwZgfNn/6shJ/YcasovMMwscJI CO5mvnfp3RRE6J0VXYz2u4d41qzmV+f8kdTI562G9NPr4tlNq3k/MbnMk A==; X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="343559450" X-IronPort-AV: E=Sophos;i="5.98,303,1673942400"; d="scan'208";a="343559450" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2023 01:41:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="684618839" X-IronPort-AV: E=Sophos;i="5.98,303,1673942400"; d="scan'208";a="684618839" Received: from mike-ilbpg1.png.intel.com ([10.88.227.76]) by orsmga002.jf.intel.com with ESMTP; 30 Mar 2023 01:40:57 -0700 From: Michael Sit Wei Hong To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Ong Boon Leong , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux@armlinux.org.uk, hkallweit1@gmail.com, andrew@lunn.ch Cc: Looi Hong Aun , Voon Weifeng , Lai Peter Jun Ann Subject: [PATCH net v4 2/3] net: stmmac: check if MAC needs to attach to a PHY Date: Thu, 30 Mar 2023 16:39:59 +0800 Message-Id: <20230330084000.3292487-3-michael.wei.hong.sit@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230330084000.3292487-1-michael.wei.hong.sit@intel.com> References: <20230330084000.3292487-1-michael.wei.hong.sit@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org After the introduction of the fixed-link support, the MAC driver no longer attempt to scan for a PHY to attach to. This causes the non fixed-link setups to stop working. Using the phylink_expects_phy() to check and determine if the MAC should expect and attach a PHY. Fixes: ab21cf920928 ("net: stmmac: make mdio register skips PHY scanning for fixed-link") Signed-off-by: Michael Sit Wei Hong Signed-off-by: Lai Peter Jun Ann --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8f543c3ab5c5..41f0f3b74933 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1135,6 +1135,7 @@ static int stmmac_init_phy(struct net_device *dev) { struct stmmac_priv *priv = netdev_priv(dev); struct fwnode_handle *fwnode; + bool phy_needed; int ret; fwnode = of_fwnode_handle(priv->plat->phylink_node); @@ -1144,10 +1145,11 @@ static int stmmac_init_phy(struct net_device *dev) if (fwnode) ret = phylink_fwnode_phy_connect(priv->phylink, fwnode, 0); + phy_needed = phylink_expects_phy(priv->phylink); /* Some DT bindings do not set-up the PHY handle. Let's try to * manually parse it */ - if (!fwnode || ret) { + if (!fwnode || phy_needed || ret) { int addr = priv->plat->phy_addr; struct phy_device *phydev; From patchwork Thu Mar 30 08:40:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sit, Michael Wei Hong" X-Patchwork-Id: 13193618 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB054C77B61 for ; Thu, 30 Mar 2023 08:41:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230134AbjC3Il2 (ORCPT ); Thu, 30 Mar 2023 04:41:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230032AbjC3IlQ (ORCPT ); Thu, 30 Mar 2023 04:41:16 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BDA66A58; Thu, 30 Mar 2023 01:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680165668; x=1711701668; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=huOgNrOBcSC1/tjpitYzPeEN/HeYkrzn2WanLt9fM1M=; b=f6d55c35nedygYhOp9iyerUVYnL1y6vSUEWdV0WX16vLrwkw/rM7HgPT q8WxtGcARVvpqTBM66v9chp5HJjM2EbxfH+JkFilR2YGXzROm5QHN2/Gi AlCp37KO07oROpOSWAUjPhqIDh7DgJfKwkIgLRCeNn5bt+/5ZLYG8pEMl moa6XaAT9ng810UL6Tnzhi3pm1ZL0dmq/Tgw0SPg+G9gGrhMoVtFHTvY3 meOffZBmPs7PyYBE6lyC4NMJAz1+4ZBRsrAXqSEOxNZE0xizZM4l8umc3 efOf/URu/Mc+yykatC0X6WDfU3bPqJLL0rBiEu2UL5hEujb3Oo6eQbYSu A==; X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="343559508" X-IronPort-AV: E=Sophos;i="5.98,303,1673942400"; d="scan'208";a="343559508" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2023 01:41:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="684618854" X-IronPort-AV: E=Sophos;i="5.98,303,1673942400"; d="scan'208";a="684618854" Received: from mike-ilbpg1.png.intel.com ([10.88.227.76]) by orsmga002.jf.intel.com with ESMTP; 30 Mar 2023 01:41:02 -0700 From: Michael Sit Wei Hong To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Ong Boon Leong , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux@armlinux.org.uk, hkallweit1@gmail.com, andrew@lunn.ch Cc: Looi Hong Aun , Voon Weifeng , Lai Peter Jun Ann Subject: [PATCH net v4 3/3] net: stmmac: remove redundant fixup to support fixed-link mode Date: Thu, 30 Mar 2023 16:40:00 +0800 Message-Id: <20230330084000.3292487-4-michael.wei.hong.sit@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230330084000.3292487-1-michael.wei.hong.sit@intel.com> References: <20230330084000.3292487-1-michael.wei.hong.sit@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Currently, intel_speed_mode_2500() will fix-up xpcs_an_inband to 1 if the underlying controller has a max speed of 1000Mbps. The value has been initialized and modified if it is a fixed-linked setup earlier. This patch removes the fix-up to allow for fixed-linked setup support. In stmmac_phy_setup(), ovr_an_inband is set based on the value of xpcs_an_inband. Which in turn will return an error in phylink_parse_mode() where MLO_AN_FIXED and ovr_an_inband are both set. Fixes: c82386310d95 ("stmmac: intel: prepare to support 1000BASE-X phy interface setting") Signed-off-by: Michael Sit Wei Hong --- drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c index 7deb1f817dac..6db87184bf75 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -251,7 +251,6 @@ static void intel_speed_mode_2500(struct net_device *ndev, void *intel_data) priv->plat->mdio_bus_data->xpcs_an_inband = false; } else { priv->plat->max_speed = 1000; - priv->plat->mdio_bus_data->xpcs_an_inband = true; } }