From patchwork Tue Apr 4 09:14:42 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: 13199358 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 2C5D6C6FD1D for ; Tue, 4 Apr 2023 09:15:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234007AbjDDJP4 (ORCPT ); Tue, 4 Apr 2023 05:15:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233955AbjDDJP4 (ORCPT ); Tue, 4 Apr 2023 05:15:56 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C1D41A7; Tue, 4 Apr 2023 02:15:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680599755; x=1712135755; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=c3TWM/U7ae/+krBKWKZnTGu8xrMC3rbZUK6++vwlxtY=; b=b7yuJDj6TtQ6TcoPe/S0KVJYushwCH4iX8SyI7bepbqf4yQMXCljYqVi qn9Byf2j5hcTEPZG6jCKsJ8YTW3H1NWuPyHoOd0mPdIOMi65jnnbqCApg CkNdt9LQZOhRr8nzqhFYyDf+o+NAH9AOjlPoopH8OkZfwon8tRJVCJfS2 +1631Pydg8DGa9btbzHCTu4A8e47YOYbgH/OCVns2TNtHx2EJxZ9Py8Kk l82qLfoqKLTDRJz7s5GR0NeIS3sysBWoWmyxKF1XVZU5hbVbT5IBaHYWB 1RPnzqr8REwgfnKapyxTBsD4D4exejeYZ84A49tq+Se5FpHyt4sywEp6I Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10669"; a="404893346" X-IronPort-AV: E=Sophos;i="5.98,317,1673942400"; d="scan'208";a="404893346" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2023 02:15:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10669"; a="663513778" X-IronPort-AV: E=Sophos;i="5.98,317,1673942400"; d="scan'208";a="663513778" Received: from mike-ilbpg1.png.intel.com ([10.88.227.76]) by orsmga006.jf.intel.com with ESMTP; 04 Apr 2023 02:15:46 -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, Martin Blumenstingl Cc: Looi Hong Aun , Voon Weifeng , Lai Peter Jun Ann , Zulkifli Muhammad Husaini , Tan Tee Min , hock.leong.kweh@intel.com Subject: [RFC net 1/1] net: stmmac: skip PHY scanning when PHY already attached in DT mode Date: Tue, 4 Apr 2023 17:14:42 +0800 Message-Id: <20230404091442.3540092-1-michael.wei.hong.sit@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC If PHY is successfully attached during phylink_fwnode_phy_connect() in DT mode. MAC should not need to scan for PHY again. Adding a logic to check if ovr_an_inband is set before scanning for a PHY, since phylink_fwnode_phy_connect() returns 0 when phy_fwnode = fwnode_get_phy_node(fwnode); if (IS_ERR(phy_fwnode)) { if (pl->cfg_link_an_mode == MLO_AN_PHY) return -ENODEV; return 0; } Fixes: fe2cfbc96803 ("net: stmmac: check if MAC needs to attach to a PHY") Signed-off-by: Michael Sit Wei Hong Tested-by: Marek Szyprowski Tested-by: Martin Blumenstingl Reported-by: Martin Blumenstingl --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index d41a5f92aee7..4b8d3d975678 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1149,7 +1149,7 @@ static int stmmac_init_phy(struct net_device *dev) /* Some DT bindings do not set-up the PHY handle. Let's try to * manually parse it */ - if (!fwnode || phy_needed || ret) { + if (!fwnode || (phy_needed && priv->phylink_config.ovr_an_inband) || ret) { int addr = priv->plat->phy_addr; struct phy_device *phydev;