diff options
Diffstat (limited to 'arch/mips/lantiq/irq.c')
-rw-r--r-- | arch/mips/lantiq/irq.c | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c index 030568a70ac4..6ab10573490d 100644 --- a/arch/mips/lantiq/irq.c +++ b/arch/mips/lantiq/irq.c | |||
@@ -70,6 +70,7 @@ static struct resource ltq_eiu_irq[MAX_EIU]; | |||
70 | static void __iomem *ltq_icu_membase[MAX_IM]; | 70 | static void __iomem *ltq_icu_membase[MAX_IM]; |
71 | static void __iomem *ltq_eiu_membase; | 71 | static void __iomem *ltq_eiu_membase; |
72 | static struct irq_domain *ltq_domain; | 72 | static struct irq_domain *ltq_domain; |
73 | static int ltq_perfcount_irq; | ||
73 | 74 | ||
74 | int ltq_eiu_get_irq(int exin) | 75 | int ltq_eiu_get_irq(int exin) |
75 | { | 76 | { |
@@ -378,30 +379,6 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent) | |||
378 | panic("Failed to remap icu memory"); | 379 | panic("Failed to remap icu memory"); |
379 | } | 380 | } |
380 | 381 | ||
381 | /* the external interrupts are optional and xway only */ | ||
382 | eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu-xway"); | ||
383 | if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) { | ||
384 | /* find out how many external irq sources we have */ | ||
385 | exin_avail = of_irq_count(eiu_node); | ||
386 | |||
387 | if (exin_avail > MAX_EIU) | ||
388 | exin_avail = MAX_EIU; | ||
389 | |||
390 | ret = of_irq_to_resource_table(eiu_node, | ||
391 | ltq_eiu_irq, exin_avail); | ||
392 | if (ret != exin_avail) | ||
393 | panic("failed to load external irq resources"); | ||
394 | |||
395 | if (request_mem_region(res.start, resource_size(&res), | ||
396 | res.name) < 0) | ||
397 | pr_err("Failed to request eiu memory"); | ||
398 | |||
399 | ltq_eiu_membase = ioremap_nocache(res.start, | ||
400 | resource_size(&res)); | ||
401 | if (!ltq_eiu_membase) | ||
402 | panic("Failed to remap eiu memory"); | ||
403 | } | ||
404 | |||
405 | /* turn off all irqs by default */ | 382 | /* turn off all irqs by default */ |
406 | for (i = 0; i < MAX_IM; i++) { | 383 | for (i = 0; i < MAX_IM; i++) { |
407 | /* make sure all irqs are turned off by default */ | 384 | /* make sure all irqs are turned off by default */ |
@@ -449,7 +426,7 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent) | |||
449 | #endif | 426 | #endif |
450 | 427 | ||
451 | /* tell oprofile which irq to use */ | 428 | /* tell oprofile which irq to use */ |
452 | cp0_perfcount_irq = irq_create_mapping(ltq_domain, LTQ_PERF_IRQ); | 429 | ltq_perfcount_irq = irq_create_mapping(ltq_domain, LTQ_PERF_IRQ); |
453 | 430 | ||
454 | /* | 431 | /* |
455 | * if the timer irq is not one of the mips irqs we need to | 432 | * if the timer irq is not one of the mips irqs we need to |
@@ -458,9 +435,38 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent) | |||
458 | if (MIPS_CPU_TIMER_IRQ != 7) | 435 | if (MIPS_CPU_TIMER_IRQ != 7) |
459 | irq_create_mapping(ltq_domain, MIPS_CPU_TIMER_IRQ); | 436 | irq_create_mapping(ltq_domain, MIPS_CPU_TIMER_IRQ); |
460 | 437 | ||
438 | /* the external interrupts are optional and xway only */ | ||
439 | eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu-xway"); | ||
440 | if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) { | ||
441 | /* find out how many external irq sources we have */ | ||
442 | exin_avail = of_irq_count(eiu_node); | ||
443 | |||
444 | if (exin_avail > MAX_EIU) | ||
445 | exin_avail = MAX_EIU; | ||
446 | |||
447 | ret = of_irq_to_resource_table(eiu_node, | ||
448 | ltq_eiu_irq, exin_avail); | ||
449 | if (ret != exin_avail) | ||
450 | panic("failed to load external irq resources"); | ||
451 | |||
452 | if (request_mem_region(res.start, resource_size(&res), | ||
453 | res.name) < 0) | ||
454 | pr_err("Failed to request eiu memory"); | ||
455 | |||
456 | ltq_eiu_membase = ioremap_nocache(res.start, | ||
457 | resource_size(&res)); | ||
458 | if (!ltq_eiu_membase) | ||
459 | panic("Failed to remap eiu memory"); | ||
460 | } | ||
461 | |||
461 | return 0; | 462 | return 0; |
462 | } | 463 | } |
463 | 464 | ||
465 | int get_c0_perfcount_int(void) | ||
466 | { | ||
467 | return ltq_perfcount_irq; | ||
468 | } | ||
469 | |||
464 | unsigned int get_c0_compare_int(void) | 470 | unsigned int get_c0_compare_int(void) |
465 | { | 471 | { |
466 | return MIPS_CPU_TIMER_IRQ; | 472 | return MIPS_CPU_TIMER_IRQ; |