MIPS: pci-rt2880: fix slot 0 configuration
authorIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Wed, 14 Apr 2021 03:12:33 +0000 (20:12 -0700)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Fri, 16 Apr 2021 07:15:40 +0000 (09:15 +0200)
commit8e98b697006d749d745d3b174168a877bb96c500
tree7dbeed9ffb8e213e60efa73411b1718cb6188c60
parent2c92ef8ff8d327797c1920ae7f938bcc6f3f7421
MIPS: pci-rt2880: fix slot 0 configuration

pci_fixup_irqs() used to call pcibios_map_irq on every PCI device, which
for RT2880 included bus 0 slot 0. After pci_fixup_irqs() got removed,
only slots/funcs with devices attached would be called. While arguably
the right thing, that left no chance for this driver to ever initialize
slot 0, effectively bricking PCI and USB on RT2880 devices such as the
Belkin F5D8235-4 v1.

Slot 0 configuration needs to happen after PCI bus enumeration, but
before any device at slot 0x11 (func 0 or 1) is talked to. That was
determined empirically by testing on a Belkin F5D8235-4 v1 device. A
minimal BAR 0 config write followed by read, then setting slot 0
PCI_COMMAND to MASTER | IO | MEMORY is all that seems to be required for
proper functionality.

Tested by ensuring that full- and high-speed USB devices get enumerated
on the Belkin F5D8235-4 v1 (with an out of tree DTS file from OpenWrt).

Fixes: 04c81c7293df ("MIPS: PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks")
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Tobias Wolf <dev-NTEO@vplace.de>
Cc: <stable@vger.kernel.org> # v4.14+
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/pci/pci-rt2880.c