| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Broadcom BCM7120 style Level 2 interrupt controller driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2014 Broadcom Corporation |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 8 | | - * published by the Free Software Foundation. |
|---|
| 9 | 6 | */ |
|---|
| 10 | 7 | |
|---|
| 11 | 8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| .. | .. |
|---|
| 146 | 143 | |
|---|
| 147 | 144 | irq_set_chained_handler_and_data(parent_irq, |
|---|
| 148 | 145 | bcm7120_l2_intc_irq_handle, l1_data); |
|---|
| 146 | + if (data->can_wake) |
|---|
| 147 | + enable_irq_wake(parent_irq); |
|---|
| 148 | + |
|---|
| 149 | 149 | return 0; |
|---|
| 150 | 150 | } |
|---|
| 151 | 151 | |
|---|
| .. | .. |
|---|
| 250 | 250 | if (ret < 0) |
|---|
| 251 | 251 | goto out_free_l1_data; |
|---|
| 252 | 252 | |
|---|
| 253 | + data->can_wake = of_property_read_bool(dn, "brcm,irq-can-wake"); |
|---|
| 254 | + |
|---|
| 253 | 255 | for (irq = 0; irq < data->num_parent_irqs; irq++) { |
|---|
| 254 | 256 | ret = bcm7120_l2_intc_init_one(dn, data, irq, valid_mask); |
|---|
| 255 | 257 | if (ret) |
|---|
| .. | .. |
|---|
| 271 | 273 | flags |= IRQ_GC_BE_IO; |
|---|
| 272 | 274 | |
|---|
| 273 | 275 | ret = irq_alloc_domain_generic_chips(data->domain, IRQS_PER_WORD, 1, |
|---|
| 274 | | - dn->full_name, handle_level_irq, clr, 0, flags); |
|---|
| 276 | + dn->full_name, handle_level_irq, clr, |
|---|
| 277 | + IRQ_LEVEL, flags); |
|---|
| 275 | 278 | if (ret) { |
|---|
| 276 | 279 | pr_err("failed to allocate generic irq chip\n"); |
|---|
| 277 | 280 | goto out_free_domain; |
|---|
| 278 | 281 | } |
|---|
| 279 | | - |
|---|
| 280 | | - if (of_property_read_bool(dn, "brcm,irq-can-wake")) |
|---|
| 281 | | - data->can_wake = true; |
|---|
| 282 | 282 | |
|---|
| 283 | 283 | for (idx = 0; idx < data->n_words; idx++) { |
|---|
| 284 | 284 | irq = idx * IRQS_PER_WORD; |
|---|
| .. | .. |
|---|
| 310 | 310 | |
|---|
| 311 | 311 | if (data->can_wake) { |
|---|
| 312 | 312 | /* This IRQ chip can wake the system, set all |
|---|
| 313 | | - * relevant child interupts in wake_enabled mask |
|---|
| 313 | + * relevant child interrupts in wake_enabled mask |
|---|
| 314 | 314 | */ |
|---|
| 315 | 315 | gc->wake_enabled = 0xffffffff; |
|---|
| 316 | 316 | gc->wake_enabled &= ~gc->unused; |
|---|
| .. | .. |
|---|
| 318 | 318 | } |
|---|
| 319 | 319 | } |
|---|
| 320 | 320 | |
|---|
| 321 | + pr_info("registered %s intc (%pOF, parent IRQ(s): %d)\n", |
|---|
| 322 | + intc_name, dn, data->num_parent_irqs); |
|---|
| 323 | + |
|---|
| 321 | 324 | return 0; |
|---|
| 322 | 325 | |
|---|
| 323 | 326 | out_free_domain: |
|---|