From patchwork Thu Feb 1 18:49: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: 13541666 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 8FE5BC48292 for ; Thu, 1 Feb 2024 18:49:34 +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=fdCmlUE7ijos4VI9UEayoNDiAuRdCxkJpXCZoI0Mf4Q=; b=KJey23L5nPMnbK ggt7U3Nk2vv9UGQyzgHneiX7LMh+HS8j6gRf2QiqR7wRVHpnUZO5nZE3IwWq/Yx7vbKFcX+0jyEE8 uAy2WzEN5G8qWkzXsvRaMNaXNPmFruajmy9cbfCODwpWTozPiooYGv6BAkTGXOeE7eTbbWSYZRbFM GXZplEyE0MbcGvJqVBcGw6yHjBYrXO8Z/kGKdHVXGAFPq410Fv6pNlRcZVbVp9eczVy2Rc7XJku0L nPPJc1RbyqCAbZGo2FtW4E5fcuR/aDJ89ngaLVXVCZYQMzqMejavsEK288fMDUeqbaXP3qCG0tEH8 D1PzfUtCdlGdX+ZwBUkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVc7m-000000094lQ-3bxt; Thu, 01 Feb 2024 18:49:22 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVc7j-000000094jn-0DBT for linux-arm-kernel@lists.infradead.org; Thu, 01 Feb 2024 18:49:20 +0000 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a363961b96aso170037566b.3 for ; Thu, 01 Feb 2024 10:49:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706813356; x=1707418156; 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=ihl+g5/rZRPOCECkepIZuS5aKdjKNwlyiq9PZoCqPB4=; b=blwBtqIyzKtO4BBI3jNRtmmEyywVnUn/6n32NGCQb79fQtGPoByAWkWgvJ1icQtc5w AGRuNER5XS8RnY5yzanqksxfE1Z3C8D8PSMX6gaqo/a4dnp/IJPEkgY+yiL3OGKR3p+0 7SQr8GORI1q0CnFHhXDXF4NePxhainpmhT0TQ4FTbHshf8YhZG3s7cGTv/05R/KvF4bE A49dh9ppOtuWsGNBunl2JZPqFEHCSGolGssD0vaRNdm7/65fDTLUSDILDsVz/oZJX2d6 goURP6tyvTogQHCIMP60eu5mKGJNsbS2LSm9+sFqIueBaI20i/VWMFuus4j0/dex2NIy HBzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706813356; x=1707418156; 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=ihl+g5/rZRPOCECkepIZuS5aKdjKNwlyiq9PZoCqPB4=; b=u0sd13fhMF6/P8TSzKwP2P2lC7TeEAIHrPtY6KGXbzNBTAlW9fGn8N5ZdQhPxLpMjx 04usoviucTanyamgmCrk/0UrAD8O91drIfXX7uxYynky3NvCeJm+OhhLtw1jQhP7Wszn Ow9APXe6YNLBLbdfOUIdBbJBliNaOaLoesmKYuVGCTAnnoP6X2UrH7y4kOpJgJrBQK96 Xezg7Eb6NbzSlmOhr4wXLw5wVJTgG/Gdfbs5AM7eZrxp1ar/abquqX/OlhPizqC10M2K PFL0RjY8a42YuQn6741fPScJe8tOvwQcBwqmPm1xKmsz4oBnsvWrieXiAxV//aabcub7 ZQrg== X-Gm-Message-State: AOJu0YyZtSpGS4drgtQdZFNId3LT1AqTgau7FH6rGOGkK6yZUJpcCZtb i9dxIsKIAVo8ej6IhYY+ccI4P1GTSfFTyVLjbmkkxkQ0k4Vcn9ET X-Google-Smtp-Source: AGHT+IECaAKFI+HrM9GJnKMdRlUNnkOvOobYd0oCEEuIMXKyN8t8yW7yRExvNAlaXXnMFJh7rNH/7w== X-Received: by 2002:a17:906:11c4:b0:a35:de06:23fa with SMTP id o4-20020a17090611c400b00a35de0623famr4988269eja.6.1706813355834; Thu, 01 Feb 2024 10:49:15 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUN8ZouWAf5gZn/HHKLaxLcT/Ok7BEEedXGSuyBs8QzqCSIIcxcvlTiRoSbhhoXhDRkgyl5OX273PSpXkg3roODoizQK3K6v66G3knl0zkFNVVd3dP6NbzhDeH9sKVL+mav5IHyXlikv5fIGui1jaGiUURC++LAVT1pV3lzTYAOmmGXC/BXUZpJNAxWgmEWfsObFcHVBSxBaoUz7ALqWeXOgYbI25uTTc+gyCvF80w2irLuo6T4bHehALymDYQg0P0Y/ifoQ0rNoOGNw9d5chd8Gku7GMXA5eGQmiLl5/jx/FOlb/oXigxxL2fsUw8SMZqYwta+XcCxerixk6rpxuaz2mp5YNQjN2aV7/TkMqMNSxwhRq+KLCFa1O+cwxzI18I3XxoXi4GAScwEv+k0Vp91rg== Received: from localhost (p200300e41f147f00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f14:7f00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id k11-20020a17090627cb00b00a367a82c0e6sm57018ejc.156.2024.02.01.10.49.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 10:49:14 -0800 (PST) From: Thierry Reding Date: Thu, 01 Feb 2024 19:49:05 +0100 Subject: [PATCH net-next 1/3] net: stmmac: Pass resources to DT parsing code MIME-Version: 1.0 Message-Id: <20240201-stmmac-axi-config-v1-1-822e97b2d26e@nvidia.com> References: <20240201-stmmac-axi-config-v1-0-822e97b2d26e@nvidia.com> In-Reply-To: <20240201-stmmac-axi-config-v1-0-822e97b2d26e@nvidia.com> To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: 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.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=18495; i=treding@nvidia.com; h=from:subject:message-id; bh=FKxUC9O9kvT63FVRLSY5iJAMkiANp2n19vF0V6Qtwa8=; b=owEBbQKS/ZANAwAIAd0jrNd/PrOhAcsmYgBlu+eoWPJQ58rNP/yDc6hJBuMKTX/5jSzR4bGxx FG3h0uMBlmJAjMEAAEIAB0WIQSI6sMIAUnM98CNyJ/dI6zXfz6zoQUCZbvnqAAKCRDdI6zXfz6z ocJ1EACloeRZl0DD7FeN81j0pqUr0b9ZHhnAiJz8/FBGVyKH4tHdTg2DkTHdLIMuiEd3UttFEFI wWoZfhYUa2FwASA8NtnR7TSN9RrqpXpNFjohYoNhd3ksdU3JyG4T+nxzDjvU6uvbMffF0DhKRwN aZHGORiLFT9TvXlqgxmgEXW0vfdJHqH+C7MTb90YEltjYxT1OqfNih3w5p1K+08UgE7cZAunmK7 71L5drRXEzLLQOKi4Qa/jagaTsncmpx79LXzRN+nQ1EPxSfDQ6zjQNWxWtpDkYXFkK13pp012Dc P8yGhkHEPZ4psJU8L5PKKH6X7saOP3CVXly2sNufM3Vr+hmMztDXRgf05XWeTxY3R0g9KmpzpQy vNYwmYZXlrt6cdiaAczZMhtj2MHRw9Ka+qwvLFiXHeHYManGsxh8KX776aOVa9mtZzg04Y0ApeF B6lMejQ4m2zIpUXLWemC+U9bYIlu9NoSwsH0QkC6ykOx8usTJOFij6/DBbnUrAhywJ4g8ez4vCo HRQjVOCSleUK8KOJgEURDX1zGJTprkLqUkXkmsSek4IzO02x+vPlMvgXYRAScYjs3KxrOAUXu3N 94AZc2qXzTs2oLY2zQ96HL0p9LLwKKL+f+aMrDVa2Xmup1ZRgF4v4pds/sM4b7SkbCmYaJzzaMd +YBOb+Zy0nKKFGg== 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-20240201_104919_153829_1C7E6ABA X-CRM114-Status: GOOD ( 12.45 ) 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 --- 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 +- .../net/ethernet/stmicro/stmmac/dwmac-loongson1.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c | 2 +- .../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 +- .../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 +- .../net/ethernet/stmicro/stmmac/dwmac-visconti.c | 2 +- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 21 ++++++++++++--------- .../net/ethernet/stmicro/stmmac/stmmac_platform.h | 3 ++- 24 files changed, 36 insertions(+), 32 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 31631e3f89d0..473e8d4228e4 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 137741b94122..3ccf695c8b5f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -1224,7 +1224,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 70eadc83ca68..8ec2ac28a775 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); @@ -605,7 +606,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) 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) { @@ -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 Thu Feb 1 18:49: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: 13541665 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 B36F0C4828D for ; Thu, 1 Feb 2024 18:49:33 +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=I23WLP0R+c/0OPPguOVraSw5WIw3PP+gWomyGynaEhk=; b=N/IDkytm/6RT4e B3VzMeINmFZ9//eUylKOw1E1dMK/LFS/0i3ZY1Yl0AqnE9Ow83BKcqQkA3UqCgSPcoSqXtMe/SaD6 LXjv8GpzPE3wi86NAuGwFzxggqAOmZoV2DTbsAcXW8fTlu0b1pxp5cy9/2xAUQ1fIxEYVDKGwiB6c OnjQph8IhS7hsqdrEbUX91GvOrATowbGxlLcPwXwT9M+bT4r1mJrP33WN2NWAj+yn5kklJutdIwXW mcZe9/+P7cFRfLKnSVD93dNZv5hWasDqApRzQC91rTN4yAiL2w87onF5ZtNwLvfgd66nPgwsdmPrW uUYBHnZod3xHFxx8rIQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVc7n-000000094lx-2CUz; Thu, 01 Feb 2024 18:49:23 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVc7k-000000094k2-3up1 for linux-arm-kernel@lists.infradead.org; Thu, 01 Feb 2024 18:49:22 +0000 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a26fa294e56so182121566b.0 for ; Thu, 01 Feb 2024 10:49:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706813357; x=1707418157; 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=AqDWY8wmk/fnuJTUL0gf+MfJA0JNC72CzhLE0DV6ueU=; b=etUzlS8KBWh/tBadU9rNu9hGzSrs4cwBf1LhzJlJztc2xsTs/8fcIM4c6beiUEfwRK b9z0LyB+GuQ/A/qiuWBsQBoLJuwI81kujMcov80Yf9MQqmHWs4FH7XKLH+44AjUEKQS7 YMbUEI0f2EV4DjKVdzlDGnsbK8rFXci8chtVNhxU6p1+dNl84/3Qg2Rbtc/WU+/1FQ9U LzRf/edPg9+ynh6ieJxeuRx9HqjmOEskQqYSfMjSejVF22s1gvzETD587mAKDxohJJkg ouC+mOUTunQxBOI6Vhwe7JMqZEU0ZOiGpvPrGnlKOyj36kiuqlLmkrFqR50D/enZxb2j Tw7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706813357; x=1707418157; 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=AqDWY8wmk/fnuJTUL0gf+MfJA0JNC72CzhLE0DV6ueU=; b=MbXHTo2HIkXWAVlF8H4DhJI4tXe9stF6GtXKWaMMqGFMiOAR0zezIrKIlH2tOp8Hjz gkCnzSYjqj9fZdJ1S4J3MQYpe7VIpvwHp9sn55hCs+IWj61xxk/D+Q7CwEhWVLal6TQi bcYFetfa4P5+/UAcScBpYjh+2Vpwpu3nbCD95QXRftfsylmkmxN3GDpKuFlndqJpaj4i b73OF7VQMfMHEQAzEZcHGY2hWiSkhULlj1mjJ+rR8AipB1YUxxjMaO28U8sp1BGjFtln tTwGyP1pDfQMfjmK6iqqO1UVFyFp7RNfngG0Q9nYN+/ckFwmgrYWGAQ5/JFP0WKXbXTh /8WQ== X-Gm-Message-State: AOJu0Yy8ZahjPg45YJ4KSRRZTncLoRXNsVblXTx7EatpH6gTIQmp+M65 9S0/yTLBKNE/dMgPNcFnjdxfLT2/DHD7Yc5Mgef6j8kVVaRQObtI X-Google-Smtp-Source: AGHT+IGlCSjy95AXH4mYJjWbk+DnMRTrJeOc6/n32vxw6jslXvR6wtcmhksIMqv5Ku85ONcTVpRJIA== X-Received: by 2002:a17:906:4f0a:b0:a35:43d8:a297 with SMTP id t10-20020a1709064f0a00b00a3543d8a297mr4200860eju.0.1706813357648; Thu, 01 Feb 2024 10:49:17 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXg0D4fOjs5HYilBzZpjxO0yJ3sjv2MuAzioOusiL3HyFcWt+sLiMfzeT8BjpFfqnacv7Yby1XXcVHHzOR/xpT+QEskLx0mC9QT+ACNiFR8yS9HHWB6kjXFIf1xkgamzvKGPTfpUs0nFT/kIie32a/YjaeOKyyLcF//DAoNDQ0g1dQBVsH9hcu+yJzPruQUZxhC7Xav6Ephswrty10jq6fjYgREh11U2HnZfz8BZnXDBs9DMt1ZR8BYLGXRKH3kgoM4waLf50/Xdb+S1apLl5R86GarCVapWXen6MCZAmT+n2cB1wva3iCIJnoIa8mFWBLUl+i6mD6AT355vz+L2dGnOZ3hbScsotx818w9xNBhAjfoI7M7GfmX0a9Zb4GxyM9etfoacWRMkVLXALUZMLlDWg== Received: from localhost (p200300e41f147f00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f14:7f00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id va11-20020a17090711cb00b00a36894739bbsm64066ejb.88.2024.02.01.10.49.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 10:49:16 -0800 (PST) From: Thierry Reding Date: Thu, 01 Feb 2024 19:49:06 +0100 Subject: [PATCH net-next 2/3] net: stmmac: Allow drivers to provide a default AXI configuration MIME-Version: 1.0 Message-Id: <20240201-stmmac-axi-config-v1-2-822e97b2d26e@nvidia.com> References: <20240201-stmmac-axi-config-v1-0-822e97b2d26e@nvidia.com> In-Reply-To: <20240201-stmmac-axi-config-v1-0-822e97b2d26e@nvidia.com> To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: 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.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=3475; i=treding@nvidia.com; h=from:subject:message-id; bh=w0xggOKS1PGq0kFbzfjy2DAd3e5snbUxtXdb8/CdR8M=; b=owEBbQKS/ZANAwAIAd0jrNd/PrOhAcsmYgBlu+eo4do/ibRD22vEaMX4s5Ja/xO0RyvXT1Cnc RiSCmMpHyKJAjMEAAEIAB0WIQSI6sMIAUnM98CNyJ/dI6zXfz6zoQUCZbvnqAAKCRDdI6zXfz6z ocs5EACceS9fQZ3tL3oUiof4CHxmR+8LkFehtBa+PFf8289m6QSjXlUa+U6BmQYDYO82XRAQSWp sWLqVLFl+P06C9lS55li+177xc31OTwMkmTFPz6Flz/JkLkTx1IbZ7ECWXI3JObwAzAW7KAcDK2 FFEdopjouSg8ZFMuREYFowuyHiQq8clPeHRitwdByxW7rmtfb6Y7nJ5PZ+T6+0fI40v9GV6GA+M Ru97tkDMOVKGYkBf1PP1NR8YhZGv0x/rusw8SxU0uTzEvIbLsBahNtM0MrJtHIJ/NM0oC3e4/se Z+WWE7wBuxGoMSx/rhvwS/XtHmpneR8RxdZQEZZuqTXsb2jN/wLcW1XYwCdsALuMMqnrRf7l/yj GVS/0N2rbCt9oQqoXxWcCnbSS5qnBuo3cc0cQKBnQRe8hsfX2YATDtGCnY753qymvwtM3XqKndx 4Q9j5Q2ZgAeIc75t1Mozsaj5oFbjXLnNOZZKkiIjnwbnwgb215Gi7Y0bqKCoSH51v7H5LaX2Z+2 fFdp5oBoKyfxJmy3ue0dkohWH3alIPb0JzF7/iawpgLCeQcv4r6HycHubcU3QPR5HedcNDoP5rv 7FTWnqy4tAoriipDpD3G9VfWF747TP5EvjvkZkCeU9qmNDwMKWEeNvKZVdegLqn+BKPL5gMsKu8 j5QK3IU/pg3yO1g== 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-20240201_104921_015785_81FA8B4F X-CRM114-Status: GOOD ( 16.87 ) 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 --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 + .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 47 ++++++++++++++-------- 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index f155e4841c62..07706e7b3cfc 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -35,6 +35,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 8ec2ac28a775..0d5f2cebd6fc 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -91,34 +91,49 @@ static int dwmac1000_validate_ucast_entries(struct device *dev, * if required, from device-tree the AXI internal register can be tuned * by using platform parameters. */ -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; 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"); - - 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 (res->axi) + *axi = *res->axi; + + 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,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; } From patchwork Thu Feb 1 18:49:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 13541667 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 7CB28C48286 for ; Thu, 1 Feb 2024 18:49:39 +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=d96lutkWt08mtH+eJVLxzy/jKvCXrvBL5nIsJi9C/yU=; b=NudcZBghVgo2nV nOdi6G1Wh8vQ9nyjx/L0mBDVHNqc/ZEDNqzIzvIc0nAUB3Cj7kbsVh0uri7tIwqVaaHAuOJCPt3n+ a6IHynYy+olaVvtkWRAUFFuWKNV1rOkC+nTy4cD5MBMoOdtyPpP3aFXVgp6l96nYrcyo9yvr86WMz SttqZKa2Cm1BDj0IamiVZW86azipUar6jPL5ppL7OnyiBFCm/JbqrN+cT4hnErfJVajrBjRewyrKF rLWMwnMPYj6FFHHwWYuleIiVeKiCuaRUj5zsXXZJQ0Ddu/8tfCBvEkqVIyDkMR9+AKr8FacyjtmeS B4xfD1VrmQSUx7LqPySw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVc7q-000000094n4-15wN; Thu, 01 Feb 2024 18:49:26 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVc7m-000000094kR-0VpI for linux-arm-kernel@lists.infradead.org; Thu, 01 Feb 2024 18:49:23 +0000 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-55faa1e3822so1760275a12.1 for ; Thu, 01 Feb 2024 10:49:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706813359; x=1707418159; 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=CP10ASwjzq21gj6cHPQz3XuKiRelwR6OnJvv0UFbQiI=; b=T8iC6/TlAPN2OckjCF6esXoMRIb+Sag7bfMVzjPiNXMoaNOJbvwpiidL2i89MYyy0e ZmgbN9Tgs+vLLSF2TiyQr7YSWH9vYLCY+hxkIuuWQW+oG+XI/BIvQJUO7mnMb472Af+Q lZ0bmPPtqqHVqLWL8pZO6amr2SpsWqWBUpIAbq7WZ5v6VCGma7YsJmpE9iLK61KQEvDC Vqu0xh59mUqvlVQjpri6MrBbgqJRIszjBjlveOU6KQkLRbww2mqQRtRMjldBy9qV0fAm d4YchWLkmbpyH/Q2U2GKTj4kOj5wcbd5GXgK/yQaLSlwzUpEOApjc5Gpglsfpv5t/3hz Qy+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706813359; x=1707418159; 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=CP10ASwjzq21gj6cHPQz3XuKiRelwR6OnJvv0UFbQiI=; b=w170tFg5f1aoHTA1kkuSTI0RMXNyiISiSz4ZLeCf+EBGlBtNuj2rQYJRjlP5NiW9qC SBpNLwmtr9nYPgTZPNkRXLVJY1T+STvak8wP4ExVifrTwxBTVQIPWS2BtdPEg/pnG5yy lZbx+4JLOPdnO3/DDvKvE1yUvz4vzZ6B37PDipK8Z4ioawQhurmWxwgQnKTEVqEbcNzi /iM4sivd1zLHFAoOTXvvKSKNfsM2DEERHow92yRIdlyL9yAam+cyyNBOuorzKtWvYdL4 7MWrmZ2IftkmyBk0igD10xlo6Y3SyxuN3WYYmL7I4VL5UEqhu759j26giBSxTqRG9jiP QfRA== X-Gm-Message-State: AOJu0Yw8vexNvw5gtnAxHpCGMxgv06LXLNE0PgO+Q/7z8xDbO/ak2WBy kiGKWvaTghHIpPVbRmZem9ffkIEqz0YDQgbsddDzzLtIvRXbKGdk X-Google-Smtp-Source: AGHT+IFKlOu8htL+VeocZQsCqcN2H5lOEv7UpM8fH+qAO6/+jfphQEQwjVFyg6IbQ9oupKKzRN2jWw== X-Received: by 2002:aa7:d70b:0:b0:55f:caa3:f7c6 with SMTP id t11-20020aa7d70b000000b0055fcaa3f7c6mr1331654edq.31.1706813359117; Thu, 01 Feb 2024 10:49:19 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXbOS/rwccwJDrMvw00+Ow/75KWAzVeEtF8qq2WRWPm6ayDE121p8dbC3RHPHu9tOWrBYelgUWK4aTwC7J1FAzb9+KSW+tHWj6wtsbPG5QpiGXFAVp9gu0NItSxirPMXd+wWZK2owMbKeG8lbel2uXljcp7iziPhebh6QeBA9+P4HrdChU0ZKZNVIHTmcaAsulFx9dQlOW1KoJCEDLoZ9wZUcpZHWH46zoXisLtVBelrQMeGZzPsEmXoVzS7SeOBu02xZuvjc3AnA6xLOh1o3f+NSZ+wGiK1qWIoKM5qaTsO/5PO2LMpGplTh45gaqd/4cquHQ/sTWJjE2cfatRGAiP7QWontk2rXqDxJ9ZTBcI3I57X84iMHE8+QSvxIVVwizyfajFO5eSqy8ED//VogzugA== Received: from localhost (p200300e41f147f00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f14:7f00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id g23-20020a50ee17000000b0055971af7a23sm75332eds.95.2024.02.01.10.49.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 10:49:18 -0800 (PST) From: Thierry Reding Date: Thu, 01 Feb 2024 19:49:07 +0100 Subject: [PATCH net-next 3/3] net: stmmac: Configure AXI on Tegra234 MGBE MIME-Version: 1.0 Message-Id: <20240201-stmmac-axi-config-v1-3-822e97b2d26e@nvidia.com> References: <20240201-stmmac-axi-config-v1-0-822e97b2d26e@nvidia.com> In-Reply-To: <20240201-stmmac-axi-config-v1-0-822e97b2d26e@nvidia.com> To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: 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.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1341; i=treding@nvidia.com; h=from:subject:message-id; bh=NJ6QmQ9rSuyu2yILzTMeD+XilmAw5wEYJDPvDZo2/VA=; b=owEBbQKS/ZANAwAIAd0jrNd/PrOhAcsmYgBlu+ep1zJWpEM8HRzktM8KpsERNnutRk7N84dvz K2El6DKvMuJAjMEAAEIAB0WIQSI6sMIAUnM98CNyJ/dI6zXfz6zoQUCZbvnqQAKCRDdI6zXfz6z ofTjD/9vqkLXf0KsRrAGJFdVsvmQwB4UULEK0xMOneRYgY1j7/xcxTaqvOZfJ81Z9hxI/U7CDRx XvwAIYUqbi66duOyf/viRcLGYwAWCsFdn8zvMgsM004MjLki6BhICcLabpaXoYQSwC9QtKWV4Qp JIHve3g6rlXez1V4SLhClwwXJRsw7iyHTeiVc9SYVEapCIaZmEJpgLNZqgQxgP/uxME4k6wwNS3 6Zkon2xpBLVxxdw5dRRUVdWdw56JT1Xh229MaoLARsWUtaJmjpC0HSK1EBfHLzsV3fN9O58Dq9u 0xVzUsOkHlvhUVPvqbJEgpzrjHaL3w4mfkpFxoDfP7qUnJKYZbFwKwl7sko4NgeYz/SQ+fiNXh1 dIPA1FXHrHq6NyeO9/3MwKkuTiTWS1vpDhUbTXQUFzeCyFmakx9uk63lrM7fe2v3zSxmNGCBtyx TW3atIO720/GQc7okk8LM0MXlpg+UPEJYtQp7/G+6SludKy6yLf7v1gz8ovrQdfc0aeu8YaYahh +Uq35mjGpOTsDo7sYM+eONXk5zGkCaoNZCvleBvCaLJIkQvm+g1/3wJ8LeBjXNidPSGfBMsyxM+ B7ePsc1guQNfMU1CjQITNzqu4fV/Hj5fepo+1mQmnsYmAjK/0ZA2hASSBW9cQ0GPsyxNSr6zXNX kCD605YF4Kg+Uig== 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-20240201_104922_220208_031661F2 X-CRM114-Status: GOOD ( 13.32 ) 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);