Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp291220lqd; Wed, 24 Apr 2024 02:21:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUnD1e0Hyg9bR1c9R3JIBSD0Bk1vFXc02sMYMT3z0W15bIJArjjnn/B8TV16PmmqpL4RnbaRuS/K3Jp2PjUFTORvIPbTrIYS1tOXspC/g== X-Google-Smtp-Source: AGHT+IH2Aq3A86uCiSCs5twQ0eb6AuZrn+nuOsZBt/Q8pPVbG7pJfyoa3q9cX476RhNDAi9mNAwC X-Received: by 2002:a05:6a00:2789:b0:6ea:df65:ff7d with SMTP id bd9-20020a056a00278900b006eadf65ff7dmr1869910pfb.10.1713950487589; Wed, 24 Apr 2024 02:21:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713950487; cv=pass; d=google.com; s=arc-20160816; b=IvB7am9oJdjkUCDZMzp3xbTZxq9L2isvyn5W77llk8GDUWywBH4i6rxuRCmBkAh0A/ WFJhvfTxGtuyTNHVYQIW+2V2j5uHiSACYd4OGQJLhzVQ8VU+4wB8hST9SNhNsarPi1Ew 2/RfMf7yo6pMIsXwMfPFiBssXm3zAYBQimaCC16qZ03ZmjyERRDKDCH6H1Lxvzt+E7T/ fGkAmrBpZvK2q2Gy/+CzqmDRYvI7NVeav5KmNmOMA1gkftEO7BAt1VepuOi9wruNsRgG SGYBM8/tkMaJmU9SNzCpO7RhsWwScqwNTKUpya7ST0N+iGQ6VgZoE4f8qsIvbenKYnwi vcAg== 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=bPM2kEMf15wkRNUvXrLz3uHBj6EMXfPCHtn3BLrRChk=; fh=oFsTShSPyr19IUrS70fUdLsJMNXQ1yoF+i3TXZr05xY=; b=1BOIdXC2LflcnE5ur8BhBedauL5ytjOwCN3pT1erkoyWgc/xqAI4Q70Lzw6Y9SKJ1K gN2y+InFbYzuEqn2pOMDpWK+gl5IfCYOOGuvHSdKLEB0LarEZCfhhlDpg1uv4ptfwSRF gtkoY+FpbJHoV0KYYawuDw/vE/nSdKmYqImXCyWYEgEb42oVTgNyZSMVxy/YnkMja/Y+ /OwHgRQYRbz5XnKevezrWU9wlMaFTzz95zJRQoK/IbaoiCNF5+a80IqNcj/vJ2IeJj0g Rp64eoEgLYmFNuATi65ybFgCscFzEuJKgv1ykeZjydXk+BTS8/G0NgKe3L7swmc4lT7S v8GA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="YB/euR5J"; 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-156599-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156599-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id e13-20020aa7824d000000b006e8d8bff71asi10882718pfn.289.2024.04.24.02.21.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 02:21:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156599-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="YB/euR5J"; 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-156599-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156599-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 3E391B2705A for ; Wed, 24 Apr 2024 09:06:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08FC61591F4; Wed, 24 Apr 2024 09:05:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="YB/euR5J" 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 E8606157482; Wed, 24 Apr 2024 09:05:48 +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=1713949553; cv=none; b=j1yI9nIVsYJWfWtkJS1OQMG00GPcK3c8Kh72oOtd1Dj+LJkCIkrSF1ieB/xfnbe9FtyV7wur9ivcx+8fNqnGK65grztetJ/RIQAFKidGPfpswjVDQ7cm0SyunmHO0zXu9cZLzm1xlolKXR+vi4kFVLZKjYS6Rpa4gP05YHi3AUw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713949553; c=relaxed/simple; bh=RYi0++8u2X9c6dtV/xZRa3mc1bjAR7oL65UDBW4WRgo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jxCH1r3MHsO9WImvFHQxieYEbD2xZH/VNzSu+7WynE+iI0IT2cKzOm1DKO22gllFARtRB4lwIMQ4eumjikcZNHOfhYLEDNOcxl50Xsgxl3Ps+t24rCAnd8YRES2uVNSv8nHUIdYFSZJwy0y87HqxrQ+iKYO2+f5nmeclUuDqdeo= 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=YB/euR5J; 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 DC8932000E; Wed, 24 Apr 2024 09:05:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1713949547; 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=bPM2kEMf15wkRNUvXrLz3uHBj6EMXfPCHtn3BLrRChk=; b=YB/euR5J/Z8B/HqLgK4Od31HxrAfKd2VgUdvtO8x8fwZohgTkm/xrSelB4wLLAJ0wEpMU8 ILPjBahUDsGDu2UVv4EcwaTLg39lcsQPoEfWjb6Ru9C/a7OEY4o7XiKPMM2bqqAxIZIt33 snE07FB4uZRr5OWFOWZwtuF3nKIt6Jr7NhORJ5S9L+HpLQjA7fk0SRQPF6ESoC2I2oB4bK djn5btNL31RKRxMLw1fmF7CozNbbdN/j8XMBsW2CfYsnesXbalkQ/pcqwnvZ9tTyLOkEDj cUuna/7mqKhqGwgCvt6hl0PI+KMBjTCzk6/3K48gdJztVLN+vg2BpIQ6cAFjeg== From: Romain Gantois Date: Wed, 24 Apr 2024 11:06:20 +0200 Subject: [PATCH net-next v4 2/5] 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: <20240424-rzn1-gmac1-v4-2-852a5f2ce0c0@bootlin.com> References: <20240424-rzn1-gmac1-v4-0-852a5f2ce0c0@bootlin.com> In-Reply-To: <20240424-rzn1-gmac1-v4-0-852a5f2ce0c0@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 [rgantois: removed second parameters of new callbacks] Signed-off-by: Romain Gantois --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 ++++++++++++++ include/linux/stmmac.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 59bf83904b62d..bee9c9ab31a88 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7200,6 +7200,12 @@ static int stmmac_hw_init(struct stmmac_priv *priv) if (ret) return ret; + if (priv->plat->pcs_init) { + ret = priv->plat->pcs_init(priv); + if (ret) + return ret; + } + /* Get the HW capability (new GMAC newer than 3.50a) */ priv->hw_cap_support = stmmac_get_hw_features(priv); if (priv->hw_cap_support) { @@ -7282,6 +7288,12 @@ static int stmmac_hw_init(struct stmmac_priv *priv) return 0; } +static void stmmac_hw_exit(struct stmmac_priv *priv) +{ + if (priv->plat->pcs_exit) + priv->plat->pcs_exit(priv); +} + static void stmmac_napi_add(struct net_device *dev) { struct stmmac_priv *priv = netdev_priv(dev); @@ -7795,6 +7807,7 @@ int stmmac_dvr_probe(struct device *device, priv->hw->pcs != STMMAC_PCS_RTBI) stmmac_mdio_unregister(ndev); error_mdio_register: + stmmac_hw_exit(priv); stmmac_napi_del(ndev); error_hw_init: destroy_workqueue(priv->wq); @@ -7835,6 +7848,7 @@ void stmmac_dvr_remove(struct device *dev) if (priv->hw->pcs != STMMAC_PCS_TBI && priv->hw->pcs != STMMAC_PCS_RTBI) stmmac_mdio_unregister(ndev); + stmmac_hw_exit(priv); destroy_workqueue(priv->wq); mutex_destroy(&priv->lock); bitmap_free(priv->af_xdp_zc_qps); 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