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
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.
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
- return dev_get_uclass_priv(bus);
+ return dev_get_uclass_priv(pci_get_controller(bus));
In pci/pci_common.c phys_addr_t pci_hose_bus_to_phys()
/* The root controller has the region information */
hose = pci_bus_to_hose(0);
Is always to return hose of the bus0.
But our SoC has more than one PCIe controllers(RC).
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.
> -----Original Message-----
> From: Bin Meng [mailto:bmeng...@gmail.com]
> Sent: Monday, October 10, 2016 6:38 PM
> To: M.H. Lian <minghuan.l...@nxp.com>
> Cc: Simon Glass <s...@chromium.org>; U-Boot Mailing List <u-
> b...@lists.denx.de>; Mingkai Hu <mingkai...@nxp.com>; Leo Li
> Subject: Re: [U-Boot] [PATCH 1/9] dm: pci: return the real controller in
> Hi Minghuan,
> On Mon, Oct 10, 2016 at 5:09 PM, M.H. Lian <minghuan.l...@nxp.com>
> > 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,
> 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
U-Boot mailing list