Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360085
b: refs/heads/master
c: 34b134a
h: refs/heads/master
i:
  360083: baa79ea
v: v3
  • Loading branch information
Gabor Juhos authored and John Crispin committed Feb 17, 2013
1 parent 0830d3b commit c0f5569
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 18 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: 908339ef25b1d5e80f1c6fab22b9958174708b4a
refs/heads/master: 34b134aebda89888b6985b7a3139e9cbdf209236
21 changes: 20 additions & 1 deletion trunk/arch/mips/ath79/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,13 @@ static struct platform_device *
ath79_register_pci_ar724x(int id,
unsigned long cfg_base,
unsigned long ctrl_base,
unsigned long mem_base,
unsigned long mem_size,
unsigned long io_base,
int irq)
{
struct platform_device *pdev;
struct resource res[3];
struct resource res[5];

memset(res, 0, sizeof(res));

Expand All @@ -160,6 +163,16 @@ ath79_register_pci_ar724x(int id,
res[2].start = irq;
res[2].end = irq;

res[3].name = "mem_base";
res[3].flags = IORESOURCE_MEM;
res[3].start = mem_base;
res[3].end = mem_base + mem_size - 1;

res[4].name = "io_base";
res[4].flags = IORESOURCE_IO;
res[4].start = io_base;
res[4].end = io_base;

pdev = platform_device_register_simple("ar724x-pci", id,
res, ARRAY_SIZE(res));
return pdev;
Expand All @@ -175,6 +188,9 @@ int __init ath79_register_pci(void)
pdev = ath79_register_pci_ar724x(-1,
AR724X_PCI_CFG_BASE,
AR724X_PCI_CTRL_BASE,
AR724X_PCI_MEM_BASE,
AR724X_PCI_MEM_SIZE,
0,
ATH79_CPU_IRQ_IP2);
} else if (soc_is_ar9342() ||
soc_is_ar9344()) {
Expand All @@ -187,6 +203,9 @@ int __init ath79_register_pci(void)
pdev = ath79_register_pci_ar724x(-1,
AR724X_PCI_CFG_BASE,
AR724X_PCI_CTRL_BASE,
AR724X_PCI_MEM_BASE,
AR724X_PCI_MEM_SIZE,
0,
ATH79_IP2_IRQ(0));
} else {
/* No PCI support */
Expand Down
40 changes: 24 additions & 16 deletions trunk/arch/mips/pci/pci-ar724x.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ struct ar724x_pci_controller {
spinlock_t lock;

struct pci_controller pci_controller;
struct resource io_res;
struct resource mem_res;
};

static inline bool ar724x_pci_check_link(struct ar724x_pci_controller *apc)
Expand Down Expand Up @@ -190,20 +192,6 @@ static struct pci_ops ar724x_pci_ops = {
.write = ar724x_pci_write,
};

static struct resource ar724x_io_resource = {
.name = "PCI IO space",
.start = 0,
.end = 0,
.flags = IORESOURCE_IO,
};

static struct resource ar724x_mem_resource = {
.name = "PCI memory space",
.start = AR724X_PCI_MEM_BASE,
.end = AR724X_PCI_MEM_BASE + AR724X_PCI_MEM_SIZE - 1,
.flags = IORESOURCE_MEM,
};

static void ar724x_pci_irq_handler(unsigned int irq, struct irq_desc *desc)
{
struct ar724x_pci_controller *apc;
Expand Down Expand Up @@ -331,9 +319,29 @@ static int ar724x_pci_probe(struct platform_device *pdev)

spin_lock_init(&apc->lock);

res = platform_get_resource_byname(pdev, IORESOURCE_IO, "io_base");
if (!res)
return -EINVAL;

apc->io_res.parent = res;
apc->io_res.name = "PCI IO space";
apc->io_res.start = res->start;
apc->io_res.end = res->end;
apc->io_res.flags = IORESOURCE_IO;

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

apc->mem_res.parent = res;
apc->mem_res.name = "PCI memory space";
apc->mem_res.start = res->start;
apc->mem_res.end = res->end;
apc->mem_res.flags = IORESOURCE_MEM;

apc->pci_controller.pci_ops = &ar724x_pci_ops;
apc->pci_controller.io_resource = &ar724x_io_resource;
apc->pci_controller.mem_resource = &ar724x_mem_resource;
apc->pci_controller.io_resource = &apc->io_res;
apc->pci_controller.mem_resource = &apc->mem_res;

apc->link_up = ar724x_pci_check_link(apc);
if (!apc->link_up)
Expand Down

0 comments on commit c0f5569

Please sign in to comment.