Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp487569lqj; Sun, 2 Jun 2024 07:40:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUOBck3soTGIS+9kziiqBqNovoRv0DAAzegmrLp4dyenYSCbNiBnH0ZSmhPQ0SOwAEY1MayZiIkGyOiKf1ACXQ+B/0l+7eg5EVODSGpYw== X-Google-Smtp-Source: AGHT+IGAtdB1b92epSPFb2R7iHaYzC/mH5xu4viaBf1YbMrOW19ymSUskdcgUbkcwPQrk4v8FKVh X-Received: by 2002:a17:903:32c2:b0:1f3:b55:e247 with SMTP id d9443c01a7336-1f6370a783bmr54380205ad.55.1717339207269; Sun, 02 Jun 2024 07:40:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717339207; cv=pass; d=google.com; s=arc-20160816; b=vfhLPlsG+zB5nPVald0orkbTZtDhhzvoF1R3HVxVNBaCgpqttYqfWw1aqtmnkriua+ KCvOvOlAv/zzO7wP0UUc6KcSqc3U7rl5HyxwLks0a9y6x/x1ZQHwX+RuzAE07dsZw4B3 eANs4t0Se43tkjsq+d0e6UMBG3LHIfkdNIwF3y3lE0UF/s9Z8d4v8HMlvfxNjvHmbeao aE+Zv2b+fQhwDigiM7pTL57OUOOIaC2YHs05tZ4/TFeEG0mjX5Lv3mRt8lsWyBUZfQUb XXQkqWoQbMeVuP7bm1AMbI+Ql2NAZjXDglfnkablPjgCFANGKRp+dhv8PJVbXBEa/0mP AeFQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=7vjMvBNpGJ2YRY1Cb9nA1dqsGS8aAwxtGRodJv9KKVo=; fh=NpcoVopG7yPKyaOvhrKE2gfzNFIBP0X0wSE1A8QYM74=; b=TX6ShqD80XlHeY41VDb9yj2R+CzAqT/SbGGxXVrR5Sh+hlzycMwKiDrYY6TPOQdzHZ +gP3e9cBsHnU09VwUF5N9xqb22SS14b0o57/KOhCirv5lAGFUuLAc4hGsCCbtPrLcenR Ao0di5sir8ouzfS1E2fGR4eb2Af9TWOrqd4HmIwX/Sly81l3isXeCcOSJW9NurbU3VQC 1epa36RogQAdZrX5INCyykALxGIKyiSFKdaM1jq+7/j2W+dMSWvVZ6KjmVwjAddIrPLI ciJXs/uTiVglIMHUG08B7LDCffMfcqmZIM90mpT3TR2P9S5h51bIgev3Yeca03E1xmcq zSpg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WKz61syp; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-198301-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198301-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f63236192bsi50211635ad.161.2024.06.02.07.40.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 07:40:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198301-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WKz61syp; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-198301-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198301-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 87D8A28135B for ; Sun, 2 Jun 2024 14:40:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC3D87D06E; Sun, 2 Jun 2024 14:37:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WKz61syp" Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31619763E7; Sun, 2 Jun 2024 14:37:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717339024; cv=none; b=u4zE5VW+gOpytlBqQD5/hob30ZX5U1aiK6QlH20oigBYgBd6BG1tKn9wsESlFl3ujvX42lVVebaWwNHysysPz8jff54j4p47SL67kvC2zKMnK6EXbQKa/LEmLy+1KPHXl6dZzH3lzfOc9++aplbYfA54RxXkUv3DKUqt5sNyCi8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717339024; c=relaxed/simple; bh=6YA0qQck5rrALyZPnAu3fKQKni/OD78aR0XOtu0VSYs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UOetzJ56gx3i9fXfj4rZp3T5IhRCXswyDzZHlqvVXU3TJBV9M4oA/vWsRFhwgpMzP0pUxaFDyNc4MONANKdTweI/o3Fx3yWk5EVxvTwtVEAEqQBN3+JypjpM+HdxzEAq8lNoaIW3M5n1B78Z37gKckh2TFVA9QBuQpvU2QxxQdw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WKz61syp; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-52b88740a93so2439286e87.3; Sun, 02 Jun 2024 07:37:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717339021; x=1717943821; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7vjMvBNpGJ2YRY1Cb9nA1dqsGS8aAwxtGRodJv9KKVo=; b=WKz61sypK1a5CHvSBRPhbokg09bD1eIE/kMEQB8JuWlhfmyyODvd4fPwai7Djbk2Yh oztA33sbHOrFUdJSCMo4AP1giBAjQ/86/a5KVkS7YpqXTMYNHv7/1d+9n0n/d3z61+ej W+lyp4m/mocHsMTwom06gzflofTa7B+RgeJ5vwYIHMW70Vnx0Wqm2rx9QQ0QOUyUNGIc 2HjMdEqUV/Ipfa5JEwU+npn/cOjOac0lUo+D3jWFTTccM4aPCSL657Ds88aMu8OgkJ6y fsNUR3P2UKsOEJtnT5OJG2HQJa2UShnMsK9BiyTLjAAWYjyOf2j3wGPGgWPtN/r5gD6m R0fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717339021; x=1717943821; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7vjMvBNpGJ2YRY1Cb9nA1dqsGS8aAwxtGRodJv9KKVo=; b=DshgClFil3bctltjx9hKIQEP5Kqu/wjKBUQbwTrIlEazXEKFELUuG0B5PweV5PcpXS 2nVt1V7F481OmiCZ3ZnNFFnncvZV3nUMtuBdYoUZq5wKFjm/f6Kb6a0VPxEgrG0uWBKQ n5ebybaayx15Oj+36Mak2MzklwPNvC0k38Pstxv0iTaNtlTPLeLTXCloW/5k2xlGFe46 KZNh54ZK5fFejcqdOo9NGUXa515dUHLilDwAvUWYLAEgioC9f4dTDJSMOHqh11Y4Y0DN n9+13qV4jj1ZsACC5j60GUJdqNr/1+vuN4zf2fkrhRPvbsbqHl7mdFYCqA0gmA9WKLhU x4vA== X-Forwarded-Encrypted: i=1; AJvYcCW7JQUUUri186lsxi4/wvUuEzwV26aQNmc7a4xOy0/as5h7L23KyW43LO24Qdbt1PkmzDS9eZxOUEXl7scYI+scs+A5K/jM23+t4Nz2bAS+Azx+cZVwflO24L71ZgNWXD0nfZnJGCrj+x3xJaFGSb+ecgRBEKbwjFVP+phAWtqpUw== X-Gm-Message-State: AOJu0YzyND2IlsZ0woFzDBTRQIJV9pn/BNB83YTAUecj98SBKLo7UT3M QpdrsV5GLEVLgOtAcvqYlnJm4pOE0quAj2P/quR0iAw8xKxUml4v X-Received: by 2002:a05:6512:4c6:b0:52b:5f39:9221 with SMTP id 2adb3069b0e04-52b896f183fmr4063497e87.64.1717339021163; Sun, 02 Jun 2024 07:37:01 -0700 (PDT) Received: from localhost ([178.178.142.64]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52b98fb5c5asm152445e87.16.2024.06.02.07.37.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 07:37:00 -0700 (PDT) From: Serge Semin To: Andrew Lunn , Heiner Kallweit , Russell King , Alexandre Torgue , Jose Abreu , Jose Abreu , Vladimir Oltean , Florian Fainelli , Maxime Chevallier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin Cc: Serge Semin , Sagar Cheluvegowda , Abhishek Chauhan , Andrew Halaney , Jiawen Wu , Mengyuan Lou , Tomer Maimon , openbmc@lists.ozlabs.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next v2 09/10] net: stmmac: Create DW XPCS device with particular address Date: Sun, 2 Jun 2024 17:36:23 +0300 Message-ID: <20240602143636.5839-10-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240602143636.5839-1-fancer.lancer@gmail.com> References: <20240602143636.5839-1-fancer.lancer@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Currently the only STMMAC platform driver using the DW XPCS code is the Intel mGBE device driver. (It can be determined by finding all the drivers having the stmmac_mdio_bus_data::has_xpcs flag set.) At the same time the low-level platform driver masks out the DW XPCS MDIO-address from being auto-detected as PHY by the MDIO subsystem core. Seeing the PCS MDIO ID is known the procedure of the DW XPCS device creation can be simplified by dropping the loop over all the MDIO IDs. From now the DW XPCS device descriptor will be created for the pre-defined MDIO-bus address. Note besides this shall speed up a bit the Intel mGBE probing. Signed-off-by: Serge Semin --- Changelog v2: - This is a new patch introduced on v2 stage of the review. --- drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 1 + drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 15 ++++----------- include/linux/stmmac.h | 1 + 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c index 56649edb18cd..e60b7e955c35 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -586,6 +586,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev, if (plat->phy_interface == PHY_INTERFACE_MODE_SGMII || plat->phy_interface == PHY_INTERFACE_MODE_1000BASEX) { plat->mdio_bus_data->has_xpcs = true; + plat->mdio_bus_data->xpcs_addr = INTEL_MGBE_XPCS_ADDR; plat->mdio_bus_data->default_an_inband = true; } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index aa43117134d3..807789d7309a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -499,8 +499,7 @@ int stmmac_pcs_setup(struct net_device *ndev) { struct dw_xpcs *xpcs = NULL; struct stmmac_priv *priv; - int ret = -ENODEV; - int mode, addr; + int addr, mode, ret; priv = netdev_priv(ndev); mode = priv->plat->phy_interface; @@ -509,15 +508,9 @@ int stmmac_pcs_setup(struct net_device *ndev) ret = priv->plat->pcs_init(priv); } else if (priv->plat->mdio_bus_data && priv->plat->mdio_bus_data->has_xpcs) { - /* Try to probe the XPCS by scanning all addresses */ - for (addr = 0; addr < PHY_MAX_ADDR; addr++) { - xpcs = xpcs_create_mdiodev(priv->mii, addr, mode); - if (IS_ERR(xpcs)) - continue; - - ret = 0; - break; - } + addr = priv->plat->mdio_bus_data->xpcs_addr; + xpcs = xpcs_create_mdiodev(priv->mii, addr, mode); + ret = PTR_ERR_OR_ZERO(xpcs); } else { return 0; } diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index f337286623bb..a11b850d3672 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -83,6 +83,7 @@ struct stmmac_priv; struct stmmac_mdio_bus_data { unsigned int phy_mask; unsigned int has_xpcs; + unsigned int xpcs_addr; unsigned int default_an_inband; int *irqs; int probed_phy_irq; -- 2.43.0