hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/irqchip/irq-vic.c
....@@ -1,22 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * linux/arch/arm/common/vic.c
34 *
45 * Copyright (C) 1999 - 2003 ARM Limited
56 * Copyright (C) 2000 Deep Blue Solutions Ltd
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
207 */
218
229 #include <linux/export.h>
....@@ -40,7 +27,10 @@
4027
4128 #define VIC_IRQ_STATUS 0x00
4229 #define VIC_FIQ_STATUS 0x04
30
+#define VIC_RAW_STATUS 0x08
4331 #define VIC_INT_SELECT 0x0c /* 1 = FIQ, 0 = IRQ */
32
+#define VIC_INT_ENABLE 0x10 /* 1 = enable, 0 = disable */
33
+#define VIC_INT_ENABLE_CLEAR 0x14
4434 #define VIC_INT_SOFT 0x18
4535 #define VIC_INT_SOFT_CLEAR 0x1c
4636 #define VIC_PROTECT 0x20
....@@ -173,7 +163,7 @@
173163 };
174164
175165 /**
176
- * vic_pm_init - initicall to register VIC pm
166
+ * vic_pm_init - initcall to register VIC pm
177167 *
178168 * This is called via late_initcall() to register
179169 * the resources for the VICs due to the early
....@@ -407,7 +397,7 @@
407397 /*
408398 * The PL190 cell from ARM has been modified by ST to handle 64 interrupts.
409399 * The original cell has 32 interrupts, while the modified one has 64,
410
- * replocating two blocks 0x00..0x1f in 0x20..0x3f. In that case
400
+ * replicating two blocks 0x00..0x1f in 0x20..0x3f. In that case
411401 * the probe function is called twice, with base set to offset 000
412402 * and 020 within the page. We call this "second block".
413403 */
....@@ -441,7 +431,7 @@
441431 vic_register(base, 0, irq_start, vic_sources, 0, node);
442432 }
443433
444
-void __init __vic_init(void __iomem *base, int parent_irq, int irq_start,
434
+static void __init __vic_init(void __iomem *base, int parent_irq, int irq_start,
445435 u32 vic_sources, u32 resume_sources,
446436 struct device_node *node)
447437 {
....@@ -465,7 +455,7 @@
465455 return;
466456 default:
467457 printk(KERN_WARNING "VIC: unknown vendor, continuing anyways\n");
468
- /* fall through */
458
+ fallthrough;
469459 case AMBA_VENDOR_ARM:
470460 break;
471461 }
....@@ -494,27 +484,6 @@
494484 __vic_init(base, 0, irq_start, vic_sources, resume_sources, NULL);
495485 }
496486
497
-/**
498
- * vic_init_cascaded() - initialise a cascaded vectored interrupt controller
499
- * @base: iomem base address
500
- * @parent_irq: the parent IRQ we're cascaded off
501
- * @vic_sources: bitmask of interrupt sources to allow
502
- * @resume_sources: bitmask of interrupt sources to allow for resume
503
- *
504
- * This returns the base for the new interrupts or negative on error.
505
- */
506
-int __init vic_init_cascaded(void __iomem *base, unsigned int parent_irq,
507
- u32 vic_sources, u32 resume_sources)
508
-{
509
- struct vic_device *v;
510
-
511
- v = &vic_devices[vic_id];
512
- __vic_init(base, parent_irq, 0, vic_sources, resume_sources, NULL);
513
- /* Return out acquired base */
514
- return v->irq;
515
-}
516
-EXPORT_SYMBOL_GPL(vic_init_cascaded);
517
-
518487 #ifdef CONFIG_OF
519488 static int __init vic_of_init(struct device_node *node,
520489 struct device_node *parent)
....@@ -522,9 +491,7 @@
522491 void __iomem *regs;
523492 u32 interrupt_mask = ~0;
524493 u32 wakeup_mask = ~0;
525
-
526
- if (WARN(parent, "non-root VICs are not supported"))
527
- return -EINVAL;
494
+ int parent_irq;
528495
529496 regs = of_iomap(node, 0);
530497 if (WARN_ON(!regs))
....@@ -532,11 +499,14 @@
532499
533500 of_property_read_u32(node, "valid-mask", &interrupt_mask);
534501 of_property_read_u32(node, "valid-wakeup-mask", &wakeup_mask);
502
+ parent_irq = of_irq_get(node, 0);
503
+ if (parent_irq < 0)
504
+ parent_irq = 0;
535505
536506 /*
537507 * Passing 0 as first IRQ makes the simple domain allocate descriptors
538508 */
539
- __vic_init(regs, 0, 0, interrupt_mask, wakeup_mask, node);
509
+ __vic_init(regs, parent_irq, 0, interrupt_mask, wakeup_mask, node);
540510
541511 return 0;
542512 }