| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/arch/arm/common/vic.c |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 1999 - 2003 ARM Limited |
|---|
| 5 | 6 | * 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 |
|---|
| 20 | 7 | */ |
|---|
| 21 | 8 | |
|---|
| 22 | 9 | #include <linux/export.h> |
|---|
| .. | .. |
|---|
| 40 | 27 | |
|---|
| 41 | 28 | #define VIC_IRQ_STATUS 0x00 |
|---|
| 42 | 29 | #define VIC_FIQ_STATUS 0x04 |
|---|
| 30 | +#define VIC_RAW_STATUS 0x08 |
|---|
| 43 | 31 | #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 |
|---|
| 44 | 34 | #define VIC_INT_SOFT 0x18 |
|---|
| 45 | 35 | #define VIC_INT_SOFT_CLEAR 0x1c |
|---|
| 46 | 36 | #define VIC_PROTECT 0x20 |
|---|
| .. | .. |
|---|
| 173 | 163 | }; |
|---|
| 174 | 164 | |
|---|
| 175 | 165 | /** |
|---|
| 176 | | - * vic_pm_init - initicall to register VIC pm |
|---|
| 166 | + * vic_pm_init - initcall to register VIC pm |
|---|
| 177 | 167 | * |
|---|
| 178 | 168 | * This is called via late_initcall() to register |
|---|
| 179 | 169 | * the resources for the VICs due to the early |
|---|
| .. | .. |
|---|
| 407 | 397 | /* |
|---|
| 408 | 398 | * The PL190 cell from ARM has been modified by ST to handle 64 interrupts. |
|---|
| 409 | 399 | * 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 |
|---|
| 411 | 401 | * the probe function is called twice, with base set to offset 000 |
|---|
| 412 | 402 | * and 020 within the page. We call this "second block". |
|---|
| 413 | 403 | */ |
|---|
| .. | .. |
|---|
| 441 | 431 | vic_register(base, 0, irq_start, vic_sources, 0, node); |
|---|
| 442 | 432 | } |
|---|
| 443 | 433 | |
|---|
| 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, |
|---|
| 445 | 435 | u32 vic_sources, u32 resume_sources, |
|---|
| 446 | 436 | struct device_node *node) |
|---|
| 447 | 437 | { |
|---|
| .. | .. |
|---|
| 465 | 455 | return; |
|---|
| 466 | 456 | default: |
|---|
| 467 | 457 | printk(KERN_WARNING "VIC: unknown vendor, continuing anyways\n"); |
|---|
| 468 | | - /* fall through */ |
|---|
| 458 | + fallthrough; |
|---|
| 469 | 459 | case AMBA_VENDOR_ARM: |
|---|
| 470 | 460 | break; |
|---|
| 471 | 461 | } |
|---|
| .. | .. |
|---|
| 494 | 484 | __vic_init(base, 0, irq_start, vic_sources, resume_sources, NULL); |
|---|
| 495 | 485 | } |
|---|
| 496 | 486 | |
|---|
| 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 | | - |
|---|
| 518 | 487 | #ifdef CONFIG_OF |
|---|
| 519 | 488 | static int __init vic_of_init(struct device_node *node, |
|---|
| 520 | 489 | struct device_node *parent) |
|---|
| .. | .. |
|---|
| 522 | 491 | void __iomem *regs; |
|---|
| 523 | 492 | u32 interrupt_mask = ~0; |
|---|
| 524 | 493 | u32 wakeup_mask = ~0; |
|---|
| 525 | | - |
|---|
| 526 | | - if (WARN(parent, "non-root VICs are not supported")) |
|---|
| 527 | | - return -EINVAL; |
|---|
| 494 | + int parent_irq; |
|---|
| 528 | 495 | |
|---|
| 529 | 496 | regs = of_iomap(node, 0); |
|---|
| 530 | 497 | if (WARN_ON(!regs)) |
|---|
| .. | .. |
|---|
| 532 | 499 | |
|---|
| 533 | 500 | of_property_read_u32(node, "valid-mask", &interrupt_mask); |
|---|
| 534 | 501 | 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; |
|---|
| 535 | 505 | |
|---|
| 536 | 506 | /* |
|---|
| 537 | 507 | * Passing 0 as first IRQ makes the simple domain allocate descriptors |
|---|
| 538 | 508 | */ |
|---|
| 539 | | - __vic_init(regs, 0, 0, interrupt_mask, wakeup_mask, node); |
|---|
| 509 | + __vic_init(regs, parent_irq, 0, interrupt_mask, wakeup_mask, node); |
|---|
| 540 | 510 | |
|---|
| 541 | 511 | return 0; |
|---|
| 542 | 512 | } |
|---|