16 #include <linux/sched.h>
17 #include <linux/mman.h>
23 #include <asm/pgtable.h>
25 #include <mach/hardware.h>
27 #include <asm/system_misc.h>
30 #include <mach/irqs.h>
35 #define IRQDBG(args...) printk(args)
37 #define IRQDBG(args...) do {} while(0)
56 static void mask_global_irq(
struct irq_data *
d)
64 static void unmask_global_irq(
struct irq_data *
d)
74 static void inline ack_gpio_irq(
struct irq_data *
d)
85 static void inline mask_gpio_irq(
struct irq_data *d)
95 static void inline unmask_gpio_irq(
struct irq_data *d)
103 h720x_gpio_handler(
unsigned int mask,
unsigned int irq,
106 IRQDBG(
"%s irq: %d\n", __func__, irq);
109 IRQDBG(
"handling irq %d\n", irq);
118 h720x_gpioa_demux_handler(
unsigned int irq_unused,
struct irq_desc *desc)
120 unsigned int mask, irq;
123 irq = IRQ_CHAINED_GPIOA(0);
124 IRQDBG(
"%s mask: 0x%08x irq: %d\n", __func__, mask,irq);
125 h720x_gpio_handler(mask, irq, desc);
129 h720x_gpiob_demux_handler(
unsigned int irq_unused,
struct irq_desc *desc)
131 unsigned int mask, irq;
133 irq = IRQ_CHAINED_GPIOB(0);
134 IRQDBG(
"%s mask: 0x%08x irq: %d\n", __func__, mask,irq);
135 h720x_gpio_handler(mask, irq, desc);
139 h720x_gpioc_demux_handler(
unsigned int irq_unused,
struct irq_desc *desc)
141 unsigned int mask, irq;
144 irq = IRQ_CHAINED_GPIOC(0);
145 IRQDBG(
"%s mask: 0x%08x irq: %d\n", __func__, mask,irq);
146 h720x_gpio_handler(mask, irq, desc);
150 h720x_gpiod_demux_handler(
unsigned int irq_unused,
struct irq_desc *desc)
152 unsigned int mask, irq;
155 irq = IRQ_CHAINED_GPIOD(0);
156 IRQDBG(
"%s mask: 0x%08x irq: %d\n", __func__, mask,irq);
157 h720x_gpio_handler(mask, irq, desc);
160 #ifdef CONFIG_CPU_H7202
162 h720x_gpioe_demux_handler(
unsigned int irq_unused,
struct irq_desc *desc)
164 unsigned int mask, irq;
167 irq = IRQ_CHAINED_GPIOE(0);
168 IRQDBG(
"%s mask: 0x%08x irq: %d\n", __func__, mask,irq);
169 h720x_gpio_handler(mask, irq, desc);
173 static struct irq_chip h720x_global_chip = {
174 .irq_ack = mask_global_irq,
175 .irq_mask = mask_global_irq,
176 .irq_unmask = unmask_global_irq,
179 static struct irq_chip h720x_gpio_chip = {
180 .irq_ack = ack_gpio_irq,
181 .irq_mask = mask_gpio_irq,
182 .irq_unmask = unmask_gpio_irq,
202 for (irq = 0; irq < NR_GLBL_IRQS; irq++) {
203 irq_set_chip_and_handler(irq, &h720x_global_chip,
209 for (irq = IRQ_CHAINED_GPIOA(0) ; irq <= IRQ_CHAINED_GPIOD(31); irq++) {
210 irq_set_chip_and_handler(irq, &h720x_gpio_chip,
214 irq_set_chained_handler(IRQ_GPIOA, h720x_gpioa_demux_handler);
215 irq_set_chained_handler(IRQ_GPIOB, h720x_gpiob_demux_handler);
216 irq_set_chained_handler(IRQ_GPIOC, h720x_gpioc_demux_handler);
217 irq_set_chained_handler(IRQ_GPIOD, h720x_gpiod_demux_handler);
219 #ifdef CONFIG_CPU_H7202
220 for (irq = IRQ_CHAINED_GPIOE(0) ; irq <= IRQ_CHAINED_GPIOE(31); irq++) {
221 irq_set_chip_and_handler(irq, &h720x_gpio_chip,
225 irq_set_chained_handler(IRQ_GPIOE, h720x_gpioe_demux_handler);
252 static void h720x__idle(
void)
262 static int __init h720x_idle_init(
void)