From patchwork Tue Feb 18 20:51:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 3674811 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E5CC89F35F for ; Tue, 18 Feb 2014 20:51:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F0F322012E for ; Tue, 18 Feb 2014 20:51:57 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DE69B2011B for ; Tue, 18 Feb 2014 20:51:56 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WFrdw-0004ba-3E; Tue, 18 Feb 2014 20:51:52 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WFrdt-0007RN-LF; Tue, 18 Feb 2014 20:51:49 +0000 Received: from galois.linutronix.de ([2001:470:1f0b:db:abcd:42:0:1]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WFrdq-0007Pf-Ej for linux-arm-kernel@lists.infradead.org; Tue, 18 Feb 2014 20:51:47 +0000 Received: from localhost ([127.0.0.1]) by Galois.linutronix.de with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1WFrdS-0000fm-IN; Tue, 18 Feb 2014 21:51:22 +0100 Date: Tue, 18 Feb 2014 21:51:31 +0100 (CET) From: Thomas Gleixner To: Jason Cooper Subject: Re: [GIT PULL] irqchip: dove: drivers for v3.14 In-Reply-To: <20140217193230.GW7862@titan.lakedaemon.net> Message-ID: References: <20131201172914.GV2879@titan.lakedaemon.net> <20131211175037.GY10053@titan.lakedaemon.net> <20140110183430.GO19878@titan.lakedaemon.net> <20140128173531.GT29184@titan.lakedaemon.net> <20140204211219.GK8533@titan.lakedaemon.net> <20140207180836.GE8533@titan.lakedaemon.net> <20140217193230.GW7862@titan.lakedaemon.net> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1, SHORTCIRCUIT=-0.0001 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140218_155146_750552_836E939C X-CRM114-Status: GOOD ( 31.37 ) X-Spam-Score: -2.5 (--) Cc: Gregory CLEMENT , Andrew Lunn , Sebastian Hesselbarth , linux-kernel@vger.kernel.org, Linux ARM Kernel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, 17 Feb 2014, Jason Cooper wrote: > On Fri, Feb 07, 2014 at 01:08:36PM -0500, Jason Cooper wrote: > > On Tue, Feb 04, 2014 at 10:30:53PM +0100, Thomas Gleixner wrote: > > > On Tue, 4 Feb 2014, Jason Cooper wrote: > > > > > > > On Tue, Feb 04, 2014 at 07:59:58PM +0100, Thomas Gleixner wrote: > > > > > On Tue, 28 Jan 2014, Jason Cooper wrote: > > > > > > I see you pulled in mvebu/irqchip-fixes. Thanks for that. It's getting > > > > > > near to the end of the merge window and there's been no activity on this > > > > > > pull request. > > > > > > > > > > > > Please let us know if there's anything we can do to assist. > > > > > > > > > > Nah. I simply forgot about it. About to send a pull request to Linus. > > > > > > > > hmmm. I see the pull request contains the patches from > > > > mvebu/irqchip-fixes (armada), but not the patches from mvebu/irqchip > > > > (dove): > > > > > > > > 40b367d95fb3 irqchip: irq-dove: Add PMU interrupt controller. > > > > > > > > which is what this thread was originally a pull request for. > > > > > > > > > > > > Are you planning to send a second pull request to Linus? > > > > > > Duh. I'll pick that up tomorrow > > > > Ping? > > I think it's safe to say that the Dove PMU interrupt controller isn't > going to make it in to v3.14. I've posted a patch to remove the DT node > for v3.14. Yes, sorry. I messed that one up. > If you don't mind, I'll go ahead and take this pull request through the > mvebu tree for v3.15. So that way it's off your plate and you don't > have to worry about it. I pushed it out to tip/irq/core now. > There's more mvebu irqchip stuff on the way :) You have an entry in my mail filter rules now, so you'll end up in the priority queue with your pull requests :) Btw, I just looked at that dove driver and if you look at the other drivers/irqchip variants which use the generic irq domain/chip stuff, then the code in the init functions +/- some minimalistic fixes is just the same boiler plate except for quirks or a few register writes. This the diff of the relevant code for orion and dove. while (stat) { @@ -123,17 +36,14 @@ } } -static int __init orion_bridge_irq_init(struct device_node *np, - struct device_node *parent) +static int __init dove_pmu_irq_init(struct device_node *np, + struct device_node *parent) { unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; struct resource r; struct irq_domain *domain; struct irq_chip_generic *gc; - int ret, irq, nrirqs = 32; - - /* get optional number of interrupts provided */ - of_property_read_u32(np, "marvell,#interrupts", &nrirqs); + int ret, irq, nrirqs = 7; So the difference here is nrirqs domain = irq_domain_add_linear(np, nrirqs, &irq_generic_chip_ops, NULL); @@ -174,19 +107,20 @@ return -ENOMEM; } - gc->chip_types[0].regs.ack = ORION_BRIDGE_IRQ_CAUSE; - gc->chip_types[0].regs.mask = ORION_BRIDGE_IRQ_MASK; - gc->chip_types[0].chip.irq_ack = irq_gc_ack_clr_bit; + gc->chip_types[0].regs.ack = DOVE_PMU_IRQ_CAUSE; + gc->chip_types[0].regs.mask = DOVE_PMU_IRQ_MASK; + gc->chip_types[0].chip.irq_ack = pmu_irq_ack; gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit; gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit; - /* mask all interrupts */ - writel(0, gc->reg_base + ORION_BRIDGE_IRQ_MASK); + /* mask and clear all interrupts */ + writel(0, gc->reg_base + DOVE_PMU_IRQ_MASK); + writel(0, gc->reg_base + DOVE_PMU_IRQ_CAUSE); irq_set_handler_data(irq, domain); - irq_set_chained_handler(irq, orion_bridge_irq_handler); + irq_set_chained_handler(irq, dove_pmu_irq_handler); return 0; } -IRQCHIP_DECLARE(orion_bridge_intc, - "marvell,orion-bridge-intc", orion_bridge_irq_init); +IRQCHIP_DECLARE(dove_pmu_intc, + "marvell,dove-pmu-intc", dove_pmu_irq_init); I omitted the second variant in irq-orion.c which is the same boilerplate with a few minimal changes. It'd be really nice if someone would sit down and make one or two general irqchip init function which gets rid of this copied code and reduces the init functions to the bare minimum. That's not only true for the orion/dove case it's the same for lot of irq-*.c variants plus minus the individual extras and of course bugs. Thanks, tglx --- drivers/irqchip/irq-orion.c 2014-02-18 21:27:35.655468837 +0100 +++ drivers/irqchip/irq-dove.c 2014-02-18 21:27:57.099469874 +0100 @@ -1,14 +1,10 @@ +#define DOVE_PMU_IRQ_CAUSE 0x00 +#define DOVE_PMU_IRQ_MASK 0x04 -/* - * Orion SoC bridge interrupt controller - */ -#define ORION_BRIDGE_IRQ_CAUSE 0x00 -#define ORION_BRIDGE_IRQ_MASK 0x04 - -static void orion_bridge_irq_handler(unsigned int irq, struct irq_desc *desc) +static void dove_pmu_irq_handler(unsigned int irq, struct irq_desc *desc) { struct irq_domain *d = irq_get_handler_data(irq); - struct irq_chip_generic *gc = irq_get_domain_generic_chip(d, irq); - u32 stat = readl_relaxed(gc->reg_base + ORION_BRIDGE_IRQ_CAUSE) & + struct irq_chip_generic *gc = irq_get_domain_generic_chip(d, 0); + u32 stat = readl_relaxed(gc->reg_base + DOVE_PMU_IRQ_CAUSE) & gc->mask_cache; Identical except for the register constants, which are identical as well.