diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2013-02-03 04:59:45 -0500 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2013-02-16 19:25:39 -0500 |
commit | 34b134aebda89888b6985b7a3139e9cbdf209236 (patch) | |
tree | f6dc7a06f2b74420b77bac128a237af91ce00bbb /arch/mips/pci/pci-ar724x.c | |
parent | 908339ef25b1d5e80f1c6fab22b9958174708b4a (diff) |
MIPS: pci-ar724x: remove static PCI IO/MEM resources
Static resources become impractical when multiple
PCI controllers are present. Move the resources
into the platform device registration code and
change the probe routine to get those from there
platform device's resources.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Patchwork: http://patchwork.linux-mips.org/patch/4914/
Signed-off-by: John Crispin <blogic@openwrt.org>
Diffstat (limited to 'arch/mips/pci/pci-ar724x.c')
-rw-r--r-- | arch/mips/pci/pci-ar724x.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/arch/mips/pci/pci-ar724x.c b/arch/mips/pci/pci-ar724x.c index 93ab8778ce10..d0d707de6c6c 100644 --- a/arch/mips/pci/pci-ar724x.c +++ b/arch/mips/pci/pci-ar724x.c | |||
@@ -42,6 +42,8 @@ struct ar724x_pci_controller { | |||
42 | spinlock_t lock; | 42 | spinlock_t lock; |
43 | 43 | ||
44 | struct pci_controller pci_controller; | 44 | struct pci_controller pci_controller; |
45 | struct resource io_res; | ||
46 | struct resource mem_res; | ||
45 | }; | 47 | }; |
46 | 48 | ||
47 | static inline bool ar724x_pci_check_link(struct ar724x_pci_controller *apc) | 49 | static inline bool ar724x_pci_check_link(struct ar724x_pci_controller *apc) |
@@ -190,20 +192,6 @@ static struct pci_ops ar724x_pci_ops = { | |||
190 | .write = ar724x_pci_write, | 192 | .write = ar724x_pci_write, |
191 | }; | 193 | }; |
192 | 194 | ||
193 | static struct resource ar724x_io_resource = { | ||
194 | .name = "PCI IO space", | ||
195 | .start = 0, | ||
196 | .end = 0, | ||
197 | .flags = IORESOURCE_IO, | ||
198 | }; | ||
199 | |||
200 | static struct resource ar724x_mem_resource = { | ||
201 | .name = "PCI memory space", | ||
202 | .start = AR724X_PCI_MEM_BASE, | ||
203 | .end = AR724X_PCI_MEM_BASE + AR724X_PCI_MEM_SIZE - 1, | ||
204 | .flags = IORESOURCE_MEM, | ||
205 | }; | ||
206 | |||
207 | static void ar724x_pci_irq_handler(unsigned int irq, struct irq_desc *desc) | 195 | static void ar724x_pci_irq_handler(unsigned int irq, struct irq_desc *desc) |
208 | { | 196 | { |
209 | struct ar724x_pci_controller *apc; | 197 | struct ar724x_pci_controller *apc; |
@@ -331,9 +319,29 @@ static int ar724x_pci_probe(struct platform_device *pdev) | |||
331 | 319 | ||
332 | spin_lock_init(&apc->lock); | 320 | spin_lock_init(&apc->lock); |
333 | 321 | ||
322 | res = platform_get_resource_byname(pdev, IORESOURCE_IO, "io_base"); | ||
323 | if (!res) | ||
324 | return -EINVAL; | ||
325 | |||
326 | apc->io_res.parent = res; | ||
327 | apc->io_res.name = "PCI IO space"; | ||
328 | apc->io_res.start = res->start; | ||
329 | apc->io_res.end = res->end; | ||
330 | apc->io_res.flags = IORESOURCE_IO; | ||
331 | |||
332 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mem_base"); | ||
333 | if (!res) | ||
334 | return -EINVAL; | ||
335 | |||
336 | apc->mem_res.parent = res; | ||
337 | apc->mem_res.name = "PCI memory space"; | ||
338 | apc->mem_res.start = res->start; | ||
339 | apc->mem_res.end = res->end; | ||
340 | apc->mem_res.flags = IORESOURCE_MEM; | ||
341 | |||
334 | apc->pci_controller.pci_ops = &ar724x_pci_ops; | 342 | apc->pci_controller.pci_ops = &ar724x_pci_ops; |
335 | apc->pci_controller.io_resource = &ar724x_io_resource; | 343 | apc->pci_controller.io_resource = &apc->io_res; |
336 | apc->pci_controller.mem_resource = &ar724x_mem_resource; | 344 | apc->pci_controller.mem_resource = &apc->mem_res; |
337 | 345 | ||
338 | apc->link_up = ar724x_pci_check_link(apc); | 346 | apc->link_up = ar724x_pci_check_link(apc); |
339 | if (!apc->link_up) | 347 | if (!apc->link_up) |