PCI: rcar: Convert to use generic config accessors
authorRob Herring <robh@kernel.org>
Sat, 10 Jan 2015 02:34:47 +0000 (20:34 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 30 Jan 2015 22:14:43 +0000 (16:14 -0600)
Convert the rcar-gen2 host PCI driver to use the generic config access
functions.

This changes the I/O accessors from io(read|write)X to readX/writeX
variants which are equivalent on ARM.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
CC: Simon Horman <horms@verge.net.au>
CC: linux-sh@vger.kernel.org
drivers/pci/host/pci-rcar-gen2.c

index d9c042febb1a73fe049283c2ce89ac50b76edfe7..dd6b84e6206c4f40b213de597108af64abf9f3ea 100644 (file)
@@ -131,52 +131,6 @@ static void __iomem *rcar_pci_cfg_base(struct pci_bus *bus, unsigned int devfn,
        return priv->reg + (slot >> 1) * 0x100 + where;
 }
 
-static int rcar_pci_read_config(struct pci_bus *bus, unsigned int devfn,
-                               int where, int size, u32 *val)
-{
-       void __iomem *reg = rcar_pci_cfg_base(bus, devfn, where);
-
-       if (!reg)
-               return PCIBIOS_DEVICE_NOT_FOUND;
-
-       switch (size) {
-       case 1:
-               *val = ioread8(reg);
-               break;
-       case 2:
-               *val = ioread16(reg);
-               break;
-       default:
-               *val = ioread32(reg);
-               break;
-       }
-
-       return PCIBIOS_SUCCESSFUL;
-}
-
-static int rcar_pci_write_config(struct pci_bus *bus, unsigned int devfn,
-                                int where, int size, u32 val)
-{
-       void __iomem *reg = rcar_pci_cfg_base(bus, devfn, where);
-
-       if (!reg)
-               return PCIBIOS_DEVICE_NOT_FOUND;
-
-       switch (size) {
-       case 1:
-               iowrite8(val, reg);
-               break;
-       case 2:
-               iowrite16(val, reg);
-               break;
-       default:
-               iowrite32(val, reg);
-               break;
-       }
-
-       return PCIBIOS_SUCCESSFUL;
-}
-
 /* PCI interrupt mapping */
 static int rcar_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
 {
@@ -325,8 +279,9 @@ static int rcar_pci_setup(int nr, struct pci_sys_data *sys)
 }
 
 static struct pci_ops rcar_pci_ops = {
-       .read   = rcar_pci_read_config,
-       .write  = rcar_pci_write_config,
+       .map_bus = rcar_pci_cfg_base,
+       .read   = pci_generic_config_read,
+       .write  = pci_generic_config_write,
 };
 
 static int rcar_pci_probe(struct platform_device *pdev)