From patchwork Fri Jul 22 20:23:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 106386 X-Patchwork-Delegate: galak@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id AB4ACB7316 for ; Sat, 23 Jul 2011 06:25:06 +1000 (EST) Received: from mail-fx0-f42.google.com (mail-fx0-f42.google.com [209.85.161.42]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id B0F18B6F8E for ; Sat, 23 Jul 2011 06:24:30 +1000 (EST) Received: by fxe23 with SMTP id 23so5238916fxe.15 for ; Fri, 22 Jul 2011 13:24:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=N5FJPTm3RYkT64bgi2TaS0VoPJmcDD8aISOX3Grzb00=; b=nHd7OoG022nrgXp1YUEBlCBjY/2vGg/iKmSBhLNVpRB+SEaav2pKNDwVO+aQvFXGeT f7SEF3ACCvv5O0CH6VBcRNFcKI4+mnRj8ClXJuR4fhZSvu2YQAJyKE+MbQfG3t2/MSye 98djE6H0TfcagGubuBKfitht7fARm6KSJrJtk= Received: by 10.204.121.8 with SMTP id f8mr570891bkr.154.1311366266451; Fri, 22 Jul 2011 13:24:26 -0700 (PDT) Received: from localhost.localdomain (ppp91-122-86-108.pppoe.avangarddsl.ru [91.122.86.108]) by mx.google.com with ESMTPS id r24sm605209bkr.59.2011.07.22.13.24.24 (version=SSLv3 cipher=OTHER); Fri, 22 Jul 2011 13:24:25 -0700 (PDT) From: Dmitry Eremin-Solenikov To: Linux PPC Development Subject: [PATCH V2 2/2] powerpc/85xx: separate cpm2 pic init Date: Sat, 23 Jul 2011 00:23:37 +0400 Message-Id: <1311366217-15384-3-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1311366217-15384-1-git-send-email-dbaryshkov@gmail.com> References: <1311366217-15384-1-git-send-email-dbaryshkov@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Separate handling of CPM2 PIC initialization to mpc85xx_cpm2_pic_init() function. Signed-off-by: Dmitry Eremin-Solenikov --- arch/powerpc/platforms/85xx/ksi8560.c | 29 +------------------ arch/powerpc/platforms/85xx/mpc85xx.h | 7 ++++ arch/powerpc/platforms/85xx/mpc85xx_ads.c | 33 +--------------------- arch/powerpc/platforms/85xx/mpc85xx_common.c | 39 ++++++++++++++++++++++++++ arch/powerpc/platforms/85xx/sbc8560.c | 33 +--------------------- arch/powerpc/platforms/85xx/stx_gp3.c | 35 +---------------------- arch/powerpc/platforms/85xx/tqm85xx.c | 35 +---------------------- 7 files changed, 51 insertions(+), 160 deletions(-) diff --git a/arch/powerpc/platforms/85xx/ksi8560.c b/arch/powerpc/platforms/85xx/ksi8560.c index 7657e1a..3c325b1 100644 --- a/arch/powerpc/platforms/85xx/ksi8560.c +++ b/arch/powerpc/platforms/85xx/ksi8560.c @@ -33,7 +33,6 @@ #include #include -#include #include "mpc85xx.h" @@ -55,25 +54,11 @@ static void machine_restart(char *cmd) for (;;); } -static void cpm2_cascade(unsigned int irq, struct irq_desc *desc) -{ - struct irq_chip *chip = irq_desc_get_chip(desc); - int cascade_irq; - - while ((cascade_irq = cpm2_get_irq()) >= 0) - generic_handle_irq(cascade_irq); - - chip->irq_eoi(&desc->irq_data); -} - static void __init ksi8560_pic_init(void) { struct mpic *mpic; struct resource r; struct device_node *np; -#ifdef CONFIG_CPM2 - int irq; -#endif np = of_find_node_by_type(NULL, "open-pic"); @@ -96,19 +81,7 @@ static void __init ksi8560_pic_init(void) mpic_init(mpic); -#ifdef CONFIG_CPM2 - /* Setup CPM2 PIC */ - np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic"); - if (np == NULL) { - printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n"); - return; - } - irq = irq_of_parse_and_map(np, 0); - - cpm2_pic_init(np); - of_node_put(np); - irq_set_chained_handler(irq, cpm2_cascade); -#endif + mpc85xx_cpm2_pic_init(); } #ifdef CONFIG_CPM2 diff --git a/arch/powerpc/platforms/85xx/mpc85xx.h b/arch/powerpc/platforms/85xx/mpc85xx.h index 1a1b4eb..2aa7c5d 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx.h +++ b/arch/powerpc/platforms/85xx/mpc85xx.h @@ -1,4 +1,11 @@ #ifndef MPC85xx_H #define MPC85xx_H extern int mpc85xx_common_publish_devices(void); + +#ifdef CONFIG_CPM2 +extern void mpc85xx_cpm2_pic_init(void); +#else +static inline void __init mpc85xx_cpm2_pic_init(void) {} +#endif /* CONFIG_CPM2 */ + #endif diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c index 153d2aa..8df4ff5 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c @@ -32,7 +32,6 @@ #ifdef CONFIG_CPM2 #include -#include #endif #include "mpc85xx.h" @@ -48,29 +47,11 @@ static int mpc85xx_exclude_device(struct pci_controller *hose, } #endif /* CONFIG_PCI */ -#ifdef CONFIG_CPM2 - -static void cpm2_cascade(unsigned int irq, struct irq_desc *desc) -{ - struct irq_chip *chip = irq_desc_get_chip(desc); - int cascade_irq; - - while ((cascade_irq = cpm2_get_irq()) >= 0) - generic_handle_irq(cascade_irq); - - chip->irq_eoi(&desc->irq_data); -} - -#endif /* CONFIG_CPM2 */ - static void __init mpc85xx_ads_pic_init(void) { struct mpic *mpic; struct resource r; struct device_node *np = NULL; -#ifdef CONFIG_CPM2 - int irq; -#endif np = of_find_node_by_type(np, "open-pic"); if (!np) { @@ -92,19 +73,7 @@ static void __init mpc85xx_ads_pic_init(void) mpic_init(mpic); -#ifdef CONFIG_CPM2 - /* Setup CPM2 PIC */ - np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic"); - if (np == NULL) { - printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n"); - return; - } - irq = irq_of_parse_and_map(np, 0); - - cpm2_pic_init(np); - of_node_put(np); - irq_set_chained_handler(irq, cpm2_cascade); -#endif + mpc85xx_cpm2_pic_init(); } /* diff --git a/arch/powerpc/platforms/85xx/mpc85xx_common.c b/arch/powerpc/platforms/85xx/mpc85xx_common.c index 999567a..4fdf382 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_common.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_common.c @@ -8,6 +8,8 @@ #include #include +#include + #include "mpc85xx.h" static struct of_device_id __initdata mpc85xx_common_ids[] = { @@ -24,3 +26,40 @@ int __init mpc85xx_common_publish_devices(void) { return of_platform_bus_probe(NULL, mpc85xx_common_ids, NULL); } + +#ifdef CONFIG_CPM2 +static void cpm2_cascade(unsigned int irq, struct irq_desc *desc) +{ + struct irq_chip *chip = irq_desc_get_chip(desc); + int cascade_irq; + + while ((cascade_irq = cpm2_get_irq()) >= 0) + generic_handle_irq(cascade_irq); + + chip->irq_eoi(&desc->irq_data); +} + + +void __init mpc85xx_cpm2_pic_init(void) +{ + struct device_node *np; + int irq; + + /* Setup CPM2 PIC */ + np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic"); + if (np == NULL) { + printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n"); + return; + } + irq = irq_of_parse_and_map(np, 0); + if (irq == NO_IRQ) { + of_node_put(np); + printk(KERN_ERR "PIC init: got no IRQ for cpm cascade\n"); + return; + } + + cpm2_pic_init(np); + of_node_put(np); + irq_set_chained_handler(irq, cpm2_cascade); +} +#endif diff --git a/arch/powerpc/platforms/85xx/sbc8560.c b/arch/powerpc/platforms/85xx/sbc8560.c index bbb656f..ce22afa 100644 --- a/arch/powerpc/platforms/85xx/sbc8560.c +++ b/arch/powerpc/platforms/85xx/sbc8560.c @@ -34,34 +34,15 @@ #ifdef CONFIG_CPM2 #include -#include #endif #include "mpc85xx.h" -#ifdef CONFIG_CPM2 - -static void cpm2_cascade(unsigned int irq, struct irq_desc *desc) -{ - struct irq_chip *chip = irq_desc_get_chip(desc); - int cascade_irq; - - while ((cascade_irq = cpm2_get_irq()) >= 0) - generic_handle_irq(cascade_irq); - - chip->irq_eoi(&desc->irq_data); -} - -#endif /* CONFIG_CPM2 */ - static void __init sbc8560_pic_init(void) { struct mpic *mpic; struct resource r; struct device_node *np = NULL; -#ifdef CONFIG_CPM2 - int irq; -#endif np = of_find_node_by_type(np, "open-pic"); if (!np) { @@ -83,19 +64,7 @@ static void __init sbc8560_pic_init(void) mpic_init(mpic); -#ifdef CONFIG_CPM2 - /* Setup CPM2 PIC */ - np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic"); - if (np == NULL) { - printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n"); - return; - } - irq = irq_of_parse_and_map(np, 0); - - cpm2_pic_init(np); - of_node_put(np); - irq_set_chained_handler(irq, cpm2_cascade); -#endif + mpc85xx_cpm2_pic_init(); } /* diff --git a/arch/powerpc/platforms/85xx/stx_gp3.c b/arch/powerpc/platforms/85xx/stx_gp3.c index ab80044..b44c936 100644 --- a/arch/powerpc/platforms/85xx/stx_gp3.c +++ b/arch/powerpc/platforms/85xx/stx_gp3.c @@ -44,18 +44,6 @@ #ifdef CONFIG_CPM2 #include -#include - -static void cpm2_cascade(unsigned int irq, struct irq_desc *desc) -{ - struct irq_chip *chip = irq_desc_get_chip(desc); - int cascade_irq; - - while ((cascade_irq = cpm2_get_irq()) >= 0) - generic_handle_irq(cascade_irq); - - chip->irq_eoi(&desc->irq_data); -} #endif /* CONFIG_CPM2 */ static void __init stx_gp3_pic_init(void) @@ -63,9 +51,6 @@ static void __init stx_gp3_pic_init(void) struct mpic *mpic; struct resource r; struct device_node *np; -#ifdef CONFIG_CPM2 - int irq; -#endif np = of_find_node_by_type(NULL, "open-pic"); if (!np) { @@ -87,25 +72,7 @@ static void __init stx_gp3_pic_init(void) mpic_init(mpic); -#ifdef CONFIG_CPM2 - /* Setup CPM2 PIC */ - np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic"); - if (np == NULL) { - printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n"); - return; - } - irq = irq_of_parse_and_map(np, 0); - - if (irq == NO_IRQ) { - of_node_put(np); - printk(KERN_ERR "PIC init: got no IRQ for cpm cascade\n"); - return; - } - - cpm2_pic_init(np); - of_node_put(np); - irq_set_chained_handler(irq, cpm2_cascade); -#endif + mpc85xx_cpm2_pic_init(); } /* diff --git a/arch/powerpc/platforms/85xx/tqm85xx.c b/arch/powerpc/platforms/85xx/tqm85xx.c index 19e711f..2418bf8 100644 --- a/arch/powerpc/platforms/85xx/tqm85xx.c +++ b/arch/powerpc/platforms/85xx/tqm85xx.c @@ -42,18 +42,6 @@ #ifdef CONFIG_CPM2 #include -#include - -static void cpm2_cascade(unsigned int irq, struct irq_desc *desc) -{ - struct irq_chip *chip = irq_desc_get_chip(desc); - int cascade_irq; - - while ((cascade_irq = cpm2_get_irq()) >= 0) - generic_handle_irq(cascade_irq); - - chip->irq_eoi(&desc->irq_data); -} #endif /* CONFIG_CPM2 */ static void __init tqm85xx_pic_init(void) @@ -61,9 +49,6 @@ static void __init tqm85xx_pic_init(void) struct mpic *mpic; struct resource r; struct device_node *np; -#ifdef CONFIG_CPM2 - int irq; -#endif np = of_find_node_by_type(NULL, "open-pic"); if (!np) { @@ -85,25 +70,7 @@ static void __init tqm85xx_pic_init(void) mpic_init(mpic); -#ifdef CONFIG_CPM2 - /* Setup CPM2 PIC */ - np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic"); - if (np == NULL) { - printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n"); - return; - } - irq = irq_of_parse_and_map(np, 0); - - if (irq == NO_IRQ) { - of_node_put(np); - printk(KERN_ERR "PIC init: got no IRQ for cpm cascade\n"); - return; - } - - cpm2_pic_init(np); - of_node_put(np); - irq_set_chained_handler(irq, cpm2_cascade); -#endif + mpc85xx_cpm2_pic_init(); } /*