public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v2] net: axi_emac: Use reg property for DMA registers
@ 2023-11-16 16:40 Mayuresh Chitale
  2023-11-21 14:29 ` Michal Simek
  0 siblings, 1 reply; 5+ messages in thread
From: Mayuresh Chitale @ 2023-11-16 16:40 UTC (permalink / raw)
  To: Joe Hershberger, Ramon Fried, Michal Simek
  Cc: Mayuresh Chitale, u-boot, Simon Glass, Tom Rini

As per the xlnx,axi-ethernet-1.00.a DT documentation in linux, the AXI
DMA registers can be obtained via the reg property or via a separate
node for the axistream DMA controller. Currently only the latter is
supported, so add support to fetch the DMA controller registers from the
"reg" property.

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Reviewed-by: Michal Simek <michal.simek@amd.com>
---
Changes in v2:
====
Add Reviewed-by Tag.

 drivers/net/xilinx_axi_emac.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
index 54f2232768..ef151ee51b 100644
--- a/drivers/net/xilinx_axi_emac.c
+++ b/drivers/net/xilinx_axi_emac.c
@@ -903,12 +903,11 @@ static int axi_emac_of_to_plat(struct udevice *dev)
 
 	ret = dev_read_phandle_with_args(dev, "axistream-connected", NULL, 0, 0,
 					 &axistream_node);
-	if (ret) {
-		printf("%s: axistream is not found\n", __func__);
-		return -EINVAL;
-	}
+	if (!ret)
+		plat->dmatx = (struct axidma_reg *)ofnode_get_addr(axistream_node.node);
+	else
+		plat->dmatx = (struct axidma_reg *)dev_read_addr_index(dev, 1);
 
-	plat->dmatx = (struct axidma_reg *)ofnode_get_addr(axistream_node.node);
 	if (!plat->dmatx) {
 		printf("%s: axi_dma register space not found\n", __func__);
 		return -EINVAL;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH v2] drivers: pcie_xilinx: Fix "reg" not found error
@ 2023-11-11 17:36 Mayuresh Chitale
  2023-11-11 17:36 ` [PATCH v2] net: axi_emac: Use reg property for DMA registers Mayuresh Chitale
  0 siblings, 1 reply; 5+ messages in thread
From: Mayuresh Chitale @ 2023-11-11 17:36 UTC (permalink / raw)
  To: Michal Simek, Bo Gan, Puhan Zhou, Eugen Hristev,
	Heinrich Schuchardt, Jonas Karlman, Valentin Caron, Shengyu Qu
  Cc: Mayuresh Chitale, u-boot, Simon Glass, Tom Rini

Fix the driver to use the dev_read_addr_size API to fetch the reg
property from the DT.

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
---
Changes in v2:
====
- Remove global_data.h from include
- Use devm_ioremap instead of map_phsymem

 drivers/pci/pcie_xilinx.c | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/pcie_xilinx.c b/drivers/pci/pcie_xilinx.c
index 53fd121e90..c1f5bbbb1b 100644
--- a/drivers/pci/pcie_xilinx.c
+++ b/drivers/pci/pcie_xilinx.c
@@ -8,11 +8,9 @@
 #include <common.h>
 #include <dm.h>
 #include <pci.h>
-#include <asm/global_data.h>
 #include <linux/bitops.h>
 #include <linux/printk.h>
-
-#include <asm/io.h>
+#include <linux/io.h>
 
 /**
  * struct xilinx_pcie - Xilinx PCIe controller state
@@ -140,20 +138,14 @@ static int pcie_xilinx_write_config(struct udevice *bus, pci_dev_t bdf,
 static int pcie_xilinx_of_to_plat(struct udevice *dev)
 {
 	struct xilinx_pcie *pcie = dev_get_priv(dev);
-	struct fdt_resource reg_res;
-	DECLARE_GLOBAL_DATA_PTR;
-	int err;
-
-	err = fdt_get_resource(gd->fdt_blob, dev_of_offset(dev), "reg",
-			       0, &reg_res);
-	if (err < 0) {
-		pr_err("\"reg\" resource not found\n");
-		return err;
-	}
-
-	pcie->cfg_base = map_physmem(reg_res.start,
-				     fdt_resource_size(&reg_res),
-				     MAP_NOCACHE);
+	fdt_addr_t addr;
+	fdt_size_t size;
+
+	addr = dev_read_addr_size(dev, &size);
+	if (addr == FDT_ADDR_T_NONE)
+		return -EINVAL;
+
+	pcie->cfg_base = devm_ioremap(dev, addr, size);
 
 	return 0;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-11-21 14:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-16 16:40 [PATCH v2] net: axi_emac: Use reg property for DMA registers Mayuresh Chitale
2023-11-21 14:29 ` Michal Simek
  -- strict thread matches above, loose matches on Subject: below --
2023-11-11 17:36 [PATCH v2] drivers: pcie_xilinx: Fix "reg" not found error Mayuresh Chitale
2023-11-11 17:36 ` [PATCH v2] net: axi_emac: Use reg property for DMA registers Mayuresh Chitale
2023-11-13  9:10   ` Michal Simek
2023-11-16 13:22     ` mchitale

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox