diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/irq.h | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h index 03f48d936f66..8588e5efe577 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
21 | #include <linux/topology.h> | 21 | #include <linux/topology.h> |
22 | #include <linux/wait.h> | 22 | #include <linux/wait.h> |
23 | #include <linux/io.h> | ||
23 | 24 | ||
24 | #include <asm/irq.h> | 25 | #include <asm/irq.h> |
25 | #include <asm/ptrace.h> | 26 | #include <asm/ptrace.h> |
@@ -639,13 +640,6 @@ void arch_teardown_hwirq(unsigned int irq); | |||
639 | void irq_init_desc(unsigned int irq); | 640 | void irq_init_desc(unsigned int irq); |
640 | #endif | 641 | #endif |
641 | 642 | ||
642 | #ifndef irq_reg_writel | ||
643 | # define irq_reg_writel(val, addr) writel(val, addr) | ||
644 | #endif | ||
645 | #ifndef irq_reg_readl | ||
646 | # define irq_reg_readl(addr) readl(addr) | ||
647 | #endif | ||
648 | |||
649 | /** | 643 | /** |
650 | * struct irq_chip_regs - register offsets for struct irq_gci | 644 | * struct irq_chip_regs - register offsets for struct irq_gci |
651 | * @enable: Enable register offset to reg_base | 645 | * @enable: Enable register offset to reg_base |
@@ -692,6 +686,8 @@ struct irq_chip_type { | |||
692 | * struct irq_chip_generic - Generic irq chip data structure | 686 | * struct irq_chip_generic - Generic irq chip data structure |
693 | * @lock: Lock to protect register and cache data access | 687 | * @lock: Lock to protect register and cache data access |
694 | * @reg_base: Register base address (virtual) | 688 | * @reg_base: Register base address (virtual) |
689 | * @reg_readl: Alternate I/O accessor (defaults to readl if NULL) | ||
690 | * @reg_writel: Alternate I/O accessor (defaults to writel if NULL) | ||
695 | * @irq_base: Interrupt base nr for this chip | 691 | * @irq_base: Interrupt base nr for this chip |
696 | * @irq_cnt: Number of interrupts handled by this chip | 692 | * @irq_cnt: Number of interrupts handled by this chip |
697 | * @mask_cache: Cached mask register shared between all chip types | 693 | * @mask_cache: Cached mask register shared between all chip types |
@@ -716,6 +712,8 @@ struct irq_chip_type { | |||
716 | struct irq_chip_generic { | 712 | struct irq_chip_generic { |
717 | raw_spinlock_t lock; | 713 | raw_spinlock_t lock; |
718 | void __iomem *reg_base; | 714 | void __iomem *reg_base; |
715 | u32 (*reg_readl)(void __iomem *addr); | ||
716 | void (*reg_writel)(u32 val, void __iomem *addr); | ||
719 | unsigned int irq_base; | 717 | unsigned int irq_base; |
720 | unsigned int irq_cnt; | 718 | unsigned int irq_cnt; |
721 | u32 mask_cache; | 719 | u32 mask_cache; |
@@ -740,12 +738,14 @@ struct irq_chip_generic { | |||
740 | * the parent irq. Usually GPIO implementations | 738 | * the parent irq. Usually GPIO implementations |
741 | * @IRQ_GC_MASK_CACHE_PER_TYPE: Mask cache is chip type private | 739 | * @IRQ_GC_MASK_CACHE_PER_TYPE: Mask cache is chip type private |
742 | * @IRQ_GC_NO_MASK: Do not calculate irq_data->mask | 740 | * @IRQ_GC_NO_MASK: Do not calculate irq_data->mask |
741 | * @IRQ_GC_BE_IO: Use big-endian register accesses (default: LE) | ||
743 | */ | 742 | */ |
744 | enum irq_gc_flags { | 743 | enum irq_gc_flags { |
745 | IRQ_GC_INIT_MASK_CACHE = 1 << 0, | 744 | IRQ_GC_INIT_MASK_CACHE = 1 << 0, |
746 | IRQ_GC_INIT_NESTED_LOCK = 1 << 1, | 745 | IRQ_GC_INIT_NESTED_LOCK = 1 << 1, |
747 | IRQ_GC_MASK_CACHE_PER_TYPE = 1 << 2, | 746 | IRQ_GC_MASK_CACHE_PER_TYPE = 1 << 2, |
748 | IRQ_GC_NO_MASK = 1 << 3, | 747 | IRQ_GC_NO_MASK = 1 << 3, |
748 | IRQ_GC_BE_IO = 1 << 4, | ||
749 | }; | 749 | }; |
750 | 750 | ||
751 | /* | 751 | /* |
@@ -821,4 +821,22 @@ static inline void irq_gc_lock(struct irq_chip_generic *gc) { } | |||
821 | static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } | 821 | static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } |
822 | #endif | 822 | #endif |
823 | 823 | ||
824 | static inline void irq_reg_writel(struct irq_chip_generic *gc, | ||
825 | u32 val, int reg_offset) | ||
826 | { | ||
827 | if (gc->reg_writel) | ||
828 | gc->reg_writel(val, gc->reg_base + reg_offset); | ||
829 | else | ||
830 | writel(val, gc->reg_base + reg_offset); | ||
831 | } | ||
832 | |||
833 | static inline u32 irq_reg_readl(struct irq_chip_generic *gc, | ||
834 | int reg_offset) | ||
835 | { | ||
836 | if (gc->reg_readl) | ||
837 | return gc->reg_readl(gc->reg_base + reg_offset); | ||
838 | else | ||
839 | return readl(gc->reg_base + reg_offset); | ||
840 | } | ||
841 | |||
824 | #endif /* _LINUX_IRQ_H */ | 842 | #endif /* _LINUX_IRQ_H */ |