From patchwork Fri Sep 13 19:10:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11145155 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 8F43E14ED for ; Fri, 13 Sep 2019 19:10:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5944F21479 for ; Fri, 13 Sep 2019 19:10:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rd9zXjfQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388214AbfIMTKc (ORCPT ); Fri, 13 Sep 2019 15:10:32 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:34259 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388321AbfIMTKc (ORCPT ); Fri, 13 Sep 2019 15:10:32 -0400 Received: by mail-pl1-f195.google.com with SMTP id d3so13666238plr.1; Fri, 13 Sep 2019 12:10:31 -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=FFcP+UDVFEHmJs1QxzZlzSRhhd6SePZOlYiyZUxy6po=; b=rd9zXjfQyCb3Bo8/P721KqHGHmPAJdBE4Wvuh9BsBaFIMShZkZreNJdo45Iil47Q5O OJ1xVbGjR4CtVETA8CGjZgFkhg5sWt5vWyp8po9A9iiw0vybB5CW9ZzVryy8jydu8ibr I+flMYYZb9/gcuzP2XbygxSjwejGAa/u7XsEnlTWPeQ1KIew1BrWuKQc8a6duT8Lc7se ny9adHtm4i2uxwvfEvCOQKgfwCAW24Lr4uvig+e471z50K8bkPJ7QBv20hkg36gURXwb pVrhJB7ZI5FO6B64XUX/C6rIofqWwUhGjXII0k72FrVaRkQP1ZiF7PgGie4Zvws9Gk6R tygA== 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=FFcP+UDVFEHmJs1QxzZlzSRhhd6SePZOlYiyZUxy6po=; b=ivq6Cnd9Ek4yOfQ6a0qwWUMW8qPOTwK0NA3Kl/V1bLyL6u7y7s0tNW7H/j6syUntQO 0mU63NNTn73UyFLjVuPf+ieTXIPF+bJz1vAkQnSVd5MY4qSbP5FFveZtaqsW5dJFb0rD y9ZI0bd6St7H65OOzZWBxrMrkCKHyUX0lfnbWlv0w9HL7yxQGibe+ZGl0y891oTsyUPR r9k1kaZ7NTranGdJfExdqch7PXQkvUtifK5dfOlftKC1a3xEuYAnqVrBeEK0oXUcmCJA m30JqN+cquXPTTy4As5P6gpK1LiEH+4QtDnvLJIlPXiWt/aUDzfSqlFjUZzZkMYxqFE/ Li3g== X-Gm-Message-State: APjAAAWz1pidOOEcncNtupg19FzCCzBQAyhrc1kWXiJPA4eQiNxeqrEX OiT9WCDp2t+5KH+Mv5i6XGq/RpZ8q6U= X-Google-Smtp-Source: APXvYqyUX3O49Mdt0MzVDLtyNcXrGaddTXK4bW6BELEhUNQ8Ab33gUUR75qABZaEiC50qikFLcf60w== X-Received: by 2002:a17:902:8c8a:: with SMTP id t10mr28825173plo.109.1568401831271; Fri, 13 Sep 2019 12:10:31 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id r18sm27273779pfc.3.2019.09.13.12.10.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2019 12:10:30 -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 1/6] irqchip/irq-bcm7038-l1: Add PM support Date: Fri, 13 Sep 2019 12:10:21 -0700 Message-Id: <20190913191026.8801-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190913191026.8801-1-f.fainelli@gmail.com> References: <20190913191026.8801-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..c7e37eefec6d 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 +#if 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:10:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11145165 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 5367F14DB for ; Fri, 13 Sep 2019 19:10:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3296E2089F for ; Fri, 13 Sep 2019 19:10:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QstRlW77" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389056AbfIMTKf (ORCPT ); Fri, 13 Sep 2019 15:10:35 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:44432 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388137AbfIMTKe (ORCPT ); Fri, 13 Sep 2019 15:10:34 -0400 Received: by mail-pl1-f195.google.com with SMTP id k1so13634138pls.11; Fri, 13 Sep 2019 12:10:33 -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=QstRlW775vvOVJVfZz7iCtaSLdg66Gin98n43zICC+nHzLfM/2ZAbPjljpPVfx6/Bt go96ZGHkVzitEnA6q+IpZraEE2vuj6R0Z3ue539b7MPA0JBBG24S/4ylwAQbmVcv8con TQjexMZWApRv755LY1MzxYGnf2bnhLHjTfGw/3lKrcotAxD3O9OkMHbL1nW+2Ipe5YMJ lVXVGyxIugrR34ZzQ/oaaNQQfur69bpC1P+VuHkwPaIp5kpjf9Vrn3gsRUOMnk+eW3iT ZAMUvHpjhPx6hwwlGvdZ5Bc0IV0cisUhu5d9X6oEXSpPmS5CgsXyyJtk9Uhynna1BuyF Yv/w== 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=MqWIKCkvlgcerWzYggDTwxrC6uWrcCjCnjzGb4kR7bYCWduuCT3T/AARHgGHE+lnUH La4ghpmH8M0S0T82eFJnL5E6XUI+SInhIctkF3hgeBwEz+YuDbU1HBPCSNk+qMP34TMW QApRm2mOJqeLThmpg0euewso0PCcewVkHYaiVy1yLPBbZ+zpNRWhyFoYXhUemKMBaOe9 SBaIAWNqE0SCD9zYkUFWJL1MI5UhDtzhCBj01GCkJF40E6Qs7K0PTw1fpMk/NWtq2fKk hpWd3vDkCN9BCXcpGSHGMS9Hz5XbF8dfhcwvg2V3uyhen5Z6y1+gP8m85n/+6s55Su6g MKnA== X-Gm-Message-State: APjAAAUqCOLGmYJvDGpPlBe81qysxxKn/+uTKY+t0A1sx2DRKtCPrbv2 fu2KUvGN8KKDZmpt4R/NVuON13FJd+s= X-Google-Smtp-Source: APXvYqyqsS5ErT7gDpycm5ZyrTOzbE895ZvKruoe0+qutF0aSLx892M0dPTbeMUVh++tKodZBfikQQ== X-Received: by 2002:a17:902:b404:: with SMTP id x4mr48613412plr.76.1568401832506; Fri, 13 Sep 2019 12:10:32 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id r18sm27273779pfc.3.2019.09.13.12.10.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2019 12:10:31 -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 2/6] dt-bindings: Document brcm,irq-can-wake for brcm,bcm7038-l1-intc.txt Date: Fri, 13 Sep 2019 12:10:22 -0700 Message-Id: <20190913191026.8801-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190913191026.8801-1-f.fainelli@gmail.com> References: <20190913191026.8801-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 --- .../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:10:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11145163 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 B2A1A14DB for ; Fri, 13 Sep 2019 19:10:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 91ABB206A5 for ; Fri, 13 Sep 2019 19:10:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RmTU+XQh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389107AbfIMTKf (ORCPT ); Fri, 13 Sep 2019 15:10:35 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:38700 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388321AbfIMTKe (ORCPT ); Fri, 13 Sep 2019 15:10:34 -0400 Received: by mail-pf1-f196.google.com with SMTP id h195so18664881pfe.5; Fri, 13 Sep 2019 12:10:34 -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=iEP53jXE1H7ai299FkwmfDyKSeiJcsObnQa2nVkj7GM=; b=RmTU+XQhLlb77l+u6rtOMoxnjiC4sUe9yqmMLEoWDQpaVJWSGUnNkGUZLHwo0wggVs j2oI6XkqFsOc7YGifwwBDLX+v4ftQFWjFOU5xX09feO1DH4K0h9SHDcVBBPXDuAvHfFi o0SBM7dOTwL8hmns8bawZ9R7As9D19uePMMA8yoBwjw9R3ZuJ7Zj8rl9NzICa5QCyl0b 9zXTg8ykarZj0dbFBSNbu+sVHXdrzJlxMh0gr7ICtNlnoJps46lvBVPm3I1pn4Kq11WJ rrW1Qw6HVKqGa77aUw9YeqHBzpmROGVLhR4OAdXu3f+5Ec/Y05pjhpPXIsw7n1Ec47Ch fi0w== 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=iEP53jXE1H7ai299FkwmfDyKSeiJcsObnQa2nVkj7GM=; b=Pv1WD0RdinSfj7paZLeJl+trV2PpgcT+OvWAk820p0YZMFg1KUFPN5MAJ3fqpHqpqB jWdaYoHTo/DV1iX2yYAe2lNPSHyqBx6Nl7fpXomujwujOdjj3jJ5L4LCzY7obCrCclj7 Nl23Is/UxcHJvNl2NV8api3FjGAv8nbTO9rSzsUgIeKd5/E3CVmUuN1a4YiBWow+SkhM QplBa/avD3czUNYQTa6bhNcf+rTpAQtZ72c4ydw4Rdt7Lx9UxQBk0ZI0puC6BK1wt+HK dKExyUTjuLO3ZwD8kf9WCJXPGmeP+O0vUaPCCwsudo5IItaBegODBWJmxjgWZXShm/4f Nw0Q== X-Gm-Message-State: APjAAAXay2wd/kCCRxI7gTK1c98bMVRjtBR9ndVudAC799Cwv8siiDJd cRsOzFXC8uA2Ntmg7aGv29sXaZDrnsc= X-Google-Smtp-Source: APXvYqwZiwo1tQoW5TA31J5VMCx37dKX/0t8zB3TPFBw/T8fvXEn6i2sWUrClMrwhVWgjCOH0YFDug== X-Received: by 2002:a65:41c6:: with SMTP id b6mr44482007pgq.269.1568401833576; Fri, 13 Sep 2019 12:10:33 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id r18sm27273779pfc.3.2019.09.13.12.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2019 12:10:33 -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 3/6] irqchip/irq-bcm7038-l1: Enable parent IRQ if necessary Date: Fri, 13 Sep 2019 12:10:23 -0700 Message-Id: <20190913191026.8801-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190913191026.8801-1-f.fainelli@gmail.com> References: <20190913191026.8801-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 c7e37eefec6d..0ad473249f16 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:10:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11145157 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 9AAF014ED for ; Fri, 13 Sep 2019 19:10:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7973A2089F for ; Fri, 13 Sep 2019 19:10:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="avso3WPV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389395AbfIMTKj (ORCPT ); Fri, 13 Sep 2019 15:10:39 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:45090 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389124AbfIMTKf (ORCPT ); Fri, 13 Sep 2019 15:10:35 -0400 Received: by mail-pl1-f193.google.com with SMTP id x3so13616208plr.12; Fri, 13 Sep 2019 12:10:35 -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=avso3WPVgG5rVphig3UnJsw1yfQwswLbR+qRqiL2jM+brP6ugDjrCf0WasWpp8cH9h qk5ntLMPBZL9SrK+Dw0irFybfmFqatvchwKIrIru+GrRxyGQaADyaAux0S2t3FMJ74gX 3gsEMdLlvX54X8yqi70bkx0QcIQvPOBWVb2e/J94idmhTTxBb9npUWT4SughZHXtgsqb cJnq5x0+ZvULLrNf0x3gch8OyCHIDt1skSxJNUCUTTG1dNn2kU9he14v2bXiogDjk/LQ ugsdJUdE8y5mqNCRvFBePoT8j2avazilpFzkpv9VpkfP756bcB3SSSERs5bs9cKm/gd2 60bw== 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=ZWj2slDxkfxZdcfhqubZgg6T0yM5xg1HuHzm7xUMlNuLpBM3tfqppsQy1Dk5Eo/tWX 1q03nueF/4qnomyVlup173ddy/GUIVgJzgHDL+Nq8XH5D1oHP8jwc6xUdCu3jjepRjHr 5aXzRfpIJN1iTL34RRKm87JkwE8XbNc3zuL/g2K+cYigbsacNyT5NrFS/UaG4ZLPIngd hfRyZMqSeSJ3fBd1e/ZdkQHHVsMIwdznKoL0muuQOwwt7Iw/BZTgoexOM5tKj6yUqW85 /oiQMm42uATZ8NDcZj/Z2H5hHIbGCjp22rbrXVM4AcxjTFR0D1RvwzhS/1QJdl0Hwpj0 aMrQ== X-Gm-Message-State: APjAAAUUByUwbZ/4xoDXXbhRxm1rFqjdEQVTEW0gBTJTpQklM0nUB54t +rXFUyr/+GKk9VlE3eKeuuwbB600LNE= X-Google-Smtp-Source: APXvYqyd6cZeH/MXYnssX3D2Bz+40B9rxrGDpSeZ0YcPHYL1WL4HwbxzENau9QoPaQyWulgrm+Khrg== X-Received: by 2002:a17:902:6b04:: with SMTP id o4mr6389283plk.278.1568401834707; Fri, 13 Sep 2019 12:10:34 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id r18sm27273779pfc.3.2019.09.13.12.10.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2019 12:10:34 -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 4/6] dt-bindings: Document brcm,int-fwd-mask property for bcm7038-l1-intc Date: Fri, 13 Sep 2019 12:10:24 -0700 Message-Id: <20190913191026.8801-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190913191026.8801-1-f.fainelli@gmail.com> References: <20190913191026.8801-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 --- .../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:10:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11145161 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 BB92217E6 for ; Fri, 13 Sep 2019 19:10:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9A7F0206A5 for ; Fri, 13 Sep 2019 19:10:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TEWPOXwV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389023AbfIMTKj (ORCPT ); Fri, 13 Sep 2019 15:10:39 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:40278 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388321AbfIMTKh (ORCPT ); Fri, 13 Sep 2019 15:10:37 -0400 Received: by mail-pl1-f195.google.com with SMTP id y10so13613072pll.7; Fri, 13 Sep 2019 12:10:36 -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=NJmtMt3lb+Jh7/54C7Wh0cgNaZ6kTY930vy6CWOqbNM=; b=TEWPOXwVcUd7n6YYM5iomHZyHlfGoSxzv3E5JnerXffYw4STAqBc8HMmijJobQPA2Z 4NtDgId3CLS7rpRGMGMaUqEQCyP4wHYq7HDqMn2KogQCa/AURCCRyK5QrUXOZAuHsu97 g6DzY/4wEO/kT252VFiT1UactJaeR1RQ4YzOG0WbFQHIBPvMzmaFbRj/glNNkMl9vCKK i3WJXgvfQF6nuxMer6sQZ9h774FzV9uxMv+zlupv/bc1H4JL3ly6zsEatuNfCKVxNghB I6QT7/Tid7WQbpdhiVq76C8X90lCIZm3gA7kkVAXvCFEXXart11tRBjCysY+uBHFxoUp j6tg== 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=NJmtMt3lb+Jh7/54C7Wh0cgNaZ6kTY930vy6CWOqbNM=; b=Mu//BgrWWmYlEE0VuUZ/0u/2wHwR3IVc4uhefqF88IfwT9OeS5CKfOtuaNlzQsbMzF jiuT4VTysydOUp0GifykvRb4bX/qOZ5LEvT183qlbvnzv5Ht6R3FzdMr7jIls/AqDXyG HMSDAo9fn1qZRaaLJajZuEhdbd6pY4c0V7l7awyV2DTS5NjHk8CQTp/u0VutsZ0Xd0Ex mhKpZRlnpxEics5yvnJ67EVHZcRJdHHEt6RiGR90uNj19Evo0puiWgdom2ueiDZFet2x FpAy0liuLY1NlINuBFWbQzIl+pIpR+FwAaazFZNC5llgXTteftX3JawCdsMWC/ebV3IG NpPg== X-Gm-Message-State: APjAAAV9qY0pds8TynayoBsWYKx5g0RELwzKYGLLwhzIxVBDj8jIA9NF yaffD7+9Jyiefrjwaiwsu4RqmvSvT/o= X-Google-Smtp-Source: APXvYqztzVVNlRy0nky8YRo5TuTahQ8JI+kV2G8JwUejG+nnQlSeGUCXtMtjo5k1K5m/ZZx9s7yJwA== X-Received: by 2002:a17:902:8302:: with SMTP id bd2mr51910587plb.9.1568401835804; Fri, 13 Sep 2019 12:10:35 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id r18sm27273779pfc.3.2019.09.13.12.10.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2019 12:10:35 -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 5/6] irqchip/irq-bcm7038-l1: Support brcm,int-fwd-mask Date: Fri, 13 Sep 2019 12:10:25 -0700 Message-Id: <20190913191026.8801-6-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190913191026.8801-1-f.fainelli@gmail.com> References: <20190913191026.8801-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 0ad473249f16..5e8f0fbc5f20 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); From patchwork Fri Sep 13 19:10:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11145159 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 9160D14DB for ; Fri, 13 Sep 2019 19:10:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 705E4206A5 for ; Fri, 13 Sep 2019 19:10:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nPz3tW4q" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389362AbfIMTKj (ORCPT ); Fri, 13 Sep 2019 15:10:39 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:35436 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389316AbfIMTKh (ORCPT ); Fri, 13 Sep 2019 15:10:37 -0400 Received: by mail-pf1-f195.google.com with SMTP id 205so18665141pfw.2; Fri, 13 Sep 2019 12:10:37 -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=52dr8qatRQLADbgLjvJtKFDILDVDIhY+4/06nquh468=; b=nPz3tW4qoi5HnmP98xfj1kSrj3sha1ABx497Kmj4jQRBIpWtlTctWT7YqDGYOjX8B6 FJ5JTdfEQDXUcLTcV7tbnQQ/VjQgAHYHYrxnKPMekGXE4XZsyVWJyY2RR4bsDzJUsgfv /EcyWPmb/sADi5EsrIyWfPi0+32fVGKGyB4OxCS0R3ffeR+J4TX8vUYo8i5ouIEuGFAz JDxfrPma7RBsOyJzL5d6Zhr8UJtRdMOLhVC8vJ0PzfHqQyUVGufdBodRfZdhTonao7iI qIZm7CrBsFPtCBv7RqVPP1x62PfcvIfoKmVXDKRR7FYM4TXzKfWTnjPMncGn0gieS5zQ K9Wg== 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=52dr8qatRQLADbgLjvJtKFDILDVDIhY+4/06nquh468=; b=DysDme8Cigmh9Xs6ENpknDxhVRP5q0bPXmX3QBrMlUgVeUWK/4JwwWmU6kj/OTIIKL F2Cz9HUaAHjmnFTnQbDp7O1WuvNGPkg7RIMl+SY6YPU45+8YzFThTHbX6Xo171Or6kiC AxdnLLbWKg/u7Y680zSNVVkRjeOcYe+R37vEwjxX0HailVMlxutR+FNaez7nWC3HJTgD TPFKM6aV+heSEAN2H2+92wXbWAX2etzP2CcLRpN25P2TmYSZKaLFafxx56lWr4mKjCB+ P0KSXbqRg55V2KDkW9KPNOZUATBA7www0E6x+tKhzWcXoup/OHe689N1AD7Q0glZp9Np rGxw== X-Gm-Message-State: APjAAAV9V6y3pWDvbYsT1IwZwYRym84Y5F0FZfYc+/AM0n6XC8Bt3XRO NDIFDZL21k4XsDxpcAGkvXQsor512vU= X-Google-Smtp-Source: APXvYqxqR/TzT50mDL3/6MR0Yms0OQkm4wIHlKEHIMITDKqcUSrr3CHMxgugyGlui1PyebpzoowadA== X-Received: by 2002:a17:90a:8987:: with SMTP id v7mr7088657pjn.115.1568401836877; Fri, 13 Sep 2019 12:10:36 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id r18sm27273779pfc.3.2019.09.13.12.10.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2019 12:10:36 -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 6/6] fixup! irqchip/irq-bcm7038-l1: Add PM support Date: Fri, 13 Sep 2019 12:10:26 -0700 Message-Id: <20190913191026.8801-7-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190913191026.8801-1-f.fainelli@gmail.com> References: <20190913191026.8801-1-f.fainelli@gmail.com> Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org --- drivers/irqchip/irq-bcm7038-l1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c index 5e8f0fbc5f20..811a34201dd4 100644 --- a/drivers/irqchip/irq-bcm7038-l1.c +++ b/drivers/irqchip/irq-bcm7038-l1.c @@ -397,7 +397,7 @@ static struct irq_chip bcm7038_l1_irq_chip = { #ifdef CONFIG_SMP .irq_cpu_offline = bcm7038_l1_cpu_offline, #endif -#if CONFIG_PM_SLEEP +#ifdef CONFIG_PM_SLEEP .irq_set_wake = bcm7038_l1_set_wake, #endif };