diff options
Diffstat (limited to 'arch/sh/kernel/cpu/irq')
-rw-r--r-- | arch/sh/kernel/cpu/irq/intc2.c | 63 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/irq/ipr.c | 59 |
2 files changed, 61 insertions, 61 deletions
diff --git a/arch/sh/kernel/cpu/irq/intc2.c b/arch/sh/kernel/cpu/irq/intc2.c index d8e22f4ff0f0..cc5221390e09 100644 --- a/arch/sh/kernel/cpu/irq/intc2.c +++ b/arch/sh/kernel/cpu/irq/intc2.c | |||
@@ -13,36 +13,31 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <linux/io.h> | 15 | #include <linux/io.h> |
16 | #include <asm/smp.h> | ||
16 | 17 | ||
17 | #if defined(CONFIG_CPU_SUBTYPE_SH7760) | 18 | static inline struct intc2_desc *get_intc2_desc(unsigned int irq) |
18 | #define INTC2_BASE 0xfe080000 | 19 | { |
19 | #define INTC2_INTMSK (INTC2_BASE + 0x40) | 20 | struct irq_chip *chip = get_irq_chip(irq); |
20 | #define INTC2_INTMSKCLR (INTC2_BASE + 0x60) | 21 | return (void *)((char *)chip - offsetof(struct intc2_desc, chip)); |
21 | #elif defined(CONFIG_CPU_SUBTYPE_SH7780) || \ | 22 | } |
22 | defined(CONFIG_CPU_SUBTYPE_SH7785) | ||
23 | #define INTC2_BASE 0xffd40000 | ||
24 | #define INTC2_INTMSK (INTC2_BASE + 0x38) | ||
25 | #define INTC2_INTMSKCLR (INTC2_BASE + 0x3c) | ||
26 | #endif | ||
27 | 23 | ||
28 | static void disable_intc2_irq(unsigned int irq) | 24 | static void disable_intc2_irq(unsigned int irq) |
29 | { | 25 | { |
30 | struct intc2_data *p = get_irq_chip_data(irq); | 26 | struct intc2_data *p = get_irq_chip_data(irq); |
31 | ctrl_outl(1 << p->msk_shift, INTC2_INTMSK + p->msk_offset); | 27 | struct intc2_desc *d = get_intc2_desc(irq); |
28 | |||
29 | ctrl_outl(1 << p->msk_shift, d->msk_base + p->msk_offset + | ||
30 | (hard_smp_processor_id() * 4)); | ||
32 | } | 31 | } |
33 | 32 | ||
34 | static void enable_intc2_irq(unsigned int irq) | 33 | static void enable_intc2_irq(unsigned int irq) |
35 | { | 34 | { |
36 | struct intc2_data *p = get_irq_chip_data(irq); | 35 | struct intc2_data *p = get_irq_chip_data(irq); |
37 | ctrl_outl(1 << p->msk_shift, INTC2_INTMSKCLR + p->msk_offset); | 36 | struct intc2_desc *d = get_intc2_desc(irq); |
38 | } | ||
39 | 37 | ||
40 | static struct irq_chip intc2_irq_chip = { | 38 | ctrl_outl(1 << p->msk_shift, d->mskclr_base + p->msk_offset + |
41 | .name = "INTC2", | 39 | (hard_smp_processor_id() * 4)); |
42 | .mask = disable_intc2_irq, | 40 | } |
43 | .unmask = enable_intc2_irq, | ||
44 | .mask_ack = disable_intc2_irq, | ||
45 | }; | ||
46 | 41 | ||
47 | /* | 42 | /* |
48 | * Setup an INTC2 style interrupt. | 43 | * Setup an INTC2 style interrupt. |
@@ -56,30 +51,36 @@ static struct irq_chip intc2_irq_chip = { | |||
56 | * | 51 | * |
57 | * in the intc2_data table. | 52 | * in the intc2_data table. |
58 | */ | 53 | */ |
59 | void make_intc2_irq(struct intc2_data *table, unsigned int nr_irqs) | 54 | void register_intc2_controller(struct intc2_desc *desc) |
60 | { | 55 | { |
61 | int i; | 56 | int i; |
62 | 57 | ||
63 | for (i = 0; i < nr_irqs; i++) { | 58 | desc->chip.mask = disable_intc2_irq; |
59 | desc->chip.unmask = enable_intc2_irq; | ||
60 | desc->chip.mask_ack = disable_intc2_irq; | ||
61 | |||
62 | for (i = 0; i < desc->nr_irqs; i++) { | ||
64 | unsigned long ipr, flags; | 63 | unsigned long ipr, flags; |
65 | struct intc2_data *p = table + i; | 64 | struct intc2_data *p = desc->intc2_data + i; |
66 | 65 | ||
67 | disable_irq_nosync(p->irq); | 66 | disable_irq_nosync(p->irq); |
68 | 67 | ||
69 | /* Set the priority level */ | 68 | if (desc->prio_base) { |
70 | local_irq_save(flags); | 69 | /* Set the priority level */ |
70 | local_irq_save(flags); | ||
71 | 71 | ||
72 | ipr = ctrl_inl(INTC2_BASE + p->ipr_offset); | 72 | ipr = ctrl_inl(desc->prio_base + p->ipr_offset); |
73 | ipr &= ~(0xf << p->ipr_shift); | 73 | ipr &= ~(0xf << p->ipr_shift); |
74 | ipr |= p->priority << p->ipr_shift; | 74 | ipr |= p->priority << p->ipr_shift; |
75 | ctrl_outl(ipr, INTC2_BASE + p->ipr_offset); | 75 | ctrl_outl(ipr, desc->prio_base + p->ipr_offset); |
76 | 76 | ||
77 | local_irq_restore(flags); | 77 | local_irq_restore(flags); |
78 | } | ||
78 | 79 | ||
79 | set_irq_chip_and_handler_name(p->irq, &intc2_irq_chip, | 80 | set_irq_chip_and_handler_name(p->irq, &desc->chip, |
80 | handle_level_irq, "level"); | 81 | handle_level_irq, "level"); |
81 | set_irq_chip_data(p->irq, p); | 82 | set_irq_chip_data(p->irq, p); |
82 | 83 | ||
83 | enable_intc2_irq(p->irq); | 84 | disable_intc2_irq(p->irq); |
84 | } | 85 | } |
85 | } | 86 | } |
diff --git a/arch/sh/kernel/cpu/irq/ipr.c b/arch/sh/kernel/cpu/irq/ipr.c index 210280b6fddf..98e84f40c713 100644 --- a/arch/sh/kernel/cpu/irq/ipr.c +++ b/arch/sh/kernel/cpu/irq/ipr.c | |||
@@ -22,58 +22,57 @@ | |||
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | 24 | ||
25 | static inline struct ipr_desc *get_ipr_desc(unsigned int irq) | ||
26 | { | ||
27 | struct irq_chip *chip = get_irq_chip(irq); | ||
28 | return (void *)((char *)chip - offsetof(struct ipr_desc, chip)); | ||
29 | } | ||
30 | |||
25 | static void disable_ipr_irq(unsigned int irq) | 31 | static void disable_ipr_irq(unsigned int irq) |
26 | { | 32 | { |
27 | struct ipr_data *p = get_irq_chip_data(irq); | 33 | struct ipr_data *p = get_irq_chip_data(irq); |
34 | unsigned long addr = get_ipr_desc(irq)->ipr_offsets[p->ipr_idx]; | ||
28 | /* Set the priority in IPR to 0 */ | 35 | /* Set the priority in IPR to 0 */ |
29 | ctrl_outw(ctrl_inw(p->addr) & (0xffff ^ (0xf << p->shift)), p->addr); | 36 | ctrl_outw(ctrl_inw(addr) & (0xffff ^ (0xf << p->shift)), addr); |
30 | } | 37 | } |
31 | 38 | ||
32 | static void enable_ipr_irq(unsigned int irq) | 39 | static void enable_ipr_irq(unsigned int irq) |
33 | { | 40 | { |
34 | struct ipr_data *p = get_irq_chip_data(irq); | 41 | struct ipr_data *p = get_irq_chip_data(irq); |
42 | unsigned long addr = get_ipr_desc(irq)->ipr_offsets[p->ipr_idx]; | ||
35 | /* Set priority in IPR back to original value */ | 43 | /* Set priority in IPR back to original value */ |
36 | ctrl_outw(ctrl_inw(p->addr) | (p->priority << p->shift), p->addr); | 44 | ctrl_outw(ctrl_inw(addr) | (p->priority << p->shift), addr); |
37 | } | 45 | } |
38 | 46 | ||
39 | static struct irq_chip ipr_irq_chip = { | 47 | /* |
40 | .name = "IPR", | 48 | * The shift value is now the number of bits to shift, not the number of |
41 | .mask = disable_ipr_irq, | 49 | * bits/4. This is to make it easier to read the value directly from the |
42 | .unmask = enable_ipr_irq, | 50 | * datasheets. The IPR address is calculated using the ipr_offset table. |
43 | .mask_ack = disable_ipr_irq, | 51 | */ |
44 | }; | ||
45 | |||
46 | unsigned int map_ipridx_to_addr(int idx) __attribute__ ((weak)); | ||
47 | unsigned int map_ipridx_to_addr(int idx) | ||
48 | { | ||
49 | return 0; | ||
50 | } | ||
51 | 52 | ||
52 | void make_ipr_irq(struct ipr_data *table, unsigned int nr_irqs) | 53 | void register_ipr_controller(struct ipr_desc *desc) |
53 | { | 54 | { |
54 | int i; | 55 | int i; |
55 | 56 | ||
56 | for (i = 0; i < nr_irqs; i++) { | 57 | desc->chip.mask = disable_ipr_irq; |
57 | unsigned int irq = table[i].irq; | 58 | desc->chip.unmask = enable_ipr_irq; |
59 | desc->chip.mask_ack = disable_ipr_irq; | ||
58 | 60 | ||
59 | if (!irq) | 61 | for (i = 0; i < desc->nr_irqs; i++) { |
60 | irq = table[i].irq = i; | 62 | struct ipr_data *p = desc->ipr_data + i; |
61 | 63 | ||
62 | /* could the IPR index be mapped, if not we ignore this */ | 64 | BUG_ON(p->ipr_idx >= desc->nr_offsets); |
63 | if (!table[i].addr) { | 65 | BUG_ON(!desc->ipr_offsets[p->ipr_idx]); |
64 | table[i].addr = map_ipridx_to_addr(table[i].ipr_idx); | ||
65 | if (!table[i].addr) | ||
66 | continue; | ||
67 | } | ||
68 | 66 | ||
69 | disable_irq_nosync(irq); | 67 | disable_irq_nosync(p->irq); |
70 | set_irq_chip_and_handler_name(irq, &ipr_irq_chip, | 68 | set_irq_chip_and_handler_name(p->irq, &desc->chip, |
71 | handle_level_irq, "level"); | 69 | handle_level_irq, "level"); |
72 | set_irq_chip_data(irq, &table[i]); | 70 | set_irq_chip_data(p->irq, p); |
73 | enable_ipr_irq(irq); | 71 | disable_ipr_irq(p->irq); |
74 | } | 72 | } |
75 | } | 73 | } |
76 | EXPORT_SYMBOL(make_ipr_irq); | 74 | |
75 | EXPORT_SYMBOL(register_ipr_controller); | ||
77 | 76 | ||
78 | #if !defined(CONFIG_CPU_HAS_PINT_IRQ) | 77 | #if !defined(CONFIG_CPU_HAS_PINT_IRQ) |
79 | int ipr_irq_demux(int irq) | 78 | int ipr_irq_demux(int irq) |