From patchwork Tue Sep 8 08:20:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 11762975 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 B469759D for ; Tue, 8 Sep 2020 08:21:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 831C421D43 for ; Tue, 8 Sep 2020 08:21:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JVAapGc7"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HrHdOgQB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 831C421D43 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=AjgYQvwdxz7DBPcCJeyS4aHI8YDSFrxuua+u/v6dU3k=; b=JVAapGc7Bq/oNmVqJvoJ2xmAH BMAABne0h+DKuFJnihv7+UObGR6ye8zswduCqMYfRHyT6vY6iTuxm+Xc3VvooKzI0LvNVpg9cCrMP jiiEnRdss4GmxjE6Vy/Nz8Ir9cnBGzp4x88OiI3W5Fda+Elyp3h39Sm+ImPTjd3NLXE8IfaXbz9kj t7b2RwY9A7MnDc4c+Afc1Dsu6+ejXUtFj5eCwQ9Gbd50fN7CnAgmaVjmAB0kP2kC6ZVaTas0GSh1t /7hEF3w4hYrIBpsLAQ0n8axh1DgHWSNA0nUWo4645O/qlvpboRMd7e170gJpskC7QKzp+h3rwN05H UtCkUV5PA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFYsR-0004lQ-C7; Tue, 08 Sep 2020 08:21:19 +0000 Received: from mail-ej1-x643.google.com ([2a00:1450:4864:20::643]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFYs5-0004XS-7e; Tue, 08 Sep 2020 08:21:03 +0000 Received: by mail-ej1-x643.google.com with SMTP id p9so21223939ejf.6; Tue, 08 Sep 2020 01:20:55 -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 :mime-version:content-transfer-encoding; bh=ps6oy10ORdikw70XKA0O8bVm8SaRqDQHF3zytkb03qM=; b=HrHdOgQBo+a4rq90+PO/XkrIM65WRoaZk5aVcCGXI6szdjicSPLMTOMjq/ed62Z78H tI3p9FdIdlpqAwQhpKnw4eERJqQTRSxIsaVnsgnjpHMmAEYw5/6832Z0ITrzo7E/z0hN KxmAMyNN9tKOZDJ1zMhOm7839nkrT6N4n/eIc88luuXvXLkcvWnojC1iFeS4MRxJnfLz zajEboGaFstjthaPn5cLuqAzbavhUaMdHzgCt/ig90H6ISNK+rY+WXk5uPgHtPolj0cw RWvfdhoEcYtXyfgUkZX7Rfxdp+WkSgkPFH7R8uc3b80QAh/RrkdwrsD5NhxSqLJCSo2a xWaQ== 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:mime-version:content-transfer-encoding; bh=ps6oy10ORdikw70XKA0O8bVm8SaRqDQHF3zytkb03qM=; b=h/aJDYjOg64dbKIG/yD0OWZIrt0mLgMD3xAbJ4ymzE1BWJE3aPJrwz+weebuUgsIHW vjDFSHskPMjF2Po2vj5tHbcKUAVz/9R2qAEEBWfWtGKgYKW3E/BgIxfcaMKP0l4OsuNK y46OcO1Etw/S+0fGiZBsP/0jgIhHdWtQ0VpiRfakFYotCNI9eRsiFsDuuYUZrwvTl4+Q FFE8OKwv4ptoPdh3onbOxyM3gnbWyaDUlCvMggltuyHNKUyZtKvDMdv57jUga9i3ouf0 sudyKTCbuxN0Rgm6qYyDqQaxUfRX+vL8datYTWt3aLEcUKhfVULDhg8aUP+TC16VBkx5 y1yQ== X-Gm-Message-State: AOAM533EeI2BoTJ13NbLyfkyJqOCz7pQNVQ9lqkJwTJlZlh9egDxtCFF lwIxu40kJvnHiCQwsldtRR0= X-Google-Smtp-Source: ABdhPJyTAgqrwRdZP1j6C9LpWaBsGtPZvOlIDukUOwzhQk9h9U88BuYYYbnw4mXuA8xJBLi49arH2Q== X-Received: by 2002:a17:906:c289:: with SMTP id r9mr20901895ejz.402.1599553254323; Tue, 08 Sep 2020 01:20:54 -0700 (PDT) Received: from localhost.localdomain ([188.24.159.61]) by smtp.gmail.com with ESMTPSA id g24sm13172326edy.51.2020.09.08.01.20.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 01:20:53 -0700 (PDT) From: Cristian Ciocaltea To: Marc Zyngier , Rob Herring , Manivannan Sadhasivam , Thomas Gleixner , Jason Cooper , =?utf-8?q?Andreas_F=C3=A4rber?= Subject: [PATCH v6 1/3] dt-bindings: interrupt-controller: Add Actions SIRQ controller binding Date: Tue, 8 Sep 2020 11:20:48 +0300 Message-Id: X-Mailer: git-send-email 2.28.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200908_042057_342555_84B43FC0 X-CRM114-Status: GOOD ( 16.65 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:643 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [cristian.ciocaltea[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, parthiban@linumiz.com, Saravanan Sekar , linux-actions@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Actions Semi Owl SoCs SIRQ interrupt controller is found in S500, S700 and S900 SoCs and provides support for handling up to 3 external interrupt lines. Signed-off-by: Cristian Ciocaltea --- Changes in v6: - Got rid of the 'actions,owl-sirq' compatible, per Robs's feedback - Replaced 'actions,ext-interrupts' with 'interrupts', as agreed with Rob and Marc Changes in v5: - Updated controller description statements both in the commit message and the binding doc .../actions,owl-sirq.yaml | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/actions,owl-sirq.yaml diff --git a/Documentation/devicetree/bindings/interrupt-controller/actions,owl-sirq.yaml b/Documentation/devicetree/bindings/interrupt-controller/actions,owl-sirq.yaml new file mode 100644 index 000000000000..5da333c644c9 --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/actions,owl-sirq.yaml @@ -0,0 +1,65 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/interrupt-controller/actions,owl-sirq.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Actions Semi Owl SoCs SIRQ interrupt controller + +maintainers: + - Manivannan Sadhasivam + - Cristian Ciocaltea + +description: | + This interrupt controller is found in the Actions Semi Owl SoCs (S500, S700 + and S900) and provides support for handling up to 3 external interrupt lines. + +properties: + compatible: + enum: + - actions,s500-sirq + - actions,s700-sirq + - actions,s900-sirq + + reg: + maxItems: 1 + + interrupt-controller: true + + '#interrupt-cells': + const: 2 + description: + The first cell is the input IRQ number, between 0 and 2, while the second + cell is the trigger type as defined in interrupt.txt in this directory. + + 'interrupts': + description: | + Contains the GIC SPI IRQs mapped to the external interrupt lines. + They shall be specified sequentially from output 0 to 2. + minItems: 3 + maxItems: 3 + +required: + - compatible + - reg + - interrupt-controller + - '#interrupt-cells' + - 'interrupts' + +additionalProperties: false + +examples: + - | + #include + + sirq: interrupt-controller@b01b0200 { + compatible = "actions,s500-sirq"; + reg = <0xb01b0200 0x4>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = , /* SIRQ0 */ + , /* SIRQ1 */ + ; /* SIRQ2 */ + }; + +... From patchwork Tue Sep 8 08:20:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 11762977 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 E02A71599 for ; Tue, 8 Sep 2020 08:21:49 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 98FAC21D7B for ; Tue, 8 Sep 2020 08:21:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="yIGoqpf8"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U4C6tqtw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 98FAC21D7B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vLWiDBeeoZpPOPGlCrx6N8pSzpiAkoXBqPVylMBCfmA=; b=yIGoqpf89c51tnyibiCpLYnyZ qGaJQ3Od5F9U+wx0xCh/fgnJp1uNQPvlxcZK/OZjohqVyqjl+Yoai/cUdgThaT9rFxR50ah1Zv8mH KCUYhrvu6IVExfmWPhEh/zCQUX82IUKPtnqmFkXmzDbN/ep+6RqzBABhXraFSpocwdwZccVB9xej5 D7XjXEARtfs02VqdFioWTjV3lBcZDVJKFscyFmlwrq6VyxbSKiQq078jJp365Q+/ETp4kS8CcMua6 39cXyK6itIQm1WCORT8MkJuTibQnxudNpyNOiYp2S6jfHb5XYINWMxbH2FUF+GU4FV7EVdyKRjmi0 zku6bYG1g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFYsf-0004qf-GW; Tue, 08 Sep 2020 08:21:33 +0000 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFYs5-0004YZ-VG; Tue, 08 Sep 2020 08:21:06 +0000 Received: by mail-ed1-x543.google.com with SMTP id ay8so15088204edb.8; Tue, 08 Sep 2020 01:20:56 -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 :mime-version:content-transfer-encoding; bh=2DTF07SAWl5KXUyeZsjfSS7NpFEYyyCWUCIZRtdcA04=; b=U4C6tqtwGMfJS8vh6pInoZryPiNFg5tcTT9rWW/tgjIT5J6iji+DjsEnxFWb5BXwtd STeyT6JqQ80SArqnqUS3FmXsMsOBHdtnWtmwX6EB4jWSQoxkoDBmf9diyKfafjy4UhEo iE/1uS3Z4AQSVqySBmxUqXHSuIgiti/AYKlPZ9eGpyjkI1B5w7aGuq0adVw6o2V0HjPx yeJQ62I5qPwOc0WyljzZR8aE3ux0apRwlKqm2ysSR+1kQ5ClQB6GP02UsmlWwKlAUTCF lkf58FnImXmjISa+eSAKKYDlbc5T3gpkFUc7toTAiqv58WCpgUxERKWnhU/1uN38obqJ F/LA== 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:mime-version:content-transfer-encoding; bh=2DTF07SAWl5KXUyeZsjfSS7NpFEYyyCWUCIZRtdcA04=; b=uQnD9qi9sFclKKdvf08HvrdvkgLGSFlRTByYr3Mx0aVGYBj0Jq6a0mYsN8OflToDlZ cxTis+/jIQiY4y+7Ld8ZEDdh6Bz9hBfc4+57CIGnwmYvH26WE1jDzsp80fS6GJvXRyr6 t4uCsqtIRiIMra0MSjIfnbmwPocoWT7qIAWUiOUrUyGkJtW7dT/IUN3JloS8eBaYbWyR oSp31jQHmf94TmgJTaVK72OmnTc8w0YGhtES4C5M465/3KUxXvs71zwS2N7GNteCw04w jM+MfBwNchxrLwo2O2vr2vvMzGta6N0tOns2PMISWkAo77fmorZvic/crrHty33fHwtp YgAQ== X-Gm-Message-State: AOAM530WXAsrhovsHLRb6Vuj5UFzpdgIsIrbyd+qS/6GMFZ8FvCzF8yk lBUyy7hUYy2l0fKeei1bNcA= X-Google-Smtp-Source: ABdhPJwSW/c4EHpZMZAIbj1v3qYCjwrZG/GxNxPUKm6ovYqpTPjfX+Uw7pkhewYNyMzy9l4bP5VWSQ== X-Received: by 2002:aa7:cb10:: with SMTP id s16mr25947564edt.72.1599553255695; Tue, 08 Sep 2020 01:20:55 -0700 (PDT) Received: from localhost.localdomain ([188.24.159.61]) by smtp.gmail.com with ESMTPSA id g24sm13172326edy.51.2020.09.08.01.20.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 01:20:55 -0700 (PDT) From: Cristian Ciocaltea To: Marc Zyngier , Rob Herring , Manivannan Sadhasivam , Thomas Gleixner , Jason Cooper , =?utf-8?q?Andreas_F=C3=A4rber?= Subject: [PATCH v6 2/3] irqchip: Add Actions Semi Owl SIRQ controller Date: Tue, 8 Sep 2020 11:20:49 +0300 Message-Id: <1167b847f6fe1da3834aeaadf5710ddac54f06a0.1599552438.git.cristian.ciocaltea@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200908_042058_039482_31DA7E3F X-CRM114-Status: GOOD ( 29.28 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:543 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [cristian.ciocaltea[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, parthiban@linumiz.com, Saravanan Sekar , linux-actions@lists.infradead.org, linux-kernel@vger.kernel.org, Parthiban Nallathambi , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This interrupt controller is found in the Actions Semi Owl SoCs (S500, S700 and S900) and provides support for handling up to 3 external interrupt lines. Each line can be independently configured as interrupt and triggers on either of the edges or either of the levels. Additionally, each line can also be masked individually. The patch is based on the work started by Parthiban Nallathambi: https://lore.kernel.org/lkml/20181126100356.2840578-1-pn@denx.de/ Signed-off-by: Parthiban Nallathambi Signed-off-by: Saravanan Sekar [cristi: optimized DT, various fixes/cleanups/improvements] Signed-off-by: Cristian Ciocaltea Signed-off-by: Parthiban Nallathambi Signed-off-by: Saravanan Sekar Signed-off-by: Cristian Ciocaltea --- Changes in v6: - Got rid of the of_match table and used IRQCHIP_DECLARE for each of the 3 driver compatibles - Transformed owl_sirq_of_init() into a helper function: renamed to owl_sirq_of_init(), dropped handling of the custom property 'actions,ext-interrupts' and used standard API for parsing the replacement 'interrupts' - Used GIC_SPI constant instead of the related number - Minor changes in the commit message Changes in v5 - according to Marc's review: - Updated commit message - Aligned members in struct owl_sirq_chip_data - Added naming for SIRQ0 control register offset - Improved code readability by using FIELD_PREP and FIELD_GET - Dropped redundant handling of the IRQ trigger information - Added missing irq_set_affinity to owl_sirq_chip descriptor drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-owl-sirq.c | 359 +++++++++++++++++++++++++++++++++ 2 files changed, 360 insertions(+) create mode 100644 drivers/irqchip/irq-owl-sirq.c diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index 133f9c45744a..b8eb5b8b766d 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile @@ -7,6 +7,7 @@ obj-$(CONFIG_ATH79) += irq-ath79-cpu.o obj-$(CONFIG_ATH79) += irq-ath79-misc.o obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2836.o +obj-$(CONFIG_ARCH_ACTIONS) += irq-owl-sirq.o obj-$(CONFIG_DAVINCI_AINTC) += irq-davinci-aintc.o obj-$(CONFIG_DAVINCI_CP_INTC) += irq-davinci-cp-intc.o obj-$(CONFIG_EXYNOS_IRQ_COMBINER) += exynos-combiner.o diff --git a/drivers/irqchip/irq-owl-sirq.c b/drivers/irqchip/irq-owl-sirq.c new file mode 100644 index 000000000000..6e4127465094 --- /dev/null +++ b/drivers/irqchip/irq-owl-sirq.c @@ -0,0 +1,359 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Actions Semi Owl SoCs SIRQ interrupt controller driver + * + * Copyright (C) 2014 Actions Semi Inc. + * David Liu + * + * Author: Parthiban Nallathambi + * Author: Saravanan Sekar + * Author: Cristian Ciocaltea + */ + +#include +#include +#include +#include +#include + +#include + +#define NUM_SIRQ 3 + +#define INTC_EXTCTL_PENDING BIT(0) +#define INTC_EXTCTL_CLK_SEL BIT(4) +#define INTC_EXTCTL_EN BIT(5) +#define INTC_EXTCTL_TYPE_MASK GENMASK(7, 6) +#define INTC_EXTCTL_TYPE_HIGH 0 +#define INTC_EXTCTL_TYPE_LOW BIT(6) +#define INTC_EXTCTL_TYPE_RISING BIT(7) +#define INTC_EXTCTL_TYPE_FALLING (BIT(6) | BIT(7)) + +/* S500 & S700 SIRQ control register masks */ +#define INTC_EXTCTL_SIRQ0_MASK GENMASK(23, 16) +#define INTC_EXTCTL_SIRQ1_MASK GENMASK(15, 8) +#define INTC_EXTCTL_SIRQ2_MASK GENMASK(7, 0) + +/* S900 SIRQ control register offsets, relative to controller base address */ +#define INTC_EXTCTL0 0x0000 +#define INTC_EXTCTL1 0x0328 +#define INTC_EXTCTL2 0x032c + +struct owl_sirq_params { + /* INTC_EXTCTL reg shared for all three SIRQ lines */ + bool reg_shared; + /* INTC_EXTCTL reg offsets relative to controller base address */ + u16 reg_offset[NUM_SIRQ]; +}; + +struct owl_sirq_chip_data { + const struct owl_sirq_params *params; + void __iomem *base; + raw_spinlock_t lock; + u32 ext_irqs[NUM_SIRQ]; +}; + +/* S500 & S700 SoCs */ +static const struct owl_sirq_params owl_sirq_s500_params = { + .reg_shared = true, + .reg_offset = { 0, 0, 0 }, +}; + +/* S900 SoC */ +static const struct owl_sirq_params owl_sirq_s900_params = { + .reg_shared = false, + .reg_offset = { INTC_EXTCTL0, INTC_EXTCTL1, INTC_EXTCTL2 }, +}; + +static u32 owl_field_get(u32 val, u32 index) +{ + switch (index) { + case 0: + return FIELD_GET(INTC_EXTCTL_SIRQ0_MASK, val); + case 1: + return FIELD_GET(INTC_EXTCTL_SIRQ1_MASK, val); + case 2: + default: + return FIELD_GET(INTC_EXTCTL_SIRQ2_MASK, val); + } +} + +static u32 owl_field_prep(u32 val, u32 index) +{ + switch (index) { + case 0: + return FIELD_PREP(INTC_EXTCTL_SIRQ0_MASK, val); + case 1: + return FIELD_PREP(INTC_EXTCTL_SIRQ1_MASK, val); + case 2: + default: + return FIELD_PREP(INTC_EXTCTL_SIRQ2_MASK, val); + } +} + +static u32 owl_sirq_read_extctl(struct owl_sirq_chip_data *data, u32 index) +{ + u32 val; + + val = readl_relaxed(data->base + data->params->reg_offset[index]); + if (data->params->reg_shared) + val = owl_field_get(val, index); + + return val; +} + +static void owl_sirq_write_extctl(struct owl_sirq_chip_data *data, + u32 extctl, u32 index) +{ + u32 val; + + if (data->params->reg_shared) { + val = readl_relaxed(data->base + data->params->reg_offset[index]); + val &= ~owl_field_prep(0xff, index); + extctl = owl_field_prep(extctl, index) | val; + } + + writel_relaxed(extctl, data->base + data->params->reg_offset[index]); +} + +static void owl_sirq_clear_set_extctl(struct owl_sirq_chip_data *d, + u32 clear, u32 set, u32 index) +{ + unsigned long flags; + u32 val; + + raw_spin_lock_irqsave(&d->lock, flags); + val = owl_sirq_read_extctl(d, index); + val &= ~clear; + val |= set; + owl_sirq_write_extctl(d, val, index); + raw_spin_unlock_irqrestore(&d->lock, flags); +} + +static void owl_sirq_eoi(struct irq_data *data) +{ + struct owl_sirq_chip_data *chip_data = irq_data_get_irq_chip_data(data); + + /* + * Software must clear external interrupt pending, when interrupt type + * is edge triggered, so we need per SIRQ based clearing. + */ + if (!irqd_is_level_type(data)) + owl_sirq_clear_set_extctl(chip_data, 0, INTC_EXTCTL_PENDING, + data->hwirq); + + irq_chip_eoi_parent(data); +} + +static void owl_sirq_mask(struct irq_data *data) +{ + struct owl_sirq_chip_data *chip_data = irq_data_get_irq_chip_data(data); + + owl_sirq_clear_set_extctl(chip_data, INTC_EXTCTL_EN, 0, data->hwirq); + irq_chip_mask_parent(data); +} + +static void owl_sirq_unmask(struct irq_data *data) +{ + struct owl_sirq_chip_data *chip_data = irq_data_get_irq_chip_data(data); + + owl_sirq_clear_set_extctl(chip_data, 0, INTC_EXTCTL_EN, data->hwirq); + irq_chip_unmask_parent(data); +} + +/* + * GIC does not handle falling edge or active low, hence SIRQ shall be + * programmed to convert falling edge to rising edge signal and active + * low to active high signal. + */ +static int owl_sirq_set_type(struct irq_data *data, unsigned int type) +{ + struct owl_sirq_chip_data *chip_data = irq_data_get_irq_chip_data(data); + u32 sirq_type; + + switch (type) { + case IRQ_TYPE_LEVEL_LOW: + sirq_type = INTC_EXTCTL_TYPE_LOW; + type = IRQ_TYPE_LEVEL_HIGH; + break; + case IRQ_TYPE_LEVEL_HIGH: + sirq_type = INTC_EXTCTL_TYPE_HIGH; + break; + case IRQ_TYPE_EDGE_FALLING: + sirq_type = INTC_EXTCTL_TYPE_FALLING; + type = IRQ_TYPE_EDGE_RISING; + break; + case IRQ_TYPE_EDGE_RISING: + sirq_type = INTC_EXTCTL_TYPE_RISING; + break; + default: + return -EINVAL; + } + + owl_sirq_clear_set_extctl(chip_data, INTC_EXTCTL_TYPE_MASK, sirq_type, + data->hwirq); + + return irq_chip_set_type_parent(data, type); +} + +static struct irq_chip owl_sirq_chip = { + .name = "owl-sirq", + .irq_mask = owl_sirq_mask, + .irq_unmask = owl_sirq_unmask, + .irq_eoi = owl_sirq_eoi, + .irq_set_type = owl_sirq_set_type, + .irq_retrigger = irq_chip_retrigger_hierarchy, +#ifdef CONFIG_SMP + .irq_set_affinity = irq_chip_set_affinity_parent, +#endif +}; + +static int owl_sirq_domain_translate(struct irq_domain *d, + struct irq_fwspec *fwspec, + unsigned long *hwirq, + unsigned int *type) +{ + if (!is_of_node(fwspec->fwnode)) + return -EINVAL; + + if (fwspec->param_count != 2 || fwspec->param[0] >= NUM_SIRQ) + return -EINVAL; + + *hwirq = fwspec->param[0]; + *type = fwspec->param[1]; + + return 0; +} + +static int owl_sirq_domain_alloc(struct irq_domain *domain, unsigned int virq, + unsigned int nr_irqs, void *data) +{ + struct owl_sirq_chip_data *chip_data = domain->host_data; + struct irq_fwspec *fwspec = data; + struct irq_fwspec parent_fwspec; + irq_hw_number_t hwirq; + unsigned int type; + int ret; + + if (WARN_ON(nr_irqs != 1)) + return -EINVAL; + + ret = owl_sirq_domain_translate(domain, fwspec, &hwirq, &type); + if (ret) + return ret; + + switch (type) { + case IRQ_TYPE_EDGE_RISING: + case IRQ_TYPE_LEVEL_HIGH: + break; + case IRQ_TYPE_EDGE_FALLING: + type = IRQ_TYPE_EDGE_RISING; + break; + case IRQ_TYPE_LEVEL_LOW: + type = IRQ_TYPE_LEVEL_HIGH; + break; + default: + return -EINVAL; + } + + irq_domain_set_hwirq_and_chip(domain, virq, hwirq, &owl_sirq_chip, + chip_data); + + parent_fwspec.fwnode = domain->parent->fwnode; + parent_fwspec.param_count = 3; + parent_fwspec.param[0] = GIC_SPI; + parent_fwspec.param[1] = chip_data->ext_irqs[hwirq]; + parent_fwspec.param[2] = type; + + return irq_domain_alloc_irqs_parent(domain, virq, 1, &parent_fwspec); +} + +static const struct irq_domain_ops owl_sirq_domain_ops = { + .translate = owl_sirq_domain_translate, + .alloc = owl_sirq_domain_alloc, + .free = irq_domain_free_irqs_common, +}; + +static int __init owl_sirq_init(const struct owl_sirq_params *params, + struct device_node *node, + struct device_node *parent) +{ + struct irq_domain *domain, *parent_domain; + struct owl_sirq_chip_data *chip_data; + int ret, i; + + parent_domain = irq_find_host(parent); + if (!parent_domain) { + pr_err("%pOF: failed to find sirq parent domain\n", node); + return -ENXIO; + } + + chip_data = kzalloc(sizeof(*chip_data), GFP_KERNEL); + if (!chip_data) + return -ENOMEM; + + raw_spin_lock_init(&chip_data->lock); + + chip_data->params = params; + + chip_data->base = of_iomap(node, 0); + if (!chip_data->base) { + pr_err("%pOF: failed to map sirq registers\n", node); + ret = -ENXIO; + goto out_free; + } + + for (i = 0; i < NUM_SIRQ; i++) { + struct of_phandle_args irq; + + ret = of_irq_parse_one(node, i, &irq); + if (ret) { + pr_err("%pOF: failed to parse interrupt %d\n", node, i); + goto out_unmap; + } + + if (WARN_ON(irq.args_count != 3)) { + ret = -EINVAL; + goto out_unmap; + } + + chip_data->ext_irqs[i] = irq.args[1]; + + /* Set 24MHz external interrupt clock freq */ + owl_sirq_clear_set_extctl(chip_data, 0, INTC_EXTCTL_CLK_SEL, i); + } + + domain = irq_domain_add_hierarchy(parent_domain, 0, NUM_SIRQ, node, + &owl_sirq_domain_ops, chip_data); + if (!domain) { + pr_err("%pOF: failed to add domain\n", node); + ret = -ENOMEM; + goto out_unmap; + } + + return 0; + +out_unmap: + iounmap(chip_data->base); +out_free: + kfree(chip_data); + + return ret; +} + +static int __init owl_sirq_s500_of_init(struct device_node *node, + struct device_node *parent) +{ + return owl_sirq_init(&owl_sirq_s500_params, node, parent); +} + +IRQCHIP_DECLARE(owl_sirq_s500, "actions,s500-sirq", owl_sirq_s500_of_init); +IRQCHIP_DECLARE(owl_sirq_s700, "actions,s700-sirq", owl_sirq_s500_of_init); + +static int __init owl_sirq_s900_of_init(struct device_node *node, + struct device_node *parent) +{ + return owl_sirq_init(&owl_sirq_s900_params, node, parent); +} + +IRQCHIP_DECLARE(owl_sirq_s900, "actions,s900-sirq", owl_sirq_s900_of_init); From patchwork Tue Sep 8 08:20:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 11763037 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 D938A1599 for ; Tue, 8 Sep 2020 09:31:29 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A9E952166E for ; Tue, 8 Sep 2020 09:31:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TiCkbsCQ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="q3m7oZW4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9E952166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FwDsrdmKrwgsK/MGVwVSjMDjkkU/Xvw3/ctka60SE+4=; b=TiCkbsCQt73C2V8KsjGvtyN+/ Y6WMMmxVmog2oqTPOIWDBNGKptm3m1i28293X1MWsmhJdpeWpx+xiBnMJxtIkAhqjXFAI7Ot3Ajxe HDZ21v9iljQ0sA4l10IRxKGAMJntTxuP1CyE/y7XYLKEKgPIUnZAybdvEe8+mkXZhAoIUbNrYptED /lrRDERQdlTv16v3d0MopESx0gHBLORbudp4tHmWnnv1/DXwd81GAueQxJREJe/iUHoYwL4cjlJdQ GXk5Zi4HimHQlBRSxaHJHUAGOr/gmGbiMHL7V+AIOZq9ctU/oUnOMwEU4BTD7gcYUZNaV3rOYwQWK 5GaEKyoUw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFZxS-0000Sr-R6; Tue, 08 Sep 2020 09:30:34 +0000 Received: from mail-ed1-x542.google.com ([2a00:1450:4864:20::542]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFYs6-0004ZD-CW; Tue, 08 Sep 2020 08:21:04 +0000 Received: by mail-ed1-x542.google.com with SMTP id a12so15048087eds.13; Tue, 08 Sep 2020 01:20:57 -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 :mime-version:content-transfer-encoding; bh=TfJihMsMhRJ/+S5wdJVUFID0QqKRghvIoFnr9LgeHsI=; b=q3m7oZW45fffzPqJmgfA9l81+hLXs6Lbw5ThJJ/lwl7N4Js5b0kL7tHKaKZcYldxh8 poGRL9GAZwEoI7kzriXsF6H1dTijCreMpUftiDECooMIkAC+THREmKVEuli9jm6pa01x 6m51OfsGV/Nk11D6ur+z0mo3UJpV3+JD4eFmw7F3Zlsj4nDsFRTgnkTTkHKuBYMOiZDr TT87/4SWcFk+CpIKyKHCPrMoydfSW9iliTdwArtRqzVa3OsMuIqlB7ennQoXL9YOJ/6E C6h5fLA97jEAK/JiDddiw8JDvyOB95LEl/JLplAjW8/kWWX8tV7E4Tfu3fUUqH5NofTS E9pA== 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:mime-version:content-transfer-encoding; bh=TfJihMsMhRJ/+S5wdJVUFID0QqKRghvIoFnr9LgeHsI=; b=tTak4OZ1bneaRiBv0aojvv4q7s4nFamNtNbgW/WlsrPxPyf5w/eu6uJQaSpEEPgh9w VVOpS4EeyQ17aP0ktFEnKa9vZQJCNq3ON02/WRPHIEbs8L7DxHSaewnc4TB+2wK+KtwU 23sDuBnWnDdb/s3wyo8mWPm5U0+nrsPvs/NYetMUWnpKONf+HUOz5j/y8+jDp/px6cNo n89Kyv89O3z2cXRntEdvBzZHcTXGgFIDQWvH9U/Fkh6xHlgA17ZOVMt++eAZ7zC+URYs wPnJueW1Cw+Y7mKzOq3murrxO8pKAQk4zdtgRi1otE5vNHzosjSsT/ssrduIbGp4wIe1 yx9g== X-Gm-Message-State: AOAM531+u32FmYJaZbwWYU0U6qk41HwZ4KB1HgL7CMEHmEYeJ30pMLhu Z7dZ2REjex/aOKMo2vFiwDLJ0IXtV0Y= X-Google-Smtp-Source: ABdhPJyHgy9EZgTDSot0DQpBYTdm6PENWHy7FxF+KT3GvFHw9Y6Q3lrC6p1eskmu9Kz7LCUJUGIqPQ== X-Received: by 2002:a50:8062:: with SMTP id 89mr25090547eda.241.1599553257078; Tue, 08 Sep 2020 01:20:57 -0700 (PDT) Received: from localhost.localdomain ([188.24.159.61]) by smtp.gmail.com with ESMTPSA id g24sm13172326edy.51.2020.09.08.01.20.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 01:20:56 -0700 (PDT) From: Cristian Ciocaltea To: Marc Zyngier , Rob Herring , Manivannan Sadhasivam , Thomas Gleixner , Jason Cooper , =?utf-8?q?Andreas_F=C3=A4rber?= Subject: [PATCH v6 3/3] MAINTAINERS: Add entries for Actions Semi Owl SIRQ controller Date: Tue, 8 Sep 2020 11:20:50 +0300 Message-Id: X-Mailer: git-send-email 2.28.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200908_042058_452907_75411BE5 X-CRM114-Status: GOOD ( 11.75 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:542 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [cristian.ciocaltea[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, parthiban@linumiz.com, Saravanan Sekar , linux-actions@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add entries for Actions Semi Owl SIRQ controller binding and driver. Signed-off-by: Cristian Ciocaltea --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 9544eec4eff2..04c75815fac6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1525,6 +1525,7 @@ F: Documentation/devicetree/bindings/arm/actions.yaml F: Documentation/devicetree/bindings/clock/actions,owl-cmu.txt F: Documentation/devicetree/bindings/dma/owl-dma.txt F: Documentation/devicetree/bindings/i2c/i2c-owl.txt +F: Documentation/devicetree/bindings/interrupt-controller/actions,owl-sirq.yaml F: Documentation/devicetree/bindings/mmc/owl-mmc.yaml F: Documentation/devicetree/bindings/pinctrl/actions,* F: Documentation/devicetree/bindings/power/actions,owl-sps.txt @@ -1536,6 +1537,7 @@ F: drivers/clk/actions/ F: drivers/clocksource/timer-owl* F: drivers/dma/owl-dma.c F: drivers/i2c/busses/i2c-owl.c +F: drivers/irqchip/irq-owl-sirq.c F: drivers/mmc/host/owl-mmc.c F: drivers/pinctrl/actions/* F: drivers/soc/actions/