Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp329272lqo; Fri, 10 May 2024 00:39:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVKvu6ZBxXhaR1+fEcaANkdjDzosfav42rnKue8SvuuPw4tALU6UpEG4Yr4ydvK1a8uF90coce501Fcy6z5umTj3Yb2y0bqvjdXUlPVjg== X-Google-Smtp-Source: AGHT+IEXv1Z4DuI3OgPpugd38zeRrYaQQPfOe5DNFWbeCqJIuj0IwSG2lNX1k3OA8gzXpuKE90Az X-Received: by 2002:a05:6214:5b87:b0:6a0:6649:c7f3 with SMTP id 6a1803df08f44-6a168223bedmr24146306d6.41.1715326778610; Fri, 10 May 2024 00:39:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715326778; cv=pass; d=google.com; s=arc-20160816; b=rlDHME0I5OrPaemBX0i5ofDUHRwQfB/nYezUq+1Bckkmju7y5wSHz8O7prnfIVe1NL oUFy5T+yoc2ona74w5ZH59bRyy0nxvVXUR9LqQ/1/OAfj7GWbtWXOI31VePjB2Vh5X9a rJFRccs/zBzRg6hZPDVXiVxGTU7Rnt+ahsDCjG7UYfCmoOzO7rrUG/NbCgrNPU+lPb8S AjCeSkxbf/zyOaKrqGpbr41ogEzn7p8T4Qpg1DYNAWor815GFtZX6uiN8kA9mNf3//UG 7uwHRsZR23Hrj1i+mAa/XLK+z8+BtdcCTtM70/ZB0zW65vLtaQ5OEaYo7ksh7RzqYy51 JK8w== 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=s6lX9CFr+i5aMsyivdRLP1OBs4c+aSnEvczm3xZsmeE=; fh=oFsTShSPyr19IUrS70fUdLsJMNXQ1yoF+i3TXZr05xY=; b=iEqB7nRk9gJHXPryswJoX9NEiH4lQb+RtIEP22l+g9/Gqt7JYiqANKMP3HWEs62J+W H2Jqy+fG3YFJ5x6SOIU1h2QF99EpCfbS0DuDfPWhOWgosmrucYF454bA9EMNHCQR3C0A EOfRHJMd5Rb0pyFBzOcQTA27EAfTHycA/vKo3QBwk1VryCzE32MjDYQOu1Kh8ITvZio1 nYCB3UlSq/DdGB+UvC9r0hsC1tjmgyr0aiEgvGwA5AAoiGegpVm876fGr57YquJ57vsK xtFzfPEgJ5ZlYrYw3uWtcUqgFZ5P/tDNB33tD8QN+UbR8PD0fZz/3N0KL97N6Bx8I+GM iLDA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=GFDmGkT1; 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-175409-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175409-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. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f1d70b7si32356806d6.41.2024.05.10.00.39.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 00:39:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-175409-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=GFDmGkT1; 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-175409-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175409-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 560691C20FC6 for ; Fri, 10 May 2024 07:39:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C4CF716D4E9; Fri, 10 May 2024 07:37:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="GFDmGkT1" 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 52FB016079D; Fri, 10 May 2024 07:37:42 +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=1715326665; cv=none; b=MktR+AtN8LDI9mtEBdyk8P5Sg5w54DBKT+5kKjjfaY+gPZT2ktJEpQ8x1ON7W+5JM+oEEAOC7skT2Ykei31dlHAJmRElzdfBR982L1gXTp+nr6kJQ3TXnA5/5qbyW1yOEDOJA7VA/K++W2D3ISGKNqtZfU4u3Ih6RPzQIxqMOt8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715326665; c=relaxed/simple; bh=LrzkcTg0ziAo1281NHtial15InJnlwTYePwWReG4hx4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qoFou1YnEzotngvKOg3NLvNzPy6t2sRLi/q5inMYnMvkej4rVWJdDVyGMBLtP99z0ZW6hzoaGDe22RgOByF8Pa/ncYk41OK/Ic9dUwdCm0orzWWFZYgakGZz7fYvtRc3ucoEiPvfP7AkChCsUzwLdedVgQEIgIEteGZDKCJeSn0= 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=GFDmGkT1; 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 2788C240005; Fri, 10 May 2024 07:37:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1715326656; 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=s6lX9CFr+i5aMsyivdRLP1OBs4c+aSnEvczm3xZsmeE=; b=GFDmGkT1j2bOE1KvvqCzhvy0d8K7ntQAg/UGwL8XK8uZqmuMfayeWbpBT7C/5IZwoIBZn/ vwk3b7vXDCiBmBqBmzjVzBNGWsu2auIWzIhn4bi1jLYjCMXfFjqWIkMkUgciPuiAXszhvw puy/6KA3H/wyS/jdQgdoF1BRQ+Pb02yvZWlD/z0lWOfWFd0XkwmH/nQ8ieZlAzfwszgQ+w HZtBl7eNNe7Wmb5tAywqBaicPXkeXYKazQwq7x1o2xGJugptB/E9AQl/B3HCDXKLRKU1TP VS+Z+mSoHMa9MRlBMe+D2QNLW2mDZfe7g0BenGV2QhyHKKN0WFuAXvOzSkIqFQ== From: Romain Gantois Date: Fri, 10 May 2024 09:38:11 +0200 Subject: [PATCH net-next v6 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: <20240510-rzn1-gmac1-v6-4-b63942be334c@bootlin.com> References: <20240510-rzn1-gmac1-v6-0-b63942be334c@bootlin.com> In-Reply-To: <20240510-rzn1-gmac1-v6-0-b63942be334c@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 778d79cdb2e6d..f562c563aab55 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