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: 1901064 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=f9IGnDcT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:40f1:3f00::1; helo=sy.mirrors.kernel.org; envelope-from=linux-tegra+bounces-899-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [IPv6:2604:1380:40f1:3f00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TdpMb2Fcgz23cl for ; Tue, 20 Feb 2024 03:46:19 +1100 (AEDT) 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 68BE2B2174C for ; Mon, 19 Feb 2024 16:46:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F19041C81; Mon, 19 Feb 2024 16:46:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="f9IGnDcT" X-Original-To: linux-tegra@vger.kernel.org Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF475405DE; Mon, 19 Feb 2024 16:46:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708361175; cv=none; b=IZ42uj3/S33BEnyIAB55JTvSoEpwFtsdaNvM7j5WFIxoD0YYapaZN+v6DS00itgXwXVVoMEEK6x7GcX1SmpYDZLy6vBQAIVgQhcJ2H7huFvxR2SYfdlH20RbyCRoWjo+qoFakLOA1A8+EcVIbBCOgFxL4b8/UHaZdWlfGpeI6iw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708361175; c=relaxed/simple; bh=2dNkZy9Qowr+lnIaUQIrE1w0rz67bEVHP8S1+WQjZ9Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RgOzagJPMea7thHOAg6EgVJCuDSCyCJT5Qm3UkP/Vf2uzO7u/ooIceeXM7FhwIib2AaXFyK0Dexx6fL3Zqf53k4pUKIuNFuy/7PPANIbCUz/Jz11G0EuziRvJRNd/95fc2JC9Xb8t+UeLbZk/bvqE/GDOkLX3g3ht9EfFWkCW2E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=f9IGnDcT; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-512a96e44e2so2313081e87.2; 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=vger.kernel.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=f9IGnDcT4jVRegXqPvunlV0mgKFK0jCu75DzI6pqNr9XoYH1YyCt2ozb7LqoKP9/LH tuqoIqDNHxLCvhT0MeeTFPuJNrbxqx7X8JNwcQwcZsJl51oxmLV6HeuojH+5um/CWtQ9 fWuuVsJ3FhnjS6aWrRdniaBvdHEtcIF9DuHIPzoiVj+pd1jTbL1qBIx9H3dFIbwlwgRR BcdWhy4LB1WuD+yewii4AaDI14e0NKFYYU1TF5HzhCL/aHjYjgzNFAF2Z1W7Gy81uEXC oiFCAU3nECQIj/5dmz4q24zeD6Dv913nYMR5gKfDjFufAFqAqlylh+T287cOZt5QKGBf MT1A== 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=tHqgPjTj/zA36sZunTXv5eymgBbvwJcfHeOFRIcODAPBf7se57TPfJiB4Mpp2Nff0m +uopu4kvmqRx5/AZSRSKXsUBvUzSHsmOb7Rbm3jsuydYax196eiQz4m9vrl99wHYwkci Iq1EH1A4W8QAmUuY/gzltUDKjJselMrWOT9xzP90qXceGq432kxmS5fxs8ieBdhuH+t2 YIGn/DUtDOsFTjSbgtuRum1Wb691FDMIPav4BGcCVyIP2fy79RF06RoLwSv6DhSQHbCW 4bNfEOJWP9E9LQG+F9VxP9Z8eBFmge5TBHe+JSNAN5qRpQc6ihUWae69fA3j7HXw7bWS FW4Q== X-Forwarded-Encrypted: i=1; AJvYcCWhdxkRiBPLzqgyBPrWwIVxKPxoqWE4J1m85zUwG9HoKGBbcX1Pi2VHw4Qq5xfxAWrfqeiaVTXon0RQ30m+IV/MIIdS9mJk5O1HAFDIj50+Y0F+bvRncl7Qk5GxetFUnwiLe2WsFscglLS/psVVo1y0TDHn3CmiLibgxo59xsIZ+4E= X-Gm-Message-State: AOJu0YxBKiaxHDGD+hgyRqvhHMKe2lJYkhSFMH9jP6x1QjbcIg5QNDCJ LEYaqQmKZC0eagzkpO99JkF+szAwoX5zd+eVBuFRg+a7TTKN0c6l 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 Precedence: bulk X-Mailing-List: linux-tegra@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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: 1901065 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=LZaxrqb4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=139.178.88.99; helo=sv.mirrors.kernel.org; envelope-from=linux-tegra+bounces-900-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TdpMb12XVz1ybl for ; Tue, 20 Feb 2024 03:46:19 +1100 (AEDT) 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id DB927283B1B for ; Mon, 19 Feb 2024 16:46:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 493EB44389; Mon, 19 Feb 2024 16:46:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LZaxrqb4" X-Original-To: linux-tegra@vger.kernel.org Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50C9A41742; Mon, 19 Feb 2024 16:46:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708361176; cv=none; b=AN/1snnucMobjs4kw5b7YQ11IgI7QOLhaO+zZBDOks7suN3YXQ1NGu9/BUMYMWOmTTcMYmAVY0QblLV50ecNx5JflWCVWpWcUnSeREtO1Kno2nG9KbyJ1lgaOygAWnajfjy+1eBwhlaimdGwSztQ2yCQdxUsUO6vnngCcBJeW98= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708361176; c=relaxed/simple; bh=IeG2i2FspVCYQp8ErTOsHim7wlCXVIRVr+QfG27vnVo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CiK+yBqaubuQfUWNLFPGPNDmGfwGfb0pY3V0wu98H+dJnX4ccAqV1sC0MTz34OenPxJSKcZdN5lRgC+YTpjJLQu32S38DTtEfb/VtUfgvZYlhF7aR/fU67hzflKq+VSXqGqN2fwUQybLKkMHg9C7L19dNyOvimgATSQ0Ps+//AA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LZaxrqb4; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a3ee69976c9so7739566b.0; 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=1708361172; x=1708965972; darn=vger.kernel.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=LZaxrqb4EpeWpmfy8bfbQEZvYBKZj7tAzhRjmuCd21gIwiDgDBLN5ZawdLOwWfxEaF xcUDemf/9c/07plGzkQUvjP977KI/OUEAm72kemPkOIa96CJXjbQKOIHVx4+xvNVpXG5 /RwSnd1EurqOfVTWdI6fq24CZVzM95VIcuBfmh4bZNfELI/3jf0J5HrNPHvU5qiPV9vN rwLf4vgOQKfEsmsBtt+S9PWXpZA4hTbkEuwbc4ekzs8f2hDwb/Tx1vVQIR1xAtmid1uu aAzHorftyf4sFDVOYckWsdET5wqL/83QiCo15P/qKYvrOVfhQLDBiTUVGxvXhvR1D6Z1 KyXw== 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=Rnifg00310f29xiLlyx98XwCfmhFh3RduOeKieC0dtFh2UOp2yhkFLQs43uVRh6lMB ib1BFsVYB3EhLXcCJl0a57/NgfPuDwew4mPGsticBqxjJgDKwIOVkX8si92nwzZ2wPOo Wvg6opndR2OSxX6M0dhbXJ02cxK36uaY9NsyKvbQGBiElAhbM9CgBDb2kc4xIXbEBBQ/ KrJbe3qrq73cJWkjYYIqEmmDAVal83ko4XpPVaDw/3Aa6/FnqvfH5x3e8CQQ3mzxaRvR w61KiS7Z+PndyUey4UbGl2xjxW6PdXzKzVUcjoCVTriSNugbVDm19uoT86i+DP9tDvZk F6Lw== X-Forwarded-Encrypted: i=1; AJvYcCWu6s7cYKBuuB7Jk61psE63ehEEO2DoreOxusW09MkCp5l5CM7Zuefx7gfGwIh4WfdsSxUlhqpGFTp17zLTPYuHoTKc5TvTh6yW+4nUzRGtiNXF/Tg204aX/v5Rou+N48GMdnvrW7ME9v9TBu9NN1yZhKQ9Z3NAMuRYAFeEXHDr48I= X-Gm-Message-State: AOJu0YzEillG/xks6UX6aUNjfC3DdFv79kBJ5cnRX2LXgETYuaIOvv7b Um+UCnCePZHzIUyNPmlauZZaFNVCGm9o0e5T36gqO8rG7ME6h6dO 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 Precedence: bulk X-Mailing-List: linux-tegra@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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: 1901066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=KEyuVUvp; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-tegra+bounces-901-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TdpMc6mNPz1ybl for ; Tue, 20 Feb 2024 03:46:20 +1100 (AEDT) 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 975411C21D0A for ; Mon, 19 Feb 2024 16:46:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C5CA446BD; Mon, 19 Feb 2024 16:46:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KEyuVUvp" X-Original-To: linux-tegra@vger.kernel.org Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59C2341C83; Mon, 19 Feb 2024 16:46:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708361177; cv=none; b=LDYCVwd86XQdTIlCCVggUOVAgIanCuJQrX3zVEaQarLJgI2Zksqu7w0IvZV+gQIzS5XcmgzVD49rlt7KTCB8UL6ANURpjJ4XfoJhjPxzjJ3kbux/gsUQ8mdOI48gEZbBuEN9Ax+WrLvO6yOfihpBIzIGI7G95WpJ7TNtsLusmHY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708361177; c=relaxed/simple; bh=OpywkGjlXr/F1fc4QFUmendfbRWwwx4aY6lDCERPsGk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bEehgQ9q10JtGSd9jmQklTjQD7SnY/HzkIouEmDMLLwDPHHsaRxDGfB0EoWI4aa14u0Lt2MDKwfOdxdzjbDWLpUbY4vAqCXVekHWJk3Wdsd+uvRm+76L5pPHVmGIWnKEqRZzRE1GYp4oV749RxiVDMNfJb69g0FeXt475fZS9xA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KEyuVUvp; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-563b7b3e3ecso5415306a12.0; Mon, 19 Feb 2024 08:46:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708361174; x=1708965974; darn=vger.kernel.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=KEyuVUvpd1wGnyN2IWL7e6I5l5sibMk4mOWe3HraY2EX94/9trbBFd15aJlyz9iXiX N7rUfzKHF4YGqXS7RzeaZyIuucPtlGmUaw/Vz5JRM1ttUdSu6r/MXdTjAYlNSDy9CI6+ +tuV2cn5GNOvN7BBcBw5k5OG3ho1DOfvphbnjsA7SIXOlu9S4TxRzAxBzq5QXWoG3cMS 21NvFUxNFgADIDR4BUyfpRfTuo+S/bsDn/OdAACgUhRN8IcOCrHUmyAuucs51kGdgKdW UM8pVRq1gam/GKRZmeKk844m/g9UQZvCwavdkkxPyQTzgVj9Vw4gZjKrd6fmdJ4ZD3PJ zEAQ== 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=AvEooShGgEeYHb+TOqx9lJleuskIr260qni3mKumESLRzJiYQFAsXUhO+pFLzsL3w3 XZ8EIDUW+USqngNQwbNoj0/0XZiom12Obd2u8EgJ+LUhsO02VAZV6+jMEjtNmAWI2Edw IIsuXRUGq/Ry4GuUL3rzKdpA2Iqyq9W8qF3nDNWdAfTjOovX8bp331MQ5A61SUhg9W4Q t8t3Ovix8Fr+7Jve35b3ob0GRJJfMnPZQG6Ik9Gk9cktOEitq33KvgMeHeyo4+GnlpEz uxoPqE7H+N4L6tZaXt1GSOYAy5FrHPXvEiy4M1kijQ3pTiQS7P6qOVDU+LbFJT7tBhri T8wA== X-Forwarded-Encrypted: i=1; AJvYcCXfFYLn/hCXtqAZHq0HLYY8+B/YUK8Se08Ym7gxX1kt+Dx+SzlFZS6+LHlc9PkSek0VHOO7v+OV7Vdgu5hHRfx7PV299rWQ9PeKBR6bb8lZFEtxty/1PiPztNFMttek9Bj79h7Yli0VbrnZQaBQSR6CSSdNBEcGfdWSjHiYACGidbA= X-Gm-Message-State: AOJu0YxrMueonpo8ymn6DakC+hNXesCt2SnecBRbLbRadjLJoKzatv9V RvBPUcNWeHxGM2zJwnbIFT4Kmzfq/j61FrAFRMm74iXQ54uhzunj 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 Precedence: bulk X-Mailing-List: linux-tegra@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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);