Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1848675lqa; Tue, 30 Apr 2024 00:30:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXcU4wGKO0ztSPyKuqFuaRkeU4aYgtBDi4NZ00+iwEM9a7ptCaaQhrHuoHIzD2F9m8vLZeNBwZUgUXSVSE6HZmfNJlw82vc8WLodDqipQ== X-Google-Smtp-Source: AGHT+IFTF97ggmW1tEs8m64rrqA7tXoMjqfR6cLtWipPf0WuZi3BA7qT2wofw3hFLF1LSUoVOZwY X-Received: by 2002:a17:906:c44:b0:a55:428d:5de9 with SMTP id t4-20020a1709060c4400b00a55428d5de9mr1172697ejf.28.1714462249131; Tue, 30 Apr 2024 00:30:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714462249; cv=pass; d=google.com; s=arc-20160816; b=UwVXomfd3lXU0Z/19xVZ/wZmFbyLxM9+shaCBnhQQCQZQbsJ6411b/IY6HHCiUX8/A mIcoFaqGI1OH3pLuAIE06VAW6NJ7zZkoX/H0x52pUzv5nxmb7oBSenAaJVDGjt7MWFd6 R8R4YQb1WDDlX5jzr5BQavNqQHd3PJY0tvuKzcIRyx3q0n7xDyFlCiHfjg+IgXoaUIoo glYOhSJFnH+ncmCHa04O5q9yfOodmgdcmfT3d06x5YkvfkbK3QpDMWrggBqmBye9QnnW Onr+P+MxRX+uQ1Rkwcs/w/77NgMrXr1FQoFa2OucF6IKnkUtJqGjXyl9gb/qsLdQXKmm bT8g== 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=k5xJj++e/DBPx9ddAMfQsap+qn6muqbGCvqtygpbwCk=; fh=oFsTShSPyr19IUrS70fUdLsJMNXQ1yoF+i3TXZr05xY=; b=tr7Sdt6xSk3vH7lYdVJqwGwk0HQXGBCp61xXjMPUf6SgUlkGjCQyJVnKx5SxZHuk2x 4NHscKTg5eElV0p1JwIBQza1O9GR/6V4B1QQdVgxvvtKKYuZo26uUiMIC58RhDkI2Y7T mFiulPyW/mYHuxozbfaXvN8sWFxxK8MLLEu/l4TFU7W49xGzvmyLq9zfgLecF4gqu+1r GWV05+dsxLLbEFEUNb0hd7W2SKEZAvxBHnvQzf3qiVyDbww1GRVvabmggm/2Sx6O6L7o 5tfpVu4hcpxSiglrLbSVGwF1mJwsRFOZcvdh+kcmMnOvt+cx1cJ1M9lx42oWxcxp6vu7 49Kw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="cE/jd3OH"; 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-163473-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163473-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id j17-20020a1709066dd100b00a46cbbf3b89si15043684ejt.340.2024.04.30.00.30.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 00:30:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163473-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="cE/jd3OH"; 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-163473-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163473-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 am.mirrors.kernel.org (Postfix) with ESMTPS id D85FF1F2204A for ; Tue, 30 Apr 2024 07:30:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E97D2181CE9; Tue, 30 Apr 2024 07:29:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="cE/jd3OH" Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) (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 522BF3E478; Tue, 30 Apr 2024 07:29:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.193 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714462153; cv=none; b=ZPgwPA9ae7D1xI6r1htrK7fFzmFl013A2avAVtnUgkDAj27zg1y0Cz/E+1bX3Pu3WV1AHVZETnW80L7wA8QyrN0fR0Oo32EFojXFG/1M4992cI0L4yJoNsQr9rMNdcWFYfpP1u/iFjsWaLYKKUPqnjBrRpDroU63bfQWMV5ijM0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714462153; c=relaxed/simple; bh=B3/uuEQKrO405t7es5+Y1fjgKbaZC53LaBScd9e7gNw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HukUpSLX75PKQn2msvPN5blcBGtH04LlFVE8nXGGg3dHT9/PksK044Z0d1577LK2tSdGZ3eFJwDs3sc/EQOiBVjcN82HAu+DwJm5grFxH1NYUkHlE5cn/mRoo2ayWHkSyMBZ6TvbolVf0b2iuTYDVMCmZ1uutLC8mxKnl6QRrik= 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=cE/jd3OH; arc=none smtp.client-ip=217.70.183.193 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 77A2C24000D; Tue, 30 Apr 2024 07:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1714462149; 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=k5xJj++e/DBPx9ddAMfQsap+qn6muqbGCvqtygpbwCk=; b=cE/jd3OH5C4sWGElGhuhLznxd5UCD3Vf6u6N1drukFen+XxyVsOikegWQ6dC4laMHLVTor KvXcE47qheuvCv1Z9UE/8+l3WCP5xqjfUDpHBrv+UQlKflGvZPMIIWIpGovomB5+mTW1oz ldjjXkWkYExoWYL2QMZT+xcA01y/lrOHqevDt+SKiRhmPp7gqHIRYJiW9ihiDWdSy28+UO kXsxfhylKYVhyEZlyQ+hFLHZzYGuXHxt9p1QDpUHJRR87rtmkDt+L/UYMGeLjWZD9a5YEf LkT38NHGdZYJsXxidcWSjzz3FraTOGkqXaKvJfqIfhQk3HwXMShdskXYe56x/A== From: Romain Gantois Date: Tue, 30 Apr 2024 09:29:44 +0200 Subject: [PATCH net-next v5 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: <20240430-rzn1-gmac1-v5-4-62f65a84f418@bootlin.com> References: <20240430-rzn1-gmac1-v5-0-62f65a84f418@bootlin.com> In-Reply-To: <20240430-rzn1-gmac1-v5-0-62f65a84f418@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 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 af8ad9768da10..1c788caea0cfb 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); @@ -531,6 +534,9 @@ int stmmac_pcs_setup(struct net_device *ndev) void stmmac_pcs_clean(struct stmmac_priv *priv) { + 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