Testing pci_mvebu.c with Kirkwood SoCs

Pali Rohár pali at kernel.org
Wed Nov 10 00:05:23 CET 2021


Hello!

On Tuesday 09 November 2021 14:51:33 Tony Dinh wrote:
> Hi Pali,
> 
> On Tue, Nov 9, 2021 at 7:08 AM Pali Rohár <pali at kernel.org> wrote:
> >
> > On Monday 08 November 2021 22:34:51 Tony Dinh wrote:
> > > The above log was the build with the following configs:
> > > CONFIG_CMD_PCI=y
> > > CONFIG_PCI=y
> > > CONFIG_PCI_MVEBU=y
> > > CONFIG_PCI_PNP=y
> > > CONFIG_USB_XHCI_HCD=y
> > > CONFIG_USB_XHCI_PCI=y
> > > CONFIG_USB_XHCI_MVEBU=y
> > > CONFIG_PCI_INIT_R=y
> > > CONFIG_SYS_EARLY_PCI_INIT=y
> > >
> > >
> > > Any idea how to debug this? there must be some differences between the
> > > pci_init call early on, and much later with "pci enum".
> >
> > Hello! The only difference is when pci_init() function is called. So it
> > looks like that it needs to be called later (perhaps because PCIe needs
> > some other steps for initialization?).
> >
> > Could you try to disable CONFIG_SYS_EARLY_PCI_INIT option if it helps?
> 
> Please correct me if I'm wrong. It is a compound condition in
> board_r.c, so it would not be executed anyway?
> 
> #if defined(CONFIG_PCI_INIT_R) && defined(CONFIG_SYS_EARLY_PCI_INIT)
> 

And few lines below is section:

#if defined(CONFIG_PCI_INIT_R) && !defined(CONFIG_SYS_EARLY_PCI_INIT)
	/*
	 * Do pci configuration
	 */
	pci_init,
#endif

So CONFIG_SYS_EARLY_PCI_INIT controls if pci_init() is called earlier or
later.

> > And could you try to put pci_init() into board_early_init_r() and
> > disable both CONFIG_SYS_EARLY_PCI_INIT and CONFIG_PCI_INIT_R if it
> > helps?
> 
> This did not help. I've added board_early_init_r to the board file,
> and called pci_init() there. In the debug output, I can see pci_init()
> executed early. But later, "usb start" still hangs at EHCI enumeration
> like before.
> 
> scanning bus ehci at 50000 for devices... Bound device usb_hub to ehci at 50000
> 
> Strangely, on a hunch, I ran it a second time and then did "pci enum"
> and "usb start", I got a bit further. Now it scans the XHCI bus, and
> gets 3 USB devices, but then hangs.
> 
> scanning bus ehci at 50000 for devices... Bound device usb_hub to ehci at 50000
> Bound device usb_hub to usb_hub
> Bound device usb_mass_storage to usb_hub
> Bound device usb_mass_storage.lun0 to usb_mass_storage
> 3 USB Device(s) found
> scanning bus xhci_pci for devices... Bound device usb_hub to xhci_pci
> 
> So it seems that after the board has finished initialization, calling
> pci_init() again from "pci enum" will result in more probing
> processing.

So it means that there are some timing issues.

Could you try to add "mdelay(200);" at the end of mvebu_pcie_probe()
function? For mdelay you probably need also "#include <linux/delay.h>".

Or could you try to add "int board_late_init(void) { pci_init(); return 0; }"
into your board code?

In every test ensure that pci_init() is called only once. So if adding
pci_init() in board code then disable CONFIG_PCI_INIT_R.


More information about the U-Boot mailing list