Lines Matching +full:interrupt +full:- +full:map +full:- +full:mask
1 // SPDX-License-Identifier: GPL-2.0
8 #include <linux/interrupt.h>
11 #include <linux/mfd/ingenic-tcu.h>
17 struct regmap *map; member
26 struct irq_chip *irq_chip = irq_data_get_irq_chip(&desc->irq_data); in ingenic_tcu_intc_cascade()
29 struct regmap *map = gc->private; in ingenic_tcu_intc_cascade() local
34 regmap_read(map, TCU_REG_TFR, &irq_reg); in ingenic_tcu_intc_cascade()
35 regmap_read(map, TCU_REG_TMR, &irq_mask); in ingenic_tcu_intc_cascade()
52 struct regmap *map = gc->private; in ingenic_tcu_gc_unmask_enable_reg() local
53 u32 mask = d->mask; in ingenic_tcu_gc_unmask_enable_reg() local
56 regmap_write(map, ct->regs.ack, mask); in ingenic_tcu_gc_unmask_enable_reg()
57 regmap_write(map, ct->regs.enable, mask); in ingenic_tcu_gc_unmask_enable_reg()
58 *ct->mask_cache |= mask; in ingenic_tcu_gc_unmask_enable_reg()
66 struct regmap *map = gc->private; in ingenic_tcu_gc_mask_disable_reg() local
67 u32 mask = d->mask; in ingenic_tcu_gc_mask_disable_reg() local
70 regmap_write(map, ct->regs.disable, mask); in ingenic_tcu_gc_mask_disable_reg()
71 *ct->mask_cache &= ~mask; in ingenic_tcu_gc_mask_disable_reg()
79 struct regmap *map = gc->private; in ingenic_tcu_gc_mask_disable_reg_and_ack() local
80 u32 mask = d->mask; in ingenic_tcu_gc_mask_disable_reg_and_ack() local
83 regmap_write(map, ct->regs.ack, mask); in ingenic_tcu_gc_mask_disable_reg_and_ack()
84 regmap_write(map, ct->regs.disable, mask); in ingenic_tcu_gc_mask_disable_reg_and_ack()
94 struct regmap *map; in ingenic_tcu_irq_init() local
98 map = device_node_to_regmap(np); in ingenic_tcu_irq_init()
99 if (IS_ERR(map)) in ingenic_tcu_irq_init()
100 return PTR_ERR(map); in ingenic_tcu_irq_init()
104 return -ENOMEM; in ingenic_tcu_irq_init()
106 tcu->map = map; in ingenic_tcu_irq_init()
109 if (irqs < 0 || irqs > ARRAY_SIZE(tcu->parent_irqs)) { in ingenic_tcu_irq_init()
111 ret = -EINVAL; in ingenic_tcu_irq_init()
115 tcu->nb_parent_irqs = irqs; in ingenic_tcu_irq_init()
117 tcu->domain = irq_domain_add_linear(np, 32, &irq_generic_chip_ops, in ingenic_tcu_irq_init()
119 if (!tcu->domain) { in ingenic_tcu_irq_init()
120 ret = -ENOMEM; in ingenic_tcu_irq_init()
124 ret = irq_alloc_domain_generic_chips(tcu->domain, 32, 1, "TCU", in ingenic_tcu_irq_init()
132 gc = irq_get_domain_generic_chip(tcu->domain, 0); in ingenic_tcu_irq_init()
133 ct = gc->chip_types; in ingenic_tcu_irq_init()
135 gc->wake_enabled = IRQ_MSK(32); in ingenic_tcu_irq_init()
136 gc->private = tcu->map; in ingenic_tcu_irq_init()
138 ct->regs.disable = TCU_REG_TMSR; in ingenic_tcu_irq_init()
139 ct->regs.enable = TCU_REG_TMCR; in ingenic_tcu_irq_init()
140 ct->regs.ack = TCU_REG_TFCR; in ingenic_tcu_irq_init()
141 ct->chip.irq_unmask = ingenic_tcu_gc_unmask_enable_reg; in ingenic_tcu_irq_init()
142 ct->chip.irq_mask = ingenic_tcu_gc_mask_disable_reg; in ingenic_tcu_irq_init()
143 ct->chip.irq_mask_ack = ingenic_tcu_gc_mask_disable_reg_and_ack; in ingenic_tcu_irq_init()
144 ct->chip.flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_SKIP_SET_WAKE; in ingenic_tcu_irq_init()
146 /* Mask all IRQs by default */ in ingenic_tcu_irq_init()
147 regmap_write(tcu->map, TCU_REG_TMSR, IRQ_MSK(32)); in ingenic_tcu_irq_init()
150 * On JZ4740, timer 0 and timer 1 have their own interrupt line; in ingenic_tcu_irq_init()
151 * timers 2-7 share one interrupt. in ingenic_tcu_irq_init()
152 * On SoCs >= JZ4770, timer 5 has its own interrupt line; in ingenic_tcu_irq_init()
153 * timers 0-4 and 6-7 share one single interrupt. in ingenic_tcu_irq_init()
157 * channel fired the interrupt. in ingenic_tcu_irq_init()
160 tcu->parent_irqs[i] = irq_of_parse_and_map(np, i); in ingenic_tcu_irq_init()
161 if (!tcu->parent_irqs[i]) { in ingenic_tcu_irq_init()
162 ret = -EINVAL; in ingenic_tcu_irq_init()
166 irq_set_chained_handler_and_data(tcu->parent_irqs[i], in ingenic_tcu_irq_init()
168 tcu->domain); in ingenic_tcu_irq_init()
174 for (; i > 0; i--) in ingenic_tcu_irq_init()
175 irq_dispose_mapping(tcu->parent_irqs[i - 1]); in ingenic_tcu_irq_init()
177 irq_domain_remove(tcu->domain); in ingenic_tcu_irq_init()
182 IRQCHIP_DECLARE(jz4740_tcu_irq, "ingenic,jz4740-tcu", ingenic_tcu_irq_init);
183 IRQCHIP_DECLARE(jz4725b_tcu_irq, "ingenic,jz4725b-tcu", ingenic_tcu_irq_init);
184 IRQCHIP_DECLARE(jz4760_tcu_irq, "ingenic,jz4760-tcu", ingenic_tcu_irq_init);
185 IRQCHIP_DECLARE(jz4770_tcu_irq, "ingenic,jz4770-tcu", ingenic_tcu_irq_init);
186 IRQCHIP_DECLARE(x1000_tcu_irq, "ingenic,x1000-tcu", ingenic_tcu_irq_init);