aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-02-07 14:28:15 -0500
committerJohn Crispin <blogic@openwrt.org>2013-02-16 19:25:40 -0500
commit42cb60d1fab4c81ef24876d985e08fc5bb899e41 (patch)
tree817e9aa87d280c6e66c9403e42652aa861599045
parentf18118a868f1f7e7bdfea176a204fcc44fae2985 (diff)
MIPS: pci-ar71xx: remove static PCI IO/MEM resources
Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Patchwork: http://patchwork.linux-mips.org/patch/4927/ Signed-off-by: John Crispin <blogic@openwrt.org>
-rw-r--r--arch/mips/ath79/pci.c12
-rw-r--r--arch/mips/pci/pci-ar71xx.c40
2 files changed, 35 insertions, 17 deletions
diff --git a/arch/mips/ath79/pci.c b/arch/mips/ath79/pci.c
index 942e3f9184f0..ea8aa10893d8 100644
--- a/arch/mips/ath79/pci.c
+++ b/arch/mips/ath79/pci.c
@@ -117,7 +117,7 @@ static struct platform_device *
117ath79_register_pci_ar71xx(void) 117ath79_register_pci_ar71xx(void)
118{ 118{
119 struct platform_device *pdev; 119 struct platform_device *pdev;
120 struct resource res[2]; 120 struct resource res[4];
121 121
122 memset(res, 0, sizeof(res)); 122 memset(res, 0, sizeof(res));
123 123
@@ -130,6 +130,16 @@ ath79_register_pci_ar71xx(void)
130 res[1].start = ATH79_CPU_IRQ_IP2; 130 res[1].start = ATH79_CPU_IRQ_IP2;
131 res[1].end = ATH79_CPU_IRQ_IP2; 131 res[1].end = ATH79_CPU_IRQ_IP2;
132 132
133 res[2].name = "io_base";
134 res[2].flags = IORESOURCE_IO;
135 res[2].start = 0;
136 res[2].end = 0;
137
138 res[3].name = "mem_base";
139 res[3].flags = IORESOURCE_MEM;
140 res[3].start = AR71XX_PCI_MEM_BASE;
141 res[3].end = AR71XX_PCI_MEM_BASE + AR71XX_PCI_MEM_SIZE - 1;
142
133 pdev = platform_device_register_simple("ar71xx-pci", -1, 143 pdev = platform_device_register_simple("ar71xx-pci", -1,
134 res, ARRAY_SIZE(res)); 144 res, ARRAY_SIZE(res));
135 return pdev; 145 return pdev;
diff --git a/arch/mips/pci/pci-ar71xx.c b/arch/mips/pci/pci-ar71xx.c
index 44dc5bf720c0..e48dddbb4919 100644
--- a/arch/mips/pci/pci-ar71xx.c
+++ b/arch/mips/pci/pci-ar71xx.c
@@ -53,6 +53,8 @@ struct ar71xx_pci_controller {
53 spinlock_t lock; 53 spinlock_t lock;
54 int irq; 54 int irq;
55 struct pci_controller pci_ctrl; 55 struct pci_controller pci_ctrl;
56 struct resource io_res;
57 struct resource mem_res;
56}; 58};
57 59
58/* Byte lane enable bits */ 60/* Byte lane enable bits */
@@ -234,20 +236,6 @@ static struct pci_ops ar71xx_pci_ops = {
234 .write = ar71xx_pci_write_config, 236 .write = ar71xx_pci_write_config,
235}; 237};
236 238
237static struct resource ar71xx_pci_io_resource = {
238 .name = "PCI IO space",
239 .start = 0,
240 .end = 0,
241 .flags = IORESOURCE_IO,
242};
243
244static struct resource ar71xx_pci_mem_resource = {
245 .name = "PCI memory space",
246 .start = AR71XX_PCI_MEM_BASE,
247 .end = AR71XX_PCI_MEM_BASE + AR71XX_PCI_MEM_SIZE - 1,
248 .flags = IORESOURCE_MEM
249};
250
251static void ar71xx_pci_irq_handler(unsigned int irq, struct irq_desc *desc) 239static void ar71xx_pci_irq_handler(unsigned int irq, struct irq_desc *desc)
252{ 240{
253 void __iomem *base = ath79_reset_base; 241 void __iomem *base = ath79_reset_base;
@@ -370,6 +358,26 @@ static int ar71xx_pci_probe(struct platform_device *pdev)
370 if (apc->irq < 0) 358 if (apc->irq < 0)
371 return -EINVAL; 359 return -EINVAL;
372 360
361 res = platform_get_resource_byname(pdev, IORESOURCE_IO, "io_base");
362 if (!res)
363 return -EINVAL;
364
365 apc->io_res.parent = res;
366 apc->io_res.name = "PCI IO space";
367 apc->io_res.start = res->start;
368 apc->io_res.end = res->end;
369 apc->io_res.flags = IORESOURCE_IO;
370
371 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mem_base");
372 if (!res)
373 return -EINVAL;
374
375 apc->mem_res.parent = res;
376 apc->mem_res.name = "PCI memory space";
377 apc->mem_res.start = res->start;
378 apc->mem_res.end = res->end;
379 apc->mem_res.flags = IORESOURCE_MEM;
380
373 ar71xx_pci_reset(); 381 ar71xx_pci_reset();
374 382
375 /* setup COMMAND register */ 383 /* setup COMMAND register */
@@ -383,8 +391,8 @@ static int ar71xx_pci_probe(struct platform_device *pdev)
383 ar71xx_pci_irq_init(apc); 391 ar71xx_pci_irq_init(apc);
384 392
385 apc->pci_ctrl.pci_ops = &ar71xx_pci_ops; 393 apc->pci_ctrl.pci_ops = &ar71xx_pci_ops;
386 apc->pci_ctrl.mem_resource = &ar71xx_pci_mem_resource; 394 apc->pci_ctrl.mem_resource = &apc->mem_res;
387 apc->pci_ctrl.io_resource = &ar71xx_pci_io_resource; 395 apc->pci_ctrl.io_resource = &apc->io_res;
388 396
389 register_pci_controller(&apc->pci_ctrl); 397 register_pci_controller(&apc->pci_ctrl);
390 398