diff options
author | Rob Herring <robh@kernel.org> | 2015-01-09 21:34:48 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-01-30 17:14:43 -0500 |
commit | 0e7ac8de01d20a9e365dfa975720816eeb35ff1a (patch) | |
tree | 229f0819395945693cb287a1b50b0cba296ba593 | |
parent | b44923b78d11175d80a1693deb82bdcd13070ba9 (diff) |
PCI: tegra: Convert to use generic config accessors
Convert the Tegra host PCI driver to use the generic config access
functions.
Tested-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Thierry Reding <treding@nvidia.com>
CC: Stephen Warren <swarren@wwwdotorg.org>
CC: Alexandre Courbot <gnurou@gmail.com>
CC: linux-tegra@vger.kernel.org
-rw-r--r-- | drivers/pci/host/pci-tegra.c | 55 |
1 files changed, 3 insertions, 52 deletions
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index a800ae916394..44fd31b9fa2d 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c | |||
@@ -480,59 +480,10 @@ static void __iomem *tegra_pcie_conf_address(struct pci_bus *bus, | |||
480 | return addr; | 480 | return addr; |
481 | } | 481 | } |
482 | 482 | ||
483 | static int tegra_pcie_read_conf(struct pci_bus *bus, unsigned int devfn, | ||
484 | int where, int size, u32 *value) | ||
485 | { | ||
486 | void __iomem *addr; | ||
487 | |||
488 | addr = tegra_pcie_conf_address(bus, devfn, where); | ||
489 | if (!addr) { | ||
490 | *value = 0xffffffff; | ||
491 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
492 | } | ||
493 | |||
494 | *value = readl(addr); | ||
495 | |||
496 | if (size == 1) | ||
497 | *value = (*value >> (8 * (where & 3))) & 0xff; | ||
498 | else if (size == 2) | ||
499 | *value = (*value >> (8 * (where & 3))) & 0xffff; | ||
500 | |||
501 | return PCIBIOS_SUCCESSFUL; | ||
502 | } | ||
503 | |||
504 | static int tegra_pcie_write_conf(struct pci_bus *bus, unsigned int devfn, | ||
505 | int where, int size, u32 value) | ||
506 | { | ||
507 | void __iomem *addr; | ||
508 | u32 mask, tmp; | ||
509 | |||
510 | addr = tegra_pcie_conf_address(bus, devfn, where); | ||
511 | if (!addr) | ||
512 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
513 | |||
514 | if (size == 4) { | ||
515 | writel(value, addr); | ||
516 | return PCIBIOS_SUCCESSFUL; | ||
517 | } | ||
518 | |||
519 | if (size == 2) | ||
520 | mask = ~(0xffff << ((where & 0x3) * 8)); | ||
521 | else if (size == 1) | ||
522 | mask = ~(0xff << ((where & 0x3) * 8)); | ||
523 | else | ||
524 | return PCIBIOS_BAD_REGISTER_NUMBER; | ||
525 | |||
526 | tmp = readl(addr) & mask; | ||
527 | tmp |= value << ((where & 0x3) * 8); | ||
528 | writel(tmp, addr); | ||
529 | |||
530 | return PCIBIOS_SUCCESSFUL; | ||
531 | } | ||
532 | |||
533 | static struct pci_ops tegra_pcie_ops = { | 483 | static struct pci_ops tegra_pcie_ops = { |
534 | .read = tegra_pcie_read_conf, | 484 | .map_bus = tegra_pcie_conf_address, |
535 | .write = tegra_pcie_write_conf, | 485 | .read = pci_generic_config_read32, |
486 | .write = pci_generic_config_write32, | ||
536 | }; | 487 | }; |
537 | 488 | ||
538 | static unsigned long tegra_pcie_port_get_pex_ctrl(struct tegra_pcie_port *port) | 489 | static unsigned long tegra_pcie_port_get_pex_ctrl(struct tegra_pcie_port *port) |