blob: 65ec032fa0b442367c93b70cf8599fb5bd03fdd1 [file] [log] [blame]
Rene Bolldorf4ff40d52011-11-17 14:25:09 +00001/*
Gabor Juhose9b62e82012-03-14 10:36:14 +01002 * Atheros AR724X PCI host controller driver
Rene Bolldorf4ff40d52011-11-17 14:25:09 +00003 *
4 * Copyright (C) 2011 René Bolldorf <xsecute@googlemail.com>
Gabor Juhose9b62e82012-03-14 10:36:14 +01005 * Copyright (C) 2009-2011 Gabor Juhos <juhosg@openwrt.org>
Rene Bolldorf4ff40d52011-11-17 14:25:09 +00006 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
10 */
11
Gabor Juhos908339e2013-02-03 09:58:38 +000012#include <linux/spinlock.h>
Gabor Juhos4c07c7d2012-03-14 10:36:07 +010013#include <linux/irq.h>
Rene Bolldorf4ff40d52011-11-17 14:25:09 +000014#include <linux/pci.h>
Gabor Juhos58d2e9b2013-02-02 11:40:42 +000015#include <linux/module.h>
16#include <linux/platform_device.h>
Gabor Juhos6015a852012-03-14 10:36:05 +010017#include <asm/mach-ath79/ath79.h>
Gabor Juhos4c07c7d2012-03-14 10:36:07 +010018#include <asm/mach-ath79/ar71xx_regs.h>
Rene Bolldorf4ff40d52011-11-17 14:25:09 +000019
Gabor Juhosa1dca312012-08-23 15:35:26 +020020#define AR724X_PCI_REG_RESET 0x18
Gabor Juhos4c07c7d2012-03-14 10:36:07 +010021#define AR724X_PCI_REG_INT_STATUS 0x4c
22#define AR724X_PCI_REG_INT_MASK 0x50
23
Gabor Juhosa1dca312012-08-23 15:35:26 +020024#define AR724X_PCI_RESET_LINK_UP BIT(0)
25
Gabor Juhos4c07c7d2012-03-14 10:36:07 +010026#define AR724X_PCI_INT_DEV0 BIT(14)
27
28#define AR724X_PCI_IRQ_COUNT 1
29
Gabor Juhos6015a852012-03-14 10:36:05 +010030#define AR7240_BAR0_WAR_VALUE 0xffff
31
Gabor Juhos12401fc2013-02-03 14:52:47 +000032#define AR724X_PCI_CMD_INIT (PCI_COMMAND_MEMORY | \
33 PCI_COMMAND_MASTER | \
34 PCI_COMMAND_INVALIDATE | \
35 PCI_COMMAND_PARITY | \
36 PCI_COMMAND_SERR | \
37 PCI_COMMAND_FAST_BACK)
38
Gabor Juhos908339e2013-02-03 09:58:38 +000039struct ar724x_pci_controller {
40 void __iomem *devcfg_base;
41 void __iomem *ctrl_base;
Gabor Juhos12401fc2013-02-03 14:52:47 +000042 void __iomem *crp_base;
Rene Bolldorf4ff40d52011-11-17 14:25:09 +000043
Gabor Juhos908339e2013-02-03 09:58:38 +000044 int irq;
Gabor Juhos8b66d462013-02-03 10:00:16 +000045 int irq_base;
Gabor Juhosa1dca312012-08-23 15:35:26 +020046
Gabor Juhos908339e2013-02-03 09:58:38 +000047 bool link_up;
48 bool bar0_is_cached;
49 u32 bar0_value;
50
51 spinlock_t lock;
52
53 struct pci_controller pci_controller;
Gabor Juhos34b134a2013-02-03 09:59:45 +000054 struct resource io_res;
55 struct resource mem_res;
Gabor Juhos908339e2013-02-03 09:58:38 +000056};
57
58static inline bool ar724x_pci_check_link(struct ar724x_pci_controller *apc)
Gabor Juhosa1dca312012-08-23 15:35:26 +020059{
60 u32 reset;
61
Gabor Juhos908339e2013-02-03 09:58:38 +000062 reset = __raw_readl(apc->ctrl_base + AR724X_PCI_REG_RESET);
Gabor Juhosa1dca312012-08-23 15:35:26 +020063 return reset & AR724X_PCI_RESET_LINK_UP;
64}
Gabor Juhos6015a852012-03-14 10:36:05 +010065
Gabor Juhos908339e2013-02-03 09:58:38 +000066static inline struct ar724x_pci_controller *
67pci_bus_to_ar724x_controller(struct pci_bus *bus)
68{
69 struct pci_controller *hose;
70
71 hose = (struct pci_controller *) bus->sysdata;
72 return container_of(hose, struct ar724x_pci_controller, pci_controller);
73}
74
Gabor Juhos12401fc2013-02-03 14:52:47 +000075static int ar724x_pci_local_write(struct ar724x_pci_controller *apc,
76 int where, int size, u32 value)
77{
78 unsigned long flags;
79 void __iomem *base;
80 u32 data;
81 int s;
82
83 WARN_ON(where & (size - 1));
84
85 if (!apc->link_up)
86 return PCIBIOS_DEVICE_NOT_FOUND;
87
88 base = apc->crp_base;
89
90 spin_lock_irqsave(&apc->lock, flags);
91 data = __raw_readl(base + (where & ~3));
92
93 switch (size) {
94 case 1:
95 s = ((where & 3) * 8);
96 data &= ~(0xff << s);
97 data |= ((value & 0xff) << s);
98 break;
99 case 2:
100 s = ((where & 2) * 8);
101 data &= ~(0xffff << s);
102 data |= ((value & 0xffff) << s);
103 break;
104 case 4:
105 data = value;
106 break;
107 default:
108 spin_unlock_irqrestore(&apc->lock, flags);
109 return PCIBIOS_BAD_REGISTER_NUMBER;
110 }
111
112 __raw_writel(data, base + (where & ~3));
113 /* flush write */
114 __raw_readl(base + (where & ~3));
115 spin_unlock_irqrestore(&apc->lock, flags);
116
117 return PCIBIOS_SUCCESSFUL;
118}
119
Gabor Juhosd624bd32012-03-14 10:29:26 +0100120static int ar724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where,
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000121 int size, uint32_t *value)
122{
Gabor Juhos908339e2013-02-03 09:58:38 +0000123 struct ar724x_pci_controller *apc;
Gabor Juhos64adb6b2012-03-14 10:36:04 +0100124 unsigned long flags;
Gabor Juhosc1984412012-03-14 10:29:27 +0100125 void __iomem *base;
Gabor Juhos64adb6b2012-03-14 10:36:04 +0100126 u32 data;
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000127
Gabor Juhos908339e2013-02-03 09:58:38 +0000128 apc = pci_bus_to_ar724x_controller(bus);
129 if (!apc->link_up)
Gabor Juhosa1dca312012-08-23 15:35:26 +0200130 return PCIBIOS_DEVICE_NOT_FOUND;
131
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000132 if (devfn)
133 return PCIBIOS_DEVICE_NOT_FOUND;
134
Gabor Juhos908339e2013-02-03 09:58:38 +0000135 base = apc->devcfg_base;
Gabor Juhosc1984412012-03-14 10:29:27 +0100136
Gabor Juhos908339e2013-02-03 09:58:38 +0000137 spin_lock_irqsave(&apc->lock, flags);
Gabor Juhos64adb6b2012-03-14 10:36:04 +0100138 data = __raw_readl(base + (where & ~3));
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000139
140 switch (size) {
141 case 1:
Gabor Juhos64adb6b2012-03-14 10:36:04 +0100142 if (where & 1)
143 data >>= 8;
144 if (where & 2)
145 data >>= 16;
146 data &= 0xff;
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000147 break;
148 case 2:
Gabor Juhos64adb6b2012-03-14 10:36:04 +0100149 if (where & 2)
150 data >>= 16;
151 data &= 0xffff;
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000152 break;
153 case 4:
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000154 break;
155 default:
Gabor Juhos908339e2013-02-03 09:58:38 +0000156 spin_unlock_irqrestore(&apc->lock, flags);
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000157
158 return PCIBIOS_BAD_REGISTER_NUMBER;
159 }
160
Gabor Juhos908339e2013-02-03 09:58:38 +0000161 spin_unlock_irqrestore(&apc->lock, flags);
Gabor Juhos6015a852012-03-14 10:36:05 +0100162
163 if (where == PCI_BASE_ADDRESS_0 && size == 4 &&
Gabor Juhos908339e2013-02-03 09:58:38 +0000164 apc->bar0_is_cached) {
Gabor Juhos6015a852012-03-14 10:36:05 +0100165 /* use the cached value */
Gabor Juhos908339e2013-02-03 09:58:38 +0000166 *value = apc->bar0_value;
Gabor Juhos6015a852012-03-14 10:36:05 +0100167 } else {
168 *value = data;
169 }
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000170
171 return PCIBIOS_SUCCESSFUL;
172}
173
Gabor Juhosd624bd32012-03-14 10:29:26 +0100174static int ar724x_pci_write(struct pci_bus *bus, unsigned int devfn, int where,
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000175 int size, uint32_t value)
176{
Gabor Juhos908339e2013-02-03 09:58:38 +0000177 struct ar724x_pci_controller *apc;
Gabor Juhos64adb6b2012-03-14 10:36:04 +0100178 unsigned long flags;
Gabor Juhosc1984412012-03-14 10:29:27 +0100179 void __iomem *base;
Gabor Juhos64adb6b2012-03-14 10:36:04 +0100180 u32 data;
181 int s;
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000182
Gabor Juhos908339e2013-02-03 09:58:38 +0000183 apc = pci_bus_to_ar724x_controller(bus);
184 if (!apc->link_up)
Gabor Juhosa1dca312012-08-23 15:35:26 +0200185 return PCIBIOS_DEVICE_NOT_FOUND;
186
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000187 if (devfn)
188 return PCIBIOS_DEVICE_NOT_FOUND;
189
Gabor Juhos6015a852012-03-14 10:36:05 +0100190 if (soc_is_ar7240() && where == PCI_BASE_ADDRESS_0 && size == 4) {
191 if (value != 0xffffffff) {
192 /*
193 * WAR for a hw issue. If the BAR0 register of the
194 * device is set to the proper base address, the
195 * memory space of the device is not accessible.
196 *
197 * Cache the intended value so it can be read back,
198 * and write a SoC specific constant value to the
199 * BAR0 register in order to make the device memory
200 * accessible.
201 */
Gabor Juhos908339e2013-02-03 09:58:38 +0000202 apc->bar0_is_cached = true;
203 apc->bar0_value = value;
Gabor Juhos6015a852012-03-14 10:36:05 +0100204
205 value = AR7240_BAR0_WAR_VALUE;
206 } else {
Gabor Juhos908339e2013-02-03 09:58:38 +0000207 apc->bar0_is_cached = false;
Gabor Juhos6015a852012-03-14 10:36:05 +0100208 }
209 }
210
Gabor Juhos908339e2013-02-03 09:58:38 +0000211 base = apc->devcfg_base;
Gabor Juhosc1984412012-03-14 10:29:27 +0100212
Gabor Juhos908339e2013-02-03 09:58:38 +0000213 spin_lock_irqsave(&apc->lock, flags);
Gabor Juhos64adb6b2012-03-14 10:36:04 +0100214 data = __raw_readl(base + (where & ~3));
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000215
216 switch (size) {
217 case 1:
Gabor Juhos64adb6b2012-03-14 10:36:04 +0100218 s = ((where & 3) * 8);
219 data &= ~(0xff << s);
220 data |= ((value & 0xff) << s);
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000221 break;
222 case 2:
Gabor Juhos64adb6b2012-03-14 10:36:04 +0100223 s = ((where & 2) * 8);
224 data &= ~(0xffff << s);
225 data |= ((value & 0xffff) << s);
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000226 break;
227 case 4:
Gabor Juhos64adb6b2012-03-14 10:36:04 +0100228 data = value;
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000229 break;
230 default:
Gabor Juhos908339e2013-02-03 09:58:38 +0000231 spin_unlock_irqrestore(&apc->lock, flags);
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000232
233 return PCIBIOS_BAD_REGISTER_NUMBER;
234 }
235
Gabor Juhos64adb6b2012-03-14 10:36:04 +0100236 __raw_writel(data, base + (where & ~3));
237 /* flush write */
238 __raw_readl(base + (where & ~3));
Gabor Juhos908339e2013-02-03 09:58:38 +0000239 spin_unlock_irqrestore(&apc->lock, flags);
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000240
241 return PCIBIOS_SUCCESSFUL;
242}
243
Gabor Juhosd624bd32012-03-14 10:29:26 +0100244static struct pci_ops ar724x_pci_ops = {
245 .read = ar724x_pci_read,
246 .write = ar724x_pci_write,
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000247};
248
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100249static void ar724x_pci_irq_handler(unsigned int irq, struct irq_desc *desc)
Rene Bolldorf4ff40d52011-11-17 14:25:09 +0000250{
Gabor Juhos908339e2013-02-03 09:58:38 +0000251 struct ar724x_pci_controller *apc;
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100252 void __iomem *base;
253 u32 pending;
254
Gabor Juhos908339e2013-02-03 09:58:38 +0000255 apc = irq_get_handler_data(irq);
256 base = apc->ctrl_base;
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100257
258 pending = __raw_readl(base + AR724X_PCI_REG_INT_STATUS) &
259 __raw_readl(base + AR724X_PCI_REG_INT_MASK);
260
261 if (pending & AR724X_PCI_INT_DEV0)
Gabor Juhos8b66d462013-02-03 10:00:16 +0000262 generic_handle_irq(apc->irq_base + 0);
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100263
264 else
265 spurious_interrupt();
266}
267
268static void ar724x_pci_irq_unmask(struct irq_data *d)
269{
Gabor Juhos908339e2013-02-03 09:58:38 +0000270 struct ar724x_pci_controller *apc;
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100271 void __iomem *base;
Gabor Juhos8b66d462013-02-03 10:00:16 +0000272 int offset;
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100273 u32 t;
274
Gabor Juhos908339e2013-02-03 09:58:38 +0000275 apc = irq_data_get_irq_chip_data(d);
276 base = apc->ctrl_base;
Gabor Juhos8b66d462013-02-03 10:00:16 +0000277 offset = apc->irq_base - d->irq;
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100278
Gabor Juhos8b66d462013-02-03 10:00:16 +0000279 switch (offset) {
280 case 0:
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100281 t = __raw_readl(base + AR724X_PCI_REG_INT_MASK);
282 __raw_writel(t | AR724X_PCI_INT_DEV0,
283 base + AR724X_PCI_REG_INT_MASK);
284 /* flush write */
285 __raw_readl(base + AR724X_PCI_REG_INT_MASK);
286 }
287}
288
289static void ar724x_pci_irq_mask(struct irq_data *d)
290{
Gabor Juhos908339e2013-02-03 09:58:38 +0000291 struct ar724x_pci_controller *apc;
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100292 void __iomem *base;
Gabor Juhos8b66d462013-02-03 10:00:16 +0000293 int offset;
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100294 u32 t;
295
Gabor Juhos908339e2013-02-03 09:58:38 +0000296 apc = irq_data_get_irq_chip_data(d);
297 base = apc->ctrl_base;
Gabor Juhos8b66d462013-02-03 10:00:16 +0000298 offset = apc->irq_base - d->irq;
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100299
Gabor Juhos8b66d462013-02-03 10:00:16 +0000300 switch (offset) {
301 case 0:
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100302 t = __raw_readl(base + AR724X_PCI_REG_INT_MASK);
303 __raw_writel(t & ~AR724X_PCI_INT_DEV0,
304 base + AR724X_PCI_REG_INT_MASK);
305
306 /* flush write */
307 __raw_readl(base + AR724X_PCI_REG_INT_MASK);
308
309 t = __raw_readl(base + AR724X_PCI_REG_INT_STATUS);
310 __raw_writel(t | AR724X_PCI_INT_DEV0,
311 base + AR724X_PCI_REG_INT_STATUS);
312
313 /* flush write */
314 __raw_readl(base + AR724X_PCI_REG_INT_STATUS);
315 }
316}
317
318static struct irq_chip ar724x_pci_irq_chip = {
319 .name = "AR724X PCI ",
320 .irq_mask = ar724x_pci_irq_mask,
321 .irq_unmask = ar724x_pci_irq_unmask,
322 .irq_mask_ack = ar724x_pci_irq_mask,
323};
324
Gabor Juhos8b66d462013-02-03 10:00:16 +0000325static void ar724x_pci_irq_init(struct ar724x_pci_controller *apc,
326 int id)
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100327{
328 void __iomem *base;
329 int i;
330
Gabor Juhos908339e2013-02-03 09:58:38 +0000331 base = apc->ctrl_base;
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100332
333 __raw_writel(0, base + AR724X_PCI_REG_INT_MASK);
334 __raw_writel(0, base + AR724X_PCI_REG_INT_STATUS);
335
Gabor Juhos8b66d462013-02-03 10:00:16 +0000336 apc->irq_base = ATH79_PCI_IRQ_BASE + (id * AR724X_PCI_IRQ_COUNT);
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100337
Gabor Juhos8b66d462013-02-03 10:00:16 +0000338 for (i = apc->irq_base;
339 i < apc->irq_base + AR724X_PCI_IRQ_COUNT; i++) {
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100340 irq_set_chip_and_handler(i, &ar724x_pci_irq_chip,
341 handle_level_irq);
Gabor Juhos908339e2013-02-03 09:58:38 +0000342 irq_set_chip_data(i, apc);
343 }
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100344
Gabor Juhos908339e2013-02-03 09:58:38 +0000345 irq_set_handler_data(apc->irq, apc);
346 irq_set_chained_handler(apc->irq, ar724x_pci_irq_handler);
Gabor Juhos4c07c7d2012-03-14 10:36:07 +0100347}
348
Gabor Juhos58d2e9b2013-02-02 11:40:42 +0000349static int ar724x_pci_probe(struct platform_device *pdev)
350{
Gabor Juhos908339e2013-02-03 09:58:38 +0000351 struct ar724x_pci_controller *apc;
Gabor Juhos58d2e9b2013-02-02 11:40:42 +0000352 struct resource *res;
Gabor Juhos8b66d462013-02-03 10:00:16 +0000353 int id;
354
355 id = pdev->id;
356 if (id == -1)
357 id = 0;
Gabor Juhos908339e2013-02-03 09:58:38 +0000358
359 apc = devm_kzalloc(&pdev->dev, sizeof(struct ar724x_pci_controller),
360 GFP_KERNEL);
361 if (!apc)
362 return -ENOMEM;
Gabor Juhos58d2e9b2013-02-02 11:40:42 +0000363
364 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl_base");
365 if (!res)
366 return -EINVAL;
367
Silviu-Mihai Popescuf560fab2013-03-12 10:30:05 +0000368 apc->ctrl_base = devm_ioremap_resource(&pdev->dev, res);
369 if (IS_ERR(apc->ctrl_base))
370 return PTR_ERR(apc->ctrl_base);
Gabor Juhos58d2e9b2013-02-02 11:40:42 +0000371
372 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base");
373 if (!res)
374 return -EINVAL;
375
Silviu-Mihai Popescuf560fab2013-03-12 10:30:05 +0000376 apc->devcfg_base = devm_ioremap_resource(&pdev->dev, res);
377 if (IS_ERR(apc->devcfg_base))
378 return PTR_ERR(apc->devcfg_base);
Gabor Juhos58d2e9b2013-02-02 11:40:42 +0000379
Gabor Juhos12401fc2013-02-03 14:52:47 +0000380 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "crp_base");
381 if (!res)
382 return -EINVAL;
383
Silviu-Mihai Popescuf560fab2013-03-12 10:30:05 +0000384 apc->crp_base = devm_ioremap_resource(&pdev->dev, res);
385 if (IS_ERR(apc->crp_base))
386 return PTR_ERR(apc->crp_base);
Gabor Juhos12401fc2013-02-03 14:52:47 +0000387
Gabor Juhos908339e2013-02-03 09:58:38 +0000388 apc->irq = platform_get_irq(pdev, 0);
389 if (apc->irq < 0)
Gabor Juhos58d2e9b2013-02-02 11:40:42 +0000390 return -EINVAL;
391
Gabor Juhos908339e2013-02-03 09:58:38 +0000392 spin_lock_init(&apc->lock);
393
Gabor Juhos34b134a2013-02-03 09:59:45 +0000394 res = platform_get_resource_byname(pdev, IORESOURCE_IO, "io_base");
395 if (!res)
396 return -EINVAL;
397
398 apc->io_res.parent = res;
399 apc->io_res.name = "PCI IO space";
400 apc->io_res.start = res->start;
401 apc->io_res.end = res->end;
402 apc->io_res.flags = IORESOURCE_IO;
403
404 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mem_base");
405 if (!res)
406 return -EINVAL;
407
408 apc->mem_res.parent = res;
409 apc->mem_res.name = "PCI memory space";
410 apc->mem_res.start = res->start;
411 apc->mem_res.end = res->end;
412 apc->mem_res.flags = IORESOURCE_MEM;
413
Gabor Juhos908339e2013-02-03 09:58:38 +0000414 apc->pci_controller.pci_ops = &ar724x_pci_ops;
Gabor Juhos34b134a2013-02-03 09:59:45 +0000415 apc->pci_controller.io_resource = &apc->io_res;
416 apc->pci_controller.mem_resource = &apc->mem_res;
Gabor Juhos908339e2013-02-03 09:58:38 +0000417
418 apc->link_up = ar724x_pci_check_link(apc);
419 if (!apc->link_up)
Gabor Juhos58d2e9b2013-02-02 11:40:42 +0000420 dev_warn(&pdev->dev, "PCIe link is down\n");
421
Gabor Juhos8b66d462013-02-03 10:00:16 +0000422 ar724x_pci_irq_init(apc, id);
Gabor Juhos58d2e9b2013-02-02 11:40:42 +0000423
Gabor Juhos12401fc2013-02-03 14:52:47 +0000424 ar724x_pci_local_write(apc, PCI_COMMAND, 4, AR724X_PCI_CMD_INIT);
425
Gabor Juhos908339e2013-02-03 09:58:38 +0000426 register_pci_controller(&apc->pci_controller);
Gabor Juhos58d2e9b2013-02-02 11:40:42 +0000427
428 return 0;
429}
430
431static struct platform_driver ar724x_pci_driver = {
432 .probe = ar724x_pci_probe,
433 .driver = {
434 .name = "ar724x-pci",
435 .owner = THIS_MODULE,
436 },
437};
438
439static int __init ar724x_pci_init(void)
440{
441 return platform_driver_register(&ar724x_pci_driver);
442}
443
444postcore_initcall(ar724x_pci_init);