Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360076
b: refs/heads/master
c: 58d2e9b
h: refs/heads/master
v: v3
  • Loading branch information
Gabor Juhos authored and John Crispin committed Feb 17, 2013
1 parent a9ca193 commit cf7f0c8
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d3d2b4200b5a42851365e903d101f8f0882eb9eb
refs/heads/master: 58d2e9bcd682d76bcb9575dc56c85f1d82a81bfa
57 changes: 55 additions & 2 deletions trunk/arch/mips/pci/pci-ar724x.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#include <linux/irq.h>
#include <linux/pci.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <asm/mach-ath79/ath79.h>
#include <asm/mach-ath79/ar71xx_regs.h>
#include <asm/mach-ath79/pci.h>
Expand Down Expand Up @@ -262,7 +264,7 @@ static struct irq_chip ar724x_pci_irq_chip = {
.irq_mask_ack = ar724x_pci_irq_mask,
};

static void __init ar724x_pci_irq_init(int irq)
static void ar724x_pci_irq_init(int irq)
{
void __iomem *base;
int i;
Expand All @@ -282,7 +284,7 @@ static void __init ar724x_pci_irq_init(int irq)
irq_set_chained_handler(irq, ar724x_pci_irq_handler);
}

int __init ar724x_pcibios_init(int irq)
int ar724x_pcibios_init(int irq)
{
int ret;

Expand Down Expand Up @@ -312,3 +314,54 @@ int __init ar724x_pcibios_init(int irq)
err:
return ret;
}

static int ar724x_pci_probe(struct platform_device *pdev)
{
struct resource *res;
int irq;

res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl_base");
if (!res)
return -EINVAL;

ar724x_pci_ctrl_base = devm_request_and_ioremap(&pdev->dev, res);
if (ar724x_pci_ctrl_base == NULL)
return -EBUSY;

res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base");
if (!res)
return -EINVAL;

ar724x_pci_devcfg_base = devm_request_and_ioremap(&pdev->dev, res);
if (!ar724x_pci_devcfg_base)
return -EBUSY;

irq = platform_get_irq(pdev, 0);
if (irq < 0)
return -EINVAL;

ar724x_pci_link_up = ar724x_pci_check_link();
if (!ar724x_pci_link_up)
dev_warn(&pdev->dev, "PCIe link is down\n");

ar724x_pci_irq_init(irq);

register_pci_controller(&ar724x_pci_controller);

return 0;
}

static struct platform_driver ar724x_pci_driver = {
.probe = ar724x_pci_probe,
.driver = {
.name = "ar724x-pci",
.owner = THIS_MODULE,
},
};

static int __init ar724x_pci_init(void)
{
return platform_driver_register(&ar724x_pci_driver);
}

postcore_initcall(ar724x_pci_init);

0 comments on commit cf7f0c8

Please sign in to comment.