diff mbox

[U-Boot,2/9] dm: pci: remove pci_bus_to_hose(0) calling

Message ID 1476089269-28697-2-git-send-email-Minghuan.Lian@nxp.com
State Superseded
Delegated to: York Sun
Headers show

Commit Message

M.h. Lian Oct. 10, 2016, 8:47 a.m. UTC
There may be multiple PCIe controllers in a SoC.
It is not correct that always calling pci_bus_to_hose(0) to get
the first PCIe controller for the PCIe device connected other
controllers. We just remove this calling because hose always point
the correct PCIe controller.

Signed-off-by: Minghuan Lian <Minghuan.Lian@nxp.com>
---
 drivers/pci/pci_common.c | 10 ----------
 1 file changed, 10 deletions(-)

Comments

Bin Meng Oct. 10, 2016, 11:54 a.m. UTC | #1
+Simon

Hi Minghuan,

On Mon, Oct 10, 2016 at 4:47 PM, Minghuan Lian <Minghuan.Lian@nxp.com> wrote:
> There may be multiple PCIe controllers in a SoC.
> It is not correct that always calling pci_bus_to_hose(0) to get
> the first PCIe controller for the PCIe device connected other
> controllers. We just remove this calling because hose always point
> the correct PCIe controller.
>
> Signed-off-by: Minghuan Lian <Minghuan.Lian@nxp.com>
> ---
>  drivers/pci/pci_common.c | 10 ----------
>  1 file changed, 10 deletions(-)
>
> diff --git a/drivers/pci/pci_common.c b/drivers/pci/pci_common.c
> index 1755914..448e814 100644
> --- a/drivers/pci/pci_common.c
> +++ b/drivers/pci/pci_common.c
> @@ -181,11 +181,6 @@ phys_addr_t pci_hose_bus_to_phys(struct pci_controller *hose,
>                 return phys_addr;
>         }
>
> -#ifdef CONFIG_DM_PCI
> -       /* The root controller has the region information */
> -       hose = pci_bus_to_hose(0);
> -#endif

Again if you fully convert the driver to use DM PCI, this API won't be
called. And what's broken here? The comment says "The root controller
has the region information", which is correct.

> -
>         /*
>          * if PCI_REGION_MEM is set we do a two pass search with preference
>          * on matches that don't have PCI_REGION_SYS_MEMORY set
> @@ -248,11 +243,6 @@ pci_addr_t pci_hose_phys_to_bus(struct pci_controller *hose,
>                 return bus_addr;
>         }
>
> -#ifdef CONFIG_DM_PCI
> -       /* The root controller has the region information */
> -       hose = pci_bus_to_hose(0);
> -#endif
> -
>         /*
>          * if PCI_REGION_MEM is set we do a two pass search with preference
>          * on matches that don't have PCI_REGION_SYS_MEMORY set
> --

Regards,
Bin
M.h. Lian Oct. 11, 2016, 7:26 a.m. UTC | #2
Hi Bin,

Please see my comments inline.

Thanks,
Minghuan

> -----Original Message-----
> From: Bin Meng [mailto:bmeng.cn@gmail.com]
> Sent: Monday, October 10, 2016 7:55 PM
> To: M.H. Lian <minghuan.lian@nxp.com>; Simon Glass <sjg@chromium.org>
> Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Mingkai Hu
> <mingkai.hu@nxp.com>; Leo Li <leoyang.li@nxp.com>
> Subject: Re: [U-Boot] [PATCH 2/9] dm: pci: remove pci_bus_to_hose(0)
> calling
> 
> +Simon
> 
> Hi Minghuan,
> 
> On Mon, Oct 10, 2016 at 4:47 PM, Minghuan Lian <Minghuan.Lian@nxp.com>
> wrote:
> > There may be multiple PCIe controllers in a SoC.
> > It is not correct that always calling pci_bus_to_hose(0) to get the
> > first PCIe controller for the PCIe device connected other controllers.
> > We just remove this calling because hose always point the correct PCIe
> > controller.
> >
> > Signed-off-by: Minghuan Lian <Minghuan.Lian@nxp.com>
> > ---
> >  drivers/pci/pci_common.c | 10 ----------
> >  1 file changed, 10 deletions(-)
> >
> > diff --git a/drivers/pci/pci_common.c b/drivers/pci/pci_common.c index
> > 1755914..448e814 100644
> > --- a/drivers/pci/pci_common.c
> > +++ b/drivers/pci/pci_common.c
> > @@ -181,11 +181,6 @@ phys_addr_t pci_hose_bus_to_phys(struct
> pci_controller *hose,
> >                 return phys_addr;
> >         }
> >
> > -#ifdef CONFIG_DM_PCI
> > -       /* The root controller has the region information */
> > -       hose = pci_bus_to_hose(0);
> > -#endif
> 
> Again if you fully convert the driver to use DM PCI, this API won't be called.
> And what's broken here? The comment says "The root controller has the
> region information", which is correct.

[Minghuan Lian]  Our SoCs have multiple PCIe controllers - RCs.
Each PCIe controller has different region information.
Only the first PCIe controller is assigned to bus number 0.
The second/third PCIe controllers may be assigned bus number 2 / 3.
 pci_bus_to_hose(0)  is only correct for the first PCIe controller.


> 
> > -
> >         /*
> >          * if PCI_REGION_MEM is set we do a two pass search with preference
> >          * on matches that don't have PCI_REGION_SYS_MEMORY set @@
> > -248,11 +243,6 @@ pci_addr_t pci_hose_phys_to_bus(struct pci_controller
> *hose,
> >                 return bus_addr;
> >         }
> >
> > -#ifdef CONFIG_DM_PCI
> > -       /* The root controller has the region information */
> > -       hose = pci_bus_to_hose(0);
> > -#endif
> > -
> >         /*
> >          * if PCI_REGION_MEM is set we do a two pass search with preference
> >          * on matches that don't have PCI_REGION_SYS_MEMORY set
> > --
> 
> Regards,
> Bin
diff mbox

Patch

diff --git a/drivers/pci/pci_common.c b/drivers/pci/pci_common.c
index 1755914..448e814 100644
--- a/drivers/pci/pci_common.c
+++ b/drivers/pci/pci_common.c
@@ -181,11 +181,6 @@  phys_addr_t pci_hose_bus_to_phys(struct pci_controller *hose,
 		return phys_addr;
 	}
 
-#ifdef CONFIG_DM_PCI
-	/* The root controller has the region information */
-	hose = pci_bus_to_hose(0);
-#endif
-
 	/*
 	 * if PCI_REGION_MEM is set we do a two pass search with preference
 	 * on matches that don't have PCI_REGION_SYS_MEMORY set
@@ -248,11 +243,6 @@  pci_addr_t pci_hose_phys_to_bus(struct pci_controller *hose,
 		return bus_addr;
 	}
 
-#ifdef CONFIG_DM_PCI
-	/* The root controller has the region information */
-	hose = pci_bus_to_hose(0);
-#endif
-
 	/*
 	 * if PCI_REGION_MEM is set we do a two pass search with preference
 	 * on matches that don't have PCI_REGION_SYS_MEMORY set