From: mchitale@ventanamicro.com
To: Michal Simek <michal.simek@amd.com>, Bo Gan <ganboing@gmail.com>,
Puhan Zhou <puh4n.zhou@gmail.com>,
Eugen Hristev <eugen.hristev@collabora.com>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
Jonas Karlman <jonas@kwiboo.se>,
Valentin Caron <valentin.caron@foss.st.com>,
Shengyu Qu <wiagn233@outlook.com>
Cc: u-boot@lists.denx.de, Simon Glass <sjg@chromium.org>,
Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH v2] drivers: pcie_xilinx: Fix "reg" not found error
Date: Thu, 16 Nov 2023 18:59:27 +0530 [thread overview]
Message-ID: <e746da595267406ed1cd51778987488eae4c64bf.camel@ventanamicro.com> (raw)
In-Reply-To: <fc6ca54c-a609-4a0b-a9eb-1478b9bf3d39@amd.com>
On Mon, 2023-11-13 at 09:10 +0100, Michal Simek wrote:
>
> On 11/11/23 18:36, Mayuresh Chitale wrote:
> > 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, ®_res);
> > - if (err < 0) {
> > - pr_err("\"reg\" resource not found\n");
> > - return err;
> > - }
> > -
> > - pcie->cfg_base = map_physmem(reg_res.start,
> > - fdt_resource_size(®_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);
>
> this can also fail.
>
> Just put there.
> if (IS_ERR(pcie->cfg_base))
> return PTR_ERR(pcie->cfg_base);
Ok.
>
> M
next prev parent reply other threads:[~2023-11-16 13:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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
2023-11-11 17:36 ` [PATCH v2] pci: xilinx: Enable MMIO region Mayuresh Chitale
2023-11-13 8:10 ` [PATCH v2] drivers: pcie_xilinx: Fix "reg" not found error Michal Simek
2023-11-16 13:29 ` mchitale [this message]
2023-11-13 9:12 ` Michal Simek
2023-11-16 13:30 ` mchitale
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=e746da595267406ed1cd51778987488eae4c64bf.camel@ventanamicro.com \
--to=mchitale@ventanamicro.com \
--cc=eugen.hristev@collabora.com \
--cc=ganboing@gmail.com \
--cc=jonas@kwiboo.se \
--cc=michal.simek@amd.com \
--cc=puh4n.zhou@gmail.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=valentin.caron@foss.st.com \
--cc=wiagn233@outlook.com \
--cc=xypron.glpk@gmx.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