diff options
| author | Rob Herring <robh@kernel.org> | 2015-01-09 21:34:46 -0500 |
|---|---|---|
| committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-01-30 17:14:43 -0500 |
| commit | 21186728865ec0485fe874a175f99b375c859f2b (patch) | |
| tree | ad1c0ffbcc80e9b02c9f13bcd45c406a494b8caf | |
| parent | b98fa508479589c3b0b003820bcec6a067db4bff (diff) | |
PCI: generic: Convert to use generic config accessors
Convert the generic host PCI driver to use the generic config access
functions.
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Will Deacon <will.deacon@arm.com>
CC: linux-arm-kernel@lists.infradead.org
| -rw-r--r-- | drivers/pci/host/pci-host-generic.c | 51 |
1 files changed, 3 insertions, 48 deletions
diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c index 6eb1aa75bd37..925e29e3d4c8 100644 --- a/drivers/pci/host/pci-host-generic.c +++ b/drivers/pci/host/pci-host-generic.c | |||
| @@ -76,55 +76,9 @@ static struct gen_pci_cfg_bus_ops gen_pci_cfg_ecam_bus_ops = { | |||
| 76 | .map_bus = gen_pci_map_cfg_bus_ecam, | 76 | .map_bus = gen_pci_map_cfg_bus_ecam, |
| 77 | }; | 77 | }; |
| 78 | 78 | ||
| 79 | static int gen_pci_config_read(struct pci_bus *bus, unsigned int devfn, | ||
| 80 | int where, int size, u32 *val) | ||
| 81 | { | ||
| 82 | void __iomem *addr; | ||
| 83 | struct pci_sys_data *sys = bus->sysdata; | ||
| 84 | struct gen_pci *pci = sys->private_data; | ||
| 85 | |||
| 86 | addr = pci->cfg.ops->map_bus(bus, devfn, where); | ||
| 87 | |||
| 88 | switch (size) { | ||
| 89 | case 1: | ||
| 90 | *val = readb(addr); | ||
| 91 | break; | ||
| 92 | case 2: | ||
| 93 | *val = readw(addr); | ||
| 94 | break; | ||
| 95 | default: | ||
| 96 | *val = readl(addr); | ||
| 97 | } | ||
| 98 | |||
| 99 | return PCIBIOS_SUCCESSFUL; | ||
| 100 | } | ||
| 101 | |||
| 102 | static int gen_pci_config_write(struct pci_bus *bus, unsigned int devfn, | ||
| 103 | int where, int size, u32 val) | ||
| 104 | { | ||
| 105 | void __iomem *addr; | ||
| 106 | struct pci_sys_data *sys = bus->sysdata; | ||
| 107 | struct gen_pci *pci = sys->private_data; | ||
| 108 | |||
| 109 | addr = pci->cfg.ops->map_bus(bus, devfn, where); | ||
| 110 | |||
| 111 | switch (size) { | ||
| 112 | case 1: | ||
| 113 | writeb(val, addr); | ||
| 114 | break; | ||
| 115 | case 2: | ||
| 116 | writew(val, addr); | ||
| 117 | break; | ||
| 118 | default: | ||
| 119 | writel(val, addr); | ||
| 120 | } | ||
| 121 | |||
| 122 | return PCIBIOS_SUCCESSFUL; | ||
| 123 | } | ||
| 124 | |||
| 125 | static struct pci_ops gen_pci_ops = { | 79 | static struct pci_ops gen_pci_ops = { |
| 126 | .read = gen_pci_config_read, | 80 | .read = pci_generic_config_read, |
| 127 | .write = gen_pci_config_write, | 81 | .write = pci_generic_config_write, |
| 128 | }; | 82 | }; |
| 129 | 83 | ||
| 130 | static const struct of_device_id gen_pci_of_match[] = { | 84 | static const struct of_device_id gen_pci_of_match[] = { |
| @@ -287,6 +241,7 @@ static int gen_pci_probe(struct platform_device *pdev) | |||
| 287 | 241 | ||
| 288 | of_id = of_match_node(gen_pci_of_match, np); | 242 | of_id = of_match_node(gen_pci_of_match, np); |
| 289 | pci->cfg.ops = of_id->data; | 243 | pci->cfg.ops = of_id->data; |
| 244 | gen_pci_ops.map_bus = pci->cfg.ops->map_bus; | ||
| 290 | pci->host.dev.parent = dev; | 245 | pci->host.dev.parent = dev; |
| 291 | INIT_LIST_HEAD(&pci->host.windows); | 246 | INIT_LIST_HEAD(&pci->host.windows); |
| 292 | INIT_LIST_HEAD(&pci->resources); | 247 | INIT_LIST_HEAD(&pci->resources); |
