From patchwork Mon Feb 19 16:46:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13562906 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 23CE6C48BF8 for ; Mon, 19 Feb 2024 16:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EEgfLxhCs8T9jV46KMITKknriQGZ/hQD9tPvmQCN1Hs=; b=vec9Sc2TXEXzZ5 7pnAuqbRDkUGB2wdHSOu970jnk9C4iy9i+8W1k266XuGyLPytwFvgAtwYVC8Wilzej3ZOMI546Iaw Ce9sh0SCiBmjvSXLLVDzGFQnzxbp6q+4YU5D2yPpgYPiHPktOSwfTaiO+iQrJL8GWzBWd3WsvZPRr l4SyDhFOhbYO4z27cEWFBNyh1RoCFT0V085Bs+flhVu8wMsh1o827V1TwWHDlSL9tO66gINuYKskc 3SjJ83IhEa8WG25y7lbXkjiSUTVbDEB24fC3Cfh5OaIlgYn0mQupCIVlEECehIT6aSaOtkslLgzP3 bu6GlpML3yE/XN7QcsxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rc6mV-0000000BPEj-27oP; Mon, 19 Feb 2024 16:46:15 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rc6mS-0000000BPDi-2jax for linux-arm-kernel@lists.infradead.org; Mon, 19 Feb 2024 16:46:14 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-512b42b6697so1227270e87.1 for ; Mon, 19 Feb 2024 08:46:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708361171; x=1708965971; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gtDtxHtlcu9ASavvT/LxF1yz07grVTxYpKmjdaNvLlA=; b=DputbwCyVvrhKOijWn5syHSa5Cwy1AILkxpoJ/Ayb9Wn2/Dc+zAUSJ8F3Ti6whv0Gp aWWzGXedeZFrhJODv3CvKLfRxum2Uzptx4kQSxa2UFoIJ0dZynKvf1L0ps6fm2y30ZJx gyKVMrtoqcG1SgFOiI5KfHSV1v0nUCG8MYPGlXXtbxAifsXP1Ob3yfJgGhGBD0gU3Ldc lGZGfv4ftHLNPTTFPqkAVX5qaENTw5gDiNUuESLIXO3sTRwjFuyPPUsE2kJp8RppQBep Ar6z3NZP+ULNC5nPnNbCZNdcnX7oloPW19fk8zj+4Y3AFB61EZDTzwUmwm8L81jHURZ6 q++g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708361171; x=1708965971; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gtDtxHtlcu9ASavvT/LxF1yz07grVTxYpKmjdaNvLlA=; b=JUI1kQ2u7ejuTtXwmY2kfgQB1RyzC7Zt1zEosDxnmOGF0pXK7GkuZPoq0mYAEeSdtG vs1c24FPp7/ToJxILS7g8WkTtBuRtKc/seKvPyNkOPoTPauZZgVM6gbuEMxHGV6/myao at3a+/3fgQO3iS9mgKWzees6yWz6XkwiMvv4QdFpYIgpKRSW94PY0PWl/xCFaux2uYWX UikDuDsTfP4qLXYIRu/833LZNIh+8Jx7VBHOgxzddwCNRDS2XiYLDihcYhs3z/H692xp kswzWXXfPYxshRi60QEbi51Cp1iFqa2GuI9YX/E422X4yjjGY7cE1uwLxbVG852T4mlD 50TA== X-Forwarded-Encrypted: i=1; AJvYcCWEafq5l7ZQAZ3L+20Fpz1TQwEkDtsW2Sp2WHs4OmTO3RTRVLkSrAb68FbrhcwpcI9L9F6QaxGCsa83kZdPTAP3X4gbzclOlQHpvT7sTix1tWE3lyI= X-Gm-Message-State: AOJu0Yxxc8+NgLf2KZkNKfAi4xdORr+/5YPt3wEFgmspjgLda8KGTBLV 5gXGkl59dCcX0OdzOpUEUdTOjm/nx6BmsWDQiWsuXeB74IDFMDaI X-Google-Smtp-Source: AGHT+IEKhu3/RJx/D2ZdIXAGGxEZhDJ+CzcXwqo7Dd3MS4t2r7Ee/yMmfsTMn/53gYqw6nZ4agFzCw== X-Received: by 2002:a19:5e12:0:b0:512:b115:a62f with SMTP id s18-20020a195e12000000b00512b115a62fmr2303991lfb.59.1708361170598; Mon, 19 Feb 2024 08:46:10 -0800 (PST) Received: from localhost (p200300e41f2d4600f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f2d:4600:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id fj6-20020a1709069c8600b00a3cfe376116sm3125777ejc.57.2024.02.19.08.46.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 08:46:10 -0800 (PST) From: Thierry Reding Date: Mon, 19 Feb 2024 17:46:04 +0100 Subject: [PATCH net-next v3 1/3] net: stmmac: Pass resources to DT parsing code MIME-Version: 1.0 Message-Id: <20240219-stmmac-axi-config-v3-1-fca7f046e6ee@nvidia.com> References: <20240219-stmmac-axi-config-v3-0-fca7f046e6ee@nvidia.com> In-Reply-To: <20240219-stmmac-axi-config-v3-0-fca7f046e6ee@nvidia.com> To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Serge Semit , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, Thierry Reding X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=18284; i=treding@nvidia.com; h=from:subject:message-id; bh=tPuSb3hQEc/qFI5pO8U8rTYdq/fzctAjnfT+D0rXkZg=; b=owEBbQKS/ZANAwAIAd0jrNd/PrOhAcsmYgBl04XQ6770lXFRm8Hm035I191EStZqe1GOks4fl ToD9a4HluaJAjMEAAEIAB0WIQSI6sMIAUnM98CNyJ/dI6zXfz6zoQUCZdOF0AAKCRDdI6zXfz6z oatRD/9yHWXEbNduxQNzMTvSpL7DZXy2AdlnOyUiD1HHrzb6ycYv5La40QildzqoAVHTy4RxfQE eMa82BUWnAeVh8dfGS9V3NNDnCD/w6f6d3SSXYnWbVp+qXihyKVayNsMvoZV02ZgSv/SLUmBQZT SfO8tEiJQ2+GZC0oFRBbZpHcSCoIsLtmbXC13jmfS63zFxWJi8WKI4+1iuG+EsOQna5jgCS9VBv gj9lyAXZRlCe72/eFIAayKcfYvBM9I9KMm8/Cv4ceZqNMUitY+gk7cgjbnSTr432EkLwos71n6/ hErE9tnCwLo2LdVqdVXVfDSlrWhaItPaGUZyuCOBl33bC54wGoDFD03K/ZHbQiKNDrf34qjhGlt WuR2tLiCrbjtErMLIDPnsoG9VADzj/ViAdAmJheF6ZzjZ3z4xsgDupEodvDAX89UbAFO9o4yPTe INjOzSE3ps6sNRHxwUt+05bOY39p6ytdaemcLBrKmLkQ8bugksHKUmVo7tIMNNEE5kITSC+Jqye NckI7VjTWc6qsOw4WP6tTVqRiX1HMpKaX2+ffxb9ABwLogRAcqnJj3q1wUvGdQSFaa8HV7tRWG7 Vr/RKfzkmsckqkxwJ1cl7Npqy8ahTYLdyhX28zUxikoeF3Xef84t3lD5wqCD9U/dg/0d2pbT8VZ U3JO6LAJXSnaU5A== X-Developer-Key: i=treding@nvidia.com; a=openpgp; fpr=88EAC3080149CCF7C08DC89FDD23ACD77F3EB3A1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240219_084612_757428_75203A9D X-CRM114-Status: GOOD ( 12.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Thierry Reding We already pass the stmmac_resources structure to other initialization functions since it allows us to exchange more data between the driver and those functions. Passing this structure to the DT parsing code makes it easier to extend what we pass around in the future. Signed-off-by: Thierry Reding --- Changes in v2: - fix bisectability --- drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac-intel-plat.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 19 +++++++++++-------- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h | 3 ++- 24 files changed, 35 insertions(+), 31 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c index 643ee6d8d4dd..f37d9912380b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c @@ -115,7 +115,7 @@ static int anarion_dwmac_probe(struct platform_device *pdev) if (IS_ERR(gmac)) return PTR_ERR(gmac); - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c index ec924c6c76c6..36ef2ed9fd2d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c @@ -435,7 +435,7 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev) if (IS_ERR(stmmac_res.addr)) return PTR_ERR(stmmac_res.addr); - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c index 598eff926815..98a00084807b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c @@ -27,7 +27,7 @@ static int dwmac_generic_probe(struct platform_device *pdev) return ret; if (pdev->dev.of_node) { - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) { dev_err(&pdev->dev, "dt configuration failed\n"); return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c index 6b65420e11b5..d72b9d8ac464 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c @@ -331,7 +331,7 @@ static int imx_dwmac_probe(struct platform_device *pdev) if (!dwmac) return -ENOMEM; - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c index 19c93b998fb3..de2f5d7e95b2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c @@ -241,7 +241,7 @@ static int ingenic_mac_probe(struct platform_device *pdev) if (ret) return ret; - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c index d68f0c4e7835..79582983c060 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c @@ -84,7 +84,7 @@ static int intel_eth_plat_probe(struct platform_device *pdev) if (ret) return ret; - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) { dev_err(&pdev->dev, "dt configuration failed\n"); return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c index 281687d7083b..311410509012 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c @@ -384,7 +384,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) if (val) return val; - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c index 3e86810717d3..1ede4f409937 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c @@ -169,7 +169,7 @@ static int ls1x_dwmac_probe(struct platform_device *pdev) if (!dwmac) return -ENOMEM; - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return dev_err_probe(&pdev->dev, PTR_ERR(plat_dat), "dt configuration failed\n"); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c index 4c810d8f5bea..004bf4d14fdb 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c @@ -37,7 +37,7 @@ static int lpc18xx_dwmac_probe(struct platform_device *pdev) if (ret) return ret; - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c index 2a9132d6d743..763ec218ff2c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c @@ -656,7 +656,7 @@ static int mediatek_dwmac_probe(struct platform_device *pdev) if (ret) return ret; - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c index a16bfa9089ea..5bd936ef2796 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c @@ -52,7 +52,7 @@ static int meson6_dwmac_probe(struct platform_device *pdev) if (ret) return ret; - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c index b23944aa344e..88db2907640d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c @@ -400,7 +400,7 @@ static int meson8b_dwmac_probe(struct platform_device *pdev) if (ret) return ret; - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 2691a250a5a7..7f4cbea4042f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -735,7 +735,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) return dev_err_probe(dev, ret, "Failed to get platform resources\n"); - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) { return dev_err_probe(dev, PTR_ERR(plat_dat), "dt configuration failed\n"); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c index 382e8de1255d..4297a6919c8a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c @@ -1824,7 +1824,7 @@ static int rk_gmac_probe(struct platform_device *pdev) if (ret) return ret; - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c index 68f85e4605cb..e827e01b4398 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -400,7 +400,7 @@ static int socfpga_dwmac_probe(struct platform_device *pdev) if (ret) return ret; - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c index 4e1076faee0c..a0f15fbb8993 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c @@ -122,7 +122,7 @@ static int starfive_dwmac_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, err, "failed to get resources\n"); - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return dev_err_probe(&pdev->dev, PTR_ERR(plat_dat), "dt configuration failed\n"); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c index 4445cddc4cbe..5b2cde45dc3e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c @@ -273,7 +273,7 @@ static int sti_dwmac_probe(struct platform_device *pdev) if (ret) return ret; - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c index c92dfc4ecf57..af131b0bf589 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c @@ -366,7 +366,7 @@ static int stm32_dwmac_probe(struct platform_device *pdev) if (ret) return ret; - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c index b21d99faa2d0..8f47f2e904d3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -1223,7 +1223,7 @@ static int sun8i_dwmac_probe(struct platform_device *pdev) if (ret) return -EINVAL; - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c index 2653a9f0958c..f78e244b9d81 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c @@ -108,7 +108,7 @@ static int sun7i_gmac_probe(struct platform_device *pdev) if (ret) return ret; - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c index 362f85136c3e..bab57d1675df 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c @@ -284,7 +284,7 @@ static int tegra_mgbe_probe(struct platform_device *pdev) if (err < 0) goto disable_clks; - plat = devm_stmmac_probe_config_dt(pdev, res.mac); + plat = devm_stmmac_probe_config_dt(pdev, &res); if (IS_ERR(plat)) { err = PTR_ERR(plat); goto disable_clks; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c index a5a5cfa989c6..f99d147b3424 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c @@ -220,7 +220,7 @@ static int visconti_eth_dwmac_probe(struct platform_device *pdev) if (ret) return ret; - plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, &stmmac_res); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 54797edc9b38..4e2eb54306f9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -424,13 +424,14 @@ static void stmmac_remove_config_dt(struct platform_device *pdev, /** * stmmac_probe_config_dt - parse device-tree driver parameters * @pdev: platform_device structure - * @mac: MAC address to use + * @res: driver-specific parameters * Description: * this function is to read the driver parameters from device-tree and * set some private fields that will be used by the main at runtime. */ static struct plat_stmmacenet_data * -stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) +stmmac_probe_config_dt(struct platform_device *pdev, + struct stmmac_resources *res) { struct device_node *np = pdev->dev.of_node; struct plat_stmmacenet_data *plat; @@ -443,12 +444,12 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) if (!plat) return ERR_PTR(-ENOMEM); - rc = of_get_mac_address(np, mac); + rc = of_get_mac_address(np, res->mac); if (rc) { if (rc == -EPROBE_DEFER) return ERR_PTR(rc); - eth_zero_addr(mac); + eth_zero_addr(res->mac); } phy_mode = device_get_phy_mode(&pdev->dev); @@ -677,17 +678,18 @@ static void devm_stmmac_remove_config_dt(void *data) /** * devm_stmmac_probe_config_dt * @pdev: platform_device structure - * @mac: MAC address to use + * @res: driver-specific parameters * Description: Devres variant of stmmac_probe_config_dt(). Does not require * the user to call stmmac_remove_config_dt() at driver detach. */ struct plat_stmmacenet_data * -devm_stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) +devm_stmmac_probe_config_dt(struct platform_device *pdev, + struct stmmac_resources *res) { struct plat_stmmacenet_data *plat; int ret; - plat = stmmac_probe_config_dt(pdev, mac); + plat = stmmac_probe_config_dt(pdev, res); if (IS_ERR(plat)) return plat; @@ -700,7 +702,8 @@ devm_stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) } #else struct plat_stmmacenet_data * -devm_stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) +devm_stmmac_probe_config_dt(struct platform_device *pdev, + struct stmmac_resources *res) { return ERR_PTR(-EINVAL); } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h index bb6fc7e59aed..daf3bbb503a3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h @@ -12,7 +12,8 @@ #include "stmmac.h" struct plat_stmmacenet_data * -devm_stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac); +devm_stmmac_probe_config_dt(struct platform_device *pdev, + struct stmmac_resources *res); int stmmac_get_platform_resources(struct platform_device *pdev, struct stmmac_resources *stmmac_res); From patchwork Mon Feb 19 16:46:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13562907 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7E0B5C5475B for ; Mon, 19 Feb 2024 16:46:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3Y0VKdTogO+/LaZD5BQLzbPIRvIf3TYMU1s0PVY1UJU=; b=tPBAMwCX1ElTrb vqg4lgQOJnvfgxeLK2RYVwaF+88yREWA4mxuAmOJfww0/7GP+PxtgRmnN80C4uFElKbfq/hVkeEd8 rKLbRLpipcOhyH23nxEX0sRK+PxGn9H3K1+tKGiTHC5cobhgg1y37nQBWO8OezGFdJHGQ5Oju76KP cg629zqcoJE9eTqr18WgKkFeget9YOFMy2KtgECYODpStMwn/SB6FutGGGEaSpwobRy6zLbSUkih1 jcjQEUHDAWNmsH69TvbSshajb045S7AC0NI+s0wDYoNFsggGDDvtD2JEatBlPY/xy+Ze9pBDCZYBo 1icLhMTgWRHy1qLerYPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rc6mb-0000000BPHM-3kn8; Mon, 19 Feb 2024 16:46:21 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rc6mW-0000000BPEJ-0sAy for linux-arm-kernel@lists.infradead.org; Mon, 19 Feb 2024 16:46:17 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a3ee69976c9so7739666b.0 for ; Mon, 19 Feb 2024 08:46:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708361172; x=1708965972; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=hvQx/ZWr1fmONRjsP3PMsf6y/RwS/zsUlWEFNTxP3t4=; b=fWMVhW8siYflq/mEfPsxm/x9b1+iX1L5Kvq/U82i4IIOncQ4AZeuTK4iA7ZYa+0/yl Jot8zLtxggUjk4sy8NJau1szGABTEwaTGfgnLrki8x3wX1BeilwRyWLYhaZl3+qx66aF qfcs40eU4K+OAuLQN/fERMGMqtf8RL+klT49Brh6ircRPhu5E+CZKb3cPRrvWX/wskE+ ccOfzH8SqyUwpYNvKtDPScfgn5Snuq5zRMSQdwRvor2NvR7bIyZ/b10ohaQ0sISbLhvQ gQ9rYbkRj1DFvCE79JM7ztpDmjEot8TMEGe6Ky+er/Yb1H+jAEfEp2djsvR3c6vCIS0K zOdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708361172; x=1708965972; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hvQx/ZWr1fmONRjsP3PMsf6y/RwS/zsUlWEFNTxP3t4=; b=VteQUHj/3o43iiyufIaK2SGhzCZVurS4dYUuG8m56uJgjmQqosx8pMxU2Syax94g5M rIrAjcl7lE71so+aaBVdrp8lsILcu+zT6I0H9vAeKQTNoAeXgznP+X6vAZM58wR4XaGh 1302rIAy5aaqgWDBFO2kTTfTNu1s2F1Gd1IafVMgZywIdjPlxUxBNhhEPJKGHswGCEda kAUdSxKc2gVtuHKEzl0GtT88uzK80co3kzdWuMtkSTyRFohmZc/HLZ6r8YRCzDjyyWae O28nD95Yh6cHpZxv3o1xzFybROPMTG7BlVcXeMZbs9dBVtFwXwkVnx4IvOZoZ71GQiIh qc4A== X-Forwarded-Encrypted: i=1; AJvYcCWIDGuCPLVeUi6s26IjBpVHp7rOgyWgsnqF5Q2FIpiSyRzDtXNKgBhrt42BagADD0lvmFqaTNcFWqbRuyB9/66QjF3sHIcDyW+VbH6ZKoVWuDXqpD4= X-Gm-Message-State: AOJu0Yy6hnI9WU/DUZf//+4f8xTXZVMaGgEcskE1acYXhs2s/aURpuvG D2kPK4PF3j5yF3CXJ/+4pERfLv9cTBjpXUxnRvsuWJ4d6J0+Aa/d X-Google-Smtp-Source: AGHT+IGMrTXFePHwGK0f6Gfcanrxom7RdEshhcX0lXB5XyndiBsQwJpHCJ0fUqxOBqv59BYd5yg1Cw== X-Received: by 2002:a17:906:8c4:b0:a3d:b6c2:fc58 with SMTP id o4-20020a17090608c400b00a3db6c2fc58mr7225638eje.2.1708361172613; Mon, 19 Feb 2024 08:46:12 -0800 (PST) Received: from localhost (p200300e41f2d4600f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f2d:4600:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id qo3-20020a170907874300b00a3e4efbfdacsm2186128ejc.225.2024.02.19.08.46.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 08:46:11 -0800 (PST) From: Thierry Reding Date: Mon, 19 Feb 2024 17:46:05 +0100 Subject: [PATCH net-next v3 2/3] net: stmmac: Allow drivers to provide a default AXI configuration MIME-Version: 1.0 Message-Id: <20240219-stmmac-axi-config-v3-2-fca7f046e6ee@nvidia.com> References: <20240219-stmmac-axi-config-v3-0-fca7f046e6ee@nvidia.com> In-Reply-To: <20240219-stmmac-axi-config-v3-0-fca7f046e6ee@nvidia.com> To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Serge Semit , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, Thierry Reding X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4527; i=treding@nvidia.com; h=from:subject:message-id; bh=LdiFXY9cbeHxsNR8EpusW5e+abDEIKHDPw46DFX7qbE=; b=owEBbQKS/ZANAwAIAd0jrNd/PrOhAcsmYgBl04XQc+VvRHCQa0rFZHSQK8YQYoyBj0+ZspjNm wiF3N9H2gWJAjMEAAEIAB0WIQSI6sMIAUnM98CNyJ/dI6zXfz6zoQUCZdOF0AAKCRDdI6zXfz6z oefgD/oDiQVayaGBy3gD68Lgg02XvmyihQ7dQxJr9YR0oiGoOk2gp3rjgUYIzlzCKv72+CHcRSn Z2tjumF8g1yKw1DNsAjbldFLiUldaSd1yJxvjB5Mnj+XPAcZU2T82LC7k9e9dP1R0MZhxL63858 Pkl5ItL3P0HnUJlDTCQYio9QKe0FZa3KoN+YXGp2bOnJzAsmOM/0NHXps/j0Z36V5oKtcc51Qo0 wLQJivZTpduN7INxBHyVK0MZaGkQOJ3PY++gT78AwujJDbeSd3lXd6esYCesHqVUx6hqMD3t0tG iIeYMqzS6sEbYeJVSnO5vawV0yIjitoReFbU/FDLpEQl8rBWNMEI5bRCu7iZjiVULTjvGq6iha2 e+ExUKqPuN2ShbmnMKPzPHHzfIkG3bqYNuCYuF5+6t+nL7WagNr96PpXvX980dYJGp2W8CiKned NbqyN8fITO8FuydmB5Gt+C5igUVCj9ZUN9pd9R6eHLBIEP7sZgkyomnaGK1IqnDpAjWOPGLvCPx ptpGh0Z/ZrBlxQsqup77PUdIjQbcvtV7EXLDiY+XSIIJvguDFoskjse27vsMvoc0toj0QtfnCE2 IMYg87AbH+uXWUqSQjALEgnuzf3o4+SdWnvNIlczWvIGvmTs6V/4mw0nrABpYNNQpMcxXd0j5Ik 6FVsTp7wlqeiJ6Q== X-Developer-Key: i=treding@nvidia.com; a=openpgp; fpr=88EAC3080149CCF7C08DC89FDD23ACD77F3EB3A1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240219_084616_328851_65E6F3B6 X-CRM114-Status: GOOD ( 21.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Thierry Reding In many cases the AXI configuration can be derived from the compatible string, so there's no need to add the configuration to DT. Allow drivers to pass in the default AXI configuration so they can be properly set up without extra data in DT. Signed-off-by: Thierry Reding --- Changes in v3: - add comments to help explain override logic - add missing kerneldoc for new parameter Changes in v2: - fix bisectability --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 + .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 59 +++++++++++++++------- 2 files changed, 43 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index dddcaa9220cc..573c5d99b4d6 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -36,6 +36,8 @@ struct stmmac_resources { int sfty_ue_irq; int rx_irq[MTL_MAX_RX_QUEUES]; int tx_irq[MTL_MAX_TX_QUEUES]; + + const struct stmmac_axi *axi; }; enum stmmac_txbuf_type { diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 4e2eb54306f9..583f78ae9bb0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -87,38 +87,61 @@ static int dwmac1000_validate_ucast_entries(struct device *dev, /** * stmmac_axi_setup - parse DT parameters for programming the AXI register * @pdev: platform device + * @res: driver-specific parameters * Description: - * if required, from device-tree the AXI internal register can be tuned - * by using platform parameters. + * Use driver-specific defaults for the AXI internal registers if available, + * or parse them from device tree, if present. Driver-specific defaults can + * be overridden by the values from device tree. */ -static struct stmmac_axi *stmmac_axi_setup(struct platform_device *pdev) +static struct stmmac_axi *stmmac_axi_setup(struct platform_device *pdev, + struct stmmac_resources *res) { struct device_node *np; struct stmmac_axi *axi; + /* + * Exit early if the driver hasn't provided any defaults and the + * device tree doesn't specify values for the AXI configuration. + */ np = of_parse_phandle(pdev->dev.of_node, "snps,axi-config", 0); - if (!np) + if (!np && !res->axi) return NULL; axi = devm_kzalloc(&pdev->dev, sizeof(*axi), GFP_KERNEL); if (!axi) { - of_node_put(np); + if (np) + of_node_put(np); + return ERR_PTR(-ENOMEM); } - axi->axi_lpi_en = of_property_read_bool(np, "snps,lpi_en"); - axi->axi_xit_frm = of_property_read_bool(np, "snps,xit_frm"); - axi->axi_kbbe = of_property_read_bool(np, "snps,kbbe"); - axi->axi_fb = of_property_read_bool(np, "snps,fb"); - axi->axi_mb = of_property_read_bool(np, "snps,mb"); - axi->axi_rb = of_property_read_bool(np, "snps,rb"); + /* copy defaults provided by the driver */ + if (res->axi) + *axi = *res->axi; + + /* override defaults with data from DT */ + if (np) { + axi->axi_lpi_en = of_property_read_bool(np, "snps,lpi_en"); + axi->axi_xit_frm = of_property_read_bool(np, "snps,xit_frm"); + axi->axi_kbbe = of_property_read_bool(np, "snps,kbbe"); + axi->axi_fb = of_property_read_bool(np, "snps,fb"); + axi->axi_mb = of_property_read_bool(np, "snps,mb"); + axi->axi_rb = of_property_read_bool(np, "snps,rb"); + + if (of_property_read_u32(np, "snps,wr_osr_lmt", &axi->axi_wr_osr_lmt)) { + if (!res->axi) + axi->axi_wr_osr_lmt = 1; + } - if (of_property_read_u32(np, "snps,wr_osr_lmt", &axi->axi_wr_osr_lmt)) - axi->axi_wr_osr_lmt = 1; - if (of_property_read_u32(np, "snps,rd_osr_lmt", &axi->axi_rd_osr_lmt)) - axi->axi_rd_osr_lmt = 1; - of_property_read_u32_array(np, "snps,blen", axi->axi_blen, AXI_BLEN); - of_node_put(np); + if (of_property_read_u32(np, "snps,rd_osr_lmt", &axi->axi_rd_osr_lmt)) { + if (!res->axi) + axi->axi_rd_osr_lmt = 1; + } + + of_property_read_u32_array(np, "snps,blen", axi->axi_blen, AXI_BLEN); + + of_node_put(np); + } return axi; } @@ -606,7 +629,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, of_property_read_u32(np, "snps,ps-speed", &plat->mac_port_sel_speed); - plat->axi = stmmac_axi_setup(pdev); + plat->axi = stmmac_axi_setup(pdev, res); rc = stmmac_mtl_setup(pdev, plat); if (rc) { From patchwork Mon Feb 19 16:46:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13562909 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D369BC48BC3 for ; Mon, 19 Feb 2024 16:46:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mnKtXoJCTk5R2IFPxt2gPJzEd3sFOwxZuLGJ2tyN+eQ=; b=bO5IKvCZXq7yCz 5ThXPJ25Po5/FwANKquSONlcvcZ2l9lm73BYNuiDu2QWu0ZRlp0W9a/GcXVx3zNowljyAP236LmQV ak7hKVMTKwQBXp+eNtOp9cUIS7nBWkzSG47uFVo0fuGFaUhM43W490/A4p/ZLAIotRdGSWOiow4wa j6sLryy40XVs8QD2pvB1cy+QD4oJukYDQIjJOCCJ9nPHZ8AncLH8Uk22SQQdGM8GiroKiewTzxZmU yJY0QsPLES8P/+hDE7oWit4E17PJhaGTiMiVy+qpyWV63U37PSb504eblhiQs+5TUT+SOCoZbxPVP Luq4X4NUzA/InumO8ViA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rc6mc-0000000BPHp-3HcQ; Mon, 19 Feb 2024 16:46:22 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rc6mW-0000000BPEN-0rlI for linux-arm-kernel@lists.infradead.org; Mon, 19 Feb 2024 16:46:17 +0000 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-563c2b2bddbso6174430a12.1 for ; Mon, 19 Feb 2024 08:46:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708361174; x=1708965974; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=RNjiIU+MnMIcoYvV35lNchbg525xkgaHmjWjHQnrgAI=; b=TetMuihMdeNRvZT/dwNw+RAi+Vaz1P4x2+ndmG+Y4UUqGzNm1nwi9NRneTzIm/0fgi jr9LESLhC9cv61S/OODFwh0PTNj7tQmFGPx7BHZzQx/cDtUPBA/gfxxcVaULmhpjpulH cLkx6a6r6/mH9i4eOYzXUImn2BBKmgX8vNwUJ9b6ve7QkgOWHfy0UDYhqI95muvqINid 18WIXybl0xAZh/duiST/HPcE41C86J17zCM5Qq4MUFUB7PuL5mUkNUVUHtiM49SGIlRP VmQE+SGoQuhGwDUsjKyRc0TPDRNJseSBPj0zx+fxZvQKininrTm92DEorlPnDbxRQ0R+ 5WLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708361174; x=1708965974; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RNjiIU+MnMIcoYvV35lNchbg525xkgaHmjWjHQnrgAI=; b=fZUh6cA+gQkglxFqcUIFn5Bdjw7RqR7KQTh0vFvKrDqkPOtZnXWi67MPqCTBKgKWs+ OqH3R+1Q+fT8rx5u2GffUOm9aU23NAbgMG9eEuTZdxKwfaqgjT+t8XihnoVEX2UAlRgy 8zDx2FIqZnLuRaTbE4J7Hp3JhCU3gPweHIQQKHW1fPWlOrsSHKE+vZBntpSpKL/ySjDd 1y9WHbHRY1X86kXz7OU33YfuvLD2UZvRDL9kmeEJEw42+EksZKShy2+z1CfUgFbid4lz 3gkYjhwfIV6GR0RbRYLZ2lotgpQ5/IyY67+Wj6VB6m6Jl8+L2aF/p4DR3Je3PQVgdEk1 A29w== X-Forwarded-Encrypted: i=1; AJvYcCWUB7+1iRVMiM654hFqYMZ1UZtSsuew/OtDjvRQ4YpmBMf27q9axJ7gCHhhY3oWPUUkMkB6DbRLolAWN6/0u+3obh6oKDU3ZOu8E+xZQHS9wm2NeMo= X-Gm-Message-State: AOJu0Yx/depFQMoA7NT1fisXvPIA+0J1fSmjPATLwayHW1VTjM4l0WJE tLaIdpAcF6P/xjnVH6VQXPni8we9UgUe8bggdWhip2S4HsZdMtW8 X-Google-Smtp-Source: AGHT+IFeILrgwOmdxu67ncHUZUE4nXhvuhlNOkspzkSZnFXnnQtvp7fWPgo27EPTD8QyCHtOOaECPw== X-Received: by 2002:a05:6402:2696:b0:564:15b:9f57 with SMTP id w22-20020a056402269600b00564015b9f57mr5925624edd.11.1708361173701; Mon, 19 Feb 2024 08:46:13 -0800 (PST) Received: from localhost (p200300e41f2d4600f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f2d:4600:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id fd11-20020a056402388b00b0056104738371sm2837765edb.65.2024.02.19.08.46.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 08:46:13 -0800 (PST) From: Thierry Reding Date: Mon, 19 Feb 2024 17:46:06 +0100 Subject: [PATCH net-next v3 3/3] net: stmmac: Configure AXI on Tegra234 MGBE MIME-Version: 1.0 Message-Id: <20240219-stmmac-axi-config-v3-3-fca7f046e6ee@nvidia.com> References: <20240219-stmmac-axi-config-v3-0-fca7f046e6ee@nvidia.com> In-Reply-To: <20240219-stmmac-axi-config-v3-0-fca7f046e6ee@nvidia.com> To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Serge Semit , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, Thierry Reding X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1341; i=treding@nvidia.com; h=from:subject:message-id; bh=FahNwLbVWpd8t2eBaIzLF59MdYIoMLjB5FhApvU3UBw=; b=owEBbQKS/ZANAwAIAd0jrNd/PrOhAcsmYgBl04XQ/0uAEXnL2R0DFCkdbK7AgOwWu4oUXANiH 26R0FoU+QeJAjMEAAEIAB0WIQSI6sMIAUnM98CNyJ/dI6zXfz6zoQUCZdOF0AAKCRDdI6zXfz6z obeRD/0WpBZm0htLrSxWNAacexNdC3abLvhbs3ndyfACIDGwCU53kDkEqlMbz0gv3HT04VBGnie 9cn8oWrdmfouSWku3KZy0B13uPUOlZigCDOixje6BB+14wxnEDra8af9OGSLO+v0VjlG5rFs5Nk 0vMV2SH9hkJ0ArDHFp+9H3KSKRaBMIgkGn1ANcMDot8V44Lz03euWWGvbtcIyyxXo7vGSF8IObM tklx3v3obPjVPA1jyof873G2DD59ijCxSklfDDdBDvpev1lxeodCgDHV/kDZKDrCFrmiFIJTbJ0 TVG7qT/3/xoO1yC0ANtVm5Id8GxUD08oZggVpGmqC4yTWnGC05uzRdvugwgD1AX+zG4GNrx7YMD 5w0KO0faOnQxjv3H8zUDIKh1r4HlpDgSgTea8auvPSKMRhTJTbk9iNxO+jhumrSAQ4NctSnRFOV B89KrwJXZN/qxNYQCudhwmbGzzPg3w1Ii+CK/a6H1ZX3SEVjy0aaPFkiPkbMtHZNbOF6us+FDpD 6orf236g/m4kNRitVuG9Ss0pwjprbjcQL3NgzVnZP1TTVF4fFFIV6PvHAIMBPlxj/WdJZYPFzh+ gUgPfQeYNAH0UQrm3bWbEDlvjgskdXTPftihd8CBZUjkl3GvE0J2/678V9IpD/iQplM6l9LP6y0 kZKxN/nhE4NHGTg== X-Developer-Key: i=treding@nvidia.com; a=openpgp; fpr=88EAC3080149CCF7C08DC89FDD23ACD77F3EB3A1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240219_084616_320759_8B699CFA X-CRM114-Status: GOOD ( 13.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Thierry Reding Allow the device to use bursts and increase the maximum number of outstanding requests to improve performance. Measurements show an increase in throughput of around 5x on a 1 Gbps link. Signed-off-by: Thierry Reding --- drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c index bab57d1675df..b6bfa48f279d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c @@ -199,6 +199,12 @@ static void mgbe_uphy_lane_bringup_serdes_down(struct net_device *ndev, void *mg writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); } +static const struct stmmac_axi tegra234_mgbe_axi = { + .axi_wr_osr_lmt = 63, + .axi_rd_osr_lmt = 63, + .axi_blen = { 256, }, +}; + static int tegra_mgbe_probe(struct platform_device *pdev) { struct plat_stmmacenet_data *plat; @@ -284,6 +290,9 @@ static int tegra_mgbe_probe(struct platform_device *pdev) if (err < 0) goto disable_clks; + /* setup default AXI configuration */ + res.axi = &tegra234_mgbe_axi; + plat = devm_stmmac_probe_config_dt(pdev, &res); if (IS_ERR(plat)) { err = PTR_ERR(plat);