diff options
Diffstat (limited to 'arch/powerpc/sysdev/mpic.c')
-rw-r--r-- | arch/powerpc/sysdev/mpic.c | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index 0f7c6718d261..f91c065bed5a 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c | |||
@@ -361,7 +361,7 @@ static inline void mpic_ht_end_irq(struct mpic *mpic, unsigned int source) | |||
361 | } | 361 | } |
362 | 362 | ||
363 | static void mpic_startup_ht_interrupt(struct mpic *mpic, unsigned int source, | 363 | static void mpic_startup_ht_interrupt(struct mpic *mpic, unsigned int source, |
364 | unsigned int irqflags) | 364 | bool level) |
365 | { | 365 | { |
366 | struct mpic_irq_fixup *fixup = &mpic->fixups[source]; | 366 | struct mpic_irq_fixup *fixup = &mpic->fixups[source]; |
367 | unsigned long flags; | 367 | unsigned long flags; |
@@ -370,14 +370,14 @@ static void mpic_startup_ht_interrupt(struct mpic *mpic, unsigned int source, | |||
370 | if (fixup->base == NULL) | 370 | if (fixup->base == NULL) |
371 | return; | 371 | return; |
372 | 372 | ||
373 | DBG("startup_ht_interrupt(0x%x, 0x%x) index: %d\n", | 373 | DBG("startup_ht_interrupt(0x%x) index: %d\n", |
374 | source, irqflags, fixup->index); | 374 | source, fixup->index); |
375 | raw_spin_lock_irqsave(&mpic->fixup_lock, flags); | 375 | raw_spin_lock_irqsave(&mpic->fixup_lock, flags); |
376 | /* Enable and configure */ | 376 | /* Enable and configure */ |
377 | writeb(0x10 + 2 * fixup->index, fixup->base + 2); | 377 | writeb(0x10 + 2 * fixup->index, fixup->base + 2); |
378 | tmp = readl(fixup->base + 4); | 378 | tmp = readl(fixup->base + 4); |
379 | tmp &= ~(0x23U); | 379 | tmp &= ~(0x23U); |
380 | if (irqflags & IRQ_LEVEL) | 380 | if (level) |
381 | tmp |= 0x22; | 381 | tmp |= 0x22; |
382 | writel(tmp, fixup->base + 4); | 382 | writel(tmp, fixup->base + 4); |
383 | raw_spin_unlock_irqrestore(&mpic->fixup_lock, flags); | 383 | raw_spin_unlock_irqrestore(&mpic->fixup_lock, flags); |
@@ -389,8 +389,7 @@ static void mpic_startup_ht_interrupt(struct mpic *mpic, unsigned int source, | |||
389 | #endif | 389 | #endif |
390 | } | 390 | } |
391 | 391 | ||
392 | static void mpic_shutdown_ht_interrupt(struct mpic *mpic, unsigned int source, | 392 | static void mpic_shutdown_ht_interrupt(struct mpic *mpic, unsigned int source) |
393 | unsigned int irqflags) | ||
394 | { | 393 | { |
395 | struct mpic_irq_fixup *fixup = &mpic->fixups[source]; | 394 | struct mpic_irq_fixup *fixup = &mpic->fixups[source]; |
396 | unsigned long flags; | 395 | unsigned long flags; |
@@ -399,7 +398,7 @@ static void mpic_shutdown_ht_interrupt(struct mpic *mpic, unsigned int source, | |||
399 | if (fixup->base == NULL) | 398 | if (fixup->base == NULL) |
400 | return; | 399 | return; |
401 | 400 | ||
402 | DBG("shutdown_ht_interrupt(0x%x, 0x%x)\n", source, irqflags); | 401 | DBG("shutdown_ht_interrupt(0x%x)\n", source); |
403 | 402 | ||
404 | /* Disable */ | 403 | /* Disable */ |
405 | raw_spin_lock_irqsave(&mpic->fixup_lock, flags); | 404 | raw_spin_lock_irqsave(&mpic->fixup_lock, flags); |
@@ -616,7 +615,7 @@ static struct mpic *mpic_find(unsigned int irq) | |||
616 | if (irq < NUM_ISA_INTERRUPTS) | 615 | if (irq < NUM_ISA_INTERRUPTS) |
617 | return NULL; | 616 | return NULL; |
618 | 617 | ||
619 | return get_irq_chip_data(irq); | 618 | return irq_get_chip_data(irq); |
620 | } | 619 | } |
621 | 620 | ||
622 | /* Determine if the linux irq is an IPI */ | 621 | /* Determine if the linux irq is an IPI */ |
@@ -650,7 +649,7 @@ static inline struct mpic * mpic_from_ipi(struct irq_data *d) | |||
650 | /* Get the mpic structure from the irq number */ | 649 | /* Get the mpic structure from the irq number */ |
651 | static inline struct mpic * mpic_from_irq(unsigned int irq) | 650 | static inline struct mpic * mpic_from_irq(unsigned int irq) |
652 | { | 651 | { |
653 | return get_irq_chip_data(irq); | 652 | return irq_get_chip_data(irq); |
654 | } | 653 | } |
655 | 654 | ||
656 | /* Get the mpic structure from the irq data */ | 655 | /* Get the mpic structure from the irq data */ |
@@ -738,7 +737,7 @@ static void mpic_unmask_ht_irq(struct irq_data *d) | |||
738 | 737 | ||
739 | mpic_unmask_irq(d); | 738 | mpic_unmask_irq(d); |
740 | 739 | ||
741 | if (irq_to_desc(d->irq)->status & IRQ_LEVEL) | 740 | if (irqd_is_level_type(d)) |
742 | mpic_ht_end_irq(mpic, src); | 741 | mpic_ht_end_irq(mpic, src); |
743 | } | 742 | } |
744 | 743 | ||
@@ -748,7 +747,7 @@ static unsigned int mpic_startup_ht_irq(struct irq_data *d) | |||
748 | unsigned int src = mpic_irq_to_hw(d->irq); | 747 | unsigned int src = mpic_irq_to_hw(d->irq); |
749 | 748 | ||
750 | mpic_unmask_irq(d); | 749 | mpic_unmask_irq(d); |
751 | mpic_startup_ht_interrupt(mpic, src, irq_to_desc(d->irq)->status); | 750 | mpic_startup_ht_interrupt(mpic, src, irqd_is_level_type(d)); |
752 | 751 | ||
753 | return 0; | 752 | return 0; |
754 | } | 753 | } |
@@ -758,7 +757,7 @@ static void mpic_shutdown_ht_irq(struct irq_data *d) | |||
758 | struct mpic *mpic = mpic_from_irq_data(d); | 757 | struct mpic *mpic = mpic_from_irq_data(d); |
759 | unsigned int src = mpic_irq_to_hw(d->irq); | 758 | unsigned int src = mpic_irq_to_hw(d->irq); |
760 | 759 | ||
761 | mpic_shutdown_ht_interrupt(mpic, src, irq_to_desc(d->irq)->status); | 760 | mpic_shutdown_ht_interrupt(mpic, src); |
762 | mpic_mask_irq(d); | 761 | mpic_mask_irq(d); |
763 | } | 762 | } |
764 | 763 | ||
@@ -775,7 +774,7 @@ static void mpic_end_ht_irq(struct irq_data *d) | |||
775 | * latched another edge interrupt coming in anyway | 774 | * latched another edge interrupt coming in anyway |
776 | */ | 775 | */ |
777 | 776 | ||
778 | if (irq_to_desc(d->irq)->status & IRQ_LEVEL) | 777 | if (irqd_is_level_type(d)) |
779 | mpic_ht_end_irq(mpic, src); | 778 | mpic_ht_end_irq(mpic, src); |
780 | mpic_eoi(mpic); | 779 | mpic_eoi(mpic); |
781 | } | 780 | } |
@@ -864,7 +863,6 @@ int mpic_set_irq_type(struct irq_data *d, unsigned int flow_type) | |||
864 | { | 863 | { |
865 | struct mpic *mpic = mpic_from_irq_data(d); | 864 | struct mpic *mpic = mpic_from_irq_data(d); |
866 | unsigned int src = mpic_irq_to_hw(d->irq); | 865 | unsigned int src = mpic_irq_to_hw(d->irq); |
867 | struct irq_desc *desc = irq_to_desc(d->irq); | ||
868 | unsigned int vecpri, vold, vnew; | 866 | unsigned int vecpri, vold, vnew; |
869 | 867 | ||
870 | DBG("mpic: set_irq_type(mpic:@%p,virq:%d,src:0x%x,type:0x%x)\n", | 868 | DBG("mpic: set_irq_type(mpic:@%p,virq:%d,src:0x%x,type:0x%x)\n", |
@@ -879,10 +877,7 @@ int mpic_set_irq_type(struct irq_data *d, unsigned int flow_type) | |||
879 | if (flow_type == IRQ_TYPE_NONE) | 877 | if (flow_type == IRQ_TYPE_NONE) |
880 | flow_type = IRQ_TYPE_LEVEL_LOW; | 878 | flow_type = IRQ_TYPE_LEVEL_LOW; |
881 | 879 | ||
882 | desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL); | 880 | irqd_set_trigger_type(d, flow_type); |
883 | desc->status |= flow_type & IRQ_TYPE_SENSE_MASK; | ||
884 | if (flow_type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) | ||
885 | desc->status |= IRQ_LEVEL; | ||
886 | 881 | ||
887 | if (mpic_is_ht_interrupt(mpic, src)) | 882 | if (mpic_is_ht_interrupt(mpic, src)) |
888 | vecpri = MPIC_VECPRI_POLARITY_POSITIVE | | 883 | vecpri = MPIC_VECPRI_POLARITY_POSITIVE | |
@@ -897,7 +892,7 @@ int mpic_set_irq_type(struct irq_data *d, unsigned int flow_type) | |||
897 | if (vold != vnew) | 892 | if (vold != vnew) |
898 | mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI), vnew); | 893 | mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI), vnew); |
899 | 894 | ||
900 | return 0; | 895 | return IRQ_SET_MASK_OK_NOCOPY;; |
901 | } | 896 | } |
902 | 897 | ||
903 | void mpic_set_vector(unsigned int virq, unsigned int vector) | 898 | void mpic_set_vector(unsigned int virq, unsigned int vector) |
@@ -983,8 +978,8 @@ static int mpic_host_map(struct irq_host *h, unsigned int virq, | |||
983 | WARN_ON(!(mpic->flags & MPIC_PRIMARY)); | 978 | WARN_ON(!(mpic->flags & MPIC_PRIMARY)); |
984 | 979 | ||
985 | DBG("mpic: mapping as IPI\n"); | 980 | DBG("mpic: mapping as IPI\n"); |
986 | set_irq_chip_data(virq, mpic); | 981 | irq_set_chip_data(virq, mpic); |
987 | set_irq_chip_and_handler(virq, &mpic->hc_ipi, | 982 | irq_set_chip_and_handler(virq, &mpic->hc_ipi, |
988 | handle_percpu_irq); | 983 | handle_percpu_irq); |
989 | return 0; | 984 | return 0; |
990 | } | 985 | } |
@@ -1006,11 +1001,11 @@ static int mpic_host_map(struct irq_host *h, unsigned int virq, | |||
1006 | 1001 | ||
1007 | DBG("mpic: mapping to irq chip @%p\n", chip); | 1002 | DBG("mpic: mapping to irq chip @%p\n", chip); |
1008 | 1003 | ||
1009 | set_irq_chip_data(virq, mpic); | 1004 | irq_set_chip_data(virq, mpic); |
1010 | set_irq_chip_and_handler(virq, chip, handle_fasteoi_irq); | 1005 | irq_set_chip_and_handler(virq, chip, handle_fasteoi_irq); |
1011 | 1006 | ||
1012 | /* Set default irq type */ | 1007 | /* Set default irq type */ |
1013 | set_irq_type(virq, IRQ_TYPE_NONE); | 1008 | irq_set_irq_type(virq, IRQ_TYPE_NONE); |
1014 | 1009 | ||
1015 | /* If the MPIC was reset, then all vectors have already been | 1010 | /* If the MPIC was reset, then all vectors have already been |
1016 | * initialized. Otherwise, a per source lazy initialization | 1011 | * initialized. Otherwise, a per source lazy initialization |