aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/pci/pci-ar724x.c57
1 files changed, 55 insertions, 2 deletions
diff --git a/arch/mips/pci/pci-ar724x.c b/arch/mips/pci/pci-ar724x.c
index c11c75be2d7e..e7aca88ba0c0 100644
--- a/arch/mips/pci/pci-ar724x.c
+++ b/arch/mips/pci/pci-ar724x.c
@@ -11,6 +11,8 @@
11 11
12#include <linux/irq.h> 12#include <linux/irq.h>
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/module.h>
15#include <linux/platform_device.h>
14#include <asm/mach-ath79/ath79.h> 16#include <asm/mach-ath79/ath79.h>
15#include <asm/mach-ath79/ar71xx_regs.h> 17#include <asm/mach-ath79/ar71xx_regs.h>
16#include <asm/mach-ath79/pci.h> 18#include <asm/mach-ath79/pci.h>
@@ -262,7 +264,7 @@ static struct irq_chip ar724x_pci_irq_chip = {
262 .irq_mask_ack = ar724x_pci_irq_mask, 264 .irq_mask_ack = ar724x_pci_irq_mask,
263}; 265};
264 266
265static void __init ar724x_pci_irq_init(int irq) 267static void ar724x_pci_irq_init(int irq)
266{ 268{
267 void __iomem *base; 269 void __iomem *base;
268 int i; 270 int i;
@@ -282,7 +284,7 @@ static void __init ar724x_pci_irq_init(int irq)
282 irq_set_chained_handler(irq, ar724x_pci_irq_handler); 284 irq_set_chained_handler(irq, ar724x_pci_irq_handler);
283} 285}
284 286
285int __init ar724x_pcibios_init(int irq) 287int ar724x_pcibios_init(int irq)
286{ 288{
287 int ret; 289 int ret;
288 290
@@ -312,3 +314,54 @@ err_unmap_devcfg:
312err: 314err:
313 return ret; 315 return ret;
314} 316}
317
318static int ar724x_pci_probe(struct platform_device *pdev)
319{
320 struct resource *res;
321 int irq;
322
323 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl_base");
324 if (!res)
325 return -EINVAL;
326
327 ar724x_pci_ctrl_base = devm_request_and_ioremap(&pdev->dev, res);
328 if (ar724x_pci_ctrl_base == NULL)
329 return -EBUSY;
330
331 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base");
332 if (!res)
333 return -EINVAL;
334
335 ar724x_pci_devcfg_base = devm_request_and_ioremap(&pdev->dev, res);
336 if (!ar724x_pci_devcfg_base)
337 return -EBUSY;
338
339 irq = platform_get_irq(pdev, 0);
340 if (irq < 0)
341 return -EINVAL;
342
343 ar724x_pci_link_up = ar724x_pci_check_link();
344 if (!ar724x_pci_link_up)
345 dev_warn(&pdev->dev, "PCIe link is down\n");
346
347 ar724x_pci_irq_init(irq);
348
349 register_pci_controller(&ar724x_pci_controller);
350
351 return 0;
352}
353
354static struct platform_driver ar724x_pci_driver = {
355 .probe = ar724x_pci_probe,
356 .driver = {
357 .name = "ar724x-pci",
358 .owner = THIS_MODULE,
359 },
360};
361
362static int __init ar724x_pci_init(void)
363{
364 return platform_driver_register(&ar724x_pci_driver);
365}
366
367postcore_initcall(ar724x_pci_init);