diff options
author | Kevin Cernekee <cernekee@gmail.com> | 2014-11-07 01:44:18 -0500 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2014-11-08 23:01:40 -0500 |
commit | 2b28037632b1e62b92c0616f08652d806008c80d (patch) | |
tree | 3b49ff067e4865e92e92a096d5aa7d92d302c94d | |
parent | 332fd7c4fef5f3b166e93decb07fd69eb24f7998 (diff) |
genirq: Generic chip: Allow irqchip drivers to override irq_reg_{readl,writel}
Currently, these I/O accessors always assume little endian 32-bit
registers (readl/writel). On some systems the IRQ registers need to be
accessed in BE mode or using 16-bit loads/stores, so we will provide a
way to override the default behavior.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Acked-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lkml.kernel.org/r/1415342669-30640-4-git-send-email-cernekee@gmail.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
-rw-r--r-- | include/linux/irq.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h index ed1135d32d80..0fecd95ba271 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -686,6 +686,8 @@ struct irq_chip_type { | |||
686 | * struct irq_chip_generic - Generic irq chip data structure | 686 | * struct irq_chip_generic - Generic irq chip data structure |
687 | * @lock: Lock to protect register and cache data access | 687 | * @lock: Lock to protect register and cache data access |
688 | * @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) | ||
689 | * @irq_base: Interrupt base nr for this chip | 691 | * @irq_base: Interrupt base nr for this chip |
690 | * @irq_cnt: Number of interrupts handled by this chip | 692 | * @irq_cnt: Number of interrupts handled by this chip |
691 | * @mask_cache: Cached mask register shared between all chip types | 693 | * @mask_cache: Cached mask register shared between all chip types |
@@ -710,6 +712,8 @@ struct irq_chip_type { | |||
710 | struct irq_chip_generic { | 712 | struct irq_chip_generic { |
711 | raw_spinlock_t lock; | 713 | raw_spinlock_t lock; |
712 | 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); | ||
713 | unsigned int irq_base; | 717 | unsigned int irq_base; |
714 | unsigned int irq_cnt; | 718 | unsigned int irq_cnt; |
715 | u32 mask_cache; | 719 | u32 mask_cache; |
@@ -818,13 +822,19 @@ static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } | |||
818 | static inline void irq_reg_writel(struct irq_chip_generic *gc, | 822 | static inline void irq_reg_writel(struct irq_chip_generic *gc, |
819 | u32 val, int reg_offset) | 823 | u32 val, int reg_offset) |
820 | { | 824 | { |
821 | writel(val, gc->reg_base + reg_offset); | 825 | if (gc->reg_writel) |
826 | gc->reg_writel(val, gc->reg_base + reg_offset); | ||
827 | else | ||
828 | writel(val, gc->reg_base + reg_offset); | ||
822 | } | 829 | } |
823 | 830 | ||
824 | static inline u32 irq_reg_readl(struct irq_chip_generic *gc, | 831 | static inline u32 irq_reg_readl(struct irq_chip_generic *gc, |
825 | int reg_offset) | 832 | int reg_offset) |
826 | { | 833 | { |
827 | return readl(gc->reg_base + reg_offset); | 834 | if (gc->reg_readl) |
835 | return gc->reg_readl(gc->reg_base + reg_offset); | ||
836 | else | ||
837 | return readl(gc->reg_base + reg_offset); | ||
828 | } | 838 | } |
829 | 839 | ||
830 | #endif /* _LINUX_IRQ_H */ | 840 | #endif /* _LINUX_IRQ_H */ |