From patchwork Fri Sep 13 19:15:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11145181 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 799E914DB for ; Fri, 13 Sep 2019 19:16:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4EBDA2089F for ; Fri, 13 Sep 2019 19:16:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sJJ+SsFB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389946AbfIMTPv (ORCPT ); Fri, 13 Sep 2019 15:15:51 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:45094 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388860AbfIMTPv (ORCPT ); Fri, 13 Sep 2019 15:15:51 -0400 Received: by mail-pf1-f193.google.com with SMTP id y72so18626553pfb.12; Fri, 13 Sep 2019 12:15:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dcs6bMyS/VDu68tzLaf+jXNYIvYTGSAM7Bablmbjtko=; b=sJJ+SsFBjNEeBJLl3+8b06rFGIeb+5olRurrrk19mN5RhLHimGUrcOji5FrI6ujnwp JMF7txWsn89EUYJJ3bWFfHm5ElcBO2d5XSxOouVl6ZbIAjtKmMLE88IKvjfZZmDNlmnT 7DiDhbAgLCz9nRjdh24kCFtkmw5WuIfcwsieJjEBP0lEsr0NKXAVHiKmIhMZbqMcfUbu PnZ9S3GcmLy3WkOKpbj++UzDgYq2j8n9cUguVw4uej9i1IqJQ+IyHI2dCZyse3pZCPrE z3oDSmUuy16DaNSC35hGOM72ngnymKghDVAZSBqZbxeBwMgON+6fmvE4SrajEHCtdJA8 NKVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dcs6bMyS/VDu68tzLaf+jXNYIvYTGSAM7Bablmbjtko=; b=cIn2ACRCMjCwtPZhj2K4myTPsYTwaeZ00fp8N0KJ4eGPaMNrvBITRDt5hcjGgJhIBY F0seYjJ1kl3OTczg9Cki3p3NJCaKrmTizF/u4EPFUHIgtQp07VB5z6ZQ6JX8Tm8pIQZ9 tKi+BzO3/yuM+9cmJJ0xTYpX3RJ4F2GJzMPWbac6aF5BMvC9JuikNFiZCXWZgO9MJpMV SUw08g7Olm9BRtfh/WA7FIE+A4UAGyYEM0qCRd59L5FZvVwkQoH7DFqxqM5GZi8ssF8s +PrF42GP3KdiN7yttfskkrXlDlSZjYrGR5PrBNVvd1iWuGPYYI57ibJNyfyrD70zrgtr WnWA== X-Gm-Message-State: APjAAAUzQLK9FkxQga8SSDCdLofCSTpitpX0NrYVzOtQxbIl99wh8AjT u7L6K0T3EtE2db20xUHHfI++CJ92spc= X-Google-Smtp-Source: APXvYqwZKbhxTZdGWMshxGNcxFTxjfeFGOIkX1BMH19hPGJynwsek8/TY57nQjtt7q/Q3tQ7CN9l7w== X-Received: by 2002:a63:cb4f:: with SMTP id m15mr44502938pgi.100.1568402148516; Fri, 13 Sep 2019 12:15:48 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m24sm6988149pgj.71.2019.09.13.12.15.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2019 12:15:47 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Justin Chen , Florian Fainelli , Thomas Gleixner , Jason Cooper , Marc Zyngier , Rob Herring , Mark Rutland , Kevin Cernekee , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), bcm-kernel-feedback-list@broadcom.com (open list:BROADCOM BMIPS MIPS ARCHITECTURE), linux-mips@vger.kernel.org (open list:BROADCOM BMIPS MIPS ARCHITECTURE) Subject: [PATCH v2 1/5] irqchip/irq-bcm7038-l1: Add PM support Date: Fri, 13 Sep 2019 12:15:38 -0700 Message-Id: <20190913191542.9908-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190913191542.9908-1-f.fainelli@gmail.com> References: <20190913191542.9908-1-f.fainelli@gmail.com> Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org From: Justin Chen The current l1 controller does not mask any interrupts when dropping into suspend. This mean we can receive unexpected wake up sources. Modified MIPS l1 controller to mask the all non-wake interrupts before dropping into suspend. Signed-off-by: Justin Chen Signed-off-by: Florian Fainelli --- drivers/irqchip/irq-bcm7038-l1.c | 98 ++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c index fc75c61233aa..f5e4ff5251ab 100644 --- a/drivers/irqchip/irq-bcm7038-l1.c +++ b/drivers/irqchip/irq-bcm7038-l1.c @@ -27,6 +27,7 @@ #include #include #include +#include #define IRQS_PER_WORD 32 #define REG_BYTES_PER_IRQ_WORD (sizeof(u32) * 4) @@ -39,6 +40,10 @@ struct bcm7038_l1_chip { unsigned int n_words; struct irq_domain *domain; struct bcm7038_l1_cpu *cpus[NR_CPUS]; +#ifdef CONFIG_PM_SLEEP + struct list_head list; + u32 wake_mask[MAX_WORDS]; +#endif u8 affinity[MAX_WORDS * IRQS_PER_WORD]; }; @@ -47,6 +52,17 @@ struct bcm7038_l1_cpu { u32 mask_cache[0]; }; +/* + * We keep a list of bcm7038_l1_chip used for suspend/resume. This hack is + * used because the struct chip_type suspend/resume hooks are not called + * unless chip_type is hooked onto a generic_chip. Since this driver does + * not use generic_chip, we need to manually hook our resume/suspend to + * syscore_ops. + */ +#ifdef CONFIG_PM_SLEEP +static LIST_HEAD(bcm7038_l1_intcs_list); +#endif + /* * STATUS/MASK_STATUS/MASK_SET/MASK_CLEAR are packed one right after another: * @@ -287,6 +303,77 @@ static int __init bcm7038_l1_init_one(struct device_node *dn, return 0; } +#ifdef CONFIG_PM_SLEEP +static int bcm7038_l1_suspend(void) +{ + struct bcm7038_l1_chip *intc; + unsigned long flags; + int boot_cpu, word; + + /* Wakeup interrupt should only come from the boot cpu */ + boot_cpu = cpu_logical_map(smp_processor_id()); + + list_for_each_entry(intc, &bcm7038_l1_intcs_list, list) { + raw_spin_lock_irqsave(&intc->lock, flags); + for (word = 0; word < intc->n_words; word++) { + l1_writel(~intc->wake_mask[word], + intc->cpus[boot_cpu]->map_base + + reg_mask_set(intc, word)); + l1_writel(intc->wake_mask[word], + intc->cpus[boot_cpu]->map_base + + reg_mask_clr(intc, word)); + } + raw_spin_unlock_irqrestore(&intc->lock, flags); + } + + return 0; +} + +static void bcm7038_l1_resume(void) +{ + struct bcm7038_l1_chip *intc; + unsigned long flags; + int boot_cpu, word; + + boot_cpu = cpu_logical_map(smp_processor_id()); + + list_for_each_entry(intc, &bcm7038_l1_intcs_list, list) { + raw_spin_lock_irqsave(&intc->lock, flags); + for (word = 0; word < intc->n_words; word++) { + l1_writel(intc->cpus[boot_cpu]->mask_cache[word], + intc->cpus[boot_cpu]->map_base + + reg_mask_set(intc, word)); + l1_writel(~intc->cpus[boot_cpu]->mask_cache[word], + intc->cpus[boot_cpu]->map_base + + reg_mask_clr(intc, word)); + } + raw_spin_unlock_irqrestore(&intc->lock, flags); + } +} + +static struct syscore_ops bcm7038_l1_syscore_ops = { + .suspend = bcm7038_l1_suspend, + .resume = bcm7038_l1_resume, +}; + +static int bcm7038_l1_set_wake(struct irq_data *d, unsigned int on) +{ + struct bcm7038_l1_chip *intc = irq_data_get_irq_chip_data(d); + unsigned long flags; + u32 word = d->hwirq / IRQS_PER_WORD; + u32 mask = BIT(d->hwirq % IRQS_PER_WORD); + + raw_spin_lock_irqsave(&intc->lock, flags); + if (on) + intc->wake_mask[word] |= mask; + else + intc->wake_mask[word] &= ~mask; + raw_spin_unlock_irqrestore(&intc->lock, flags); + + return 0; +} +#endif + static struct irq_chip bcm7038_l1_irq_chip = { .name = "bcm7038-l1", .irq_mask = bcm7038_l1_mask, @@ -295,6 +382,9 @@ static struct irq_chip bcm7038_l1_irq_chip = { #ifdef CONFIG_SMP .irq_cpu_offline = bcm7038_l1_cpu_offline, #endif +#ifdef CONFIG_PM_SLEEP + .irq_set_wake = bcm7038_l1_set_wake, +#endif }; static int bcm7038_l1_map(struct irq_domain *d, unsigned int virq, @@ -340,6 +430,14 @@ int __init bcm7038_l1_of_init(struct device_node *dn, goto out_unmap; } +#ifdef CONFIG_PM_SLEEP + /* Add bcm7038_l1_chip into a list */ + INIT_LIST_HEAD(&intc->list); + list_add_tail(&intc->list, &bcm7038_l1_intcs_list); + + register_syscore_ops(&bcm7038_l1_syscore_ops); +#endif + pr_info("registered BCM7038 L1 intc (%pOF, IRQs: %d)\n", dn, IRQS_PER_WORD * intc->n_words); From patchwork Fri Sep 13 19:15:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11145179 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 20BF313BD for ; Fri, 13 Sep 2019 19:16:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F2AD5206A5 for ; Fri, 13 Sep 2019 19:16:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BrzvUUF5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389968AbfIMTPv (ORCPT ); Fri, 13 Sep 2019 15:15:51 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:39638 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389943AbfIMTPu (ORCPT ); Fri, 13 Sep 2019 15:15:50 -0400 Received: by mail-pg1-f193.google.com with SMTP id u17so15719401pgi.6; Fri, 13 Sep 2019 12:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=x/1eUyWPGFj2wULry4fSJWpBPwqBU21SfxLgwHYAjPg=; b=BrzvUUF5gYKFZkqIivZmB5392yuvze9AbbplQ0GK3OoiiglyzWFvtk2nrYz+Yb0TSc cKpsMW+oSuKcUm8ZunWjTWq0L2bvfY3HjhKUrdvOswfnIyslNjK1foQRpPCO3sR+jzY/ seeby2arHTHMeF8pzPH765fwMrAuQAWaFwBmLENDmUJQt2DNNWHB+YNbeGMW97k/Vi3T reEZIK9WFDsYEh0sCcBO+zZtXnwsA6t2vcryZu5xHijF7Q92xZXCo5QcWMsF/oEkvAJs 4fqKOGSWcf1CtJArCdyvwD3BCbgha1zh0+Q7ybYjK3fDfilNr3Hpz+iaOfHkdiS5/yZ9 8Nvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=x/1eUyWPGFj2wULry4fSJWpBPwqBU21SfxLgwHYAjPg=; b=VInYcBrNGvz5y2g1T8EaUV8P5rLESCwYKmT4MlRHp7awBRrAwt678bEsR9ADxd6Mm9 AgOWDPZpefZqEJ/MrXX4U39eTLlbMcr2YKSrhMWurmy/O/GoP57sPLYYPf4e30+OlFaK 8JTM5dbxX7xZG1RRF2gLf/Lw7DcQPg4m3V1IG1Vq9GucSX2+BytFEvhmU2TuKrubW4xA m3sUB6y3KkjxG1ie5VjCb8iL0bLphDxVihH+IlGbnh2ZuDss87mRXlJPy+SQVwN8azAU hJSb9sdwaiAJgungv16tolvHUeWVJu1UFF3TMxGURlNBh0qNYkfR86yKqHH7RsArxRnZ Bwwg== X-Gm-Message-State: APjAAAWJZ3KQp9iUU2wWF8/KvHFVTyvr9FE2A7TWNme2DsM3LSB7fhLb +3RRCmqSsgt9tg8Smm/LPwmUjIoduHw= X-Google-Smtp-Source: APXvYqzF2s/bKLuw6kiJgc+ZNlKO896um1C1U0ZeAJYaxCjGTB/uSBl2HKUw3aBwzImKCG+aOqktMw== X-Received: by 2002:a63:bf01:: with SMTP id v1mr43807633pgf.278.1568402149873; Fri, 13 Sep 2019 12:15:49 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m24sm6988149pgj.71.2019.09.13.12.15.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2019 12:15:49 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Thomas Gleixner , Jason Cooper , Marc Zyngier , Rob Herring , Mark Rutland , Kevin Cernekee , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), bcm-kernel-feedback-list@broadcom.com (open list:BROADCOM BMIPS MIPS ARCHITECTURE), linux-mips@vger.kernel.org (open list:BROADCOM BMIPS MIPS ARCHITECTURE) Subject: [PATCH v2 2/5] dt-bindings: Document brcm,irq-can-wake for brcm,bcm7038-l1-intc.txt Date: Fri, 13 Sep 2019 12:15:39 -0700 Message-Id: <20190913191542.9908-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190913191542.9908-1-f.fainelli@gmail.com> References: <20190913191542.9908-1-f.fainelli@gmail.com> Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org The BCM7038 L1 interrupt controller can be used as a wake-up interrupt controller on MIPS and ARM-based systems, document the brcm,irq-can-wake which has been "standardized" across Broadcom interrupt controllers. Signed-off-by: Florian Fainelli Acked-by: Rob Herring --- .../bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt index 2117d4ac1ae5..4eb043270f5b 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt +++ b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt @@ -31,6 +31,11 @@ Required properties: - interrupts: specifies the interrupt line(s) in the interrupt-parent controller node; valid values depend on the type of parent interrupt controller +Optional properties: + +- brcm,irq-can-wake: If present, this means the L1 controller can be used as a + wakeup source for system suspend/resume. + If multiple reg ranges and interrupt-parent entries are present on an SMP system, the driver will allow IRQ SMP affinity to be set up through the /proc/irq/ interface. In the simplest possible configuration, only one From patchwork Fri Sep 13 19:15:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11145177 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C73AD13BD for ; Fri, 13 Sep 2019 19:16:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A44632084F for ; Fri, 13 Sep 2019 19:16:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VrmwgEjj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390124AbfIMTQC (ORCPT ); Fri, 13 Sep 2019 15:16:02 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:44080 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389998AbfIMTPw (ORCPT ); Fri, 13 Sep 2019 15:15:52 -0400 Received: by mail-pf1-f193.google.com with SMTP id q21so18655391pfn.11; Fri, 13 Sep 2019 12:15:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=INAHQPZxPjASPWSXn6L1a3UYoeuWNtidHTqQgxidBgw=; b=VrmwgEjjU7805jbM2dL5NG1Kj2azuVNCpIxjTIErUdeGZhB0x+hh5Wh1G6EgbvLEV0 9uHVXgKYiZ/XmiQKLzH7flBZTi3cg9Jsj48uN8CZUFghOrNLjpVUkU36FYQ+abkA2b3t zhrZSUzQfeT5GDh9Iq9kXTenViJU5A87H+hbz5RA303fhcJnTq08cAUMAprpUmL8Kv8m MTuU/cJ7ZYZccxxWw/UkffhFjkgsLjfbfMhIm52nl3Jvr9ElfFaef3VRRYsAUHOD/nYb nv8BbT8waeSzCAB1X+YrV81sJQMUGvN623ox07Yof1IoyaKx/G0jFvMJeNM840H0TmwM mDEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=INAHQPZxPjASPWSXn6L1a3UYoeuWNtidHTqQgxidBgw=; b=gpIQ+sskXhwfFXP1YH5bsBnjtZzf0FmRp0yCwLaAKomqsMtJ7gREAlZf6xrxo8fdYE RNIjPz+Y0nB/gzfVG5JxJHDuC9fVTt9bPAEgg0whJG8GYX/zzGVp16h8Pr4FR+BgcQJn luUkUiY97RZwPsmuHR+kMYUSdvU77gW9+pYa0HyYnoff8YMI8Qat2ccfdQklgg+qld9+ Ytn4Wu8WKOcaWjv2j/aV9myMWzZ4YgQ3Mz99VWg0K9509axSNsPVsDQ67jmlBwAEdibs n2teFZ7Wh+ywRtr4gJyy78KJ+XeeEZ4OzFA6GTHUtX8/3FcCvUq1pxAXugkxmNygynkP Vkqg== X-Gm-Message-State: APjAAAVMv8Oaey2kOdlnG8j3yi1OgiplsOuebsxBUn3V3XaodIeFWPNL RayYMlR2hCozORRUlrLRVgWGTUqaaSk= X-Google-Smtp-Source: APXvYqwcrJruIpEGc0fXRvhfKOwYQ1EUjtJ6xCZVKpmVC1AHVhs+dIZX2Fd1SicTBEvpMS1t9Dt+IA== X-Received: by 2002:a63:1d2:: with SMTP id 201mr45910616pgb.307.1568402150967; Fri, 13 Sep 2019 12:15:50 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m24sm6988149pgj.71.2019.09.13.12.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2019 12:15:50 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Thomas Gleixner , Jason Cooper , Marc Zyngier , Rob Herring , Mark Rutland , Kevin Cernekee , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), bcm-kernel-feedback-list@broadcom.com (open list:BROADCOM BMIPS MIPS ARCHITECTURE), linux-mips@vger.kernel.org (open list:BROADCOM BMIPS MIPS ARCHITECTURE) Subject: [PATCH v2 3/5] irqchip/irq-bcm7038-l1: Enable parent IRQ if necessary Date: Fri, 13 Sep 2019 12:15:40 -0700 Message-Id: <20190913191542.9908-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190913191542.9908-1-f.fainelli@gmail.com> References: <20190913191542.9908-1-f.fainelli@gmail.com> Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org If the 'brcm,irq-can-wake' property is specified, make sure we also enable the corresponding parent interrupt we are attached to. Signed-off-by: Florian Fainelli --- drivers/irqchip/irq-bcm7038-l1.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c index f5e4ff5251ab..0673a44bbdc2 100644 --- a/drivers/irqchip/irq-bcm7038-l1.c +++ b/drivers/irqchip/irq-bcm7038-l1.c @@ -297,6 +297,10 @@ static int __init bcm7038_l1_init_one(struct device_node *dn, pr_err("failed to map parent interrupt %d\n", parent_irq); return -EINVAL; } + + if (of_property_read_bool(dn, "brcm,irq-can-wake")) + enable_irq_wake(parent_irq); + irq_set_chained_handler_and_data(parent_irq, bcm7038_l1_irq_handle, intc); From patchwork Fri Sep 13 19:15:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11145173 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C928714DB for ; Fri, 13 Sep 2019 19:16:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A62712084F for ; Fri, 13 Sep 2019 19:16:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jtbuwLj4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390071AbfIMTPz (ORCPT ); Fri, 13 Sep 2019 15:15:55 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:39101 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390051AbfIMTPx (ORCPT ); Fri, 13 Sep 2019 15:15:53 -0400 Received: by mail-pf1-f195.google.com with SMTP id i1so9820764pfa.6; Fri, 13 Sep 2019 12:15:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BRtSatqLH/MfhNYbSV1CsCvP0aOfEd/XjwPUQaxk57I=; b=jtbuwLj4zNgb1GtpmdFk0gc5/kOlfHWykktKB/RyfHGZlZ1uNNSe///SsSsOJUQYFF Q9razuSg4mXJrOS3/UL7LsOqJCRQ3kwJ61kXoB9GaoWUMuk39DPbAje3201ECWIP6foO 5tvjebWmEksOAdijtNIJCgdo0QIt76FT2Cu4Uc8LjA7mpoLUgAeE7lJMuIXTsSOiR8TU ZiJDd2lV4KYp8fZRljygwB/gZbxkKw2lXiLxI95TPPvR+hxQP5vhRdb5JGiCSBmj6VzY uhkJTeOlUCpYzsaVOJtrHduNmkwVa2XZuljaU0dT/4SI5WtVmLAHjoR6E+SeaSvCf12j Bw4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BRtSatqLH/MfhNYbSV1CsCvP0aOfEd/XjwPUQaxk57I=; b=Yoy9HlDON14GqNsJo+5BSOs+AxuzkvUBPfXwRf6QaZ6odYR4Lqz2xMkwhKkYjikbWo hh5HrspqpG+7mEPhKaW+jbr9ROVTrGU33N1s6EhJH0w+GsjJmirdpVSy9GtmHTWVmenO Rv/CoxY7cCMMfCI7+XHqmXzHC9U06QwSIQW3gFRiStVmmwHbZ1AsNA8Ul1p89t6wunpL dMuCvvBjOnemfLlfCQQz30RRicSpxUYNNgBFhTrzBvca5uZtREMx7LGD7qlLpnld1eDB kLgdz1PZL6vddIsEqVuTPwdx8RLeCbEVTaszr+M9mVrFHTr0zQyC2Gq5GLV4Si1jALxe pXLQ== X-Gm-Message-State: APjAAAVIiyEucjhGThvLUPrrt6DZEKWw2zFrxHF3dpzXBGX1kYZ+oPZl T8mm8M+hJ1HYTiMZgQUPeGd8d/LgUAo= X-Google-Smtp-Source: APXvYqzxO0qzlIQtB7mDNY47JFE1/g8cLqnGE+hjEzq3cLN7pORngII31PI7vqJXoRIRninpX2wrJQ== X-Received: by 2002:a63:e44b:: with SMTP id i11mr7318696pgk.297.1568402152112; Fri, 13 Sep 2019 12:15:52 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m24sm6988149pgj.71.2019.09.13.12.15.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2019 12:15:51 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Thomas Gleixner , Jason Cooper , Marc Zyngier , Rob Herring , Mark Rutland , Kevin Cernekee , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), bcm-kernel-feedback-list@broadcom.com (open list:BROADCOM BMIPS MIPS ARCHITECTURE), linux-mips@vger.kernel.org (open list:BROADCOM BMIPS MIPS ARCHITECTURE) Subject: [PATCH v2 4/5] dt-bindings: Document brcm,int-fwd-mask property for bcm7038-l1-intc Date: Fri, 13 Sep 2019 12:15:41 -0700 Message-Id: <20190913191542.9908-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190913191542.9908-1-f.fainelli@gmail.com> References: <20190913191542.9908-1-f.fainelli@gmail.com> Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Indicate that the brcm,int-fwd-mask property is optional and can be optionaly set on platforms which require to leave specific interrupts untouched from Linux and retain the firmware configuration. Signed-off-by: Florian Fainelli Acked-by: Rob Herring --- .../bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt index 4eb043270f5b..31d31af408c5 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt +++ b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt @@ -36,6 +36,10 @@ Optional properties: - brcm,irq-can-wake: If present, this means the L1 controller can be used as a wakeup source for system suspend/resume. +- brcm,int-fwd-mask: if present, a bit mask to indicate which interrupts + have already been configured by the firmware and should be left untouched. + This should have one 32-bit word per status/set/clear/mask group. + If multiple reg ranges and interrupt-parent entries are present on an SMP system, the driver will allow IRQ SMP affinity to be set up through the /proc/irq/ interface. In the simplest possible configuration, only one From patchwork Fri Sep 13 19:15:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11145175 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB15314DB for ; Fri, 13 Sep 2019 19:16:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 897D92089F for ; Fri, 13 Sep 2019 19:16:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oPqAd1bZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390065AbfIMTPz (ORCPT ); Fri, 13 Sep 2019 15:15:55 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:34891 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389943AbfIMTPy (ORCPT ); Fri, 13 Sep 2019 15:15:54 -0400 Received: by mail-pl1-f194.google.com with SMTP id s17so8728237plp.2; Fri, 13 Sep 2019 12:15:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/Zfca3eBC3FxQ0Lu1bAKtyRgZM7bqDEwWR5lS4SRkXc=; b=oPqAd1bZ9afcNGvYlxRMM4uWGpi0g1bhxAHxvFePweLp2haJiogBCM3WuhEvnYaumy LcFEbcSraSU8NhFsbn6VKL7rSILgsSi2YNvZqF0Lpm426xZr6+/42tzntDowaibwlP7R C/LbHY8971oDmCujauKxw/gGg7xcCHu1pl0/zEGTIZv3TIvn6bTFgcnmvFRqUV0cl/9n ztG8K6TuoGp8Q+qb7zFGEL+9IyAeryBCTnw3jw3nPKOCxSATJM9lzZ5JDWvKTG5o1Dw8 pNtI9aa3H29XJcUodQRQ/ePEIbQWMxR66ZsX/ugPHPiFaEgOemMRMoIlmWjHbhruvuUI VkkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/Zfca3eBC3FxQ0Lu1bAKtyRgZM7bqDEwWR5lS4SRkXc=; b=rXuG+N5Vofh7DhZkWCa9v/iTlt9g4Lq/ntPYKeXbPDCnDK3AvsmKZOJc+hCA3TRXyb I6M4YwzMkmVEPqloKDBTpZRoSTb0JOpTrSSXkzN3Mv+Tr46rYQdIiM8R7u7lH5OK4IW3 s3hV/b1wOZTic1r6C8itGNDEd72oEsuLy/jUtjKB9WQ2LQv+IWS+MvvAx2qQtK/xoqMx MKF6+d/LhwZMGk+Qqhhko80QQJoplKGhb0gI+YpQOTA07y3jvL5dmlp4EPHPogp648IZ N42/Nxl+eQ6jLSZXOm6y0MCxBF0/Sj8P7I4crNTxuQJPmb1rzY0rzg6kJvI13c0zVJs4 829g== X-Gm-Message-State: APjAAAXjvL7bSnwEDgxW/Xle2+Z7iWkRqd8X5VfduoEwCsYltIgkpwU7 gKJjePfEvjFPa0IBE6wDhFylyT6Qmh4= X-Google-Smtp-Source: APXvYqz+ZgP+flHaC+BWiwysROcvCYvBhri3cq7zXr4ymxgx1DaoHjR89HAO73VBs5LiW2QPqBaAzA== X-Received: by 2002:a17:902:8c98:: with SMTP id t24mr27538384plo.230.1568402153383; Fri, 13 Sep 2019 12:15:53 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m24sm6988149pgj.71.2019.09.13.12.15.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2019 12:15:52 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Thomas Gleixner , Jason Cooper , Marc Zyngier , Rob Herring , Mark Rutland , Kevin Cernekee , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), bcm-kernel-feedback-list@broadcom.com (open list:BROADCOM BMIPS MIPS ARCHITECTURE), linux-mips@vger.kernel.org (open list:BROADCOM BMIPS MIPS ARCHITECTURE) Subject: [PATCH v2 5/5] irqchip/irq-bcm7038-l1: Support brcm,int-fwd-mask Date: Fri, 13 Sep 2019 12:15:42 -0700 Message-Id: <20190913191542.9908-6-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190913191542.9908-1-f.fainelli@gmail.com> References: <20190913191542.9908-1-f.fainelli@gmail.com> Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org On some specific chips like 7211 we need to leave some interrupts untouched/forwarded to the VPU which is another agent in the system making use of that interrupt controller hardware (goes to both ARM GIC and VPU L1 interrupt controller). Make that possible by using the existing brcm,int-fwd-mask property. Signed-off-by: Florian Fainelli --- drivers/irqchip/irq-bcm7038-l1.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c index 0673a44bbdc2..811a34201dd4 100644 --- a/drivers/irqchip/irq-bcm7038-l1.c +++ b/drivers/irqchip/irq-bcm7038-l1.c @@ -44,6 +44,7 @@ struct bcm7038_l1_chip { struct list_head list; u32 wake_mask[MAX_WORDS]; #endif + u32 irq_fwd_mask[MAX_WORDS]; u8 affinity[MAX_WORDS * IRQS_PER_WORD]; }; @@ -265,6 +266,7 @@ static int __init bcm7038_l1_init_one(struct device_node *dn, resource_size_t sz; struct bcm7038_l1_cpu *cpu; unsigned int i, n_words, parent_irq; + int ret; if (of_address_to_resource(dn, idx, &res)) return -EINVAL; @@ -278,6 +280,14 @@ static int __init bcm7038_l1_init_one(struct device_node *dn, else if (intc->n_words != n_words) return -EINVAL; + ret = of_property_read_u32_array(dn , "brcm,int-fwd-mask", + intc->irq_fwd_mask, n_words); + if (ret != 0 && ret != -EINVAL) { + /* property exists but has the wrong number of words */ + pr_err("invalid brcm,int-fwd-mask property\n"); + return -EINVAL; + } + cpu = intc->cpus[idx] = kzalloc(sizeof(*cpu) + n_words * sizeof(u32), GFP_KERNEL); if (!cpu) @@ -288,8 +298,9 @@ static int __init bcm7038_l1_init_one(struct device_node *dn, return -ENOMEM; for (i = 0; i < n_words; i++) { - l1_writel(0xffffffff, cpu->map_base + reg_mask_set(intc, i)); - cpu->mask_cache[i] = 0xffffffff; + l1_writel(0xffffffff & ~intc->irq_fwd_mask[i], + cpu->map_base + reg_mask_set(intc, i)); + cpu->mask_cache[i] = 0xffffffff & ~intc->irq_fwd_mask[i]; } parent_irq = irq_of_parse_and_map(dn, idx);