Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1874075lqo; Mon, 13 May 2024 00:25:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWHd9KcpwZfHu6kkfdA+aUhRPA3ByGwqqEw4W12vUU/7o153ucCs7eblFaJe2AtsmAo4vmsnGdxKgXwz0gQT4FFrTkIeE4iDDz4y7hzQQ== X-Google-Smtp-Source: AGHT+IFxEHeQ4BGakFs4CQh1qtBUynT186vDkq787WyPUEVhABNTNTpPyLY77QscqBwwZWnW4NJR X-Received: by 2002:a05:622a:3d1:b0:43a:4b03:8000 with SMTP id d75a77b69052e-43dfdf9c697mr80813951cf.67.1715585158107; Mon, 13 May 2024 00:25:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715585158; cv=pass; d=google.com; s=arc-20160816; b=PuE93fo92fy19481WA/EemmnKWLmCLEg8pVAdIt+jRfyH0oK/XNXBT3y5ASB4fGnWe rxTE/KsM5jkPmoXL+p7gebWMewXk/grYMsIBtiyOTkJs/0XX+8+9SA0z3qEc1fu5uovh 4SSyyemejdF6SR2BENaELVazjTSlb49ihgxqo2irYQ+EtpH6ZonsBwzV/Ck2DKQhkeDi wrPe8n0M2mTedstZVjRODMCVuFHRPT2HdVW6D3z3sFwNJkQoIEOooiU4orxC4aW4iz+2 2v2zCpDFyNF5f8DDhMzr8Cvy3MyJku91Znn76EhiuHuNhnQzE8q9iTrwIUPSBPY5Bojb T1ig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=d8DEnR7Vsu1dYEHLUDLUrKJDthlP0UhWogu5sP7ZpV0=; fh=oFsTShSPyr19IUrS70fUdLsJMNXQ1yoF+i3TXZr05xY=; b=gLETpkmgYz47uHwMlpPNErusE1hz4GmmtUDR6Pjwe8rwL6TQAm4MP07FptH+vZUwJQ 0LMoChd98+pxdocTJAAYyN1MSbADWt7R8+7iC6/rmUpKESohbcHO82KWIMDBeQJiN7Wz JL59Jcqp2fU08jq66W92Y0MM916nRc9f24T7FPcjqNTea8DotuTDaC9jIpxygxDAiNWs 8KdR+eD3d8bkXqr6ED+5y04+bjcuS8K/UeQTfE3s3ss3r4P8HYe1w4SNxD5NftVosiKr S1dY8YyoHTDXa0WYG9nxic3RtJ45iONFv8Fqj4DDnsPvrHpdmvH+GFczRkpSp/dOK6Zs npNw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=atvZ28IO; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-177250-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177250-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43df549ed39si100556891cf.120.2024.05.13.00.25.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 00:25:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-177250-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=atvZ28IO; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-177250-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177250-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B11941C210A5 for ; Mon, 13 May 2024 07:25:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D35E1482FA; Mon, 13 May 2024 07:24:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="atvZ28IO" Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B82F146D7F; Mon, 13 May 2024 07:24:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715585087; cv=none; b=Wz7+hoqocdqCpRpPeJdA6IvV4sPlTl6VX+k5+v3etDSReajj8oGW4ibUf/BhXKiZ/V0aqfNQV+2upC2S40NdQWPTMG/Iu3ignPx5KUxU0mRa1IBC4n7q/mZ2HF+NWVcPkKCrlWQEa6/2pkMIS8LjpvU2xxNBM/w+P5zmsvwqIeI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715585087; c=relaxed/simple; bh=dheHqiZnkFTbcdak8Es4kqGAatIQ1tnP4WdYf2N3TTM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oKka0TZp9hYBJQl6wwA3u9N9Eb4azf5ceWCd9dr37AuFh/Z3pe2FNZE6bQYlgLfE36tgft8nBNzqT0yRKuvrUO1FmHdfq1dCIdoSA+1viSvbONrbjQHZtUe23/J8LG1Ozq008AptJ1hNK2d8XsiSG4uLUbLg8jytb/pSUVJdw4Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=atvZ28IO; arc=none smtp.client-ip=217.70.183.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 68D3420013; Mon, 13 May 2024 07:24:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1715585083; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d8DEnR7Vsu1dYEHLUDLUrKJDthlP0UhWogu5sP7ZpV0=; b=atvZ28IOPJ/7gXI9wJ5lOWl7GABpMIq+CO7/O7bl3xETKTRzYg33zdSH/rg665n80gdgNb ngFsZZtiLPjQoo7+uPvC/Ty9Rw3zSlQ4P8nRoMFtto6fsS/aicFDFVnhIOJV62dEaNRGwF 8SkwuWcTCtoGyYCcz4PLxXZvXF9Rizxad+YNhSrQyYzn67Kn86KVJBATjtMLRFmddbF58f MxRUZKyLD4tBZ5s1tPMeza3C6znnjzm3sfYNQ3afGfCk5g0WnkHmkRUqJmB8W630wUHwJB 3cv12XOgg+HI1hGLxbZHJI8xjjnsw8GEyy37wM+tuomQxqsQPfmOisj1a7eLzQ== From: Romain Gantois Date: Mon, 13 May 2024 09:25:15 +0200 Subject: [PATCH net-next v7 4/7] net: stmmac: introduce pcs_init/pcs_exit stmmac operations Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240513-rzn1-gmac1-v7-4-6acf58b5440d@bootlin.com> References: <20240513-rzn1-gmac1-v7-0-6acf58b5440d@bootlin.com> In-Reply-To: <20240513-rzn1-gmac1-v7-0-6acf58b5440d@bootlin.com> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Russell King , =?utf-8?q?Cl=C3=A9ment_L=C3=A9ger?= , Serge Semin Cc: Thomas Petazzoni , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, "Russell King (Oracle)" , Maxime Chevallier , Romain Gantois X-Mailer: b4 0.13.0 X-GND-Sasl: romain.gantois@bootlin.com From: "Russell King (Oracle)" Introduce a mechanism whereby platforms can create their PCS instances prior to the network device being published to userspace, but after some of the core stmmac initialisation has been completed. This means that the data structures that platforms need will be available. Signed-off-by: Russell King (Oracle) Reviewed-by: Maxime Chevallier Reviewed-by: Serge Semin Co-developed-by: Romain Gantois Signed-off-by: Romain Gantois --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 8 +++++++- include/linux/stmmac.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 54708440e27b8..aa43117134d38 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -505,7 +505,10 @@ int stmmac_pcs_setup(struct net_device *ndev) priv = netdev_priv(ndev); mode = priv->plat->phy_interface; - if (priv->plat->mdio_bus_data && priv->plat->mdio_bus_data->has_xpcs) { + if (priv->plat->pcs_init) { + 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); @@ -533,6 +536,9 @@ void stmmac_pcs_clean(struct net_device *ndev) { struct stmmac_priv *priv = netdev_priv(ndev); + if (priv->plat->pcs_exit) + priv->plat->pcs_exit(priv); + if (!priv->hw->xpcs) return; diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index dfa1828cd756a..4a24a246c617d 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -285,6 +285,8 @@ struct plat_stmmacenet_data { int (*crosststamp)(ktime_t *device, struct system_counterval_t *system, void *ctx); void (*dump_debug_regs)(void *priv); + int (*pcs_init)(struct stmmac_priv *priv); + void (*pcs_exit)(struct stmmac_priv *priv); void *bsp_priv; struct clk *stmmac_clk; struct clk *pclk; -- 2.44.0