From patchwork Wed Dec 9 00:48:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Ware X-Patchwork-Id: 40695 X-Patchwork-Delegate: galak@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 3684CB7E04 for ; Wed, 9 Dec 2009 11:48:52 +1100 (EST) Received: by ozlabs.org (Postfix) id F1A2CB6F0F; Wed, 9 Dec 2009 11:48:44 +1100 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from ipmail02.adl6.internode.on.net (ipmail02.adl6.internode.on.net [203.16.214.140]) by ozlabs.org (Postfix) with ESMTP id D50F5B6F09 for ; Wed, 9 Dec 2009 11:48:44 +1100 (EST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqYBAGiBHkt20YwF/2dsb2JhbAAImHyDXLt3hDIEgWg Received: from ppp118-209-140-5.lns20.mel6.internode.on.net (HELO [192.168.1.1]) ([118.209.140.5]) by ipmail02.adl6.internode.on.net with ESMTP; 09 Dec 2009 11:18:43 +1030 Message-ID: <4B1EF3E9.8050005@elphinstone.net> Date: Wed, 09 Dec 2009 11:48:41 +1100 From: Mark Ware User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706) MIME-Version: 1.0 To: Linuxppc-dev Development Subject: [PATCH v2] cpm2_pic: Allow correct flow_types for port C interrupts Cc: Scott Wood X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Port C interrupts can be either falling edge, or either edge. Other external interrupts are either falling edge or active low. Signed-Off-By: Mark Ware Reviewed-by: Anton Vorontsov --- Changed in v2: - Disallow rising edge only on Port C arch/powerpc/sysdev/cpm2_pic.c | 30 +++++++++++++++++++++++------- 1 files changed, 23 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c index 78f1f7c..eba5f24 100644 --- a/arch/powerpc/sysdev/cpm2_pic.c +++ b/arch/powerpc/sysdev/cpm2_pic.c @@ -141,13 +141,29 @@ static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type) struct irq_desc *desc = get_irq_desc(virq); unsigned int vold, vnew, edibit; - if (flow_type == IRQ_TYPE_NONE) - flow_type = IRQ_TYPE_LEVEL_LOW; - - if (flow_type & IRQ_TYPE_EDGE_RISING) { - printk(KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n", - flow_type); - return -EINVAL; + /* Port C interrupts are either IRQ_TYPE_EDGE_FALLING or + * IRQ_TYPE_EDGE_BOTH (default). All others are IRQ_TYPE_EDGE_FALLING + * or IRQ_TYPE_LEVEL_LOW (default) + */ + if (src >= CPM2_IRQ_PORTC15 && src <= CPM2_IRQ_PORTC0) { + if (flow_type == IRQ_TYPE_NONE) + flow_type = IRQ_TYPE_EDGE_BOTH; + + if ((flow_type != IRQ_TYPE_EDGE_BOTH) && + (flow_type != IRQ_TYPE_EDGE_FALLING)) { + printk(KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n", + flow_type); + return -EINVAL; + } + } else { + if (flow_type == IRQ_TYPE_NONE) + flow_type = IRQ_TYPE_LEVEL_LOW; + + if (flow_type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_LEVEL_HIGH)) { + printk(KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n", + flow_type); + return -EINVAL; + } } desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);