Lines Matching +full:l2 +full:- +full:intc
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2014-2017 Broadcom
35 /* Register offsets in the L2 latched interrupt controller */
45 /* Register offsets in the L2 level interrupt controller */
49 .cpu_clear = -1, /* Register not present */
55 /* L2 intc private data structure */
66 * brcmstb_l2_mask_and_ack - Mask and ack pending interrupt
82 u32 mask = d->mask; in brcmstb_l2_mask_and_ack()
85 irq_reg_writel(gc, mask, ct->regs.disable); in brcmstb_l2_mask_and_ack()
86 *ct->mask_cache &= ~mask; in brcmstb_l2_mask_and_ack()
87 irq_reg_writel(gc, mask, ct->regs.ack); in brcmstb_l2_mask_and_ack()
100 status = irq_reg_readl(b->gc, b->status_offset) & in brcmstb_l2_intc_irq_handle()
101 ~(irq_reg_readl(b->gc, b->mask_offset)); in brcmstb_l2_intc_irq_handle()
104 raw_spin_lock(&desc->lock); in brcmstb_l2_intc_irq_handle()
106 raw_spin_unlock(&desc->lock); in brcmstb_l2_intc_irq_handle()
111 irq = ffs(status) - 1; in brcmstb_l2_intc_irq_handle()
113 generic_handle_domain_irq(b->domain, irq); in brcmstb_l2_intc_irq_handle()
123 struct brcmstb_l2_intc_data *b = gc->private; in brcmstb_l2_intc_suspend()
128 b->saved_mask = irq_reg_readl(gc, ct->regs.mask); in brcmstb_l2_intc_suspend()
130 if (b->can_wake) { in brcmstb_l2_intc_suspend()
132 irq_reg_writel(gc, ~gc->wake_active, ct->regs.disable); in brcmstb_l2_intc_suspend()
133 irq_reg_writel(gc, gc->wake_active, ct->regs.enable); in brcmstb_l2_intc_suspend()
142 struct brcmstb_l2_intc_data *b = gc->private; in brcmstb_l2_intc_resume()
146 if (ct->chip.irq_ack) { in brcmstb_l2_intc_resume()
147 /* Clear unmasked non-wakeup interrupts */ in brcmstb_l2_intc_resume()
148 irq_reg_writel(gc, ~b->saved_mask & ~gc->wake_active, in brcmstb_l2_intc_resume()
149 ct->regs.ack); in brcmstb_l2_intc_resume()
153 irq_reg_writel(gc, b->saved_mask, ct->regs.disable); in brcmstb_l2_intc_resume()
154 irq_reg_writel(gc, ~b->saved_mask, ct->regs.enable); in brcmstb_l2_intc_resume()
173 return -ENOMEM; in brcmstb_l2_intc_of_init()
177 pr_err("failed to remap intc L2 registers\n"); in brcmstb_l2_intc_of_init()
178 ret = -ENOMEM; in brcmstb_l2_intc_of_init()
183 writel(0xffffffff, base + init_params->cpu_mask_set); in brcmstb_l2_intc_of_init()
186 data->can_wake = of_property_read_bool(np, "brcm,irq-can-wake"); in brcmstb_l2_intc_of_init()
187 if (!data->can_wake && (init_params->cpu_clear >= 0)) in brcmstb_l2_intc_of_init()
188 writel(0xffffffff, base + init_params->cpu_clear); in brcmstb_l2_intc_of_init()
193 ret = -EINVAL; in brcmstb_l2_intc_of_init()
197 data->domain = irq_domain_add_linear(np, 32, in brcmstb_l2_intc_of_init()
199 if (!data->domain) { in brcmstb_l2_intc_of_init()
200 ret = -ENOMEM; in brcmstb_l2_intc_of_init()
205 * peripheral registers for CPU-native byte order. in brcmstb_l2_intc_of_init()
212 ret = irq_alloc_domain_generic_chips(data->domain, 32, 1, in brcmstb_l2_intc_of_init()
213 np->full_name, init_params->handler, clr, 0, flags); in brcmstb_l2_intc_of_init()
223 data->gc = irq_get_domain_generic_chip(data->domain, 0); in brcmstb_l2_intc_of_init()
224 data->gc->reg_base = base; in brcmstb_l2_intc_of_init()
225 data->gc->private = data; in brcmstb_l2_intc_of_init()
226 data->status_offset = init_params->cpu_status; in brcmstb_l2_intc_of_init()
227 data->mask_offset = init_params->cpu_mask_status; in brcmstb_l2_intc_of_init()
229 ct = data->gc->chip_types; in brcmstb_l2_intc_of_init()
231 if (init_params->cpu_clear >= 0) { in brcmstb_l2_intc_of_init()
232 ct->regs.ack = init_params->cpu_clear; in brcmstb_l2_intc_of_init()
233 ct->chip.irq_ack = irq_gc_ack_set_bit; in brcmstb_l2_intc_of_init()
234 ct->chip.irq_mask_ack = brcmstb_l2_mask_and_ack; in brcmstb_l2_intc_of_init()
236 /* No Ack - but still slightly more efficient to define this */ in brcmstb_l2_intc_of_init()
237 ct->chip.irq_mask_ack = irq_gc_mask_disable_reg; in brcmstb_l2_intc_of_init()
240 ct->chip.irq_mask = irq_gc_mask_disable_reg; in brcmstb_l2_intc_of_init()
241 ct->regs.disable = init_params->cpu_mask_set; in brcmstb_l2_intc_of_init()
242 ct->regs.mask = init_params->cpu_mask_status; in brcmstb_l2_intc_of_init()
244 ct->chip.irq_unmask = irq_gc_unmask_enable_reg; in brcmstb_l2_intc_of_init()
245 ct->regs.enable = init_params->cpu_mask_clear; in brcmstb_l2_intc_of_init()
247 ct->chip.irq_suspend = brcmstb_l2_intc_suspend; in brcmstb_l2_intc_of_init()
248 ct->chip.irq_resume = brcmstb_l2_intc_resume; in brcmstb_l2_intc_of_init()
249 ct->chip.irq_pm_shutdown = brcmstb_l2_intc_suspend; in brcmstb_l2_intc_of_init()
251 if (data->can_wake) { in brcmstb_l2_intc_of_init()
255 data->gc->wake_enabled = 0xffffffff; in brcmstb_l2_intc_of_init()
256 ct->chip.irq_set_wake = irq_gc_set_wake; in brcmstb_l2_intc_of_init()
260 pr_info("registered L2 intc (%pOF, parent irq: %d)\n", np, parent_irq); in brcmstb_l2_intc_of_init()
265 irq_domain_remove(data->domain); in brcmstb_l2_intc_of_init()
286 IRQCHIP_MATCH("brcm,l2-intc", brcmstb_l2_edge_intc_of_init)
287 IRQCHIP_MATCH("brcm,hif-spi-l2-intc", brcmstb_l2_edge_intc_of_init)
288 IRQCHIP_MATCH("brcm,upg-aux-aon-l2-intc", brcmstb_l2_edge_intc_of_init)
289 IRQCHIP_MATCH("brcm,bcm7271-l2-intc", brcmstb_l2_lvl_intc_of_init)
291 MODULE_DESCRIPTION("Broadcom STB generic L2 interrupt controller");