From patchwork Mon Dec 11 20:39:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 10105773 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F41EE602D8 for ; Mon, 11 Dec 2017 20:41:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D66BA26E79 for ; Mon, 11 Dec 2017 20:41:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB1D02989B; Mon, 11 Dec 2017 20:41:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3762926E79 for ; Mon, 11 Dec 2017 20:41:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=TEMBKhI5HEjfH/nXTT2/Nt8upcyoYXTHZK86Q3S6FR4=; b=MTh+6AX6aZ8EMBMTH1aLX78Mjr fG2pkc/UhM98GSd/X3tudYYWbACYknyY9G0z9HmbUBFa7ET93oRpJ9LCPywS8vlBjrq4RHrovFRG8 NZSlg9x27kL3cIDhIEnb3y+XiVSUrVLdrr6SyKHCs40wjOEuGZfyvF69QgYdc2xXPegpPnhDXOONt Rq3NMHFi7MTfqf3qG4Ga3nrcSOG1x9Wjw+InIQZ81TXZm2H4Wg/4QTGidWwuiOmbfx5Jct9kh7W0/ UywPfIaucwM1PfnwREtbaKDd68WtFyepGNdFHIc1q6xA2erjnQ2cN9EiBuLL2h3KncJsT1l/1/Zmk Y1GmI+NA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eOUtd-0006XQ-QX; Mon, 11 Dec 2017 20:41:53 +0000 Received: from mout.kundenserver.de ([217.72.192.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eOUse-0005ca-7F; Mon, 11 Dec 2017 20:40:54 +0000 Received: from localhost.localdomain ([95.90.209.155]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.183]) with ESMTPSA (Nemesis) id 0LsyLK-1f3Uve1znW-012X95; Mon, 11 Dec 2017 21:40:12 +0100 From: Stefan Wahren To: Thomas Gleixner , Jason Cooper , Marc Zyngier , Eric Anholt , Florian Fainelli , Scott Branden , Rob Herring , Mark Rutland Subject: [PATCH 2/3] irqchip: irq-bcm2836: add support for DT interrupt polarity Date: Mon, 11 Dec 2017 21:39:11 +0100 Message-Id: <1513024752-11246-3-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513024752-11246-1-git-send-email-stefan.wahren@i2se.com> References: <1513024752-11246-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K0:CwcYHIEIBFwlkR6ntdhqwo896AfNWzyrVG/c7NLFdBbxJ2eEoDD FuhyHssdQBn50vi5bX7OkNPUf/JLzatrTilE91NJW23/J12bATLyNtZvdXUYmyPRO1GIPap DcbC81/WKY/WwSvPoyhidJqcBb6yZee0ZqdTUQ8dg+o5iYV+1N9TIEbdYeXQMeKD0kYeUBG BvZCnpBHiTkL37QLgmbmA== X-UI-Out-Filterresults: notjunk:1; V01:K0:WQzmmJpd1pY=:DzKu9xkakMWbrCdNdLmIm6 RPJlacnbi9J315BUZKDhjdSLmxGljrEnyxhBdgqOkZ+knXVOSCfk8aiBdy2hJ1rasZ7IK4UG1 +tvPjnhi4jsHUKyWCyIQCCn6/a6p0BKYvyinhkXNXZuqoRDQeMdrgaG2Z7IcLTjmg8SvC4TrZ pSGuEYi2cglMvKsZ4eR5qB/J5820WVJOgmB7Jy80enLqdWU9lwpiZB9aNGK/dx4XK1hMS2aPN /KhMhrZa9Ztlz/Y26pIazjOrFnRrn+VDjvt/ABKYCaakGh8YJ57Y7I4Bv7kjqw0cwZjh1Lxw4 YszTg9VnAPvHGfaK8XmHVTVwTrybJ5gDEqossDYtNqyUsNvpW+NM/G1ZiIzGGjmzP+yfYR9D+ dbka4nAft1ygh1A2enOaULkl33UkmUqM7UI9zOyK66MQXkbX4VxRZIltXEz/dKI5zAF94Yx+e d6Tx2ll4nLJkFhJE6pbYtnurvw6/KRibhDk7gFFc/MZIt/6kZIaMZEfrZH77fUpJsFM18YyRw S+XLAvpsPX7ZklmkKinmnfW572A2J6wAgW1mviOn3fMltOX9nydwuJoe6tqmelUGy8hLqQIC1 xMq/gyQSCbq2zJRY8fRwznzQejzn9o9Qu52svNTMtuLBMt2t3yQsdZBeaZKCAnnjLfH1d5yTY O9byzRCi8NXc9HMhd10eitbCn5Kam2shI2ywY5yyj1N2e6a0RAryVdd7zDsOr6901GMOP3sa6 mA7eaXczPLovgdcmmZ5GKu1TqmLTucWUouSyMA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171211_124052_760070_DDDDD81F X-CRM114-Status: GOOD ( 10.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , devicetree@vger.kernel.org, phil@raspberrypi.org, Russell King , linux-rpi-kernel@lists.infradead.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 X-Virus-Scanned: ClamAV using ClamSMTP In order to properly define the polarity of the per-cpu interrupts, we need to support for a second property cell. But this must be optional to keep backward compatibility with old DT blobs. Suggested-by: Marc Zyngier Signed-off-by: Stefan Wahren --- drivers/irqchip/irq-bcm2836.c | 46 ++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c index 667b9e1..dfe4a46 100644 --- a/drivers/irqchip/irq-bcm2836.c +++ b/drivers/irqchip/irq-bcm2836.c @@ -98,13 +98,35 @@ static struct irq_chip bcm2836_arm_irqchip_gpu = { .irq_unmask = bcm2836_arm_irqchip_unmask_gpu_irq, }; -static void bcm2836_arm_irqchip_register_irq(int hwirq, struct irq_chip *chip) -{ - int irq = irq_create_mapping(intc.domain, hwirq); +static int bcm2836_map(struct irq_domain *d, unsigned int irq, + irq_hw_number_t hw) +{ + struct irq_chip *chip; + + switch (hw) { + case LOCAL_IRQ_CNTPSIRQ: + case LOCAL_IRQ_CNTPNSIRQ: + case LOCAL_IRQ_CNTHPIRQ: + case LOCAL_IRQ_CNTVIRQ: + chip = &bcm2836_arm_irqchip_timer; + break; + case LOCAL_IRQ_GPU_FAST: + chip = &bcm2836_arm_irqchip_gpu; + break; + case LOCAL_IRQ_PMU_FAST: + chip = &bcm2836_arm_irqchip_pmu; + break; + default: + pr_warn_once("Unexpected hw irq: %lu\n", hw); + return -EINVAL; + } irq_set_percpu_devid(irq); - irq_set_chip_and_handler(irq, chip, handle_percpu_devid_irq); + irq_domain_set_info(d, irq, hw, chip, d->host_data, + handle_percpu_devid_irq, NULL, NULL); irq_set_status_flags(irq, IRQ_NOAUTOEN); + + return 0; } static void @@ -165,7 +187,8 @@ static int bcm2836_cpu_dying(unsigned int cpu) #endif static const struct irq_domain_ops bcm2836_arm_irqchip_intc_ops = { - .xlate = irq_domain_xlate_onecell + .xlate = irq_domain_xlate_onetwocell, + .map = bcm2836_map, }; static void @@ -218,19 +241,6 @@ static int __init bcm2836_arm_irqchip_l1_intc_of_init(struct device_node *node, if (!intc.domain) panic("%pOF: unable to create IRQ domain\n", node); - bcm2836_arm_irqchip_register_irq(LOCAL_IRQ_CNTPSIRQ, - &bcm2836_arm_irqchip_timer); - bcm2836_arm_irqchip_register_irq(LOCAL_IRQ_CNTPNSIRQ, - &bcm2836_arm_irqchip_timer); - bcm2836_arm_irqchip_register_irq(LOCAL_IRQ_CNTHPIRQ, - &bcm2836_arm_irqchip_timer); - bcm2836_arm_irqchip_register_irq(LOCAL_IRQ_CNTVIRQ, - &bcm2836_arm_irqchip_timer); - bcm2836_arm_irqchip_register_irq(LOCAL_IRQ_GPU_FAST, - &bcm2836_arm_irqchip_gpu); - bcm2836_arm_irqchip_register_irq(LOCAL_IRQ_PMU_FAST, - &bcm2836_arm_irqchip_pmu); - bcm2836_arm_irqchip_smp_init(); set_handle_irq(bcm2836_arm_irqchip_handle_irq);