diff options
author | Kevin Cernekee <cernekee@gmail.com> | 2014-11-06 22:44:18 -0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2015-11-07 10:12:34 +0800 |
commit | 666eeee7c4ff323b56e98e76fb9371e21554dc30 (patch) | |
tree | ec199cf148e90ac2c8100f6db8a1350399a36a44 /include | |
parent | 1422d7115b42adba3e7b73d194a4c2045348a402 (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>
(cherry picked from commit 2b28037632b1e62b92c0616f08652d806008c80d)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
Diffstat (limited to 'include')
-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 b432ddf12ea1..4ae411288364 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -709,6 +709,8 @@ struct irq_chip_type { * struct irq_chip_generic - Generic irq chip data structure * @lock: Lock to protect register and cache data access * @reg_base: Register base address (virtual) + * @reg_readl: Alternate I/O accessor (defaults to readl if NULL) + * @reg_writel: Alternate I/O accessor (defaults to writel if NULL) * @irq_base: Interrupt base nr for this chip * @irq_cnt: Number of interrupts handled by this chip * @mask_cache: Cached mask register shared between all chip types @@ -733,6 +735,8 @@ struct irq_chip_type { struct irq_chip_generic { raw_spinlock_t lock; void __iomem *reg_base; + u32 (*reg_readl)(void __iomem *addr); + void (*reg_writel)(u32 val, void __iomem *addr); unsigned int irq_base; unsigned int irq_cnt; u32 mask_cache; @@ -841,13 +845,19 @@ static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } static inline void irq_reg_writel(struct irq_chip_generic *gc, u32 val, int reg_offset) { - writel(val, gc->reg_base + reg_offset); + if (gc->reg_writel) + gc->reg_writel(val, gc->reg_base + reg_offset); + else + writel(val, gc->reg_base + reg_offset); } static inline u32 irq_reg_readl(struct irq_chip_generic *gc, int reg_offset) { - return readl(gc->reg_base + reg_offset); + if (gc->reg_readl) + return gc->reg_readl(gc->reg_base + reg_offset); + else + return readl(gc->reg_base + reg_offset); } #endif /* _LINUX_IRQ_H */ |