From patchwork Fri Mar 24 08:16:54 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: 13186537 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 9972EC6FD20 for ; Fri, 24 Mar 2023 08:17:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231303AbjCXIRo (ORCPT ); Fri, 24 Mar 2023 04:17:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbjCXIRm (ORCPT ); Fri, 24 Mar 2023 04:17:42 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B6CE24705; Fri, 24 Mar 2023 01:17:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679645861; x=1711181861; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7zEf318EIZQVC7Yb173ekmxTq+Dw6hKeKqmHqTYHp78=; b=XWlX2aiI0mu0vuIvgxk4TtNpg2rHKvr4Q+kzU4EN3TLENUqAFATZjKbV 3fbSq8vGcH9X8xyfqdUcxBvyuzPK7SCk2zi/gKjET++dxAGok4zXoKWVu +WV3vv7lej0JvAw79oktNnTHLw85XPd4oDI6a492wp10YgJAf+miSdIKm L0zeu/jwFvpbjORv2bV6gSwIQ0K5IyjHsCKrctgSP43eJiuZRUPS9Geaj ubV5yh1o4KHwu/ifawz+nGCXu1dFrSUEyBnw3vqCV8/PMWBYxVmhULFuE qbDeHStI+1hRmJ0wXH7PCMrFDemOBW6otyN9DaPQS5rgGUUD8mRrVsbFK Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="320116081" X-IronPort-AV: E=Sophos;i="5.98,287,1673942400"; d="scan'208";a="320116081" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2023 01:17:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="928574701" X-IronPort-AV: E=Sophos;i="5.98,287,1673942400"; d="scan'208";a="928574701" Received: from mike-ilbpg1.png.intel.com ([10.88.227.76]) by fmsmga006.fm.intel.com with ESMTP; 24 Mar 2023 01:17:37 -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 Cc: Looi Hong Aun , Voon Weifeng , Lai Peter Jun Ann Subject: [PATCH net v3 1/3] net: phylink: add phylink_expects_phy() method Date: Fri, 24 Mar 2023 16:16:54 +0800 Message-Id: <20230324081656.2969663-2-michael.wei.hong.sit@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230324081656.2969663-1-michael.wei.hong.sit@intel.com> References: <20230324081656.2969663-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 --- drivers/net/phy/phylink.c | 13 +++++++++++++ include/linux/phylink.h | 1 + 2 files changed, 14 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 1a2f074685fa..5c2bd1370993 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1586,6 +1586,19 @@ 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) +{ + return pl->cfg_link_an_mode != MLO_AN_FIXED; +} +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 Fri Mar 24 08:16:55 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: 13186538 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 DCF51C6FD20 for ; Fri, 24 Mar 2023 08:17:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231532AbjCXIRx (ORCPT ); Fri, 24 Mar 2023 04:17:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231267AbjCXIRt (ORCPT ); Fri, 24 Mar 2023 04:17:49 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5539A24BC5; Fri, 24 Mar 2023 01:17:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679645865; x=1711181865; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=h7HA31Ype249VhePLWHGaLt81vSRMT92v7O/eTwjq3g=; b=BCVnIJRx4CATyaHpI9tvPX8nmVcgZ3Lr3uaMpaLUlKhgjpsOsw0KyIYX LG63zvGtnSi32RWV0tGKXV8FPZ/aDtZ+cB94G76V+tvMQ5052o8Z7ZoL+ R05MjDdbsiUbhwYsFSmgm3TmHIN4WF5d1mL50OsTNv6/Comg3/8wkQuj0 Sy53D8a+yLlFqclUCbc9mGOt4keOi8PPenlCraliGEjCwj5GNNZbF/Rku fBZysv5g0+OBROyiW3NOMr4DQDIn2TFQkqFYrGJ+tyIpWh6oGnb+raMJA 1sEorCiYsmGG6q/ksiYr4Gn7EJYo7JogLqMfuBsOwvktHEox6f6kvwk9D Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="320116138" X-IronPort-AV: E=Sophos;i="5.98,287,1673942400"; d="scan'208";a="320116138" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2023 01:17:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="928574735" X-IronPort-AV: E=Sophos;i="5.98,287,1673942400"; d="scan'208";a="928574735" Received: from mike-ilbpg1.png.intel.com ([10.88.227.76]) by fmsmga006.fm.intel.com with ESMTP; 24 Mar 2023 01:17:41 -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 Cc: Looi Hong Aun , Voon Weifeng , Lai Peter Jun Ann Subject: [PATCH net v3 2/3] net: stmmac: check if MAC needs to attach to a PHY Date: Fri, 24 Mar 2023 16:16:55 +0800 Message-Id: <20230324081656.2969663-3-michael.wei.hong.sit@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230324081656.2969663-1-michael.wei.hong.sit@intel.com> References: <20230324081656.2969663-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 Fri Mar 24 08:16:56 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: 13186539 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 34F45C6FD1C for ; Fri, 24 Mar 2023 08:18:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231466AbjCXISF (ORCPT ); Fri, 24 Mar 2023 04:18:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231438AbjCXIRx (ORCPT ); Fri, 24 Mar 2023 04:17:53 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 860C4252A9; Fri, 24 Mar 2023 01:17:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679645869; x=1711181869; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=huOgNrOBcSC1/tjpitYzPeEN/HeYkrzn2WanLt9fM1M=; b=mwZ2mHOajToQtBkqit/Zizuknis3rRMx+YWLAy23lNS91OqfNHVap31n 8osDZP4gSa/D+AHu1K2//gyy+N4x4eCNMEfa4pPs4tl9lEEZ6dGQzbwKw cfgkTqjxPdvYHe6ZB9ooAmk3ncWOxzgncicGE6b/pLpmu3YjxmdDKTHYV n7WFNv2iuZjfIwTIsBHEtmn3l6qVAwTaLuYr2oX086QQO0GLXqJHt8eqo AUFrf3DXUXHXnW1GDQfmp5Y4Q5e1uEYpyA9ag7hUWfc+xN9/9SVZ6IEbq qIgU11oytcOuXlOYqrxk0+2DgYDq7M00D06cvX2hcZkUWTtKaU/vYfbdT A==; X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="320116160" X-IronPort-AV: E=Sophos;i="5.98,287,1673942400"; d="scan'208";a="320116160" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2023 01:17:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="928574755" X-IronPort-AV: E=Sophos;i="5.98,287,1673942400"; d="scan'208";a="928574755" Received: from mike-ilbpg1.png.intel.com ([10.88.227.76]) by fmsmga006.fm.intel.com with ESMTP; 24 Mar 2023 01:17:45 -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 Cc: Looi Hong Aun , Voon Weifeng , Lai Peter Jun Ann Subject: [PATCH net v3 3/3] net: stmmac: remove redundant fixup to support fixed-link mode Date: Fri, 24 Mar 2023 16:16:56 +0800 Message-Id: <20230324081656.2969663-4-michael.wei.hong.sit@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230324081656.2969663-1-michael.wei.hong.sit@intel.com> References: <20230324081656.2969663-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; } }