diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2009-12-07 17:54:35 -0500 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2009-12-09 15:50:40 -0500 |
commit | f93611fac7eed3aa175795fb8e452aa30af33b6a (patch) | |
tree | 37b3e9e8e9065ee80aefb02800fe1b88c697cf4b /arch/powerpc | |
parent | e090aa80321b64c3b793f3b047e31ecf1af9538d (diff) |
powerpc/fsl_pci: Fix P2P bridge handling for MPC83xx PCIe controllers
It appears that we wrongly calculate dev_base for type1 config cycles.
The thing is: we shouldn't subtract hose->first_busno because PCI core
sets PCI primary, secondary and subordinate bus numbers, and PCIe
controller actually takes the registers into account. So we should use
just bus->number.
Also, according to MPC8315 reference manual, primary bus number should
always remain 0. We have PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS quirk
in indirect_pci.c, but since 83xx is somewhat special, it doesn't use
indirect_pci.c routines, so we have to implement the quirk specifically
for 83xx PCIe controllers.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/sysdev/fsl_pci.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index 4e3a3e345ab3..e1a028c1f18d 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c | |||
@@ -464,8 +464,7 @@ static void __iomem *mpc83xx_pcie_remap_cfg(struct pci_bus *bus, | |||
464 | { | 464 | { |
465 | struct pci_controller *hose = pci_bus_to_host(bus); | 465 | struct pci_controller *hose = pci_bus_to_host(bus); |
466 | struct mpc83xx_pcie_priv *pcie = hose->dn->data; | 466 | struct mpc83xx_pcie_priv *pcie = hose->dn->data; |
467 | u8 bus_no = bus->number - hose->first_busno; | 467 | u32 dev_base = bus->number << 24 | devfn << 16; |
468 | u32 dev_base = bus_no << 24 | devfn << 16; | ||
469 | int ret; | 468 | int ret; |
470 | 469 | ||
471 | ret = mpc83xx_pcie_exclude_device(bus, devfn); | 470 | ret = mpc83xx_pcie_exclude_device(bus, devfn); |
@@ -515,12 +514,17 @@ static int mpc83xx_pcie_read_config(struct pci_bus *bus, unsigned int devfn, | |||
515 | static int mpc83xx_pcie_write_config(struct pci_bus *bus, unsigned int devfn, | 514 | static int mpc83xx_pcie_write_config(struct pci_bus *bus, unsigned int devfn, |
516 | int offset, int len, u32 val) | 515 | int offset, int len, u32 val) |
517 | { | 516 | { |
517 | struct pci_controller *hose = pci_bus_to_host(bus); | ||
518 | void __iomem *cfg_addr; | 518 | void __iomem *cfg_addr; |
519 | 519 | ||
520 | cfg_addr = mpc83xx_pcie_remap_cfg(bus, devfn, offset); | 520 | cfg_addr = mpc83xx_pcie_remap_cfg(bus, devfn, offset); |
521 | if (!cfg_addr) | 521 | if (!cfg_addr) |
522 | return PCIBIOS_DEVICE_NOT_FOUND; | 522 | return PCIBIOS_DEVICE_NOT_FOUND; |
523 | 523 | ||
524 | /* PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS */ | ||
525 | if (offset == PCI_PRIMARY_BUS && bus->number == hose->first_busno) | ||
526 | val &= 0xffffff00; | ||
527 | |||
524 | switch (len) { | 528 | switch (len) { |
525 | case 1: | 529 | case 1: |
526 | out_8(cfg_addr, val); | 530 | out_8(cfg_addr, val); |