From: Mayuresh Chitale <mchitale@ventanamicro.com>
To: u-boot@lists.denx.de
Cc: Mayuresh Chitale <mchitale@ventanamicro.com>
Subject: [PATCH] pci: ecm generic: use dev_read_() interface
Date: Sat, 18 Feb 2023 17:55:25 +0530 [thread overview]
Message-ID: <20230218122525.3815554-1-mchitale@ventanamicro.com> (raw)
Use dev_read_() api instead of the fdtdec API to fetch the host
controller's reg property value. This is similar to the other host
controller drivers such as Sifive, Rockchip etc. Without this change,
enabling CONFIG_OF_LIVE breaks the PCIe enumeration on Qemu Risc-V virt
machine. The issue is described in the link below:
Link: https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/1
Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
---
drivers/pci/pcie_ecam_generic.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/drivers/pci/pcie_ecam_generic.c b/drivers/pci/pcie_ecam_generic.c
index 1a9f9aec2e..f0effe0001 100644
--- a/drivers/pci/pcie_ecam_generic.c
+++ b/drivers/pci/pcie_ecam_generic.c
@@ -132,19 +132,14 @@ static int pci_generic_ecam_write_config(struct udevice *bus, pci_dev_t bdf,
static int pci_generic_ecam_of_to_plat(struct udevice *dev)
{
struct generic_ecam_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, ®_res);
- if (err < 0) {
- pr_err("\"reg\" resource not found\n");
- return err;
- }
-
- pcie->size = fdt_resource_size(®_res);
- pcie->cfg_base = map_physmem(reg_res.start, pcie->size, MAP_NOCACHE);
+ fdt_addr_t addr;
+ fdt_size_t size;
+
+ addr = dev_read_addr_size(dev, "reg", &size);
+ if (addr == FDT_ADDR_T_NONE)
+ return -EINVAL;
+ pcie->size = size;
+ pcie->cfg_base = map_physmem(addr, pcie->size, MAP_NOCACHE);
return 0;
}
--
2.34.1
next reply other threads:[~2023-02-18 12:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-18 12:25 Mayuresh Chitale [this message]
2023-02-20 16:21 ` [PATCH] pci: ecm generic: use dev_read_() interface Simon Glass
2023-05-03 20:34 ` Tom Rini
2023-05-08 15:00 ` Mayuresh Chitale
2023-05-08 15:08 ` Tom Rini
2023-11-10 11:50 ` Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230218122525.3815554-1-mchitale@ventanamicro.com \
--to=mchitale@ventanamicro.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox