2024-02-01 18:49:33

by Thierry Reding

[permalink] [raw]
Subject: [PATCH net-next 0/3] net: stmmac: Allow driver-specific AXI configuration

AXI bus configuration can, in most cases, be derived from the compatible
string, so instead of relying exclusively on device tree for the AXI bus
configuration, create a method for device drivers to pass along a known-
good configuration.

Signed-off-by: Thierry Reding <[email protected]>
---
Thierry Reding (3):
net: stmmac: Pass resources to DT parsing code
net: stmmac: Allow drivers to provide a default AXI configuration
net: stmmac: Configure AXI on Tegra234 MGBE

.../net/ethernet/stmicro/stmmac/dwmac-anarion.c | 2 +-
.../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 2 +-
.../net/ethernet/stmicro/stmmac/dwmac-generic.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 2 +-
.../net/ethernet/stmicro/stmmac/dwmac-ingenic.c | 2 +-
.../net/ethernet/stmicro/stmmac/dwmac-intel-plat.c | 2 +-
.../net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | 2 +-
.../net/ethernet/stmicro/stmmac/dwmac-loongson1.c | 2 +-
.../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 +-
.../net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 2 +-
.../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 2 +-
.../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 | 11 +++-
.../net/ethernet/stmicro/stmmac/dwmac-visconti.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 +
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 66 ++++++++++++++--------
.../net/ethernet/stmicro/stmmac/stmmac_platform.h | 3 +-
25 files changed, 77 insertions(+), 47 deletions(-)
---
base-commit: 51b70ff55ed88edd19b080a524063446bcc34b62
change-id: 20240201-stmmac-axi-config-77ea05ea9eff

Best regards,
--
Thierry Reding <[email protected]>



2024-02-01 18:50:11

by Thierry Reding

[permalink] [raw]
Subject: [PATCH net-next 2/3] net: stmmac: Allow drivers to provide a default AXI configuration

From: Thierry Reding <[email protected]>

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 <[email protected]>
---
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;
}

--
2.43.0


2024-02-01 18:50:15

by Thierry Reding

[permalink] [raw]
Subject: [PATCH net-next 1/3] net: stmmac: Pass resources to DT parsing code

From: Thierry Reding <[email protected]>

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 <[email protected]>
---
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);

--
2.43.0


2024-02-01 18:50:33

by Thierry Reding

[permalink] [raw]
Subject: [PATCH net-next 3/3] net: stmmac: Configure AXI on Tegra234 MGBE

From: Thierry Reding <[email protected]>

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 <[email protected]>
---
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);

--
2.43.0


2024-02-02 11:57:00

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH net-next 1/3] net: stmmac: Pass resources to DT parsing code

On Thu Feb 1, 2024 at 7:49 PM CET, Thierry Reding wrote:
[...]
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
[...]
> @@ -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);

Looks like I messed up splitting these changes, so this will actually
fail to build before patch 2. I've sent out an updated v2 that I've
explicitly tested for bisectability.

Sorry for not catching this earlier.

Thierry


Attachments:
signature.asc (849.00 B)

2024-02-03 12:08:19

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH net-next 2/3] net: stmmac: Allow drivers to provide a default AXI configuration

Hi Thierry,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 51b70ff55ed88edd19b080a524063446bcc34b62]

url: https://github.com/intel-lab-lkp/linux/commits/Thierry-Reding/net-stmmac-Pass-resources-to-DT-parsing-code/20240202-025357
base: 51b70ff55ed88edd19b080a524063446bcc34b62
patch link: https://lore.kernel.org/r/20240201-stmmac-axi-config-v1-2-822e97b2d26e%40nvidia.com
patch subject: [PATCH net-next 2/3] net: stmmac: Allow drivers to provide a default AXI configuration
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20240203/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240203/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:96: warning: Function parameter or struct member 'res' not described in 'stmmac_axi_setup'


vim +96 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c

3b57de958e2aa3 Vince Bridgers 2014-07-31 86
afea03656add70 Giuseppe Cavallaro 2016-02-29 87 /**
afea03656add70 Giuseppe Cavallaro 2016-02-29 88 * stmmac_axi_setup - parse DT parameters for programming the AXI register
afea03656add70 Giuseppe Cavallaro 2016-02-29 89 * @pdev: platform device
afea03656add70 Giuseppe Cavallaro 2016-02-29 90 * Description:
afea03656add70 Giuseppe Cavallaro 2016-02-29 91 * if required, from device-tree the AXI internal register can be tuned
afea03656add70 Giuseppe Cavallaro 2016-02-29 92 * by using platform parameters.
afea03656add70 Giuseppe Cavallaro 2016-02-29 93 */
af49f82367c1e3 Thierry Reding 2024-02-01 94 static struct stmmac_axi *stmmac_axi_setup(struct platform_device *pdev,
af49f82367c1e3 Thierry Reding 2024-02-01 95 struct stmmac_resources *res)
afea03656add70 Giuseppe Cavallaro 2016-02-29 @96 {
afea03656add70 Giuseppe Cavallaro 2016-02-29 97 struct device_node *np;
afea03656add70 Giuseppe Cavallaro 2016-02-29 98 struct stmmac_axi *axi;
afea03656add70 Giuseppe Cavallaro 2016-02-29 99
afea03656add70 Giuseppe Cavallaro 2016-02-29 100 np = of_parse_phandle(pdev->dev.of_node, "snps,axi-config", 0);
af49f82367c1e3 Thierry Reding 2024-02-01 101 if (!np && !res->axi)
afea03656add70 Giuseppe Cavallaro 2016-02-29 102 return NULL;
afea03656add70 Giuseppe Cavallaro 2016-02-29 103
64f48e593a54a8 Joao Pinto 2017-03-07 104 axi = devm_kzalloc(&pdev->dev, sizeof(*axi), GFP_KERNEL);
4613b279bee795 Peter Chen 2016-08-01 105 if (!axi) {
af49f82367c1e3 Thierry Reding 2024-02-01 106 if (np)
4613b279bee795 Peter Chen 2016-08-01 107 of_node_put(np);
af49f82367c1e3 Thierry Reding 2024-02-01 108
afea03656add70 Giuseppe Cavallaro 2016-02-29 109 return ERR_PTR(-ENOMEM);
4613b279bee795 Peter Chen 2016-08-01 110 }
afea03656add70 Giuseppe Cavallaro 2016-02-29 111
af49f82367c1e3 Thierry Reding 2024-02-01 112 if (res->axi)
af49f82367c1e3 Thierry Reding 2024-02-01 113 *axi = *res->axi;
af49f82367c1e3 Thierry Reding 2024-02-01 114
af49f82367c1e3 Thierry Reding 2024-02-01 115 if (np) {
afea03656add70 Giuseppe Cavallaro 2016-02-29 116 axi->axi_lpi_en = of_property_read_bool(np, "snps,lpi_en");
afea03656add70 Giuseppe Cavallaro 2016-02-29 117 axi->axi_xit_frm = of_property_read_bool(np, "snps,xit_frm");
61d4f140943c47 Jisheng Zhang 2022-12-03 118 axi->axi_kbbe = of_property_read_bool(np, "snps,kbbe");
61d4f140943c47 Jisheng Zhang 2022-12-03 119 axi->axi_fb = of_property_read_bool(np, "snps,fb");
61d4f140943c47 Jisheng Zhang 2022-12-03 120 axi->axi_mb = of_property_read_bool(np, "snps,mb");
61d4f140943c47 Jisheng Zhang 2022-12-03 121 axi->axi_rb = of_property_read_bool(np, "snps,rb");
afea03656add70 Giuseppe Cavallaro 2016-02-29 122
af49f82367c1e3 Thierry Reding 2024-02-01 123 if (of_property_read_u32(np, "snps,wr_osr_lmt", &axi->axi_wr_osr_lmt)) {
af49f82367c1e3 Thierry Reding 2024-02-01 124 if (!res->axi)
6b3374cb1c0bd4 Niklas Cassel 2016-12-05 125 axi->axi_wr_osr_lmt = 1;
af49f82367c1e3 Thierry Reding 2024-02-01 126 }
af49f82367c1e3 Thierry Reding 2024-02-01 127
af49f82367c1e3 Thierry Reding 2024-02-01 128 if (of_property_read_u32(np, "snps,rd_osr_lmt", &axi->axi_rd_osr_lmt)) {
af49f82367c1e3 Thierry Reding 2024-02-01 129 if (!res->axi)
6b3374cb1c0bd4 Niklas Cassel 2016-12-05 130 axi->axi_rd_osr_lmt = 1;
af49f82367c1e3 Thierry Reding 2024-02-01 131 }
af49f82367c1e3 Thierry Reding 2024-02-01 132
afea03656add70 Giuseppe Cavallaro 2016-02-29 133 of_property_read_u32_array(np, "snps,blen", axi->axi_blen, AXI_BLEN);
af49f82367c1e3 Thierry Reding 2024-02-01 134
4613b279bee795 Peter Chen 2016-08-01 135 of_node_put(np);
af49f82367c1e3 Thierry Reding 2024-02-01 136 }
afea03656add70 Giuseppe Cavallaro 2016-02-29 137
afea03656add70 Giuseppe Cavallaro 2016-02-29 138 return axi;
afea03656add70 Giuseppe Cavallaro 2016-02-29 139 }
afea03656add70 Giuseppe Cavallaro 2016-02-29 140

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki