diff options
Diffstat (limited to 'drivers/pci/host/pci-host-generic.c')
-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); |