1 From f1c3a7dadf7b77809cda7f77df4b1ba3b24fbfa3 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Wed, 27 Jun 2012 10:12:50 +0200
4 Subject: [PATCH 11/34] MIPS: pci-ar724x: remove static PCI resources
6 Get those from the platform device instead.
8 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
10 arch/mips/ath79/pci.c | 21 ++++++++++++++++++++-
11 arch/mips/pci/pci-ar724x.c | 40 ++++++++++++++++++++++++----------------
12 2 files changed, 44 insertions(+), 17 deletions(-)
14 --- a/arch/mips/ath79/pci.c
15 +++ b/arch/mips/ath79/pci.c
16 @@ -137,10 +137,13 @@ static struct platform_device *
17 ath79_register_pci_ar724x(int id,
18 unsigned long cfg_base,
19 unsigned long ctrl_base,
20 + unsigned long mem_base,
21 + unsigned long mem_size,
22 + unsigned long io_base,
25 struct platform_device *pdev;
26 - struct resource res[3];
27 + struct resource res[5];
29 memset(res, 0, sizeof(res));
31 @@ -158,6 +161,16 @@ ath79_register_pci_ar724x(int id,
35 + res[3].name = "mem_base";
36 + res[3].flags = IORESOURCE_MEM;
37 + res[3].start = mem_base;
38 + res[3].end = mem_base + mem_size - 1;
40 + res[4].name = "io_base";
41 + res[4].flags = IORESOURCE_IO;
42 + res[4].start = io_base;
43 + res[4].end = io_base;
45 pdev = platform_device_register_simple("ar724x-pci", id,
46 res, ARRAY_SIZE(res));
48 @@ -173,6 +186,9 @@ int __init ath79_register_pci(void)
49 pdev = ath79_register_pci_ar724x(-1,
52 + AR724X_PCI_MEM_BASE,
53 + AR724X_PCI_MEM_SIZE,
56 } else if (soc_is_ar9342() ||
58 @@ -185,6 +201,9 @@ int __init ath79_register_pci(void)
59 pdev = ath79_register_pci_ar724x(-1,
62 + AR724X_PCI_MEM_BASE,
63 + AR724X_PCI_MEM_SIZE,
68 --- a/arch/mips/pci/pci-ar724x.c
69 +++ b/arch/mips/pci/pci-ar724x.c
70 @@ -42,6 +42,8 @@ struct ar724x_pci_controller {
73 struct pci_controller pci_controller;
74 + struct resource io_res;
75 + struct resource mem_res;
78 static inline bool ar724x_pci_check_link(struct ar724x_pci_controller *apc)
79 @@ -190,20 +192,6 @@ static struct pci_ops ar724x_pci_ops = {
80 .write = ar724x_pci_write,
83 -static struct resource ar724x_io_resource = {
84 - .name = "PCI IO space",
87 - .flags = IORESOURCE_IO,
90 -static struct resource ar724x_mem_resource = {
91 - .name = "PCI memory space",
92 - .start = AR724X_PCI_MEM_BASE,
93 - .end = AR724X_PCI_MEM_BASE + AR724X_PCI_MEM_SIZE - 1,
94 - .flags = IORESOURCE_MEM,
97 static void ar724x_pci_irq_handler(unsigned int irq, struct irq_desc *desc)
99 struct ar724x_pci_controller *apc;
100 @@ -331,9 +319,29 @@ static int ar724x_pci_probe(struct platf
102 spin_lock_init(&apc->lock);
104 + res = platform_get_resource_byname(pdev, IORESOURCE_IO, "io_base");
108 + apc->io_res.parent = res;
109 + apc->io_res.name = "PCI IO space";
110 + apc->io_res.start = res->start;
111 + apc->io_res.end = res->end;
112 + apc->io_res.flags = IORESOURCE_IO;
114 + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mem_base");
118 + apc->mem_res.parent = res;
119 + apc->mem_res.name = "PCI memory space";
120 + apc->mem_res.start = res->start;
121 + apc->mem_res.end = res->end;
122 + apc->mem_res.flags = IORESOURCE_MEM;
124 apc->pci_controller.pci_ops = &ar724x_pci_ops;
125 - apc->pci_controller.io_resource = &ar724x_io_resource;
126 - apc->pci_controller.mem_resource = &ar724x_mem_resource;
127 + apc->pci_controller.io_resource = &apc->io_res;
128 + apc->pci_controller.mem_resource = &apc->mem_res;
130 apc->link_up = ar724x_pci_check_link(apc);