diff options
Diffstat (limited to 'arch/powerpc/kernel/irq.c')
-rw-r--r-- | arch/powerpc/kernel/irq.c | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 8cf987809c66..01bdae35cb55 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -391,15 +391,14 @@ struct irq_host *irq_alloc_host(unsigned int revmap_type, | |||
391 | irq_map[i].host = host; | 391 | irq_map[i].host = host; |
392 | smp_wmb(); | 392 | smp_wmb(); |
393 | 393 | ||
394 | /* Clear some flags */ | 394 | /* Clear norequest flags */ |
395 | get_irq_desc(i)->status | 395 | get_irq_desc(i)->status &= ~IRQ_NOREQUEST; |
396 | &= ~(IRQ_NOREQUEST | IRQ_LEVEL); | ||
397 | 396 | ||
398 | /* Legacy flags are left to default at this point, | 397 | /* Legacy flags are left to default at this point, |
399 | * one can then use irq_create_mapping() to | 398 | * one can then use irq_create_mapping() to |
400 | * explicitely change them | 399 | * explicitely change them |
401 | */ | 400 | */ |
402 | ops->map(host, i, i, 0); | 401 | ops->map(host, i, i); |
403 | } | 402 | } |
404 | break; | 403 | break; |
405 | case IRQ_HOST_MAP_LINEAR: | 404 | case IRQ_HOST_MAP_LINEAR: |
@@ -457,13 +456,11 @@ void irq_set_virq_count(unsigned int count) | |||
457 | } | 456 | } |
458 | 457 | ||
459 | unsigned int irq_create_mapping(struct irq_host *host, | 458 | unsigned int irq_create_mapping(struct irq_host *host, |
460 | irq_hw_number_t hwirq, | 459 | irq_hw_number_t hwirq) |
461 | unsigned int flags) | ||
462 | { | 460 | { |
463 | unsigned int virq, hint; | 461 | unsigned int virq, hint; |
464 | 462 | ||
465 | pr_debug("irq: irq_create_mapping(0x%p, 0x%lx, 0x%x)\n", | 463 | pr_debug("irq: irq_create_mapping(0x%p, 0x%lx)\n", host, hwirq); |
466 | host, hwirq, flags); | ||
467 | 464 | ||
468 | /* Look for default host if nececssary */ | 465 | /* Look for default host if nececssary */ |
469 | if (host == NULL) | 466 | if (host == NULL) |
@@ -482,7 +479,6 @@ unsigned int irq_create_mapping(struct irq_host *host, | |||
482 | virq = irq_find_mapping(host, hwirq); | 479 | virq = irq_find_mapping(host, hwirq); |
483 | if (virq != IRQ_NONE) { | 480 | if (virq != IRQ_NONE) { |
484 | pr_debug("irq: -> existing mapping on virq %d\n", virq); | 481 | pr_debug("irq: -> existing mapping on virq %d\n", virq); |
485 | host->ops->map(host, virq, hwirq, flags); | ||
486 | return virq; | 482 | return virq; |
487 | } | 483 | } |
488 | 484 | ||
@@ -504,18 +500,18 @@ unsigned int irq_create_mapping(struct irq_host *host, | |||
504 | } | 500 | } |
505 | pr_debug("irq: -> obtained virq %d\n", virq); | 501 | pr_debug("irq: -> obtained virq %d\n", virq); |
506 | 502 | ||
507 | /* Clear some flags */ | 503 | /* Clear IRQ_NOREQUEST flag */ |
508 | get_irq_desc(virq)->status &= ~(IRQ_NOREQUEST | IRQ_LEVEL); | 504 | get_irq_desc(virq)->status &= ~IRQ_NOREQUEST; |
509 | 505 | ||
510 | /* map it */ | 506 | /* map it */ |
511 | if (host->ops->map(host, virq, hwirq, flags)) { | 507 | smp_wmb(); |
508 | irq_map[virq].hwirq = hwirq; | ||
509 | smp_mb(); | ||
510 | if (host->ops->map(host, virq, hwirq)) { | ||
512 | pr_debug("irq: -> mapping failed, freeing\n"); | 511 | pr_debug("irq: -> mapping failed, freeing\n"); |
513 | irq_free_virt(virq, 1); | 512 | irq_free_virt(virq, 1); |
514 | return NO_IRQ; | 513 | return NO_IRQ; |
515 | } | 514 | } |
516 | smp_wmb(); | ||
517 | irq_map[virq].hwirq = hwirq; | ||
518 | smp_mb(); | ||
519 | return virq; | 515 | return virq; |
520 | } | 516 | } |
521 | EXPORT_SYMBOL_GPL(irq_create_mapping); | 517 | EXPORT_SYMBOL_GPL(irq_create_mapping); |
@@ -525,25 +521,38 @@ extern unsigned int irq_create_of_mapping(struct device_node *controller, | |||
525 | { | 521 | { |
526 | struct irq_host *host; | 522 | struct irq_host *host; |
527 | irq_hw_number_t hwirq; | 523 | irq_hw_number_t hwirq; |
528 | unsigned int flags = IRQ_TYPE_NONE; | 524 | unsigned int type = IRQ_TYPE_NONE; |
525 | unsigned int virq; | ||
529 | 526 | ||
530 | if (controller == NULL) | 527 | if (controller == NULL) |
531 | host = irq_default_host; | 528 | host = irq_default_host; |
532 | else | 529 | else |
533 | host = irq_find_host(controller); | 530 | host = irq_find_host(controller); |
534 | if (host == NULL) | 531 | if (host == NULL) { |
532 | printk(KERN_WARNING "irq: no irq host found for %s !\n", | ||
533 | controller->full_name); | ||
535 | return NO_IRQ; | 534 | return NO_IRQ; |
535 | } | ||
536 | 536 | ||
537 | /* If host has no translation, then we assume interrupt line */ | 537 | /* If host has no translation, then we assume interrupt line */ |
538 | if (host->ops->xlate == NULL) | 538 | if (host->ops->xlate == NULL) |
539 | hwirq = intspec[0]; | 539 | hwirq = intspec[0]; |
540 | else { | 540 | else { |
541 | if (host->ops->xlate(host, controller, intspec, intsize, | 541 | if (host->ops->xlate(host, controller, intspec, intsize, |
542 | &hwirq, &flags)) | 542 | &hwirq, &type)) |
543 | return NO_IRQ; | 543 | return NO_IRQ; |
544 | } | 544 | } |
545 | 545 | ||
546 | return irq_create_mapping(host, hwirq, flags); | 546 | /* Create mapping */ |
547 | virq = irq_create_mapping(host, hwirq); | ||
548 | if (virq == NO_IRQ) | ||
549 | return virq; | ||
550 | |||
551 | /* Set type if specified and different than the current one */ | ||
552 | if (type != IRQ_TYPE_NONE && | ||
553 | type != (get_irq_desc(virq)->status & IRQF_TRIGGER_MASK)) | ||
554 | set_irq_type(virq, type); | ||
555 | return virq; | ||
547 | } | 556 | } |
548 | EXPORT_SYMBOL_GPL(irq_create_of_mapping); | 557 | EXPORT_SYMBOL_GPL(irq_create_of_mapping); |
549 | 558 | ||