From patchwork Wed Sep 16 16:36:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grzegorz Jaszczyk X-Patchwork-Id: 11780135 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 3F80E92C for ; Wed, 16 Sep 2020 16:39:58 +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 0BE3D223BD for ; Wed, 16 Sep 2020 16:39:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="gkWn+EzL"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="iA8Gq/Yn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0BE3D223BD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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:In-Reply-To:References:List-Owner; bh=KRm030QK5A8rFVOi9u9rzpFC+qhzZ6YXisXbdqHJJZU=; b=gkWn+EzL4CkhCHHcXnTFUk9BeV qE+C1MJP5zE/KKS+gP8h7zGiVnQ1BmO/keSAnlpMXDXpqMAcMwkN1a6xHBcMlGWQdotnjgQ4U4+gK dUHg3LF/V9OG7lmDUZSDFkw/qv+yFKpLasLmAkWTTdwXGeqtCQ1mEUkBQKZfo1rg1wLEC6iqUhImm zgmIxQj92h6suRA/iLL94dbcZSw3qpL9UJqk3uPSV3gmKhRH/0y/QZVnXMOg+MZTs6mG8Y6fF6bhq PZDQmgntf+ABY+hRKfAAOn2O3ljzowqXxBMmnIC15tdtzNV0UozPNRPBt1Xl3Pcw276x2sFza7Yk3 INBq69Mg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIaQd-0000If-7T; Wed, 16 Sep 2020 16:37:07 +0000 Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIaQZ-0000Gi-PS for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 16:37:04 +0000 Received: by mail-lf1-x143.google.com with SMTP id x69so7701700lff.3 for ; Wed, 16 Sep 2020 09:37:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=jMYu4kXE2sjgBZ9G0n0UMw/4sfdmoPqRtdExz+XAFWs=; b=iA8Gq/YnrRpNj705xinp0UvGfAmmUb+FvDWYzbCZILwOStSmi7k7yRicuZ+OFi/Jey EYzGUzcOj1of4kQDN1doygwRCKgkrt1JJyrVwb4lNKemp+17ZddMKiRSlm7auBl/dzOm NFt7vL8nLyuqg85P0OYs8MyEIJ6apy0XF1E7TB6XuJ9YJTwoE8Ri2FYgXCFIW7DwX/kJ MpLNtn1Ms8hNKP/k0kLPjRsS4wWv6sP5m+Et+WGAUh82IJYa43b6pdiC4UlQ//N7Iq70 q0TYiP/+HhXSaaEB1OC6rYWlZ6/WdxdjGMKczjYg8I9zdCjETU5ljUoluDcDZfpzaxR/ 7hzA== 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; bh=jMYu4kXE2sjgBZ9G0n0UMw/4sfdmoPqRtdExz+XAFWs=; b=VBr9uThk8Tgb2O4u1xM4/agtsbdoM0RUBYZVM+IWnxHgYbvcQ53jYMuN6yjwWbQfEt GgeWv7/JXu6+3vtGZLeFAxDkmDbRjCbqQgRRNOnjDfqy4jSPepu4wJNW0zB0mK3Ut5rz oZiI4yjVTzQKA0qk37Ga/4xgi/dbw5KblQMed5Oim8NoKR8EbUy0Mm+/Jd14wmUEDYXS 3FsULo0dFZReazw9JpIB9k2iMkNzg06EB6j/QQfYY5Gzxvnvk/ebTxA7dGta2fb/h3x1 nhybq9ZBAeC1uHUEzMScCZzZgYGW0WConr4LyJDJMg11XXTdQqdj8psCsXLVIPOBtVhF 3iwg== X-Gm-Message-State: AOAM5312rD8q5hnKIEKAvILPbRLNCe/PLMAxfqssyVPPLnMn+fhsu99w xkgCs0JbrY+7R9AobtKoNBaNew== X-Google-Smtp-Source: ABdhPJwcCdpfObZXqTGqBWbqGkCbuZ41n1X/oiZxN1Zv/wkx2VjUjFa3aUlmgB8PN1u9TCcFhIXNIw== X-Received: by 2002:ac2:494f:: with SMTP id o15mr2729070lfi.355.1600274222391; Wed, 16 Sep 2020 09:37:02 -0700 (PDT) Received: from gilgamesh.semihalf.com (193-106-246-138.noc.fibertech.net.pl. [193.106.246.138]) by smtp.gmail.com with ESMTPSA id o15sm4684400lfo.188.2020.09.16.09.37.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Sep 2020 09:37:01 -0700 (PDT) From: Grzegorz Jaszczyk To: tglx@linutronix.de, jason@lakedaemon.net, maz@kernel.org, s-anna@ti.com Subject: [PATCH v7 3/5] irqchip/irq-pruss-intc: Add logic for handling reserved interrupts Date: Wed, 16 Sep 2020 18:36:36 +0200 Message-Id: <1600274198-30470-1-git-send-email-grzegorz.jaszczyk@linaro.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_123703_875031_C6C6E691 X-CRM114-Status: GOOD ( 20.32 ) 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:143 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.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 -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 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, grzegorz.jaszczyk@linaro.org, david@lechnology.com, praneeth@ti.com, linux-kernel@vger.kernel.org, robh+dt@kernel.org, linux-omap@vger.kernel.org, lee.jones@linaro.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Suman Anna The PRUSS INTC has a fixed number of output interrupt lines that are connected to a number of processors or other PRUSS instances or other devices (like DMA) on the SoC. The output interrupt lines 2 through 9 are usually connected to the main Arm host processor and are referred to as host interrupts 0 through 7 from ARM/MPU perspective. All of these 8 host interrupts are not always exclusively connected to the Arm interrupt controller. Some SoCs have some interrupt lines not connected to the Arm interrupt controller at all, while a few others have the interrupt lines connected to multiple processors in which they need to be partitioned as per SoC integration needs. For example, AM437x and 66AK2G SoCs have 2 PRUSS instances each and have the host interrupt 5 connected to the other PRUSS, while AM335x has host interrupt 0 shared between MPU and TSC_ADC and host interrupts 6 & 7 shared between MPU and a DMA controller. Add logic to the PRUSS INTC driver to ignore both these shared and invalid interrupts. Signed-off-by: Suman Anna Co-developed-by: Grzegorz Jaszczyk Signed-off-by: Grzegorz Jaszczyk --- v6->v7: - Add Co-developed-by tag. v5->v6: - No change. v4->v5: - Rename: s/invalid_intr/irqs_reserved/ v3->v4: - Due to changes in DT bindings which converts irqs-reserved property from uint8-array to bitmask requested by Rob introduce relevant changes in the driver. - Merge the irqs-reserved and irqs-shared to one property since they can be handled by one logic (relevant change was introduced to DT binding). - Update commit message. v2->v3: - Extra checks for (intc->irqs[i]) in error/remove path was moved from "irqchip/irq-pruss-intc: Add a PRUSS irqchip driver for PRUSS interrupts" to this patch v1->v2: - https://patchwork.kernel.org/patch/11069757/ --- drivers/irqchip/irq-pruss-intc.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/drivers/irqchip/irq-pruss-intc.c b/drivers/irqchip/irq-pruss-intc.c index c8bdef4..e7ba358 100644 --- a/drivers/irqchip/irq-pruss-intc.c +++ b/drivers/irqchip/irq-pruss-intc.c @@ -484,7 +484,7 @@ static int pruss_intc_probe(struct platform_device *pdev) struct pruss_intc *intc; struct pruss_host_irq_data *host_data; int i, irq, ret; - u8 max_system_events; + u8 max_system_events, irqs_reserved = 0; data = of_device_get_match_data(dev); if (!data) @@ -504,6 +504,16 @@ static int pruss_intc_probe(struct platform_device *pdev) if (IS_ERR(intc->base)) return PTR_ERR(intc->base); + ret = of_property_read_u8(dev->of_node, "ti,irqs-reserved", + &irqs_reserved); + + /* + * The irqs-reserved is used only for some SoC's therefore not having + * this property is still valid + */ + if (ret < 0 && ret != -EINVAL) + return ret; + pruss_intc_init(intc); mutex_init(&intc->lock); @@ -514,6 +524,9 @@ static int pruss_intc_probe(struct platform_device *pdev) return -ENOMEM; for (i = 0; i < MAX_NUM_HOST_IRQS; i++) { + if (irqs_reserved & BIT(i)) + continue; + irq = platform_get_irq_byname(pdev, irq_names[i]); if (irq <= 0) { ret = (irq == 0) ? -EINVAL : irq; @@ -538,8 +551,11 @@ static int pruss_intc_probe(struct platform_device *pdev) return 0; fail_irq: - while (--i >= 0) - irq_set_chained_handler_and_data(intc->irqs[i], NULL, NULL); + while (--i >= 0) { + if (intc->irqs[i]) + irq_set_chained_handler_and_data(intc->irqs[i], NULL, + NULL); + } irq_domain_remove(intc->domain); @@ -553,8 +569,11 @@ static int pruss_intc_remove(struct platform_device *pdev) unsigned int hwirq; int i; - for (i = 0; i < MAX_NUM_HOST_IRQS; i++) - irq_set_chained_handler_and_data(intc->irqs[i], NULL, NULL); + for (i = 0; i < MAX_NUM_HOST_IRQS; i++) { + if (intc->irqs[i]) + irq_set_chained_handler_and_data(intc->irqs[i], NULL, + NULL); + } for (hwirq = 0; hwirq < max_system_events; hwirq++) irq_dispose_mapping(irq_find_mapping(intc->domain, hwirq));