PCI: mvebu: Fix configuring secondary bus of PCIe Root Port via emulated bridge
authorPali Rohár <pali@kernel.org>
Thu, 25 Nov 2021 12:46:01 +0000 (13:46 +0100)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Tue, 4 Jan 2022 14:59:18 +0000 (14:59 +0000)
commit91a8d79fc797d3486ae978beebdfc55261c7d65b
treecc83757ab14484544f5e8995f15097ac5e792bdb
parentf587775828219d4e2d7a796c7fff97e50c7f76f1
PCI: mvebu: Fix configuring secondary bus of PCIe Root Port via emulated bridge

It looks like that mvebu PCIe controller has for each PCIe link fully
independent PCIe host bridge and so every PCIe Root Port is isolated not
only on its own bus but also isolated from each others. But in past device
tree structure was defined to put all PCIe Root Ports (as PCI Bridge
devices) into one root bus 0 and this bus is emulated by pci-mvebu.c
driver.

Probably reason for this decision was incorrect understanding of PCIe
topology of these Armada SoCs and also reason of misunderstanding how is
PCIe controller generating Type 0 and Type 1 config requests (it is fully
different compared to other drivers). Probably incorrect setup leaded to
very surprised things like having PCIe Root Port (PCI Bridge device, with
even incorrect Device Class set to Memory Controller) and the PCIe device
behind the Root Port on the same PCI bus, which obviously was needed to
somehow hack (as these two devices cannot be in reality on the same bus).

Properly set mvebu local bus number and mvebu local device number based on
PCI Bridge secondary bus number configuration. Also correctly report
configured secondary bus number in config space. And explain in driver
comment why this setup is correct.

Link: https://lore.kernel.org/r/20211125124605.25915-12-pali@kernel.org
Fixes: 1f08673eef12 ("PCI: mvebu: Convert to PCI emulated bridge config space")
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
drivers/pci/controller/pci-mvebu.c