.. | .. |
---|
10 | 10 | #include <linux/irqchip.h> |
---|
11 | 11 | #include <nds32_intrinsic.h> |
---|
12 | 12 | |
---|
| 13 | +unsigned long wake_mask; |
---|
| 14 | + |
---|
13 | 15 | static void ativic32_ack_irq(struct irq_data *data) |
---|
14 | 16 | { |
---|
15 | 17 | __nds32__mtsr_dsb(BIT(data->hwirq), NDS32_SR_INT_PEND2); |
---|
.. | .. |
---|
27 | 29 | __nds32__mtsr_dsb(int_mask2 | (BIT(data->hwirq)), NDS32_SR_INT_MASK2); |
---|
28 | 30 | } |
---|
29 | 31 | |
---|
| 32 | +static int nointc_set_wake(struct irq_data *data, unsigned int on) |
---|
| 33 | +{ |
---|
| 34 | + unsigned long int_mask = __nds32__mfsr(NDS32_SR_INT_MASK); |
---|
| 35 | + static unsigned long irq_orig_bit; |
---|
| 36 | + u32 bit = 1 << data->hwirq; |
---|
| 37 | + |
---|
| 38 | + if (on) { |
---|
| 39 | + if (int_mask & bit) |
---|
| 40 | + __assign_bit(data->hwirq, &irq_orig_bit, true); |
---|
| 41 | + else |
---|
| 42 | + __assign_bit(data->hwirq, &irq_orig_bit, false); |
---|
| 43 | + |
---|
| 44 | + __assign_bit(data->hwirq, &int_mask, true); |
---|
| 45 | + __assign_bit(data->hwirq, &wake_mask, true); |
---|
| 46 | + |
---|
| 47 | + } else { |
---|
| 48 | + if (!(irq_orig_bit & bit)) |
---|
| 49 | + __assign_bit(data->hwirq, &int_mask, false); |
---|
| 50 | + |
---|
| 51 | + __assign_bit(data->hwirq, &wake_mask, false); |
---|
| 52 | + __assign_bit(data->hwirq, &irq_orig_bit, false); |
---|
| 53 | + } |
---|
| 54 | + |
---|
| 55 | + __nds32__mtsr_dsb(int_mask, NDS32_SR_INT_MASK); |
---|
| 56 | + |
---|
| 57 | + return 0; |
---|
| 58 | +} |
---|
| 59 | + |
---|
30 | 60 | static struct irq_chip ativic32_chip = { |
---|
31 | 61 | .name = "ativic32", |
---|
32 | 62 | .irq_ack = ativic32_ack_irq, |
---|
33 | 63 | .irq_mask = ativic32_mask_irq, |
---|
34 | 64 | .irq_unmask = ativic32_unmask_irq, |
---|
| 65 | + .irq_set_wake = nointc_set_wake, |
---|
35 | 66 | }; |
---|
36 | 67 | |
---|
37 | 68 | static unsigned int __initdata nivic_map[6] = { 6, 2, 10, 16, 24, 32 }; |
---|
.. | .. |
---|
61 | 92 | return 0; |
---|
62 | 93 | } |
---|
63 | 94 | |
---|
64 | | -static struct irq_domain_ops ativic32_ops = { |
---|
| 95 | +static const struct irq_domain_ops ativic32_ops = { |
---|
65 | 96 | .map = ativic32_irq_domain_map, |
---|
66 | 97 | .xlate = irq_domain_xlate_onecell |
---|
67 | 98 | }; |
---|