public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] drivers: pcie_xilinx: Fix "reg" not found error
@ 2023-11-02  8:23 Mayuresh Chitale
  2023-11-02  8:23 ` [PATCH] drivers: xilinx_spi: Fixes for MMC_SPI Mayuresh Chitale
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Mayuresh Chitale @ 2023-11-02  8:23 UTC (permalink / raw)
  To: Michal Simek, Patrice Chotard, Puhan Zhou, Thierry Reding,
	Alexander Dahl, Jonas Karlman, Svyatoslav Ryhel, 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>
---
 drivers/pci/pcie_xilinx.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/pci/pcie_xilinx.c b/drivers/pci/pcie_xilinx.c
index 53fd121e90..20b630027f 100644
--- a/drivers/pci/pcie_xilinx.c
+++ b/drivers/pci/pcie_xilinx.c
@@ -140,20 +140,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 = map_physmem(addr, size, MAP_NOCACHE);
 
 	return 0;
 }
-- 
2.34.1


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

end of thread, other threads:[~2023-11-11 13:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-02  8:23 [PATCH] drivers: pcie_xilinx: Fix "reg" not found error Mayuresh Chitale
2023-11-02  8:23 ` [PATCH] drivers: xilinx_spi: Fixes for MMC_SPI Mayuresh Chitale
2023-11-02  8:37   ` Michal Simek
2023-11-11 13:21     ` mchitale
2023-11-02  8:23 ` [PATCH] net: axi_emac: Use reg property for DMA registers Mayuresh Chitale
2023-11-02  9:15   ` Michal Simek
2023-11-11 13:23     ` mchitale
2023-11-02  8:23 ` [PATCH] pci: xilinx: Enable MMIO region Mayuresh Chitale
2023-11-02  9:13   ` Michal Simek
2023-11-02  9:05 ` [PATCH] drivers: pcie_xilinx: Fix "reg" not found error Michal Simek
2023-11-11 13:25   ` mchitale

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