Hi Marek and Pali,

On Mon, Nov 8, 2021 at 3:04 PM Marek Behún <marek.be...@nic.cz> wrote:
>
> On Mon, 8 Nov 2021 14:48:03 -0800
> Tony Dinh <mibo...@gmail.com> wrote:
>
> > > So to avoid calling 'pci enum' manually, you need to put pci_init();
> > > function call into your board board_early_init_r() function.
> >
> > Thanks! will do that.
>
> Don't do that.
>
> Instead enable CONFIG_PCI_INIT_R and CONFIG_SYS_EARLY_PCI_INIT, and the
> code in common/board_r.c will do it itself.
>
> Look at:
>
> https://source.denx.de/u-boot/u-boot/-/blob/f8ed9059001d803b0eae4b49178789aa0e29edec/common/board_r.c#L675

Thanks for that advice. I also compared this code with the  "pci enum"
command. Indeed, like Pali said, it just calls pci_init() like in
board_r.c.

However, after enabling CONFIG_PCI_INIT_R and
CONFIG_SYS_EARLY_PCI_INIT, it hit a bug-on while scanning the USB bus!

U-Boot 2022.01-rc1-00054-g52207514ba-dirty (Nov 08 2021 - 22:17:10 -0800)
Pogoplug V4

SoC:   Kirkwood 88F6192_A1
DRAM:  128 MiB
device_probe:
device_probe: exit 0
mvebu_pcie_bind: begin
mvebu_pcie_bind: got an available node
Bound device  to pcie@82000000
mvebu_pcie_bind: bound
mvebu_pcie_bind: exit 0
Bound device pcie@82000000 to mbus@f1000000
Bound device mbus@f1000000 to root_driver
Bound device ehci@50000 to ocp@f1000000
Bound device ethernet-controller@72000 to ocp@f1000000
Bound device sata@80000 to ocp@f1000000
Bound device mvs...@90000.blk to mvsdio@90000
Bound device mvsdio@90000 to ocp@f1000000
Bound device ocp@f1000000 to root_driver
NAND:  128 MiB
MMC:   device_probe:
device_probe:
device_probe:
device_probe: exit 0
device_probe: exit 0
device_probe:
device_probe:
mvsdio@90000: 0
Loading Environment from NAND... *** Warning - bad CRC, using default
environment

device_probe:
device_probe:
device_probe:
device_probe:
device_probe: exit 0
device_probe: exit 0
mvebu_pcie_probe:
mvebu_pcie_probe: exit 0
Bound device pci_0:0.0 to pcie0.0
device_probe:
device_probe:
Bound device xhci_pci to pci_0:0.0
device_probe: exit 0
device_probe: exit 0
device_probe:
In:    serial
Out:   serial
Err:   serial
Net:   device_probe:
device_probe:

Warning: ethernet-controller@72000 (eth0) using random MAC address -
82:09:1e:66:49:21
device_probe: exit 0
eth0: ethernet-controller@72000
Hit any key to stop autoboot:  0
Pogo_V4> pci 0
device_probe:
Scanning PCI devices on bus 0
BusDevFun  VendorId   DeviceId   Device Class       Sub-Class
_____________________________________________________________
00.00.00   0x11ab     0x6281     Bridge device           0x04
Pogo_V4> pci 1
device_probe:
Scanning PCI devices on bus 1
BusDevFun  VendorId   DeviceId   Device Class       Sub-Class
_____________________________________________________________
01.00.00   0x1b73     0x1009     Serial bus controller   0x03
Pogo_V4> usb start
starting USB...
Bus ehci@50000: device_probe:
device_probe:
USB EHCI 1.00
device_probe: exit 0
Bus xhci_pci: device_probe:
device_probe:
Register 400081f NbrPorts 4
Starting the controller
USB XHCI 1.00
device_probe: exit 0
scanning bus ehci@50000 for devices... Bound device usb_hub to ehci@50000
device_probe:
device_probe:
Bound device usb_hub to usb_hub
device_probe:
device_probe:
device_probe: exit 0
Bound device usb_mass_storage to usb_hub
device_probe:
device_probe:
Bound device usb_mass_storage.lun0 to usb_mass_storage
device_probe: exit 0
device_probe: exit 0
3 USB Device(s) found
scanning bus xhci_pci for devices... Bound device usb_hub to xhci_pci
device_probe:
device_probe:
XHCI timeout on event type 33... cannot recover.
BUG at drivers/usb/host/xhci-ring.c:481/xhci_wait_for_event()!
BUG!
resetting ...

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".

Thanks,
Tony

>
> Marek

Reply via email to