// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2010 Broadcom * Copyright 2012 Simon Arlott, Chris Boot, Stephen Warren * * Quirk 1: Shortcut interrupts don't set the bank 1/2 register pending bits * * If an interrupt fires on bank 1 that isn't in the shortcuts list, bit 8 * on bank 0 is set to signify that an interrupt in bank 1 has fired, and * to look in the bank 1 status register for more information. * * If an interrupt fires on bank 1 that _is_ in the shortcuts list, its * shortcut bit in bank 0 is set as well as its interrupt bit in the bank 1 * status register, but bank 0 bit 8 is _not_ set. * * Quirk 2: You can't mask the register 1/2 pending interrupts * * In a proper cascaded interrupt controller, the interrupt lines with * cascaded interrupt controllers on them are just normal interrupt lines. * You can mask the interrupts and get on with things. With this controller * you can't do that. * * Quirk 3: The shortcut interrupts can't be (un)masked in bank 0 * * Those interrupts that have shortcuts can only be masked/unmasked in * their respective banks' enable/disable registers. Doing so in the bank 0 * enable/disable registers has no effect. * * The FIQ control register: * Bits 0-6: IRQ (index in order of interrupts from banks 1, 2, then 0) * Bit 7: Enable FIQ generation * Bits 8+: Unused * * An interrupt must be disabled before configuring it for FIQ generation * otherwise both handlers will fire at the same time!
*/
/* Put the bank and irq (32 bits) into the hwirq */ #define MAKE_HWIRQ(b, n) ((b << 5) | (n)) #define HWIRQ_BANK(i) (i >> 5) #define HWIRQ_BIT(i) BIT(i & 0x1f)
#define NR_IRQS_BANK0 8 #define BANK0_HWIRQ_MASK 0xff /* Shortcuts can't be disabled so any unknown new ones need to be masked */ #define SHORTCUT1_MASK 0x00007c00 #define SHORTCUT2_MASK 0x001f8000 #define SHORTCUT_SHIFT 10 #define BANK1_HWIRQ BIT(8) #define BANK2_HWIRQ BIT(9) #define BANK0_VALID_MASK (BANK0_HWIRQ_MASK | BANK1_HWIRQ | BANK2_HWIRQ \
| SHORTCUT1_MASK | SHORTCUT2_MASK)
base = of_iomap(node, 0); if (!base)
panic("%pOF: unable to map IC registers\n", node);
intc.domain = irq_domain_create_linear(of_fwnode_handle(node), MAKE_HWIRQ(NR_BANKS, 0),
&armctrl_ops, NULL); if (!intc.domain)
panic("%pOF: unable to create IRQ domain\n", node);
for (b = 0; b < NR_BANKS; b++) {
intc.pending[b] = base + reg_pending[b];
intc.enable[b] = base + reg_enable[b];
intc.disable[b] = base + reg_disable[b];
for (i = 0; i < bank_irqs[b]; i++) {
irq = irq_create_mapping(intc.domain, MAKE_HWIRQ(b, i));
BUG_ON(irq <= 0);
irq_set_chip_and_handler(irq, &armctrl_chip,
handle_level_irq);
irq_set_probe(irq);
}
/* * Handle each interrupt across the entire interrupt controller. This reads the * status register before handling each interrupt, which is necessary given that * handle_IRQ may briefly re-enable interrupts for soft IRQ handling.
*/
static u32 armctrl_translate_bank(int bank)
{
u32 stat = readl_relaxed(intc.pending[bank]);
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.8Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.