From patchwork Mon Mar 13 08:01:34 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: 13172046 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 456AEC6FD1F for ; Mon, 13 Mar 2023 08:06:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229864AbjCMIGX (ORCPT ); Mon, 13 Mar 2023 04:06:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229849AbjCMIFu (ORCPT ); Mon, 13 Mar 2023 04:05:50 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B175574D9; Mon, 13 Mar 2023 01:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678694570; x=1710230570; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+jXWOkuHIz7opU+/4fOqwtDaqYNzAOX5btGkyFBkb6Q=; b=a612Qm4bg02oxWeNaGMqvlcyiKvIfMalGTot6159c/wDpdtKLsQJgdia FOdgAkSYgdX+7MTOoNiuavAfoW/LCJ/j6kIFqeLjvgDBOCkDojMMsYa1Y Te18T81O5oYvmxhWbi/usg+c2MG+2Q505yVwlBnxonLrFmbyI5CuZuETm Gks/rOASBrWGAemU/hvjbmhXODGatxBVuZZLpyRbbV1u91TuBAs2JeOcZ tHSHkGYSyWkLN8/f3glWVQg185UhgRIhJQv+vuE8/wGJea9JvN8AshIrJ N4JUOLuU3V5gGy0ROzeRozJQnR/nRDXjBdoeZfxbV/yIoZCjDR2vYciSe A==; X-IronPort-AV: E=McAfee;i="6500,9779,10647"; a="337107451" X-IronPort-AV: E=Sophos;i="5.98,256,1673942400"; d="scan'208";a="337107451" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2023 01:02:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10647"; a="747517977" X-IronPort-AV: E=Sophos;i="5.98,256,1673942400"; d="scan'208";a="747517977" Received: from mike-ilbpg1.png.intel.com ([10.88.227.76]) by fmsmga004.fm.intel.com with ESMTP; 13 Mar 2023 01:02:10 -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 Cc: Looi Hong Aun , Voon Weifeng , Lai Peter Jun Ann Subject: [PATCH net 1/2] net: stmmac: fix PHY handle parsing Date: Mon, 13 Mar 2023 16:01:34 +0800 Message-Id: <20230313080135.2952774-2-michael.wei.hong.sit@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230313080135.2952774-1-michael.wei.hong.sit@intel.com> References: <20230313080135.2952774-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 phylink_fwnode_phy_connect returns 0 when set to MLO_AN_INBAND. This causes the PHY handle parsing to skip and the PHY will not be attached to the MAC. Add additional check for PHY handle parsing when set to MLO_AN_INBAND. 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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8f543c3ab5c5..398adcd68ee8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1134,6 +1134,7 @@ static void stmmac_check_pcs_mode(struct stmmac_priv *priv) static int stmmac_init_phy(struct net_device *dev) { struct stmmac_priv *priv = netdev_priv(dev); + struct fwnode_handle *fixed_node; struct fwnode_handle *fwnode; int ret; @@ -1141,13 +1142,16 @@ static int stmmac_init_phy(struct net_device *dev) if (!fwnode) fwnode = dev_fwnode(priv->device); - if (fwnode) + if (fwnode) { + fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link"); + fwnode_handle_put(fixed_node); ret = phylink_fwnode_phy_connect(priv->phylink, fwnode, 0); + } /* Some DT bindings do not set-up the PHY handle. Let's try to * manually parse it */ - if (!fwnode || ret) { + if (!fwnode || ret || !fixed_node) { int addr = priv->plat->phy_addr; struct phy_device *phydev; From patchwork Mon Mar 13 08:01:35 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: 13172045 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 9C729C61DA4 for ; Mon, 13 Mar 2023 08:06:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229559AbjCMIGG (ORCPT ); Mon, 13 Mar 2023 04:06:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229514AbjCMIFi (ORCPT ); Mon, 13 Mar 2023 04:05:38 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE6B159419; Mon, 13 Mar 2023 01:02:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678694555; x=1710230555; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uhBtqsa1AIy5YV1rBDSt/rXxAQ/955DS3N8XQfdem04=; b=VcOTkdqBdHUvHJrIgHxUZZ8wSWBE5LbVCBBEnW9h0PmxWN7nSAwWBk7h Y4RvjrpnjYxQusQEHnEtguTo618ejs3p6lEHrMcBxdtwt3aRuCo31F/kc fuscOQn6xzopRCrICi67nRTtt8ak4okjlOD7TimV59UaKm9nbvUHxYWI1 6unt3bHev5uB101hoczS8XMm6AfzwUiMyOL/hJ4a0PlDv0IsEHRO63SFD AlJNkRyVNs0VXN2d9+U69zx2Rl3LPTeGKOgC5gL5BtzYfYjZo56C1mEt3 PlEBiWJoVKER9SJz2w6jTRs4Z2+NH6cFGnCJVGGhJc0HwoxbNce16nq6C Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10647"; a="337107425" X-IronPort-AV: E=Sophos;i="5.98,256,1673942400"; d="scan'208";a="337107425" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2023 01:02:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10647"; a="747518016" X-IronPort-AV: E=Sophos;i="5.98,256,1673942400"; d="scan'208";a="747518016" Received: from mike-ilbpg1.png.intel.com ([10.88.227.76]) by fmsmga004.fm.intel.com with ESMTP; 13 Mar 2023 01:02:14 -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 Cc: Looi Hong Aun , Voon Weifeng , Lai Peter Jun Ann Subject: [PATCH net 2/2] net: stmmac: move fixed-link support fixup code Date: Mon, 13 Mar 2023 16:01:35 +0800 Message-Id: <20230313080135.2952774-3-michael.wei.hong.sit@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230313080135.2952774-1-michael.wei.hong.sit@intel.com> References: <20230313080135.2952774-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 xpcs_an_inband value is updated in the speed_mode_2500 function which turns on the xpcs_an_inband mode. Moving the fixed-link fixup code to right before phylink setup to ensure no more fixup will affect the fixed-link mode configurations. Fixes: 72edaf39fc65 ("stmmac: intel: add phy-mode and fixed-link ACPI _DSD setting support") Signed-off-by: Michael Sit Wei Hong --- drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 11 ----------- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c index 7deb1f817dac..d02db2b529b9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -592,17 +592,6 @@ static int intel_mgbe_common_data(struct pci_dev *pdev, plat->mdio_bus_data->xpcs_an_inband = true; } - /* For fixed-link setup, we clear xpcs_an_inband */ - if (fwnode) { - struct fwnode_handle *fixed_node; - - fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link"); - if (fixed_node) - plat->mdio_bus_data->xpcs_an_inband = false; - - fwnode_handle_put(fixed_node); - } - /* Ensure mdio bus scan skips intel serdes and pcs-xpcs */ plat->mdio_bus_data->phy_mask = 1 << INTEL_MGBE_ADHOC_ADDR; plat->mdio_bus_data->phy_mask |= 1 << INTEL_MGBE_XPCS_ADDR; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 398adcd68ee8..5a9abafba490 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7064,6 +7064,7 @@ int stmmac_dvr_probe(struct device *device, struct stmmac_resources *res) { struct net_device *ndev = NULL; + struct fwnode_handle *fwnode; struct stmmac_priv *priv; u32 rxq; int i, ret = 0; @@ -7306,6 +7307,20 @@ int stmmac_dvr_probe(struct device *device, goto error_xpcs_setup; } + /* For fixed-link setup, we clear xpcs_an_inband */ + if (!fwnode) + fwnode = dev_fwnode(priv->device); + + if (fwnode) { + struct fwnode_handle *fixed_node; + + fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link"); + if (fixed_node) + priv->plat->mdio_bus_data->xpcs_an_inband = false; + + fwnode_handle_put(fixed_node); + } + ret = stmmac_phy_setup(priv); if (ret) { netdev_err(ndev, "failed to setup phy (%d)\n", ret);