diff options
author | Magnus Damm <damm@igel.co.jp> | 2007-06-15 05:56:19 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2007-06-15 05:56:19 -0400 |
commit | 68abdbbb03476a60d932eeba0035dd5069afec38 (patch) | |
tree | de3854f76d6d9aec121c432a3cd276bb756003c9 /include/asm-sh | |
parent | 50f63f2518ee68bc132d357d2b6fdb7f60ef79e0 (diff) |
sh: rework ipr code
This patch reworks the ipr code by grouping the offset array together
with the ipr_data structure in a new data structure called ipr_desc.
This new structure also contains the name of the controller in struct
irq_chip. The idea behind putting struct irq_chip in there is that we
can use offsetof() to locate the base addresses in the irq_chip
callbacks. This strategy has much in common with the recently merged
intc2 code.
One logic change has been made - the original ipr code enabled the
interrupts by default but with this patch they are all disabled by
default.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include/asm-sh')
-rw-r--r-- | include/asm-sh/hw_irq.h | 23 | ||||
-rw-r--r-- | include/asm-sh/irq.h | 30 | ||||
-rw-r--r-- | include/asm-sh/sh03/io.h | 4 | ||||
-rw-r--r-- | include/asm-sh/snapgear.h | 4 |
4 files changed, 23 insertions, 38 deletions
diff --git a/include/asm-sh/hw_irq.h b/include/asm-sh/hw_irq.h index f9dfdc04aef5..4ca3f765bacc 100644 --- a/include/asm-sh/hw_irq.h +++ b/include/asm-sh/hw_irq.h | |||
@@ -24,4 +24,27 @@ struct intc2_desc { | |||
24 | void register_intc2_controller(struct intc2_desc *); | 24 | void register_intc2_controller(struct intc2_desc *); |
25 | void init_IRQ_intc2(void); | 25 | void init_IRQ_intc2(void); |
26 | 26 | ||
27 | struct ipr_data { | ||
28 | unsigned char irq; | ||
29 | unsigned char ipr_idx; /* Index for the IPR registered */ | ||
30 | unsigned char shift; /* Number of bits to shift the data */ | ||
31 | unsigned char priority; /* The priority */ | ||
32 | }; | ||
33 | |||
34 | struct ipr_desc { | ||
35 | unsigned long *ipr_offsets; | ||
36 | unsigned int nr_offsets; | ||
37 | struct ipr_data *ipr_data; | ||
38 | unsigned int nr_irqs; | ||
39 | struct irq_chip chip; | ||
40 | }; | ||
41 | |||
42 | void register_ipr_controller(struct ipr_desc *); | ||
43 | void init_IRQ_ipr(void); | ||
44 | |||
45 | /* | ||
46 | * Enable individual interrupt mode for external IPR IRQs. | ||
47 | */ | ||
48 | void ipr_irq_enable_irlm(void); | ||
49 | |||
27 | #endif /* __ASM_SH_HW_IRQ_H */ | 50 | #endif /* __ASM_SH_HW_IRQ_H */ |
diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h index c247b733a7d6..c61d902b8bff 100644 --- a/include/asm-sh/irq.h +++ b/include/asm-sh/irq.h | |||
@@ -31,37 +31,7 @@ extern unsigned short *irq_mask_register; | |||
31 | * PINT IRQs | 31 | * PINT IRQs |
32 | */ | 32 | */ |
33 | void init_IRQ_pint(void); | 33 | void init_IRQ_pint(void); |
34 | |||
35 | /* | ||
36 | * The shift value is now the number of bits to shift, not the number of | ||
37 | * bits/4. This is to make it easier to read the value directly from the | ||
38 | * datasheets. The IPR address, addr, will be set from ipr_idx via the | ||
39 | * map_ipridx_to_addr function. | ||
40 | */ | ||
41 | struct ipr_data { | ||
42 | unsigned int irq; | ||
43 | int ipr_idx; /* Index for the IPR registered */ | ||
44 | int shift; /* Number of bits to shift the data */ | ||
45 | int priority; /* The priority */ | ||
46 | unsigned int addr; /* Address of Interrupt Priority Register */ | ||
47 | }; | ||
48 | |||
49 | /* | ||
50 | * Given an IPR IDX, map the value to an IPR register address. | ||
51 | */ | ||
52 | unsigned int map_ipridx_to_addr(int idx); | ||
53 | |||
54 | /* | ||
55 | * Enable individual interrupt mode for external IPR IRQs. | ||
56 | */ | ||
57 | void ipr_irq_enable_irlm(void); | ||
58 | |||
59 | /* | ||
60 | * Function for "on chip support modules". | ||
61 | */ | ||
62 | void make_ipr_irq(struct ipr_data *table, unsigned int nr_irqs); | ||
63 | void make_imask_irq(unsigned int irq); | 34 | void make_imask_irq(unsigned int irq); |
64 | void init_IRQ_ipr(void); | ||
65 | 35 | ||
66 | static inline int generic_irq_demux(int irq) | 36 | static inline int generic_irq_demux(int irq) |
67 | { | 37 | { |
diff --git a/include/asm-sh/sh03/io.h b/include/asm-sh/sh03/io.h index df3b187ef883..4ff1eb900301 100644 --- a/include/asm-sh/sh03/io.h +++ b/include/asm-sh/sh03/io.h | |||
@@ -14,22 +14,18 @@ | |||
14 | #define INTC_IPRD 0xffd00010UL | 14 | #define INTC_IPRD 0xffd00010UL |
15 | 15 | ||
16 | #define IRL0_IRQ 2 | 16 | #define IRL0_IRQ 2 |
17 | #define IRL0_IPR_ADDR INTC_IPRD | ||
18 | #define IRL0_IPR_POS 3 | 17 | #define IRL0_IPR_POS 3 |
19 | #define IRL0_PRIORITY 13 | 18 | #define IRL0_PRIORITY 13 |
20 | 19 | ||
21 | #define IRL1_IRQ 5 | 20 | #define IRL1_IRQ 5 |
22 | #define IRL1_IPR_ADDR INTC_IPRD | ||
23 | #define IRL1_IPR_POS 2 | 21 | #define IRL1_IPR_POS 2 |
24 | #define IRL1_PRIORITY 10 | 22 | #define IRL1_PRIORITY 10 |
25 | 23 | ||
26 | #define IRL2_IRQ 8 | 24 | #define IRL2_IRQ 8 |
27 | #define IRL2_IPR_ADDR INTC_IPRD | ||
28 | #define IRL2_IPR_POS 1 | 25 | #define IRL2_IPR_POS 1 |
29 | #define IRL2_PRIORITY 7 | 26 | #define IRL2_PRIORITY 7 |
30 | 27 | ||
31 | #define IRL3_IRQ 11 | 28 | #define IRL3_IRQ 11 |
32 | #define IRL3_IPR_ADDR INTC_IPRD | ||
33 | #define IRL3_IPR_POS 0 | 29 | #define IRL3_IPR_POS 0 |
34 | #define IRL3_PRIORITY 4 | 30 | #define IRL3_PRIORITY 4 |
35 | 31 | ||
diff --git a/include/asm-sh/snapgear.h b/include/asm-sh/snapgear.h index 2d712e72c9e5..3554e3a74e99 100644 --- a/include/asm-sh/snapgear.h +++ b/include/asm-sh/snapgear.h | |||
@@ -20,22 +20,18 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #define IRL0_IRQ 2 | 22 | #define IRL0_IRQ 2 |
23 | #define IRL0_IPR_ADDR INTC_IPRD | ||
24 | #define IRL0_IPR_POS 3 | 23 | #define IRL0_IPR_POS 3 |
25 | #define IRL0_PRIORITY 13 | 24 | #define IRL0_PRIORITY 13 |
26 | 25 | ||
27 | #define IRL1_IRQ 5 | 26 | #define IRL1_IRQ 5 |
28 | #define IRL1_IPR_ADDR INTC_IPRD | ||
29 | #define IRL1_IPR_POS 2 | 27 | #define IRL1_IPR_POS 2 |
30 | #define IRL1_PRIORITY 10 | 28 | #define IRL1_PRIORITY 10 |
31 | 29 | ||
32 | #define IRL2_IRQ 8 | 30 | #define IRL2_IRQ 8 |
33 | #define IRL2_IPR_ADDR INTC_IPRD | ||
34 | #define IRL2_IPR_POS 1 | 31 | #define IRL2_IPR_POS 1 |
35 | #define IRL2_PRIORITY 7 | 32 | #define IRL2_PRIORITY 7 |
36 | 33 | ||
37 | #define IRL3_IRQ 11 | 34 | #define IRL3_IRQ 11 |
38 | #define IRL3_IPR_ADDR INTC_IPRD | ||
39 | #define IRL3_IPR_POS 0 | 35 | #define IRL3_IPR_POS 0 |
40 | #define IRL3_PRIORITY 4 | 36 | #define IRL3_PRIORITY 4 |
41 | #endif | 37 | #endif |