powerpc/85xx: cleanup efforts
Subsystems (2)
v2 cover powerpc/85xx: cleanup efforts
This is a second revision of patches, cleaning up mpc85xx support Changes since V1:
* Temporarily drop questionable patches
* Use common cpm2 init routing in stx_gp3.c
* Add powerpc/ prefix
PATCH v2 1/2 powerpc/85xx: consolidate of_platform_bus_probe calls
85xx board files have a lot of duplication in *_publish_devices()/ *_declare_of_platform_devices() functions. Merge that into a single function common to most of the boards.
Signed-off-by Dmitry Eremin-Solenikov <[email protected]>
--- arch/powerpc/platforms/85xx/Makefile | 2 + arch/powerpc/platforms/85xx/ksi8560.c | 18 +--------- arch/powerpc/platforms/85xx/mpc8536_ds.c | 16 ++------- arch/powerpc/platforms/85xx/mpc85xx.h | 4 ++ arch/powerpc/platforms/85xx/mpc85xx_ads.c | 20 ++--------- arch/powerpc/platforms/85xx/mpc85xx_cds.c | 16 ++------- arch/powerpc/platforms/85xx/mpc85xx_common.c | 26 ++++++++++++++ arch/powerpc/platforms/85xx/mpc85xx_ds.c | 20 +++-------- arch/powerpc/platforms/85xx/mpc85xx_mds.c | 46 ++----------------------- arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 18 ++-------- arch/powerpc/platforms/85xx/p1010rdb.c | 15 ++------- arch/powerpc/platforms/85xx/p1022_ds.c | 7 ++-- arch/powerpc/platforms/85xx/p1023_rds.c | 19 ++--------- arch/powerpc/platforms/85xx/sbc8548.c | 18 ++-------- arch/powerpc/platforms/85xx/sbc8560.c | 20 ++--------- arch/powerpc/platforms/85xx/socrates.c | 13 +------ arch/powerpc/platforms/85xx/stx_gp3.c | 16 ++------- arch/powerpc/platforms/85xx/tqm85xx.c | 16 ++------- arch/powerpc/platforms/85xx/xes_mpc85xx.c | 20 +++-------- 19 files changed, 84 insertions(+), 246 deletions(-) create mode 100644 arch/powerpc/platforms/85xx/mpc85xx.h create mode 100644 arch/powerpc/platforms/85xx/mpc85xx_common.c
arch/powerpc/platforms/85xx/Makefile +2 -0
@@ -3,6 +3,8 @@ # obj-$(CONFIG_SMP) += smp.o +obj-y += mpc85xx_common.o + obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
arch/powerpc/platforms/85xx/ksi8560.c +2 -16
@@ -35,6 +35,7 @@#include <asm/cpm2.h> #include <sysdev/cpm2_pic.h> +#include "mpc85xx.h" #define KSI8560_CPLD_HVR 0x04/* Hardware Version Register */ #define KSI8560_CPLD_PVR 0x08/* PLD Version Register */
@@ -215,22 +216,7 @@ static void ksi8560_show_cpuinfo(struct seq_file *m)seq_printf (m,"PLL setting\t: 0x%x\n" , ((phid1 >>24 ) &0x3f )); } -static struct of_device_id __initdata of_bus_ids[] = { - { .type ="soc" , }, - { .type ="simple-bus" , }, - { .name ="cpm" , }, - { .name ="localbus" , }, - { .compatible ="gianfar" , }, - {}, -}; - -static int __init declare_of_platform_devices (void ) -{ -of_platform_bus_probe (NULL , of_bus_ids,NULL ); - -return 0 ; -} -machine_device_initcall (ksi8560, declare_of_platform_devices); +machine_device_initcall (ksi8560, mpc85xx_common_publish_devices);/* * Called very early, device-tree isn't unflattened
arch/powerpc/platforms/85xx/mpc8536_ds.c +3 -13
@@ -32,6 +32,8 @@#include <sysdev/fsl_soc.h> #include <sysdev/fsl_pci.h> +#include "mpc85xx.h" +void __init mpc8536_ds_pic_init (void ) {struct mpic *mpic;
@@ -104,19 +106,7 @@ static void __init mpc8536_ds_setup_arch(void)printk ("MPC8536 DS board from Freescale Semiconductor\n" ); } -static struct of_device_id __initdata mpc8536_ds_ids[] = { - { .type ="soc" , }, - { .compatible ="soc" , }, - { .compatible ="simple-bus" , }, - { .compatible ="gianfar" , }, - {}, -}; - -static int __init mpc8536_ds_publish_devices (void ) -{ -return of_platform_bus_probe (NULL , mpc8536_ds_ids,NULL ); -} -machine_device_initcall (mpc8536_ds, mpc8536_ds_publish_devices); +machine_device_initcall (mpc8536_ds, mpc85xx_common_publish_devices);machine_arch_initcall (mpc8536_ds, swiotlb_setup_bus_notifier);
arch/powerpc/platforms/85xx/mpc85xx.h new file +4 -0
@@ -0,0 +1,4 @@ +#ifndef MPC85xx_H +#define MPC85xx_H +extern int mpc85xx_common_publish_devices (void ); +#endif
arch/powerpc/platforms/85xx/mpc85xx_ads.c +3 -17
@@ -35,6 +35,8 @@#include <sysdev/cpm2_pic.h> #endif +#include "mpc85xx.h" +#ifdef CONFIG_PCI static int mpc85xx_exclude_device (struct pci_controller *hose,u_char bus,u_char devfn)
@@ -221,23 +223,7 @@ static void mpc85xx_ads_show_cpuinfo(struct seq_file *m)seq_printf (m,"PLL setting\t: 0x%x\n" , ((phid1 >>24 ) &0x3f )); } -static struct of_device_id __initdata of_bus_ids[] = { - { .name ="soc" , }, - { .type ="soc" , }, - { .name ="cpm" , }, - { .name ="localbus" , }, - { .compatible ="simple-bus" , }, - { .compatible ="gianfar" , }, - {}, -}; - -static int __init declare_of_platform_devices (void ) -{ -of_platform_bus_probe (NULL , of_bus_ids,NULL ); - -return 0 ; -} -machine_device_initcall (mpc85xx_ads, declare_of_platform_devices); +machine_device_initcall (mpc85xx_ads, mpc85xx_common_publish_devices);/* * Called very early, device-tree isn't unflattened
arch/powerpc/platforms/85xx/mpc85xx_cds.c +3 -13
@@ -47,6 +47,8 @@#include <sysdev/fsl_soc.h> #include <sysdev/fsl_pci.h> +#include "mpc85xx.h" +/* CADMUS info */ /* xxx - galak, move into device tree */ #define CADMUS_BASE (0xf8004000)
@@ -331,19 +333,7 @@ static int __init mpc85xx_cds_probe(void)return of_flat_dt_is_compatible (root,"MPC85xxCDS" ); } -static struct of_device_id __initdata of_bus_ids[] = { - { .type ="soc" , }, - { .compatible ="soc" , }, - { .compatible ="simple-bus" , }, - { .compatible ="gianfar" , }, - {}, -}; - -static int __init declare_of_platform_devices (void ) -{ -return of_platform_bus_probe (NULL , of_bus_ids,NULL ); -} -machine_device_initcall (mpc85xx_cds, declare_of_platform_devices); +machine_device_initcall (mpc85xx_cds, mpc85xx_common_publish_devices);define_machine (mpc85xx_cds) { .name = "MPC85xx CDS",
arch/powerpc/platforms/85xx/mpc85xx_common.c new file +26 -0
@@ -0,0 +1,26 @@ +/* +* Routines common to most mpc85xx-based boards. +* +* This is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#include <linux/kernel.h> +#include <linux/of_platform.h> + +#include "mpc85xx.h" + +static struct of_device_id __initdata mpc85xx_common_ids[] = { + { .type ="soc" , }, + { .compatible ="soc" , }, + { .compatible ="simple-bus" , }, + { .compatible ="gianfar" , }, + { .compatible ="fsl,qe" , }, + { .compatible ="fsl,cpm2" , }, + {}, +}; + +int __init mpc85xx_common_publish_devices (void ) +{ +return of_platform_bus_probe (NULL , mpc85xx_common_ids,NULL ); +}
arch/powerpc/platforms/85xx/mpc85xx_ds.c +5 -15
@@ -36,6 +36,8 @@#include <sysdev/fsl_soc.h> #include <sysdev/fsl_pci.h> +#include "mpc85xx.h" +#undef DEBUG#ifdef DEBUG
@@ -218,21 +220,9 @@ static int __init mpc8544_ds_probe(void)return 0 ; } -static struct of_device_id __initdata mpc85xxds_ids[] = { - { .type ="soc" , }, - { .compatible ="soc" , }, - { .compatible ="simple-bus" , }, - { .compatible ="gianfar" , }, - {}, -}; - -static int __init mpc85xxds_publish_devices (void ) -{ -return of_platform_bus_probe (NULL , mpc85xxds_ids,NULL ); -} -machine_device_initcall (mpc8544_ds, mpc85xxds_publish_devices); -machine_device_initcall (mpc8572_ds, mpc85xxds_publish_devices); -machine_device_initcall (p2020_ds, mpc85xxds_publish_devices); +machine_device_initcall (mpc8544_ds, mpc85xx_common_publish_devices); +machine_device_initcall (mpc8572_ds, mpc85xx_common_publish_devices); +machine_device_initcall (p2020_ds, mpc85xx_common_publish_devices);machine_arch_initcall (mpc8544_ds, swiotlb_setup_bus_notifier);machine_arch_initcall (mpc8572_ds, swiotlb_setup_bus_notifier);
arch/powerpc/platforms/85xx/mpc85xx_mds.c +4 -42
89 lines not on this page · raw message
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +4 -14
@@ -30,6 +30,8 @@#include <sysdev/fsl_soc.h> #include <sysdev/fsl_pci.h> +#include "mpc85xx.h" +#undef DEBUG#ifdef DEBUG
@@ -108,20 +110,8 @@ static void __init mpc85xx_rdb_setup_arch(void)printk (KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n" ); } -static struct of_device_id __initdata mpc85xxrdb_ids[] = { - { .type ="soc" , }, - { .compatible ="soc" , }, - { .compatible ="simple-bus" , }, - { .compatible ="gianfar" , }, - {}, -}; - -static int __init mpc85xxrdb_publish_devices (void ) -{ -return of_platform_bus_probe (NULL , mpc85xxrdb_ids,NULL ); -} -machine_device_initcall (p2020_rdb, mpc85xxrdb_publish_devices); -machine_device_initcall (p1020_rdb, mpc85xxrdb_publish_devices); +machine_device_initcall (p2020_rdb, mpc85xx_common_publish_devices); +machine_device_initcall (p1020_rdb, mpc85xx_common_publish_devices);/* * Called very early, device-tree isn't unflattened
arch/powerpc/platforms/85xx/p1010rdb.c +3 -12
@@ -28,6 +28,8 @@#include <sysdev/fsl_soc.h> #include <sysdev/fsl_pci.h> +#include "mpc85xx.h" +void __init p1010_rdb_pic_init (void ) {struct mpic *mpic;
@@ -81,18 +83,7 @@ static void __init p1010_rdb_setup_arch(void)printk (KERN_INFO "P1010 RDB board from Freescale Semiconductor\n" ); } -static struct of_device_id __initdata p1010rdb_ids[] = { - { .type ="soc" , }, - { .compatible ="soc" , }, - { .compatible ="simple-bus" , }, - {}, -}; - -static int __init p1010rdb_publish_devices (void ) -{ -return of_platform_bus_probe (NULL , p1010rdb_ids,NULL ); -} -machine_device_initcall (p1010_rdb, p1010rdb_publish_devices); +machine_device_initcall (p1010_rdb, mpc85xx_common_publish_devices);machine_arch_initcall (p1010_rdb, swiotlb_setup_bus_notifier);/*
arch/powerpc/platforms/85xx/p1022_ds.c +3 -4
@@ -27,6 +27,8 @@#include <sysdev/fsl_pci.h> #include <asm/fsl_guts.h> +#include "mpc85xx.h" +#if defined(CONFIG_FB_FSL_DIU ) || defined(CONFIG_FB_FSL_DIU_MODULE )/*
@@ -325,10 +327,6 @@ static void __init p1022_ds_setup_arch(void) }static struct of_device_id __initdata p1022_ds_ids[] = { - { .type ="soc" , }, - { .compatible ="soc" , }, - { .compatible ="simple-bus" , }, - { .compatible ="gianfar" , },/* So that the DMA channel nodes can be probed individually: */ { .compatible ="fsl,eloplus-dma" , }, {},
@@ -338,6 +336,7 @@ static int __init p1022_ds_publish_devices(void) {return of_platform_bus_probe (NULL , p1022_ds_ids,NULL ); } +machine_device_initcall (p1022_ds, mpc85xx_common_publish_devices);machine_device_initcall (p1022_ds, p1022_ds_publish_devices);machine_arch_initcall (p1022_ds, swiotlb_setup_bus_notifier);
arch/powerpc/platforms/85xx/p1023_rds.c +3 -16
@@ -34,6 +34,8 @@#include <sysdev/fsl_soc.h> #include <sysdev/fsl_pci.h> +#include "mpc85xx.h" +/* ************************************************************************ * * Setup the architecture
@@ -92,22 +94,7 @@ static void __init mpc85xx_rds_setup_arch(void)#endif } -static struct of_device_id p1023_ids[] = { - { .type ="soc" , }, - { .compatible ="soc" , }, - { .compatible ="simple-bus" , }, - {}, -}; - - -static int __init p1023_publish_devices (void ) -{ -of_platform_bus_probe (NULL , p1023_ids,NULL ); - -return 0 ; -} - -machine_device_initcall (p1023_rds, p1023_publish_devices); +machine_device_initcall (p1023_rds, mpc85xx_common_publish_devices);static void __init mpc85xx_rds_pic_init (void ) {
arch/powerpc/platforms/85xx/sbc8548.c +3 -15
@@ -49,6 +49,8 @@#include <sysdev/fsl_soc.h> #include <sysdev/fsl_pci.h> +#include "mpc85xx.h" +static int sbc_rev;static void __init sbc8548_pic_init (void )
@@ -150,21 +152,7 @@ static void sbc8548_show_cpuinfo(struct seq_file *m)seq_printf (m,"PLL setting\t: 0x%x\n" , ((phid1 >>24 ) &0x3f )); } -static struct of_device_id __initdata of_bus_ids[] = { - { .name ="soc" , }, - { .type ="soc" , }, - { .compatible ="simple-bus" , }, - { .compatible ="gianfar" , }, - {}, -}; - -static int __init declare_of_platform_devices (void ) -{ -of_platform_bus_probe (NULL , of_bus_ids,NULL ); - -return 0 ; -} -machine_device_initcall (sbc8548, declare_of_platform_devices); +machine_device_initcall (sbc8548, mpc85xx_common_publish_devices);/* * Called very early, device-tree isn't unflattened
arch/powerpc/platforms/85xx/sbc8560.c +3 -17
@@ -37,6 +37,8 @@#include <sysdev/cpm2_pic.h> #endif +#include "mpc85xx.h" +#ifdef CONFIG_CPM2 static void cpm2_cascade (unsigned int irq,struct irq_desc *desc)
@@ -208,23 +210,7 @@ static void sbc8560_show_cpuinfo(struct seq_file *m)seq_printf (m,"PLL setting\t: 0x%x\n" , ((phid1 >>24 ) &0x3f )); } -static struct of_device_id __initdata of_bus_ids[] = { - { .name ="soc" , }, - { .type ="soc" , }, - { .name ="cpm" , }, - { .name ="localbus" , }, - { .compatible ="simple-bus" , }, - { .compatible ="gianfar" , }, - {}, -}; - -static int __init declare_of_platform_devices (void ) -{ -of_platform_bus_probe (NULL , of_bus_ids,NULL ); - -return 0 ; -} -machine_device_initcall (sbc8560, declare_of_platform_devices); +machine_device_initcall (sbc8560, mpc85xx_common_publish_devices);/* * Called very early, device-tree isn't unflattened
arch/powerpc/platforms/85xx/socrates.c +2 -11
@@ -41,6 +41,7 @@#include <sysdev/fsl_soc.h> #include <sysdev/fsl_pci.h> +#include "mpc85xx.h" #include "socrates_fpga_pic.h" static void __init socrates_pic_init (void )
@@ -96,17 +97,7 @@ static void __init socrates_setup_arch(void)#endif } -static struct of_device_id __initdata socrates_of_bus_ids[] = { - { .compatible ="simple-bus" , }, - { .compatible ="gianfar" , }, - {}, -}; - -static int __init socrates_publish_devices (void ) -{ -return of_platform_bus_probe (NULL , socrates_of_bus_ids,NULL ); -} -machine_device_initcall (socrates, socrates_publish_devices); +machine_device_initcall (socrates, mpc85xx_common_publish_devices);/* * Called very early, device-tree isn't unflattened
arch/powerpc/platforms/85xx/stx_gp3.c +3 -13
@@ -40,6 +40,8 @@#include <sysdev/fsl_soc.h> #include <sysdev/fsl_pci.h> +#include "mpc85xx.h" +#ifdef CONFIG_CPM2 #include <asm/cpm2.h> #include <sysdev/cpm2_pic.h>
@@ -144,19 +146,7 @@ static void stx_gp3_show_cpuinfo(struct seq_file *m)seq_printf (m,"PLL setting\t: 0x%x\n" , ((phid1 >>24 ) &0x3f )); } -static struct of_device_id __initdata of_bus_ids[] = { - { .compatible ="simple-bus" , }, - { .compatible ="gianfar" , }, - {}, -}; - -static int __init declare_of_platform_devices (void ) -{ -of_platform_bus_probe (NULL , of_bus_ids,NULL ); - -return 0 ; -} -machine_device_initcall (stx_gp3, declare_of_platform_devices); +machine_device_initcall (stx_gp3, mpc85xx_common_publish_devices);/* * Called very early, device-tree isn't unflattened
arch/powerpc/platforms/85xx/tqm85xx.c +3 -13
@@ -38,6 +38,8 @@#include <sysdev/fsl_soc.h> #include <sysdev/fsl_pci.h> +#include "mpc85xx.h" +#ifdef CONFIG_CPM2 #include <asm/cpm2.h> #include <sysdev/cpm2_pic.h>
@@ -173,19 +175,7 @@ static void __init tqm85xx_ti1520_fixup(struct pci_dev *pdev)DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_TI ,PCI_DEVICE_ID_TI_1520 , tqm85xx_ti1520_fixup); -static struct of_device_id __initdata of_bus_ids[] = { - { .compatible ="simple-bus" , }, - { .compatible ="gianfar" , }, - {}, -}; - -static int __init declare_of_platform_devices (void ) -{ -of_platform_bus_probe (NULL , of_bus_ids,NULL ); - -return 0 ; -} -machine_device_initcall (tqm85xx, declare_of_platform_devices); +machine_device_initcall (tqm85xx, mpc85xx_common_publish_devices);static const char *board[]__initdata = {"tqc,tqm8540" ,
arch/powerpc/platforms/85xx/xes_mpc85xx.c +5 -15
@@ -33,6 +33,8 @@#include <sysdev/fsl_soc.h> #include <sysdev/fsl_pci.h> +#include "mpc85xx.h" +/* A few bit definitions needed for fixups on some boards */ #define MPC85xx_L2CTL_L2E 0x80000000/* L2 enable */ #define MPC85xx_L2CTL_L2I 0x40000000/* L2 flash invalidate */
@@ -177,21 +179,9 @@ static void __init xes_mpc85xx_setup_arch(void)#endif } -static struct of_device_id __initdata xes_mpc85xx_ids[] = { - { .type ="soc" , }, - { .compatible ="soc" , }, - { .compatible ="simple-bus" , }, - { .compatible ="gianfar" , }, - {}, -}; - -static int __init xes_mpc85xx_publish_devices (void ) -{ -return of_platform_bus_probe (NULL , xes_mpc85xx_ids,NULL ); -} -machine_device_initcall (xes_mpc8572, xes_mpc85xx_publish_devices); -machine_device_initcall (xes_mpc8548, xes_mpc85xx_publish_devices); -machine_device_initcall (xes_mpc8540, xes_mpc85xx_publish_devices); +machine_device_initcall (xes_mpc8572, mpc85xx_common_publish_devices); +machine_device_initcall (xes_mpc8548, mpc85xx_common_publish_devices); +machine_device_initcall (xes_mpc8540, mpc85xx_common_publish_devices);/* * Called very early, device-tree isn't unflattened
Signature · 1 line
1.7.2.5
PATCH v2 2/2 powerpc/85xx: separate cpm2 pic init
In reply to Dmitry Eremin-SolenikovSeparate handling of CPM2 PIC initialization to mpc85xx_cpm2_pic_init() function.
Signed-off-by Dmitry Eremin-Solenikov <[email protected]>
--- 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(-)
arch/powerpc/platforms/85xx/ksi8560.c +1 -28
@@ -33,7 +33,6 @@#include <sysdev/fsl_pci.h> #include <asm/cpm2.h> -#include <sysdev/cpm2_pic.h> #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
arch/powerpc/platforms/85xx/mpc85xx.h +7 -0
@@ -1,4 +1,11 @@#ifndef MPC85xx_H#define MPC85xx_Hextern 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
arch/powerpc/platforms/85xx/mpc85xx_ads.c +1 -32
@@ -32,7 +32,6 @@#ifdef CONFIG_CPM2 #include <asm/cpm2.h> -#include <sysdev/cpm2_pic.h> #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 (); }/*
arch/powerpc/platforms/85xx/mpc85xx_common.c +39 -0
@@ -8,6 +8,8 @@#include <linux/kernel.h> #include <linux/of_platform.h> +#include <sysdev/cpm2_pic.h> +#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
arch/powerpc/platforms/85xx/sbc8560.c +1 -32
@@ -34,34 +34,15 @@#ifdef CONFIG_CPM2 #include <asm/cpm2.h> -#include <sysdev/cpm2_pic.h> #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 (); }/*
arch/powerpc/platforms/85xx/stx_gp3.c +1 -34
@@ -44,18 +44,6 @@#ifdef CONFIG_CPM2 #include <asm/cpm2.h> -#include <sysdev/cpm2_pic.h> - -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 (); }/*
arch/powerpc/platforms/85xx/tqm85xx.c +1 -34
@@ -42,18 +42,6 @@#ifdef CONFIG_CPM2 #include <asm/cpm2.h> -#include <sysdev/cpm2_pic.h> - -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 (); }/*
Signature · 1 line
1.7.2.5