From patchwork Thu Jan 23 23:10:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 3532361 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 E242C9F39B for ; Thu, 23 Jan 2014 23:11:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E3751201BB for ; Thu, 23 Jan 2014 23:11:23 +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 E0E6C20107 for ; Thu, 23 Jan 2014 23:11:22 +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 1W6TQZ-0001nY-EL; Thu, 23 Jan 2014 23:11:15 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W6TQX-0001Cr-2E; Thu, 23 Jan 2014 23:11:13 +0000 Received: from mail-ee0-x22b.google.com ([2a00:1450:4013:c00::22b]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W6TQL-0001Bt-5t for linux-arm-kernel@lists.infradead.org; Thu, 23 Jan 2014 23:11:09 +0000 Received: by mail-ee0-f43.google.com with SMTP id c41so655693eek.2 for ; Thu, 23 Jan 2014 15:10:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=t4OiO56EbqllLmBU1MT20M8OcCmLQxjsv8zdWfODf2o=; b=Rw2HHWOJ2xFMCvpkM+GH8j/kPACxyKerQnM6tMpHe7aVybS6N5Zzf+ik3jwbVe6Wf+ XICgr6B3I+zyEohZb6GRJBgHJJYVkqLlJriGd/ERvi3i+U+wvdF3E1znLpDX1H9fH5aJ UiU61H0WIJq/1bldBMDKBVIcwP/5aiF7QPZq5oxC5sJLMSoZcpvlDSC678tAAhg3YxnD lH8del7oIoYNEekFKbrqPmpOSxKbAofdTfjMxBPvQuJqWL61jm6Cpb1xBJk7roSDE0V8 vMco/bag2zDGSVt+MbeBZacJ8EZ5rKuy1OB+8+oZXIym/wnLlepzJxZq9RCRcAR14W4B QD3w== X-Received: by 10.14.206.198 with SMTP id l46mr9392488eeo.35.1390518639644; Thu, 23 Jan 2014 15:10:39 -0800 (PST) Received: from topkick.lan (dslc-082-083-251-183.pools.arcor-ip.net. [82.83.251.183]) by mx.google.com with ESMTPSA id 4sm44166312eed.14.2014.01.23.15.10.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jan 2014 15:10:38 -0800 (PST) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH v2 3/3] irqchip: orion: clear stale interrupts in irq_startup Date: Fri, 24 Jan 2014 00:10:32 +0100 Message-Id: <1390518632-2576-1-git-send-email-sebastian.hesselbarth@gmail.com> In-Reply-To: <1390516686-2224-4-git-send-email-sebastian.hesselbarth@gmail.com> References: <1390516686-2224-4-git-send-email-sebastian.hesselbarth@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140123_181101_379632_D454E986 X-CRM114-Status: GOOD ( 12.65 ) X-Spam-Score: -2.0 (--) Cc: Andrew Lunn , Jason Cooper , linux-kernel@vger.kernel.org, Jason Gunthorpe , Ezequiel Garcia , Gregory Clement , Thomas Gleixner , linux-arm-kernel@lists.infradead.org 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: , MIME-Version: 1.0 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.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Bridge IRQ_CAUSE bits are asserted regardless of the corresponding bit in IRQ_MASK register. To avoid interrupt events on stale irqs, we have to clear them before unmask. This installs an .irq_startup callback to ensure stale irqs are cleared before initial unmask. Signed-off-by: Sebastian Hesselbarth --- Changelog: v1->v2: - use .irq_startup instead of .irq_enable (Reported by Jason Gunthorpe) Cc: Thomas Gleixner Cc: Jason Cooper Cc: Andrew Lunn Cc: Gregory Clement Cc: Jason Gunthorpe Cc: Ezequiel Garcia Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/irqchip/irq-orion.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/irqchip/irq-orion.c b/drivers/irqchip/irq-orion.c index 1f636f719065..0dfdc5c824a1 100644 --- a/drivers/irqchip/irq-orion.c +++ b/drivers/irqchip/irq-orion.c @@ -123,6 +123,19 @@ static void orion_bridge_irq_handler(unsigned int irq, struct irq_desc *desc) } } +/* + * Bridge IRQ_CAUSE is asserted regardless of IRQ_MASK register. + * To avoid interrupt events on stale irqs, we clear them before unmask. + */ +static unsigned int orion_bridge_irq_startup(struct irq_data *d) +{ + struct irq_chip_type *ct = irq_data_get_chip_type(d); + + ct->chip.irq_ack(d); + ct->chip.irq_unmask(d); + return 0; +} + static int __init orion_bridge_irq_init(struct device_node *np, struct device_node *parent) { @@ -176,6 +189,7 @@ static int __init orion_bridge_irq_init(struct device_node *np, 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_startup = orion_bridge_irq_startup; gc->chip_types[0].chip.irq_ack = irq_gc_ack_clr_bit; gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit; gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit;