[U-Boot] [PATCH 1/9] dm: pci: return the real controller in pci_bus_to_hose()

M.H. Lian minghuan.lian at nxp.com
Tue Oct 11 09:12:36 CEST 2016


Hi Bin,

With the patches our Layerscape PCIe driver has been fully based on DM.
Ethernet driver E1000 needs to define "CONFIG_DM_ETH" to use PCIe DM API instead of legacy PCI API.
But our other Ethernet driver FM(drivers/net/fm/eth.c) is still not support DM. So we cannot define "CONFIG_DM_ETH"
Well, we must define "CONFIG_DM_PCI_COMPAT" to support e1000 and fm at the same time.
After FM driver is changed to support DM, we can define "CONFIG_DM_ETH" and remove  "CONFIG_DM_PCI_COMPAT "

But the current DM driver has an issue.

1.
 pci_bus_to_hose(int busnum)  defined in driver/pci/pci_compat.c  is to return the hose associated current busnum(PCIe device) instead of PCIe controller (RC)

pci_bus_to_hose(int bus) defined in driver/pci/pci.c for legacy PCI driver is to return the hose pointed to the PCIe controller(RC).

My first patch is to keep consistency and return the hose pointer of the PCIe controller.
-       return dev_get_uclass_priv(bus);
+       return dev_get_uclass_priv(pci_get_controller(bus));
 
2
 In pci/pci_common.c phys_addr_t pci_hose_bus_to_phys()
 
#ifdef CONFIG_DM_PCI
       /* The root controller has the region information */
       hose = pci_bus_to_hose(0);
#endif

Is always to return hose of the bus0.

But our SoC has more than one PCIe controllers(RC).

For example:
PCI0 bus 0  --  e1000#0  bus1
PCI1 bus 2  --  e1000#1  bus3.

PCI1 is the second PCIe controller (RC) has different PCIe space to PCI0.
For E1000#1, we want to get the host pointed to PCI1 bus2 not bus0.

Thanks,
Minghuan

> -----Original Message-----
> From: Bin Meng [mailto:bmeng.cn at gmail.com]
> Sent: Monday, October 10, 2016 6:38 PM
> To: M.H. Lian <minghuan.lian at nxp.com>
> Cc: Simon Glass <sjg at chromium.org>; U-Boot Mailing List <u-
> boot at lists.denx.de>; Mingkai Hu <mingkai.hu at nxp.com>; Leo Li
> <leoyang.li at nxp.com>
> Subject: Re: [U-Boot] [PATCH 1/9] dm: pci: return the real controller in
> pci_bus_to_hose()
> 
> Hi Minghuan,
> 
> On Mon, Oct 10, 2016 at 5:09 PM, M.H. Lian <minghuan.lian at nxp.com>
> wrote:
> > Hi Bin,
> >
> > Thanks for your comments.
> >
> > The series of patches is to change legacy PCIe driver to DM PCIe driver.
> > The first two patches are to change DM to support multiple PCIe controllers.
> 
> I don't understand what is broken. If you fully convert the driver to DM PCI, I
> don't think we need ever touch the pci_compat codes. Could you please
> elaborate more?
> 
> > The 8th patch is to change Layerscape PCIe driver based on DM Other
> > patches are to add PCIe dts node for five SoCs.
> >
> > Thanks,
> > Minghuan
> >
> 
> Regards,
> Bin


More information about the U-Boot mailing list