9 #include <linux/bitops.h>
10 #include <linux/kernel.h>
11 #include <linux/module.h>
19 #define IRQ_BASE XTENSA_NR_IRQS
21 #define S6_GPIO_DATA 0x000
22 #define S6_GPIO_IS 0x404
23 #define S6_GPIO_IBE 0x408
24 #define S6_GPIO_IEV 0x40C
25 #define S6_GPIO_IE 0x410
26 #define S6_GPIO_RIS 0x414
27 #define S6_GPIO_MIS 0x418
28 #define S6_GPIO_IC 0x41C
29 #define S6_GPIO_AFSEL 0x420
30 #define S6_GPIO_DIR 0x800
31 #define S6_GPIO_BANK(nr) ((nr) * 0x1000)
32 #define S6_GPIO_MASK(nr) (4 << (nr))
33 #define S6_GPIO_OFFSET(nr) \
34 (S6_GPIO_BANK((nr) >> 3) + S6_GPIO_MASK((nr) & 7))
36 static int direction_input(
struct gpio_chip *
chip,
unsigned int off)
42 static int get(
struct gpio_chip *
chip,
unsigned int off)
47 static int direction_output(
struct gpio_chip *
chip,
unsigned int off,
int val)
55 static void set(
struct gpio_chip *
chip,
unsigned int off,
int val)
60 static int to_irq(
struct gpio_chip *chip,
unsigned offset)
67 static struct gpio_chip gpiochip = {
69 .direction_input = direction_input,
71 .direction_output = direction_output,
100 static void unmask(
struct irq_data *d)
107 static int set_type(
struct irq_data *d,
unsigned int type)
131 __irq_set_handler_locked(irq, handler);
153 .irq_unmask = unmask,
154 .irq_set_type = set_type,
157 static u8 demux_masks[4];
159 static void demux_irqs(
unsigned int irq,
struct irq_desc *
desc)
161 struct irq_chip *chip = irq_desc_get_chip(desc);
162 u8 *
mask = irq_desc_get_handler_data(desc);
171 int n =
ffs(pending);
186 const signed char *
mapping = platform_irq_mappings[irq];
191 for(mask = 0; *mapping != -1; mapping++)
212 " parent irq %i\n", irq);
215 demux_masks[
n] =
mask;
225 irq_set_chained_handler(irq, demux_irqs);