hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/irqchip/irq-ativic32.c
....@@ -10,6 +10,8 @@
1010 #include <linux/irqchip.h>
1111 #include <nds32_intrinsic.h>
1212
13
+unsigned long wake_mask;
14
+
1315 static void ativic32_ack_irq(struct irq_data *data)
1416 {
1517 __nds32__mtsr_dsb(BIT(data->hwirq), NDS32_SR_INT_PEND2);
....@@ -27,11 +29,40 @@
2729 __nds32__mtsr_dsb(int_mask2 | (BIT(data->hwirq)), NDS32_SR_INT_MASK2);
2830 }
2931
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
+
3060 static struct irq_chip ativic32_chip = {
3161 .name = "ativic32",
3262 .irq_ack = ativic32_ack_irq,
3363 .irq_mask = ativic32_mask_irq,
3464 .irq_unmask = ativic32_unmask_irq,
65
+ .irq_set_wake = nointc_set_wake,
3566 };
3667
3768 static unsigned int __initdata nivic_map[6] = { 6, 2, 10, 16, 24, 32 };
....@@ -61,7 +92,7 @@
6192 return 0;
6293 }
6394
64
-static struct irq_domain_ops ativic32_ops = {
95
+static const struct irq_domain_ops ativic32_ops = {
6596 .map = ativic32_irq_domain_map,
6697 .xlate = irq_domain_xlate_onecell
6798 };