From patchwork Sun Aug 16 11:33:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 11716097 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 64E0F739 for ; Sun, 16 Aug 2020 11:34: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 3D6C120708 for ; Sun, 16 Aug 2020 11:34: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="cXZ2s0Dr"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="I2InCRRd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3D6C120708 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=v+OO6IxU6LDXwLUBO5F3QjB6z5QKO7zmfHry2OOmt5s=; b=cXZ2s0Dr/LUVF4wQa2xXl69mw faub6eMC4WzSkTLkQqtSlvbh3Oz+KdG9dxwXJWVDrk3z2qIuismaQhsLJ/IpsnCRnVnDiPT892Rlv r1bSIt+weNI3Vd0sWnvBCyp0+nPevW47YTq9YaXTWWY/rXNwqRGncjSe1wAs2EYwxk5e2O7Zkd/fZ jL4zaDUfccyahE/KTg3QwQC75zA7Hd3vcLMubFDdz1kWxdT9dXny0B7f+A4Ml5sjNeLlm7uh5Rf8S 6ZTqwfwX5I/Mk7Ho3KM1rEb+w1gJBhlkkzqpLaAjyFMZp1dr/tIeS8qnw0bP3ehONmPRfHWrRej3N 8Fsi4tCpw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7GvS-0005wd-VX; Sun, 16 Aug 2020 11:34:11 +0000 Received: from mail-ed1-x544.google.com ([2a00:1450:4864:20::544]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7GvJ-0005uf-Hh; Sun, 16 Aug 2020 11:34:02 +0000 Received: by mail-ed1-x544.google.com with SMTP id t15so10074886edq.13; Sun, 16 Aug 2020 04:34:01 -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=pASTdGuPftaeTWSCXTF0+lwxdm1UnEjBR3A/qFpOqAQ=; b=I2InCRRd5xgKuWxHbUvIzN64E3tJfg+5Hs1GBxpc+F5ecJWbP8lm5HB+sb35BcvuVZ KXqDH3dkgL0Ep00fgmmqt70nCxrZDhcAe+NZAyZMlROJhngNpykETkvu6uu0Xm1+VuJO Dh2GLx7Q4shBeRDfz+VsI1jAsPT2fVGn0LODq6K3N916SyJNf/n2jA+DdgtFskl9qZeN 85CiJW1a5KLa3S/+WSJWUgir0qDxuugu5ASL9EIzq8rEC6dM+czC+2hVASqZGEsDSfbg pNvpze2oOHb3B/ZfdIbz5G4mqA0RWpDdqY7K6af7SI89olqGMyGP+5yO+0yINnl0bG+D pyow== 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=pASTdGuPftaeTWSCXTF0+lwxdm1UnEjBR3A/qFpOqAQ=; b=f1PZddGe135JF1ynnDsOig0teMfuyNQiOwxkZYu47ywYErb13DyxFTLNV1VhZ0JG5B NVwUMzlNYUprDdqEy987oF6AfvnviUzcAPdFe+ZZWCVnnu8tkbvttBpfiVn1k5cABkHV 2J+obRRZyzIGb8R1tdTiZagsZNWBJizPPAyjFs2+I6wuvU5vR0fl0/N+oS+PTr0tZXQL ser8/Z5HYGVa2UDByypEdfEzE4GwiWp5+vd104jZzjeNLkfXw5xBzBfADHFHek+HkT6z uzfFbDdFb+z+JDGoEtF+ju8+CRG8QyQ0HbrppXGqs2NhiQwx47P6w/86TNDZ/MYLwvsx Kg4w== X-Gm-Message-State: AOAM530456dSASH3H9XsSeW9PqqZ8CGoNNVBNAqNU56vWyk3Hj64J18G a57ngZFClMDHbeSf0vMQs1I= X-Google-Smtp-Source: ABdhPJxs8Amnz2/5iDHD63BHcgYMrRkARtzwlXg1devjc6qDigDBj+XdHUxnwGKvaJ9jZmo267tTiA== X-Received: by 2002:a05:6402:1d92:: with SMTP id dk18mr10221674edb.206.1597577640766; Sun, 16 Aug 2020 04:34:00 -0700 (PDT) Received: from localhost.localdomain ([188.24.144.238]) by smtp.gmail.com with ESMTPSA id p1sm11272945edu.11.2020.08.16.04.33.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Aug 2020 04:34:00 -0700 (PDT) From: Cristian Ciocaltea To: Thomas Gleixner , Jason Cooper , Marc Zyngier , Rob Herring , =?utf-8?q?Andreas_F=C3=A4rber?= , Manivannan Sadhasivam Subject: [PATCH v4 1/3] dt-bindings: interrupt-controller: Add Actions SIRQ controller binding Date: Sun, 16 Aug 2020 14:33:54 +0300 Message-Id: <2dfc51680d37eea74374a130e7c9bc40e06b1b0e.1597571397.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-20200816_073401_695031_BAE7C73E X-CRM114-Status: GOOD ( 16.71 ) 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:544 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [cristian.ciocaltea[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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, 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 connecting up to 3 independent external interrupt controllers through dedicated SIRQ pins. Signed-off-by: Cristian Ciocaltea --- .../actions,owl-sirq.yaml | 69 +++++++++++++++++++ 1 file changed, 69 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..b9903f9d7449 --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/actions,owl-sirq.yaml @@ -0,0 +1,69 @@ +# 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 connecting up to 3 independent external + interrupt controllers through SIRQ0, SIRQ1 and SIRQ2 pins. + +properties: + compatible: + oneOf: + - items: + - enum: + - actions,s500-sirq + - actions,s700-sirq + - actions,s900-sirq + - const: actions,owl-sirq + - const: actions,owl-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. + + 'actions,ext-interrupts': + description: | + Contains the GIC SPI IRQ numbers mapped to the external interrupt + lines. They shall be specified sequentially from output 0 to 2. + $ref: /schemas/types.yaml#/definitions/uint32-array + minItems: 3 + maxItems: 3 + +required: + - compatible + - reg + - interrupt-controller + - '#interrupt-cells' + - 'actions,ext-interrupts' + +additionalProperties: false + +examples: + - | + sirq: interrupt-controller@b01b0200 { + compatible = "actions,s500-sirq", "actions,owl-sirq"; + reg = <0xb01b0200 0x4>; + interrupt-controller; + #interrupt-cells = <2>; + actions,ext-interrupts = <13>, /* SIRQ0 */ + <14>, /* SIRQ1 */ + <15>; /* SIRQ2 */ + }; + +... From patchwork Sun Aug 16 11:33:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 11716103 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 F088414F6 for ; Sun, 16 Aug 2020 11:35:56 +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 B89E620708 for ; Sun, 16 Aug 2020 11:35:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mhbCInbs"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UzJaLGhH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B89E620708 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=phuWeqz3BDqWmsqzsNOldrDN6rfPoEYbzUASKN5Pb24=; b=mhbCInbsjfniqWKkKSQogDmj5 ZXDPBatkPfEmmHeUZAuIZjeKsSAsnq18e5W11HT7qRGGkAKA0JPo1ObMlQN3jOIIHU/PH2GVo1pD/ y6pLVk5EiIRwW5ML92Jfs18i6NtrnSSXTcBwOAPKPf/YRA9Z++/l8aViIkyLyxQULvFxXr/E2ctBK WdVoi1GHcaK+wbh+f1Zx+bzV/OnLV8Lg21dSdh32lnAQxiDqWBQEc5MzWnwWB4w8S+wSpInvBvMs2 lRsIH28FsZVvyfDc8dMGXs0sOfn5OCPUzdvD5ghgSSomnL6Wi8RO+RXFU4rJpKZgZjNJAt5cK9yQg dmc0tQI4A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7Gvf-0005yj-6I; Sun, 16 Aug 2020 11:34:23 +0000 Received: from mail-ed1-x544.google.com ([2a00:1450:4864:20::544]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7GvL-0005vB-9j; Sun, 16 Aug 2020 11:34:07 +0000 Received: by mail-ed1-x544.google.com with SMTP id l23so10101172edv.11; Sun, 16 Aug 2020 04:34:03 -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=K/Xk9vqsFa2pytcZR9ZEjV+eE9g6nLCPU/rDSAimPno=; b=UzJaLGhHPGRYCf1XSubqG9MTpbrvITheAIv7kV4wyCZcDFRenDGdJWCldDeAiE+TZK JdBLWGN7Yb/KfF6AN6R6rW5D9HL8whMEWVj8f+1p2UhVgmgEY/pWTFjdsiS0nJ0b0gOm CPLU/9IjZ2DpN22S1LQ1VPmx53CjOg7zwjmncaz19Y0xneDuzaKE8BY8mFW8eRuV3GaD FuC7EAl8ru+/srrroweUgR4Jqccjnrf9ucINI8cm4+8zEQ6p/16hArc5bNIyIysuDTAQ 2ppJqL8vJcz4zmePXz5WX3jwthKMx3wcUrlvD+JLIYfoWMi/wRteEzZaCnoKf6Li6D+w 8XKw== 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=K/Xk9vqsFa2pytcZR9ZEjV+eE9g6nLCPU/rDSAimPno=; b=SDvTyGDLtI8CWBsfhglwaN8Lde367ROUsXv9kiQx/VtSwIQ6YmlMD78luOmFMwGSJ1 lTWzmiYTr0IGWNed19QcHXQBrbAR10YnWn+VaKs2BT/J2p7vHkgU5JfmiCdCJ+BgdtLO bMyMPrsg4fuNL4lXYcAUnPz3v17HHz5VlUu7T0vR/hlwcORDr1adb6VcVbtfML03D5iE sOdKV3yvUglEFwtnapytrc9X5gtlvZidHcONF1QK/OLiV909NBiIt+sJru2LqA7+bSqS w1XUi4oYIqV6Kw7tVj5vmgNyeNPKLzjEHsIXyfGcZCYjbd5bXSKjL3wTfHEgCEyJMTd9 8vlQ== X-Gm-Message-State: AOAM533hnxmquwIhgJpO7WjKPN9HCKaLL4HM/3+xuzA1hXfeNUzYkT5m 9/bFTHcWhgmLogBehJuAaWk= X-Google-Smtp-Source: ABdhPJxx5cQuV+5JU7Cb5jz1ijuFSesE5B9q177XEHYSWQxSytOpwWwHXlgS13NllYxAy13nf/lBBQ== X-Received: by 2002:a05:6402:1a46:: with SMTP id bf6mr10296238edb.284.1597577642444; Sun, 16 Aug 2020 04:34:02 -0700 (PDT) Received: from localhost.localdomain ([188.24.144.238]) by smtp.gmail.com with ESMTPSA id p1sm11272945edu.11.2020.08.16.04.34.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Aug 2020 04:34:01 -0700 (PDT) From: Cristian Ciocaltea To: Thomas Gleixner , Jason Cooper , Marc Zyngier , Rob Herring , =?utf-8?q?Andreas_F=C3=A4rber?= , Manivannan Sadhasivam Subject: [PATCH v4 2/3] irqchip: Add Actions Semi Owl SIRQ controller Date: Sun, 16 Aug 2020 14:33:55 +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-20200816_073405_858656_B40BD45E X-CRM114-Status: GOOD ( 27.93 ) 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:544 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [cristian.ciocaltea[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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, 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 controller appears on Actions Semi Owl family SoC's S500, S700 and S900 and provides support for 3 external interrupt controllers through dedicated SIRQ pins. Each line can be independently configured as interrupt and triggers on either of the edges (raising or falling) or either of the levels (high or low). Each line can also be masked independently. This is based on the patch series submitted 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 --- drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-owl-sirq.c | 318 +++++++++++++++++++++++++++++++++ 2 files changed, 319 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..29b7ffc40ac7 --- /dev/null +++ b/drivers/irqchip/irq-owl-sirq.c @@ -0,0 +1,318 @@ +// 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 + +#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)) + +/* S900 SIRQ1 & SIRQ2 control register offsets, relative to SIRQ0 */ +#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]; + u8 trigger; +}; + +/* S500 and 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 = { 0, INTC_EXTCTL1, INTC_EXTCTL2 }, +}; + +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 = (val >> (2 - index) * 8) & 0xff; + + 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 &= ~(0xff << (2 - index) * 8); + extctl &= 0xff; + extctl = (extctl << (2 - index) * 8) | 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 (chip_data->trigger & (1 << data->hwirq)) + 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; + chip_data->trigger &= ~(1 << data->hwirq); + type = IRQ_TYPE_LEVEL_HIGH; + break; + case IRQ_TYPE_LEVEL_HIGH: + sirq_type = INTC_EXTCTL_TYPE_HIGH; + chip_data->trigger &= ~(1 << data->hwirq); + break; + case IRQ_TYPE_EDGE_FALLING: + sirq_type = INTC_EXTCTL_TYPE_FALLING; + chip_data->trigger |= 1 << data->hwirq; + type = IRQ_TYPE_EDGE_RISING; + break; + case IRQ_TYPE_EDGE_RISING: + sirq_type = INTC_EXTCTL_TYPE_RISING; + chip_data->trigger |= 1 << data->hwirq; + break; + default: + WARN_ON(1); + 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, +}; + +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] = 0; /* 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 const struct of_device_id owl_sirq_of_match[] = { + { .compatible = "actions,s500-sirq", .data = &owl_sirq_s500_params }, + { .compatible = "actions,s700-sirq", .data = &owl_sirq_s500_params }, + { .compatible = "actions,s900-sirq", .data = &owl_sirq_s900_params }, + { /* sentinel */ } +}; + +static int __init owl_sirq_of_init(struct device_node *node, + struct device_node *parent) +{ + const struct of_device_id *match; + 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; + + match = of_match_node(owl_sirq_of_match, node); + if (!match) { + pr_warn("owl-sirq: assuming S500/S700 compatible controller\n"); + chip_data->params = &owl_sirq_s500_params; + } else { + chip_data->params = match->data; + } + + raw_spin_lock_init(&chip_data->lock); + + 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; + } + + ret = of_property_read_variable_u32_array(node, "actions,ext-interrupts", + chip_data->ext_irqs, + NUM_SIRQ, NUM_SIRQ); + if (ret < NUM_SIRQ) { + pr_err("%pOF: failed to read sirq interrupts\n", node); + goto out_unmap; + } + + /* Set 24MHz external interrupt clock freq */ + for (i = 0; i < NUM_SIRQ; i++) + 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; +} + +IRQCHIP_DECLARE(owl_sirq, "actions,owl-sirq", owl_sirq_of_init); From patchwork Sun Aug 16 11:33:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 11716101 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 8E228722 for ; Sun, 16 Aug 2020 11:35:43 +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 6659520760 for ; Sun, 16 Aug 2020 11:35:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0H/n+SXF"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="q5paUYdc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6659520760 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=EeGZ8PdSvcaSwEo4HSy+l60uvLm2Ro40pgftgqOxdBQ=; b=0H/n+SXFO8n8O4i5ScFLUzyWD ccvXWxWmb4QD1Vcv44KqWpSn1OG03xCygGVt7I54m2WakYLhrg8UJ3E8GgZsc4G4F9/4tqc0Vn0Gq friPfdpybgkZT/EBvtajqYpOJ7UvuMhjEeipaKsZpgwnILus70eATgqe6NdQzAv3KRF7EIGGGoG1z AJQCLi91rkQcQ94eRcKxsl8wqQIeu51kdOxGYOS5jVGtlz6k9d7uKuIk4kjoXZlXcxl+iO5VS0lag kKvqQvRCHPD3Q9XJUOeDzH67+DsIAeXqdZdabyhgQKm6+lPCOV0iE4Evh31BhXBq8BMoQji8VeT4s MWWsRZHTQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7GvY-0005x9-1X; Sun, 16 Aug 2020 11:34:16 +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 1k7GvM-0005vD-UC; Sun, 16 Aug 2020 11:34:06 +0000 Received: by mail-ej1-x643.google.com with SMTP id a26so14582842ejc.2; Sun, 16 Aug 2020 04:34:04 -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=msrdwPbqHQ8BLhMLLtrF1zjcunPvIyHoXyHAIw4Pnvc=; b=q5paUYdclK8ewke59GjeMYxkYtKcAgVzRHZQ+z1H3SMYSJ4y776HOojWHfUTdqYGa3 SnJipD5GEJEP77YGC0Uoa0bI3zOjh/+mfdVv2gHyYm+z+Fh7Y//t3nPZL9+bPJi8XftR VrRQJtVgEOrhVjJ074Rys6FtmzLcHYR26MmikQ9KeZqYKobDTAZUNM7+3K4kFwhJOQy8 88YoThXKcZxt3GKplUKlvzARI6jCK4YUcOy7F3FhLdTh7pqi8XNZ5niNn/kTDbnoWV1N xGFa7jbdkfm2Le2BNCahZQSM96BtrgDhAqpU++kWUWD89yrUxu412v4fS3Iap09kof/a xomg== 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=msrdwPbqHQ8BLhMLLtrF1zjcunPvIyHoXyHAIw4Pnvc=; b=ZSioHzSJhdmXEDNj12RsxpKYyo/KME5XKOP/K8UfKnuxrX3spbz0cEdyN8sqfDMNQ7 terH7CQ+s1/mmAjrAWzYlUXeiW6LnQDwbP9Eg/jka1upPCCot8U/fnOGqXD3q9ggK5E/ bsMTTPH/ZHNy9Y0PGWWTBV6DUcrHe99BTs0ePOGI5VudEvGcYrqYPnLJm+hkKKLI1lAE yY/A7zihoBpQ1/gRi7m2TfM517gwxQQL6obliZmMzIGi1JXR+b5l/3F0XbyoOdAajIzV 9Y8ZKyYWA3l93CD7dLQIBpuabQsIfXxse+sZDN7Z+G12lbQCHGN7G199rxdaES8Y8/Hz MIXQ== X-Gm-Message-State: AOAM532mvXcHOqqhfIyEZU8gyMnMZ4s1pKvT/HDNsZ7ljhgSU6fvIzDR ygryZ0ZlUyLA9lY3xa5RGW0= X-Google-Smtp-Source: ABdhPJw4mulA63Rkou3LrnCSgU4gnREMJyDLeK3VJp0eXtON3dguIYcD20aKA4nqeUX1+IMu6gj88w== X-Received: by 2002:a17:906:c310:: with SMTP id s16mr10626313ejz.466.1597577643581; Sun, 16 Aug 2020 04:34:03 -0700 (PDT) Received: from localhost.localdomain ([188.24.144.238]) by smtp.gmail.com with ESMTPSA id p1sm11272945edu.11.2020.08.16.04.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Aug 2020 04:34:03 -0700 (PDT) From: Cristian Ciocaltea To: Thomas Gleixner , Jason Cooper , Marc Zyngier , Rob Herring , =?utf-8?q?Andreas_F=C3=A4rber?= , Manivannan Sadhasivam Subject: [PATCH v4 3/3] MAINTAINERS: Add entries for Actions Semi Owl SIRQ controller Date: Sun, 16 Aug 2020 14:33:56 +0300 Message-Id: <85dc5395fef32d2e99c586168fc604effe392b7c.1597571397.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-20200816_073405_830948_39863519 X-CRM114-Status: GOOD ( 11.60 ) 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 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [cristian.ciocaltea[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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, 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 87fa408d0f15..00eb0fb2eb68 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1518,6 +1518,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 @@ -1529,6 +1530,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/