From patchwork Mon Jul 8 03:52:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 168602 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp6586569ilk; Sun, 7 Jul 2019 20:54:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMe574u6cKbHWv8KXlfAFwvR1hY0Ess4bmOqE1BCELTCHPytUgFJwb0YE7qE9gPaDEO6L4 X-Received: by 2002:a17:90a:d817:: with SMTP id a23mr21997955pjv.54.1562558061243; Sun, 07 Jul 2019 20:54:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562558061; cv=none; d=google.com; s=arc-20160816; b=aOigYzMSiT+dg9/jOrkw4ZCb2Hw7q7u18kPxn+zpLlym2e2nDhfb0+dW27waRdJP8h fufShEOZdnglTe4It+P4hap8wOAygj2aXoNuz2pWEmWFprDaAdw5qtoLteueGNgrpQ7c jmxdrPCwRCjgR1oGw6t4LT8N5fTRisltJYazb1JYeyez9B33zF87wX3WvKZNBDRv8PuJ LwH2pno+oBUwv6d24wSnSbbdiajKqashZhnDmQs8WQ1TzgTuG+rDeBId6grY2EKcqwqa tUZjdrk8TyKy+T20MT/6J1O2VtzM2MP8ixEJJbPWpp3pY0cdMVntJPP7pElMRSaOKDnV oHfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0frDprr6mFGJ9Tw1xlMqTJaMNs6+o4FICJuO/EOBWdw=; b=0Cu3K3sRjEexE5R5pAsfM2/Wz/rinJ8GQOp7dZ3WD3g1R4AeUBY/YFLWguFI+80Yx4 g4O97385Eo+LfkqXibXUSVXKRzQxkXQrL7+7oqNVOuHvVAJD2JxMh9894sevPla57Z7a VuA4gsqDmP2hPpn2xpd2I09tyMoXxX/Utdk/dy7BEgCMC3OoPVkBsbpdWKprq48zJRJ/ TnQJCYVXLn0hRcmbf6F2tAJdBIwQWZIxmWkNCx2UNa3L6+/FKbO9328duo0Js4jL+rWg LN/RMKGOBVsLAUau8wh48vD1bIqFnNt1VxWkdjctt3MSEaRUjpgti3sXUvi7EG3DI2Tg 1brA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tgmTgs+0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bh2si16122377plb.116.2019.07.07.20.54.20; Sun, 07 Jul 2019 20:54:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tgmTgs+0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729021AbfGHDyT (ORCPT + 30 others); Sun, 7 Jul 2019 23:54:19 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:46572 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727778AbfGHDxz (ORCPT ); Sun, 7 Jul 2019 23:53:55 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x683qkYZ017977; Sun, 7 Jul 2019 22:52:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1562557966; bh=0frDprr6mFGJ9Tw1xlMqTJaMNs6+o4FICJuO/EOBWdw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=tgmTgs+0SqkD0J3qGeKuaLLvWVdbWmhaZiIeHqry6h06CVk/w7Q5cPQvBv4b5HWiM 003P6SR1tX5rnVdYkkln8A07jlQ/qoCBm6X0LM5xRibaMHZjQFKEIOw5BOsL0+6tfR fwushiGxyFlOYUNEDqQZ+GBVv6CQVK0spATHqsPk= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x683qkMW102647 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 7 Jul 2019 22:52:46 -0500 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Sun, 7 Jul 2019 22:52:46 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Sun, 7 Jul 2019 22:52:46 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x683qkv7130108; Sun, 7 Jul 2019 22:52:46 -0500 Received: from localhost (irmo.dhcp.ti.com [128.247.58.153]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id x683qkm26441; Sun, 7 Jul 2019 22:52:46 -0500 (CDT) From: Suman Anna To: Marc Zyngier , Rob Herring , Thomas Gleixner , Jason Cooper CC: Tony Lindgren , "Andrew F. Davis" , Roger Quadros , Lokesh Vutla , Grygorii Strashko , Sekhar Nori , David Lechner , Murali Karicheri , , , , , Suman Anna Subject: [PATCH 3/6] irqchip/irq-pruss-intc: Add support for shared and invalid interrupts Date: Sun, 7 Jul 2019 22:52:40 -0500 Message-ID: <20190708035243.12170-4-s-anna@ti.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708035243.12170-1-s-anna@ti.com> References: <20190708035243.12170-1-s-anna@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 GIC. Some SoCs have some interrupt lines not connected to the ARM GIC 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 support to the PRUSS INTC driver to allow both these shared and invalid interrupts by not returning a failure if any of these interrupts are skipped from the corresponding INTC DT node. Signed-off-by: Suman Anna --- drivers/irqchip/irq-pruss-intc.c | 44 +++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) -- 2.22.0 diff --git a/drivers/irqchip/irq-pruss-intc.c b/drivers/irqchip/irq-pruss-intc.c index d62186ad1be4..142d01b434e0 100644 --- a/drivers/irqchip/irq-pruss-intc.c +++ b/drivers/irqchip/irq-pruss-intc.c @@ -68,6 +68,8 @@ * @domain: irq domain for this interrupt controller * @lock: mutex to serialize access to INTC * @host_mask: indicate which HOST IRQs are enabled + * @shared_intr: bit-map denoting if the MPU host interrupt is shared + * @invalid_intr: bit-map denoting if host interrupt is connected to MPU */ struct pruss_intc { unsigned int irqs[MAX_NUM_HOST_IRQS]; @@ -76,6 +78,8 @@ struct pruss_intc { struct irq_domain *domain; struct mutex lock; /* PRUSS INTC lock */ u32 host_mask; + u16 shared_intr; + u16 invalid_intr; }; static inline u32 pruss_intc_read_reg(struct pruss_intc *intc, unsigned int reg) @@ -243,7 +247,8 @@ static int pruss_intc_probe(struct platform_device *pdev) struct pruss_intc *intc; struct resource *res; struct irq_chip *irqchip; - int i, irq; + int i, irq, count; + u8 temp_intr[MAX_NUM_HOST_IRQS] = { 0 }; intc = devm_kzalloc(dev, sizeof(*intc), GFP_KERNEL); if (!intc) @@ -260,6 +265,39 @@ static int pruss_intc_probe(struct platform_device *pdev) dev_dbg(dev, "intc memory: pa %pa size 0x%zx va %pK\n", &res->start, (size_t)resource_size(res), intc->base); + count = of_property_read_variable_u8_array(dev->of_node, + "ti,irqs-reserved", + temp_intr, 0, + MAX_NUM_HOST_IRQS); + if (count < 0 && count != -EINVAL) + return count; + count = (count == -EINVAL ? 0 : count); + for (i = 0; i < count; i++) { + if (temp_intr[i] < MAX_NUM_HOST_IRQS) { + intc->invalid_intr |= BIT(temp_intr[i]); + } else { + dev_warn(dev, "ignoring invalid reserved irq %d\n", + temp_intr[i]); + } + temp_intr[i] = 0; + } + + count = of_property_read_variable_u8_array(dev->of_node, + "ti,irqs-shared", + temp_intr, 0, + MAX_NUM_HOST_IRQS); + if (count < 0 && count != -EINVAL) + return count; + count = (count == -EINVAL ? 0 : count); + for (i = 0; i < count; i++) { + if (temp_intr[i] < MAX_NUM_HOST_IRQS) { + intc->shared_intr |= BIT(temp_intr[i]); + } else { + dev_warn(dev, "ignoring invalid reserved irq %d\n", + temp_intr[i]); + } + } + mutex_init(&intc->lock); pruss_intc_init(intc); @@ -286,6 +324,10 @@ static int pruss_intc_probe(struct platform_device *pdev) for (i = 0; i < MAX_NUM_HOST_IRQS; i++) { irq = platform_get_irq_byname(pdev, irq_names[i]); if (irq < 0) { + if (intc->shared_intr & BIT(i) || + intc->invalid_intr & BIT(i)) + continue; + dev_err(dev->parent, "platform_get_irq_byname failed for %s : %d\n", irq_names[i], irq); goto fail_irq;