aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Reding <thierry.reding@gmail.com>2017-09-23 02:18:41 -0400
committerBjorn Helgaas <bhelgaas@google.com>2017-10-11 16:10:27 -0400
commitb6cfe8bd4118cb2896902c76bb2ea3d79c97eeae (patch)
tree193c24a9f1520bd8a670de07253e362fc0bf6e80
parent9e66317d3c92ddaab330c125dfe9d06eee268aff (diff)
PCI: tegra: Use generic accessors where possible
The Tegra PCI host controller can generate configuration space accesses with byte, word and dword granularity for devices. Only root ports can't have their configuration space accessed in this way. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/host/pci-tegra.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 9c40da54f88a..e8e1ddbaabc9 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -491,12 +491,32 @@ static void __iomem *tegra_pcie_map_bus(struct pci_bus *bus,
491 return addr; 491 return addr;
492} 492}
493 493
494static int tegra_pcie_config_read(struct pci_bus *bus, unsigned int devfn,
495 int where, int size, u32 *value)
496{
497 if (bus->number == 0)
498 return pci_generic_config_read32(bus, devfn, where, size,
499 value);
500
501 return pci_generic_config_read(bus, devfn, where, size, value);
502}
503
504static int tegra_pcie_config_write(struct pci_bus *bus, unsigned int devfn,
505 int where, int size, u32 value)
506{
507 if (bus->number == 0)
508 return pci_generic_config_write32(bus, devfn, where, size,
509 value);
510
511 return pci_generic_config_write(bus, devfn, where, size, value);
512}
513
494static struct pci_ops tegra_pcie_ops = { 514static struct pci_ops tegra_pcie_ops = {
495 .add_bus = tegra_pcie_add_bus, 515 .add_bus = tegra_pcie_add_bus,
496 .remove_bus = tegra_pcie_remove_bus, 516 .remove_bus = tegra_pcie_remove_bus,
497 .map_bus = tegra_pcie_map_bus, 517 .map_bus = tegra_pcie_map_bus,
498 .read = pci_generic_config_read32, 518 .read = tegra_pcie_config_read,
499 .write = pci_generic_config_write32, 519 .write = tegra_pcie_config_write,
500}; 520};
501 521
502static unsigned long tegra_pcie_port_get_pex_ctrl(struct tegra_pcie_port *port) 522static unsigned long tegra_pcie_port_get_pex_ctrl(struct tegra_pcie_port *port)