diff options
| author | Boris BREZILLON <boris.brezillon@free-electrons.com> | 2014-07-10 14:25:40 -0400 |
|---|---|---|
| committer | Jason Cooper <jason@lakedaemon.net> | 2014-07-17 09:38:54 -0400 |
| commit | 3d61467f9bab36aee786f762730b73565dbef3bf (patch) | |
| tree | 233f2998088b3e660005aafc68b2c06bf289d9c1 | |
| parent | b2f579b58e93ded5916fb69a28cfc86e0ab951a6 (diff) | |
irqchip: atmel-aic: Implement RTC irq fixup
Provide an implementation to fix RTC irqs before enabling the irqchip.
This was previously done in arch/arm/mach-at91/sysirq_mask.c but as we're
trying to use standard implementation (IRQCHIP_DECLARE and automatic call
of irqchip_init within arch/arm/kernel/irq.c) we need to do those fixups
in the irqchip driver.
Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
Link: https://lkml.kernel.org/r/1405016741-2407-3-git-send-email-boris.brezillon@free-electrons.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
| -rw-r--r-- | drivers/irqchip/irq-atmel-aic-common.c | 28 | ||||
| -rw-r--r-- | drivers/irqchip/irq-atmel-aic-common.h | 2 |
2 files changed, 30 insertions, 0 deletions
diff --git a/drivers/irqchip/irq-atmel-aic-common.c b/drivers/irqchip/irq-atmel-aic-common.c index 4705bdbc6e7b..6ae3cdee0681 100644 --- a/drivers/irqchip/irq-atmel-aic-common.c +++ b/drivers/irqchip/irq-atmel-aic-common.c | |||
| @@ -139,6 +139,34 @@ static void __init aic_common_ext_irq_of_init(struct irq_domain *domain) | |||
| 139 | } | 139 | } |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | #define AT91_RTC_IDR 0x24 | ||
| 143 | #define AT91_RTC_IMR 0x28 | ||
| 144 | #define AT91_RTC_IRQ_MASK 0x1f | ||
| 145 | |||
| 146 | void __init aic_common_rtc_irq_fixup(struct device_node *root) | ||
| 147 | { | ||
| 148 | struct device_node *np; | ||
| 149 | void __iomem *regs; | ||
| 150 | |||
| 151 | np = of_find_compatible_node(root, NULL, "atmel,at91rm9200-rtc"); | ||
| 152 | if (!np) | ||
| 153 | np = of_find_compatible_node(root, NULL, | ||
| 154 | "atmel,at91sam9x5-rtc"); | ||
| 155 | |||
| 156 | if (!np) | ||
| 157 | return; | ||
| 158 | |||
| 159 | regs = of_iomap(np, 0); | ||
| 160 | of_node_put(np); | ||
| 161 | |||
| 162 | if (!regs) | ||
| 163 | return; | ||
| 164 | |||
| 165 | writel(AT91_RTC_IRQ_MASK, regs + AT91_RTC_IDR); | ||
| 166 | |||
| 167 | iounmap(regs); | ||
| 168 | } | ||
| 169 | |||
| 142 | void __init aic_common_irq_fixup(const struct of_device_id *matches) | 170 | void __init aic_common_irq_fixup(const struct of_device_id *matches) |
| 143 | { | 171 | { |
| 144 | struct device_node *root = of_find_node_by_path("/"); | 172 | struct device_node *root = of_find_node_by_path("/"); |
diff --git a/drivers/irqchip/irq-atmel-aic-common.h b/drivers/irqchip/irq-atmel-aic-common.h index aa0a42c36a7f..90aa00e918d6 100644 --- a/drivers/irqchip/irq-atmel-aic-common.h +++ b/drivers/irqchip/irq-atmel-aic-common.h | |||
| @@ -32,6 +32,8 @@ struct irq_domain *__init aic_common_of_init(struct device_node *node, | |||
| 32 | const struct irq_domain_ops *ops, | 32 | const struct irq_domain_ops *ops, |
| 33 | const char *name, int nirqs); | 33 | const char *name, int nirqs); |
| 34 | 34 | ||
| 35 | void __init aic_common_rtc_irq_fixup(struct device_node *root); | ||
| 36 | |||
| 35 | void __init aic_common_irq_fixup(const struct of_device_id *matches); | 37 | void __init aic_common_irq_fixup(const struct of_device_id *matches); |
| 36 | 38 | ||
| 37 | #endif /* __IRQ_ATMEL_AIC_COMMON_H */ | 39 | #endif /* __IRQ_ATMEL_AIC_COMMON_H */ |
