Lines Matching +full:control +full:- +full:parent
1 // SPDX-License-Identifier: GPL-2.0
49 u32 control = readl_relaxed(fic->base + AL_FIC_CONTROL); in al_fic_set_trigger() local
53 control &= ~CONTROL_TRIGGER_RISING; in al_fic_set_trigger()
56 control |= CONTROL_TRIGGER_RISING; in al_fic_set_trigger()
58 gc->chip_types->handler = handler; in al_fic_set_trigger()
59 fic->state = new_state; in al_fic_set_trigger()
60 writel_relaxed(control, fic->base + AL_FIC_CONTROL); in al_fic_set_trigger()
66 struct al_fic *fic = gc->private; in al_fic_irq_set_type()
75 ret = -EINVAL; in al_fic_irq_set_type()
91 if (fic->state == AL_FIC_UNCONFIGURED) { in al_fic_irq_set_type()
93 } else if (fic->state != new_state) { in al_fic_irq_set_type()
95 fic->name, fic->state); in al_fic_irq_set_type()
96 ret = -EINVAL; in al_fic_irq_set_type()
109 struct irq_domain *domain = fic->domain; in al_fic_irq_handler()
117 pending = readl_relaxed(fic->base + AL_FIC_CAUSE); in al_fic_irq_handler()
118 pending &= ~gc->mask_cache; in al_fic_irq_handler()
129 struct al_fic *fic = gc->private; in al_fic_irq_retrigger()
131 writel_relaxed(BIT(data->hwirq), fic->base + AL_FIC_SET_CAUSE); in al_fic_irq_retrigger()
142 fic->domain = irq_domain_add_linear(node, in al_fic_register()
146 if (!fic->domain) { in al_fic_register()
148 return -ENOMEM; in al_fic_register()
151 ret = irq_alloc_domain_generic_chips(fic->domain, in al_fic_register()
153 1, fic->name, in al_fic_register()
161 gc = irq_get_domain_generic_chip(fic->domain, 0); in al_fic_register()
162 gc->reg_base = fic->base; in al_fic_register()
163 gc->chip_types->regs.mask = AL_FIC_MASK; in al_fic_register()
164 gc->chip_types->regs.ack = AL_FIC_CAUSE; in al_fic_register()
165 gc->chip_types->chip.irq_mask = irq_gc_mask_set_bit; in al_fic_register()
166 gc->chip_types->chip.irq_unmask = irq_gc_mask_clr_bit; in al_fic_register()
167 gc->chip_types->chip.irq_ack = irq_gc_ack_clr_bit; in al_fic_register()
168 gc->chip_types->chip.irq_set_type = al_fic_irq_set_type; in al_fic_register()
169 gc->chip_types->chip.irq_retrigger = al_fic_irq_retrigger; in al_fic_register()
170 gc->chip_types->chip.flags = IRQCHIP_SKIP_SET_WAKE; in al_fic_register()
171 gc->private = fic; in al_fic_register()
173 irq_set_chained_handler_and_data(fic->parent_irq, in al_fic_register()
179 irq_domain_remove(fic->domain); in al_fic_register()
185 * al_fic_wire_init() - initialize and configure fic in wire mode
189 * @parent_irq: interrupt of parent
193 * Interrupt can be generated based on positive edge or level - configuration is
203 u32 control = CONTROL_MASK_MSI_X; in al_fic_wire_init() local
207 return ERR_PTR(-ENOMEM); in al_fic_wire_init()
209 fic->base = base; in al_fic_wire_init()
210 fic->parent_irq = parent_irq; in al_fic_wire_init()
211 fic->name = name; in al_fic_wire_init()
214 writel_relaxed(0xFFFFFFFF, fic->base + AL_FIC_MASK); in al_fic_wire_init()
217 writel_relaxed(0, fic->base + AL_FIC_CAUSE); in al_fic_wire_init()
219 writel_relaxed(control, fic->base + AL_FIC_CONTROL); in al_fic_wire_init()
227 pr_debug("%s initialized successfully in Legacy mode (parent-irq=%u)\n", in al_fic_wire_init()
228 fic->name, parent_irq); in al_fic_wire_init()
238 struct device_node *parent) in al_fic_init_dt() argument
245 if (!parent) { in al_fic_init_dt()
246 pr_err("%s: unsupported - device require a parent\n", in al_fic_init_dt()
247 node->name); in al_fic_init_dt()
248 return -EINVAL; in al_fic_init_dt()
253 pr_err("%s: fail to map memory\n", node->name); in al_fic_init_dt()
254 return -ENOMEM; in al_fic_init_dt()
259 pr_err("%s: fail to map irq\n", node->name); in al_fic_init_dt()
260 ret = -EINVAL; in al_fic_init_dt()
266 node->name, in al_fic_init_dt()
270 node->name, in al_fic_init_dt()
286 IRQCHIP_DECLARE(al_fic, "amazon,al-fic", al_fic_init_dt);