Skip to contentSkip to conversation

powerpc/85xx: separate cpm2 pic init

PATCH Applied Dmitry Eremin-Solenikov 7 participants 22 messages Nov 17, 2011 – Nov 29, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 powerpc/85xx: separate cpm2 pic init

Separate handling of CPM2 PIC initialization to mpc85xx_cpm2_pic_init() function.

---
 arch/powerpc/platforms/85xx/Makefile         |    2 +
 arch/powerpc/platforms/85xx/ksi8560.c        |   29 +--------------
 arch/powerpc/platforms/85xx/mpc8536_ds.c     |    2 +
 arch/powerpc/platforms/85xx/mpc85xx.h        |    9 +++++
 arch/powerpc/platforms/85xx/mpc85xx_ads.c    |   34 ++----------------
 arch/powerpc/platforms/85xx/mpc85xx_cds.c    |    2 +
 arch/powerpc/platforms/85xx/mpc85xx_common.c |   49 ++++++++++++++++++++++++++
 arch/powerpc/platforms/85xx/mpc85xx_ds.c     |    2 +
 arch/powerpc/platforms/85xx/mpc85xx_mds.c    |    2 +
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c    |    2 +
 arch/powerpc/platforms/85xx/p1022_ds.c       |    2 +
 arch/powerpc/platforms/85xx/sbc8560.c        |   34 ++----------------
 arch/powerpc/platforms/85xx/socrates.c       |    1 +
 arch/powerpc/platforms/85xx/stx_gp3.c        |   37 ++------------------
 arch/powerpc/platforms/85xx/tqm85xx.c        |   37 ++------------------
 arch/powerpc/platforms/85xx/xes_mpc85xx.c    |    2 +
 16 files changed, 89 insertions(+), 157 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
index bc5acb9..b6beec8 100644
@@ -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 -27
index c46f935..bf9b1e5 100644
@@ -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 */
@@ -54,25 +55,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");
 
@@ -95,19 +82,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/mpc8536_ds.c +2 -0
index f79f2f1..6a4b2c1 100644
@@ -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;
arch/powerpc/platforms/85xx/mpc85xx.h new file +9 -0
new file mode 100644
index 0000000..fa55e8b
@@ -0,0 +1,9 @@
+#ifndef MPC85xx_H
+#define MPC85xx_H
+#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 +3 -31
index 3b2c9bb..8b8f7a2 100644
@@ -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)
@@ -46,29 +48,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) {
@@ -90,19 +74,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_cds.c +2 -0
index 2bf9978..93bf18a 100644
@@ -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)
arch/powerpc/platforms/85xx/mpc85xx_common.c new file +49 -0

49 lines not on this page · raw message

arch/powerpc/platforms/85xx/mpc85xx_ds.c +2 -0
index 1b9a8cf..55075b9 100644
@@ -36,6 +36,8 @@
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
 
+#include "mpc85xx.h"
+
 #undef DEBUG
 
 #ifdef DEBUG
arch/powerpc/platforms/85xx/mpc85xx_mds.c +2 -0
index 973b3f4..2ee487a 100644
@@ -53,6 +53,8 @@
 #include <asm/mpic.h>
 #include <asm/swiotlb.h>
 
+#include "mpc85xx.h"
+
 #undef DEBUG
 #ifdef DEBUG
 #define DBG(fmt...) udbg_printf(fmt)
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +2 -0
index f5ff911..824d2b6 100644
@@ -30,6 +30,8 @@
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
 
+#include "mpc85xx.h"
+
 #undef DEBUG
 
 #ifdef DEBUG
arch/powerpc/platforms/85xx/p1022_ds.c +2 -0
index 6a0b973..00d93a4 100644
@@ -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)
 
 /*
arch/powerpc/platforms/85xx/sbc8560.c +3 -31
index cebd786..43711f8 100644
@@ -32,34 +32,18 @@
 #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>
 #endif
 
-#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) {
@@ -81,19 +65,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/socrates.c +1 -0
index 747d8fb..9d0fc28 100644
@@ -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)
arch/powerpc/platforms/85xx/stx_gp3.c +3 -34
index 5387e9f..d24192b 100644
@@ -40,20 +40,10 @@
 #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>
-
-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)
@@ -61,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) {
@@ -85,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 +3 -34
index 325de77..b9e53cc 100644
@@ -38,20 +38,10 @@
 #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>
-
-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)
@@ -59,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) {
@@ -83,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();
 }
 
 /*
arch/powerpc/platforms/85xx/xes_mpc85xx.c +2 -0
index a9dc5e7..ab7025a 100644
@@ -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 */
Signature · 1 line
1.7.7.1
#1 lore raw

PATCH 2/6 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.

---
 arch/powerpc/platforms/85xx/ksi8560.c        |   17 +---------
 arch/powerpc/platforms/85xx/mpc8536_ds.c     |   14 +-------
 arch/powerpc/platforms/85xx/mpc85xx.h        |    2 +
 arch/powerpc/platforms/85xx/mpc85xx_ads.c    |   18 +----------
 arch/powerpc/platforms/85xx/mpc85xx_cds.c    |   14 +-------
 arch/powerpc/platforms/85xx/mpc85xx_common.c |   16 +++++++++
 arch/powerpc/platforms/85xx/mpc85xx_ds.c     |   18 ++---------
 arch/powerpc/platforms/85xx/mpc85xx_mds.c    |   44 +------------------------
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c    |   16 +--------
 arch/powerpc/platforms/85xx/p1022_ds.c       |    5 +--
 arch/powerpc/platforms/85xx/sbc8548.c        |   18 ++---------
 arch/powerpc/platforms/85xx/sbc8560.c        |   18 +----------
 arch/powerpc/platforms/85xx/socrates.c       |   12 +------
 arch/powerpc/platforms/85xx/stx_gp3.c        |   14 +-------
 arch/powerpc/platforms/85xx/tqm85xx.c        |   14 +-------
 arch/powerpc/platforms/85xx/xes_mpc85xx.c    |   18 ++---------
 16 files changed, 40 insertions(+), 218 deletions(-)
arch/powerpc/platforms/85xx/ksi8560.c +1 -16
index bf9b1e5..0f3e688 100644
@@ -190,22 +190,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 +1 -13
index 6a4b2c1..9ee6455 100644
@@ -106,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 +2 -0
index fa55e8b..2aa7c5d 100644
@@ -1,5 +1,7 @@
 #ifndef MPC85xx_H
 #define MPC85xx_H
+extern int mpc85xx_common_publish_devices(void);
+
 #ifdef CONFIG_CPM2
 extern void mpc85xx_cpm2_pic_init(void);
 #else
arch/powerpc/platforms/85xx/mpc85xx_ads.c +1 -17
index 8b8f7a2..986554b 100644
@@ -193,23 +193,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 +1 -13
index 93bf18a..a268f43 100644
@@ -333,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 +16 -0
index 49d781c..fe40668 100644
@@ -11,6 +11,22 @@
 
 #include "mpc85xx.h"
 
+static struct of_device_id __initdata mpc85xx_common_ids[] = {
+	{ .type = "soc", },
+	{ .compatible = "soc", },
+	{ .compatible = "simple-bus", },
+	{ .name = "cpm", },
+	{ .name = "localbus", },
+	{ .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);
+}
 #ifdef CONFIG_CPM2
 static void cpm2_cascade(unsigned int irq, struct irq_desc *desc)
 {
arch/powerpc/platforms/85xx/mpc85xx_ds.c +3 -15
index 55075b9..2113120 100644
@@ -221,21 +221,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 +2 -42

81 lines not on this page · raw message

arch/powerpc/platforms/85xx/mpc85xx_rdb.c +2 -14
index 824d2b6..9feccbb 100644
@@ -111,20 +111,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/p1022_ds.c +1 -4
index 00d93a4..cacb4d4 100644
@@ -330,10 +330,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", },
 	{},
@@ -343,6 +339,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/sbc8548.c +3 -15
index d07dcb7..35deaa9 100644
@@ -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 +1 -17
index 43711f8..e9a7ed2 100644
@@ -180,23 +180,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 +1 -11
index 9d0fc28..fec496a 100644
@@ -97,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 +1 -13
index d24192b..b44c936 100644
@@ -113,19 +113,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 +1 -13
index b9e53cc..2418bf8 100644
@@ -142,19 +142,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 +3 -15
index ab7025a..4632c1b 100644
@@ -179,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.7.1
#12 lore raw

PATCH 3/6 powerpc/85xx: separate MPIC handling code

In reply to Dmitry Eremin-Solenikov

All mpc85xx boards deal with MPIC initialization in more or less the same way. The only difrerences are some flags (WANTS_RESET, BROKEN_FRR_NIRQS, SINGLE_DEST_CPU), and some bugs like leaking device node counter, etc. To minimize problems, switch all boards to use one single instance of code.

---
 arch/powerpc/platforms/85xx/corenet_ds.c     |   29 +-------------
 arch/powerpc/platforms/85xx/ksi8560.c        |   25 +------------
 arch/powerpc/platforms/85xx/mpc8536_ds.c     |   25 +------------
 arch/powerpc/platforms/85xx/mpc85xx.h        |    1 +
 arch/powerpc/platforms/85xx/mpc85xx_ads.c    |   24 +-----------
 arch/powerpc/platforms/85xx/mpc85xx_cds.c    |   27 +-------------
 arch/powerpc/platforms/85xx/mpc85xx_common.c |   43 +++++++++++++++++++++
 arch/powerpc/platforms/85xx/mpc85xx_ds.c     |   53 +++++++-------------------
 arch/powerpc/platforms/85xx/mpc85xx_mds.c    |   23 +-----------
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c    |   37 +----------------
 arch/powerpc/platforms/85xx/p1010rdb.c       |   28 +------------
 arch/powerpc/platforms/85xx/p1022_ds.c       |   27 +-------------
 arch/powerpc/platforms/85xx/p1023_rds.c      |   28 +------------
 arch/powerpc/platforms/85xx/sbc8548.c        |   27 +-------------
 arch/powerpc/platforms/85xx/sbc8560.c        |   24 +-----------
 arch/powerpc/platforms/85xx/socrates.c       |   22 +----------
 arch/powerpc/platforms/85xx/stx_gp3.c        |   24 +-----------
 arch/powerpc/platforms/85xx/tqm85xx.c        |   24 +-----------
 arch/powerpc/platforms/85xx/xes_mpc85xx.c    |   25 +------------
 19 files changed, 82 insertions(+), 434 deletions(-)
arch/powerpc/platforms/85xx/corenet_ds.c +3 -26
index 802ad11..b4abc01 100644
@@ -32,34 +32,11 @@
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
 
+#include "mpc85xx.h"
+
 void __init corenet_ds_pic_init(void)
 {
-	struct mpic *mpic;
-	struct resource r;
-	struct device_node *np = NULL;
-	unsigned int flags = MPIC_PRIMARY | MPIC_BIG_ENDIAN |
-				MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU;
-
-	np = of_find_node_by_type(np, "open-pic");
-
-	if (np == NULL) {
-		printk(KERN_ERR "Could not find open-pic node\n");
-		return;
-	}
-
-	if (of_address_to_resource(np, 0, &r)) {
-		printk(KERN_ERR "Failed to map mpic register space\n");
-		of_node_put(np);
-		return;
-	}
-
-	if (ppc_md.get_irq == mpic_get_coreint_irq)
-		flags |= MPIC_ENABLE_COREINT;
-
-	mpic = mpic_alloc(np, r.start, flags, 0, 256, " OpenPIC  ");
-	BUG_ON(mpic == NULL);
-
-	mpic_init(mpic);
+	mpc85xx_init_mpic(0, 1, 1);
 }
 
 /*
arch/powerpc/platforms/85xx/ksi8560.c +1 -24
index 0f3e688..2f5c3bb 100644
@@ -57,30 +57,7 @@ static void machine_restart(char *cmd)
 
 static void __init ksi8560_pic_init(void)
 {
-	struct mpic *mpic;
-	struct resource r;
-	struct device_node *np;
-
-	np = of_find_node_by_type(NULL, "open-pic");
-
-	if (np == NULL) {
-		printk(KERN_ERR "Could not find open-pic node\n");
-		return;
-	}
-
-	if (of_address_to_resource(np, 0, &r)) {
-		printk(KERN_ERR "Could not map mpic register space\n");
-		of_node_put(np);
-		return;
-	}
-
-	mpic = mpic_alloc(np, r.start,
-			MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
-			0, 256, " OpenPIC  ");
-	BUG_ON(mpic == NULL);
-	of_node_put(np);
-
-	mpic_init(mpic);
+	mpc85xx_init_mpic(1, 0, 0);
 
 	mpc85xx_cpm2_pic_init();
 }
arch/powerpc/platforms/85xx/mpc8536_ds.c +1 -24
index 9ee6455..223bb7a 100644
@@ -36,30 +36,7 @@
 
 void __init mpc8536_ds_pic_init(void)
 {
-	struct mpic *mpic;
-	struct resource r;
-	struct device_node *np;
-
-	np = of_find_node_by_type(NULL, "open-pic");
-	if (np == NULL) {
-		printk(KERN_ERR "Could not find open-pic node\n");
-		return;
-	}
-
-	if (of_address_to_resource(np, 0, &r)) {
-		printk(KERN_ERR "Failed to map mpic register space\n");
-		of_node_put(np);
-		return;
-	}
-
-	mpic = mpic_alloc(np, r.start,
-			  MPIC_PRIMARY | MPIC_WANTS_RESET |
-			  MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
-			0, 256, " OpenPIC  ");
-	BUG_ON(mpic == NULL);
-	of_node_put(np);
-
-	mpic_init(mpic);
+	mpc85xx_init_mpic(1, 1, 0);
 }
 
 /*
arch/powerpc/platforms/85xx/mpc85xx.h +1 -0
index 2aa7c5d..466923b 100644
@@ -1,6 +1,7 @@
 #ifndef MPC85xx_H
 #define MPC85xx_H
 extern int mpc85xx_common_publish_devices(void);
+extern void mpc85xx_init_mpic(bool reset, bool broken_frr, bool singledest);
 
 #ifdef CONFIG_CPM2
 extern void mpc85xx_cpm2_pic_init(void);
arch/powerpc/platforms/85xx/mpc85xx_ads.c +1 -23
index 986554b..37edba4 100644
@@ -50,29 +50,7 @@ static int mpc85xx_exclude_device(struct pci_controller *hose,
 
 static void __init mpc85xx_ads_pic_init(void)
 {
-	struct mpic *mpic;
-	struct resource r;
-	struct device_node *np = NULL;
-
-	np = of_find_node_by_type(np, "open-pic");
-	if (!np) {
-		printk(KERN_ERR "Could not find open-pic node\n");
-		return;
-	}
-
-	if (of_address_to_resource(np, 0, &r)) {
-		printk(KERN_ERR "Could not map mpic register space\n");
-		of_node_put(np);
-		return;
-	}
-
-	mpic = mpic_alloc(np, r.start,
-			MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
-			0, 256, " OpenPIC  ");
-	BUG_ON(mpic == NULL);
-	of_node_put(np);
-
-	mpic_init(mpic);
+	mpc85xx_init_mpic(1, 0, 0);
 
 	mpc85xx_cpm2_pic_init();
 }
arch/powerpc/platforms/85xx/mpc85xx_cds.c +1 -26
index a268f43..aa42202 100644
@@ -188,32 +188,7 @@ static struct irqaction mpc85xxcds_8259_irqaction = {
 
 static void __init mpc85xx_cds_pic_init(void)
 {
-	struct mpic *mpic;
-	struct resource r;
-	struct device_node *np = NULL;
-
-	np = of_find_node_by_type(np, "open-pic");
-
-	if (np == NULL) {
-		printk(KERN_ERR "Could not find open-pic node\n");
-		return;
-	}
-
-	if (of_address_to_resource(np, 0, &r)) {
-		printk(KERN_ERR "Failed to map mpic register space\n");
-		of_node_put(np);
-		return;
-	}
-
-	mpic = mpic_alloc(np, r.start,
-			MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
-			0, 256, " OpenPIC  ");
-	BUG_ON(mpic == NULL);
-
-	/* Return the mpic node */
-	of_node_put(np);
-
-	mpic_init(mpic);
+	mpc85xx_init_mpic(1, 0, 0);
 }
 
 #if defined(CONFIG_PPC_I8259) && defined(CONFIG_PCI)
arch/powerpc/platforms/85xx/mpc85xx_common.c +43 -0

52 lines not on this page · raw message

arch/powerpc/platforms/85xx/mpc85xx_ds.c +14 -39

72 lines not on this page · raw message

arch/powerpc/platforms/85xx/mpc85xx_mds.c +1 -22
index 3beb00b..c49d31f 100644
@@ -441,28 +441,7 @@ machine_arch_initcall(p1021_mds, swiotlb_setup_bus_notifier);
 
 static void __init mpc85xx_mds_pic_init(void)
 {
-	struct mpic *mpic;
-	struct resource r;
-	struct device_node *np = NULL;
-
-	np = of_find_node_by_type(NULL, "open-pic");
-	if (!np)
-		return;
-
-	if (of_address_to_resource(np, 0, &r)) {
-		printk(KERN_ERR "Failed to map mpic register space\n");
-		of_node_put(np);
-		return;
-	}
-
-	mpic = mpic_alloc(np, r.start,
-			MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
-			MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
-			0, 256, " OpenPIC  ");
-	BUG_ON(mpic == NULL);
-	of_node_put(np);
-
-	mpic_init(mpic);
+	mpc85xx_init_mpic(1, 1, 1);
 	mpc85xx_mds_qeic_init();
 }
 
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +3 -34
index 9feccbb..d9ac565 100644
@@ -43,42 +43,11 @@
 
 void __init mpc85xx_rdb_pic_init(void)
 {
-	struct mpic *mpic;
-	struct resource r;
-	struct device_node *np;
 	unsigned long root = of_get_flat_dt_root();
 
-	np = of_find_node_by_type(NULL, "open-pic");
-	if (np == NULL) {
-		printk(KERN_ERR "Could not find open-pic node\n");
-		return;
-	}
-
-	if (of_address_to_resource(np, 0, &r)) {
-		printk(KERN_ERR "Failed to map mpic register space\n");
-		of_node_put(np);
-		return;
-	}
-
-	if (of_flat_dt_is_compatible(root, "fsl,MPC85XXRDB-CAMP")) {
-		mpic = mpic_alloc(np, r.start,
-			MPIC_PRIMARY |
-			MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
-			MPIC_SINGLE_DEST_CPU,
-			0, 256, " OpenPIC  ");
-	} else {
-		mpic = mpic_alloc(np, r.start,
-		  MPIC_PRIMARY | MPIC_WANTS_RESET |
-		  MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
-		  MPIC_SINGLE_DEST_CPU,
-		  0, 256, " OpenPIC  ");
-	}
-
-	BUG_ON(mpic == NULL);
-	of_node_put(np);
-
-	mpic_init(mpic);
-
+	mpc85xx_init_mpic(
+		!of_flat_dt_is_compatible(root, "fsl,MPC85XXRDB-CAMP"),
+		1, 1);
 }
 
 /*
arch/powerpc/platforms/85xx/p1010rdb.c +3 -25
index d7387fa..9273c6a 100644
@@ -28,33 +28,11 @@
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
 
+#include "mpc85xx.h"
+
 void __init p1010_rdb_pic_init(void)
 {
-	struct mpic *mpic;
-	struct resource r;
-	struct device_node *np;
-
-	np = of_find_node_by_type(NULL, "open-pic");
-	if (np == NULL) {
-		printk(KERN_ERR "Could not find open-pic node\n");
-		return;
-	}
-
-	if (of_address_to_resource(np, 0, &r)) {
-		printk(KERN_ERR "Failed to map mpic register space\n");
-		of_node_put(np);
-		return;
-	}
-
-	mpic = mpic_alloc(np, r.start, MPIC_PRIMARY | MPIC_WANTS_RESET |
-	  MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
-	  0, 256, " OpenPIC  ");
-
-	BUG_ON(mpic == NULL);
-	of_node_put(np);
-
-	mpic_init(mpic);
-
+	mpc85xx_init_mpic(1, 1, 1);
 }
 
 
arch/powerpc/platforms/85xx/p1022_ds.c +1 -26
index cacb4d4..6a7fc02 100644
@@ -242,32 +242,7 @@ int p1022ds_set_sysfs_monitor_port(int val)
 
 void __init p1022_ds_pic_init(void)
 {
-	struct mpic *mpic;
-	struct resource r;
-	struct device_node *np;
-
-	np = of_find_node_by_type(NULL, "open-pic");
-	if (!np) {
-		pr_err("Could not find open-pic node\n");
-		return;
-	}
-
-	if (of_address_to_resource(np, 0, &r)) {
-		pr_err("Failed to map mpic register space\n");
-		of_node_put(np);
-		return;
-	}
-
-	mpic = mpic_alloc(np, r.start,
-		MPIC_PRIMARY | MPIC_WANTS_RESET |
-		MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
-		MPIC_SINGLE_DEST_CPU,
-		0, 256, " OpenPIC  ");
-
-	BUG_ON(mpic == NULL);
-	of_node_put(np);
-
-	mpic_init(mpic);
+	mpc85xx_init_mpic(1, 1, 1);
 }
 
 #ifdef CONFIG_SMP
arch/powerpc/platforms/85xx/p1023_rds.c +3 -25
index 835e0b3..f6fc2b7 100644
@@ -34,6 +34,8 @@
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
 
+#include "mpc85xx.h"
+
 /* ************************************************************************
  *
  * Setup the architecture
@@ -111,31 +113,7 @@ machine_device_initcall(p1023_rds, p1023_publish_devices);
 
 static void __init mpc85xx_rds_pic_init(void)
 {
-	struct mpic *mpic;
-	struct resource r;
-	struct device_node *np = NULL;
-
-	np = of_find_node_by_type(NULL, "open-pic");
-	if (!np) {
-		printk(KERN_ERR "Could not find open-pic node\n");
-		return;
-	}
-
-	if (of_address_to_resource(np, 0, &r)) {
-		printk(KERN_ERR "Failed to map mpic register space\n");
-		of_node_put(np);
-		return;
-	}
-
-	mpic = mpic_alloc(np, r.start,
-		MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
-		MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
-		0, 256, " OpenPIC  ");
-
-	BUG_ON(mpic == NULL);
-	of_node_put(np);
-
-	mpic_init(mpic);
+	mpc85xx_init_mpic(1, 1, 1);
 }
 
 static int __init p1023_rds_probe(void)
arch/powerpc/platforms/85xx/sbc8548.c +1 -26
index 35deaa9..862c16e 100644
@@ -55,32 +55,7 @@ static int sbc_rev;
 
 static void __init sbc8548_pic_init(void)
 {
-	struct mpic *mpic;
-	struct resource r;
-	struct device_node *np = NULL;
-
-	np = of_find_node_by_type(np, "open-pic");
-
-	if (np == NULL) {
-		printk(KERN_ERR "Could not find open-pic node\n");
-		return;
-	}
-
-	if (of_address_to_resource(np, 0, &r)) {
-		printk(KERN_ERR "Failed to map mpic register space\n");
-		of_node_put(np);
-		return;
-	}
-
-	mpic = mpic_alloc(np, r.start,
-			MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
-			0, 256, " OpenPIC  ");
-	BUG_ON(mpic == NULL);
-
-	/* Return the mpic node */
-	of_node_put(np);
-
-	mpic_init(mpic);
+	mpc85xx_init_mpic(1, 0, 0);
 }
 
 /* Extract the HW Rev from the EPLD on the board */
arch/powerpc/platforms/85xx/sbc8560.c +1 -23
index e9a7ed2..b211b63 100644
@@ -41,29 +41,7 @@
 
 static void __init sbc8560_pic_init(void)
 {
-	struct mpic *mpic;
-	struct resource r;
-	struct device_node *np = NULL;
-
-	np = of_find_node_by_type(np, "open-pic");
-	if (!np) {
-		printk(KERN_ERR "Could not find open-pic node\n");
-		return;
-	}
-
-	if (of_address_to_resource(np, 0, &r)) {
-		printk(KERN_ERR "Could not map mpic register space\n");
-		of_node_put(np);
-		return;
-	}
-
-	mpic = mpic_alloc(np, r.start,
-			MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
-			0, 256, " OpenPIC  ");
-	BUG_ON(mpic == NULL);
-	of_node_put(np);
-
-	mpic_init(mpic);
+	mpc85xx_init_mpic(1, 0, 0);
 
 	mpc85xx_cpm2_pic_init();
 }
arch/powerpc/platforms/85xx/socrates.c +1 -21
index fec496a..a390d67 100644
@@ -46,29 +46,9 @@
 
 static void __init socrates_pic_init(void)
 {
-	struct mpic *mpic;
-	struct resource r;
 	struct device_node *np;
 
-	np = of_find_node_by_type(NULL, "open-pic");
-	if (!np) {
-		printk(KERN_ERR "Could not find open-pic node\n");
-		return;
-	}
-
-	if (of_address_to_resource(np, 0, &r)) {
-		printk(KERN_ERR "Could not map mpic register space\n");
-		of_node_put(np);
-		return;
-	}
-
-	mpic = mpic_alloc(np, r.start,
-			MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
-			0, 256, " OpenPIC  ");
-	BUG_ON(mpic == NULL);
-	of_node_put(np);
-
-	mpic_init(mpic);
+	mpc85xx_init_mpic(1, 0, 0);
 
 	np = of_find_compatible_node(NULL, NULL, "abb,socrates-fpga-pic");
 	if (!np) {
arch/powerpc/platforms/85xx/stx_gp3.c +1 -23
index b44c936..cdd2d35 100644
@@ -48,29 +48,7 @@
 
 static void __init stx_gp3_pic_init(void)
 {
-	struct mpic *mpic;
-	struct resource r;
-	struct device_node *np;
-
-	np = of_find_node_by_type(NULL, "open-pic");
-	if (!np) {
-		printk(KERN_ERR "Could not find open-pic node\n");
-		return;
-	}
-
-	if (of_address_to_resource(np, 0, &r)) {
-		printk(KERN_ERR "Could not map mpic register space\n");
-		of_node_put(np);
-		return;
-	}
-
-	mpic = mpic_alloc(np, r.start,
-			MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
-			0, 256, " OpenPIC  ");
-	BUG_ON(mpic == NULL);
-	of_node_put(np);
-
-	mpic_init(mpic);
+	mpc85xx_init_mpic(1, 0, 0);
 
 	mpc85xx_cpm2_pic_init();
 }
arch/powerpc/platforms/85xx/tqm85xx.c +1 -23
index 2418bf8..800842b 100644
@@ -46,29 +46,7 @@
 
 static void __init tqm85xx_pic_init(void)
 {
-	struct mpic *mpic;
-	struct resource r;
-	struct device_node *np;
-
-	np = of_find_node_by_type(NULL, "open-pic");
-	if (!np) {
-		printk(KERN_ERR "Could not find open-pic node\n");
-		return;
-	}
-
-	if (of_address_to_resource(np, 0, &r)) {
-		printk(KERN_ERR "Could not map mpic register space\n");
-		of_node_put(np);
-		return;
-	}
-
-	mpic = mpic_alloc(np, r.start,
-			MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
-			0, 256, " OpenPIC  ");
-	BUG_ON(mpic == NULL);
-	of_node_put(np);
-
-	mpic_init(mpic);
+	mpc85xx_init_mpic(1, 0, 0);
 
 	mpc85xx_cpm2_pic_init();
 }
arch/powerpc/platforms/85xx/xes_mpc85xx.c +1 -24
index 4632c1b..136b732 100644
@@ -42,30 +42,7 @@
 
 void __init xes_mpc85xx_pic_init(void)
 {
-	struct mpic *mpic;
-	struct resource r;
-	struct device_node *np;
-
-	np = of_find_node_by_type(NULL, "open-pic");
-	if (np == NULL) {
-		printk(KERN_ERR "Could not find open-pic node\n");
-		return;
-	}
-
-	if (of_address_to_resource(np, 0, &r)) {
-		printk(KERN_ERR "Failed to map mpic register space\n");
-		of_node_put(np);
-		return;
-	}
-
-	mpic = mpic_alloc(np, r.start,
-			  MPIC_PRIMARY | MPIC_WANTS_RESET |
-			  MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
-			0, 256, " OpenPIC  ");
-	BUG_ON(mpic == NULL);
-	of_node_put(np);
-
-	mpic_init(mpic);
+	mpc85xx_init_mpic(1, 1, 0);
 }
 
 static void xes_mpc85xx_configure_l2(void __iomem *l2_base)
Signature · 1 line
1.7.7.1
#17 lore raw

PATCH 4/6 powerpc/85xx: unify common parts of *_setup_arch

In reply to Dmitry Eremin-Solenikov

Refactor PCI, SWIOTLB and SMP handling out of board-specific setup_arch functions. These tasks are more or less common to all boards and thus can be moved to common place.

---
 arch/powerpc/platforms/85xx/corenet_ds.c     |   37 +------------------
 arch/powerpc/platforms/85xx/mpc8536_ds.c     |   33 +----------------
 arch/powerpc/platforms/85xx/mpc85xx.h        |    3 +
 arch/powerpc/platforms/85xx/mpc85xx_ads.c    |    9 +---
 arch/powerpc/platforms/85xx/mpc85xx_cds.c    |   18 +--------
 arch/powerpc/platforms/85xx/mpc85xx_common.c |   52 ++++++++++++++++++++++++++
 arch/powerpc/platforms/85xx/mpc85xx_ds.c     |   40 +-------------------
 arch/powerpc/platforms/85xx/mpc85xx_mds.c    |   40 +-------------------
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c    |   19 +---------
 arch/powerpc/platforms/85xx/p1010rdb.c       |   12 +-----
 arch/powerpc/platforms/85xx/p1022_ds.c       |   39 +-------------------
 arch/powerpc/platforms/85xx/p1023_rds.c      |   13 +------
 arch/powerpc/platforms/85xx/sbc8548.c        |   18 +--------
 arch/powerpc/platforms/85xx/sbc8560.c        |    9 +----
 arch/powerpc/platforms/85xx/socrates.c       |    9 +----
 arch/powerpc/platforms/85xx/stx_gp3.c        |    9 +----
 arch/powerpc/platforms/85xx/tqm85xx.c        |   19 +---------
 arch/powerpc/platforms/85xx/xes_mpc85xx.c    |   32 +---------------
 18 files changed, 74 insertions(+), 337 deletions(-)
arch/powerpc/platforms/85xx/corenet_ds.c +1 -36
index b4abc01..d782d55 100644
@@ -42,45 +42,10 @@ void __init corenet_ds_pic_init(void)
 /*
  * Setup the architecture
  */
-#ifdef CONFIG_SMP
-void __init mpc85xx_smp_init(void);
-#endif
-
 void __init corenet_ds_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct device_node *np;
-	struct pci_controller *hose;
-#endif
-	dma_addr_t max = 0xffffffff;
-
-#ifdef CONFIG_SMP
-	mpc85xx_smp_init();
-#endif
-
-#ifdef CONFIG_PCI
-	for_each_node_by_type(np, "pci") {
-		if (of_device_is_compatible(np, "fsl,p4080-pcie") ||
-		    of_device_is_compatible(np, "fsl,qoriq-pcie-v2.2")) {
-			fsl_add_bridge(np, 0);
-			hose = pci_find_hose_for_OF_device(np);
-			max = min(max, hose->dma_window_base_cur +
-					hose->dma_window_size);
-		}
-	}
-
-#ifdef CONFIG_PPC64
-	pci_devs_phb_init();
-#endif
-#endif
+	mpc85xx_setup_arch(MPC85xx_NO_PRIMARY_PHB);
 
-#ifdef CONFIG_SWIOTLB
-	if (memblock_end_of_DRAM() > max) {
-		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_dma_ops);
-		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
-	}
-#endif
 	pr_info("%s board from Freescale Semiconductor\n", ppc_md.name);
 }
 
arch/powerpc/platforms/85xx/mpc8536_ds.c +1 -32
index 223bb7a..8a7fc81 100644
@@ -44,41 +44,10 @@ void __init mpc8536_ds_pic_init(void)
  */
 static void __init mpc8536_ds_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct device_node *np;
-	struct pci_controller *hose;
-#endif
-	dma_addr_t max = 0xffffffff;
-
 	if (ppc_md.progress)
 		ppc_md.progress("mpc8536_ds_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-	for_each_node_by_type(np, "pci") {
-		if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
-		    of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
-			struct resource rsrc;
-			of_address_to_resource(np, 0, &rsrc);
-			if ((rsrc.start & 0xfffff) == 0x8000)
-				fsl_add_bridge(np, 1);
-			else
-				fsl_add_bridge(np, 0);
-
-			hose = pci_find_hose_for_OF_device(np);
-			max = min(max, hose->dma_window_base_cur +
-					hose->dma_window_size);
-		}
-	}
-
-#endif
-
-#ifdef CONFIG_SWIOTLB
-	if (memblock_end_of_DRAM() > max) {
-		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_dma_ops);
-		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
-	}
-#endif
+	mpc85xx_setup_arch(0x8000);
 
 	printk("MPC8536 DS board from Freescale Semiconductor\n");
 }
arch/powerpc/platforms/85xx/mpc85xx.h +3 -0
index 466923b..e2a6631 100644
@@ -9,4 +9,7 @@ extern void mpc85xx_cpm2_pic_init(void);
 static inline void __init mpc85xx_cpm2_pic_init(void) {}
 #endif /* CONFIG_CPM2 */
 
+#define MPC85xx_NO_PRIMARY_PHB 0xffff
+extern void mpc85xx_setup_arch(unsigned primary_phb_addr);
+
 #endif
arch/powerpc/platforms/85xx/mpc85xx_ads.c +2 -7
index 37edba4..384b4cc 100644
@@ -135,10 +135,6 @@ static void __init init_ioports(void)
 
 static void __init mpc85xx_ads_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct device_node *np;
-#endif
-
 	if (ppc_md.progress)
 		ppc_md.progress("mpc85xx_ads_setup_arch()", 0);
 
@@ -147,10 +143,9 @@ static void __init mpc85xx_ads_setup_arch(void)
 	init_ioports();
 #endif
 
-#ifdef CONFIG_PCI
-	for_each_compatible_node(np, "pci", "fsl,mpc8540-pci")
-		fsl_add_bridge(np, 1);
+	mpc85xx_setup_arch(0x8000);
 
+#ifdef CONFIG_PCI
 	ppc_md.pci_exclude_device = mpc85xx_exclude_device;
 #endif
 }
arch/powerpc/platforms/85xx/mpc85xx_cds.c +2 -16
index aa42202..49366e7 100644
@@ -245,10 +245,6 @@ machine_device_initcall(mpc85xx_cds, mpc85xx_cds_8259_attach);
  */
 static void __init mpc85xx_cds_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct device_node *np;
-#endif
-
 	if (ppc_md.progress)
 		ppc_md.progress("mpc85xx_cds_setup_arch()", 0);
 
@@ -262,19 +258,9 @@ static void __init mpc85xx_cds_setup_arch(void)
 		ppc_md.progress(buf, 0);
 	}
 
-#ifdef CONFIG_PCI
-	for_each_node_by_type(np, "pci") {
-		if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
-		    of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
-			struct resource rsrc;
-			of_address_to_resource(np, 0, &rsrc);
-			if ((rsrc.start & 0xfffff) == 0x8000)
-				fsl_add_bridge(np, 1);
-			else
-				fsl_add_bridge(np, 0);
-		}
-	}
+	mpc85xx_setup_arch(0x8000);
 
+#ifdef CONFIG_PCI
 	ppc_md.pci_irq_fixup = mpc85xx_cds_pci_irq_fixup;
 	ppc_md.pci_exclude_device = mpc85xx_exclude_device;
 #endif
arch/powerpc/platforms/85xx/mpc85xx_common.c +52 -0

67 lines not on this page · raw message

arch/powerpc/platforms/85xx/mpc85xx_ds.c +2 -38
index 7e535da..bd9931a 100644
@@ -129,53 +129,17 @@ static int mpc85xx_exclude_device(struct pci_controller *hose,
 /*
  * Setup the architecture
  */
-#ifdef CONFIG_SMP
-extern void __init mpc85xx_smp_init(void);
-#endif
 static void __init mpc85xx_ds_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct device_node *np;
-	struct pci_controller *hose;
-#endif
-	dma_addr_t max = 0xffffffff;
-
 	if (ppc_md.progress)
 		ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-	for_each_node_by_type(np, "pci") {
-		if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
-		    of_device_is_compatible(np, "fsl,mpc8548-pcie") ||
-		    of_device_is_compatible(np, "fsl,p2020-pcie")) {
-			struct resource rsrc;
-			of_address_to_resource(np, 0, &rsrc);
-			if ((rsrc.start & 0xfffff) == primary_phb_addr)
-				fsl_add_bridge(np, 1);
-			else
-				fsl_add_bridge(np, 0);
-
-			hose = pci_find_hose_for_OF_device(np);
-			max = min(max, hose->dma_window_base_cur +
-					hose->dma_window_size);
-		}
-	}
+	mpc85xx_setup_arch(primary_phb_addr);
 
+#ifdef CONFIG_PCI
 	ppc_md.pci_exclude_device = mpc85xx_exclude_device;
 #endif
 
-#ifdef CONFIG_SMP
-	mpc85xx_smp_init();
-#endif
-
-#ifdef CONFIG_SWIOTLB
-	if (memblock_end_of_DRAM() > max) {
-		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_dma_ops);
-		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
-	}
-#endif
-
 	printk("MPC85xx DS board from Freescale Semiconductor\n");
 }
 
arch/powerpc/platforms/85xx/mpc85xx_mds.c +1 -39
index c49d31f..1f5f1af 100644
@@ -156,10 +156,6 @@ static int mpc8568_mds_phy_fixups(struct phy_device *phydev)
  * Setup the architecture
  *
  */
-#ifdef CONFIG_SMP
-extern void __init mpc85xx_smp_init(void);
-#endif
-
 #ifdef CONFIG_QUICC_ENGINE
 static void __init mpc85xx_mds_reset_ucc_phys(void)
 {
@@ -337,46 +333,12 @@ static void __init mpc85xx_mds_qeic_init(void) { }
 
 static void __init mpc85xx_mds_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct pci_controller *hose;
-	struct device_node *np;
-#endif
-	dma_addr_t max = 0xffffffff;
-
 	if (ppc_md.progress)
 		ppc_md.progress("mpc85xx_mds_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-	for_each_node_by_type(np, "pci") {
-		if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
-		    of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
-			struct resource rsrc;
-			of_address_to_resource(np, 0, &rsrc);
-			if ((rsrc.start & 0xfffff) == 0x8000)
-				fsl_add_bridge(np, 1);
-			else
-				fsl_add_bridge(np, 0);
-
-			hose = pci_find_hose_for_OF_device(np);
-			max = min(max, hose->dma_window_base_cur +
-					hose->dma_window_size);
-		}
-	}
-#endif
-
-#ifdef CONFIG_SMP
-	mpc85xx_smp_init();
-#endif
+	mpc85xx_setup_arch(0x8000);
 
 	mpc85xx_mds_qe_init();
-
-#ifdef CONFIG_SWIOTLB
-	if (memblock_end_of_DRAM() > max) {
-		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_dma_ops);
-		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
-	}
-#endif
 }
 
 
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +1 -18
index d9ac565..82906b0 100644
@@ -53,29 +53,12 @@ void __init mpc85xx_rdb_pic_init(void)
 /*
  * Setup the architecture
  */
-#ifdef CONFIG_SMP
-extern void __init mpc85xx_smp_init(void);
-#endif
 static void __init mpc85xx_rdb_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct device_node *np;
-#endif
-
 	if (ppc_md.progress)
 		ppc_md.progress("mpc85xx_rdb_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-	for_each_node_by_type(np, "pci") {
-		if (of_device_is_compatible(np, "fsl,mpc8548-pcie"))
-			fsl_add_bridge(np, 0);
-	}
-
-#endif
-
-#ifdef CONFIG_SMP
-	mpc85xx_smp_init();
-#endif
+	mpc85xx_setup_arch(MPC85xx_NO_PRIMARY_PHB);
 
 	printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");
 }
arch/powerpc/platforms/85xx/p1010rdb.c +1 -11
index 9273c6a..832ed1d 100644
@@ -41,20 +41,10 @@ void __init p1010_rdb_pic_init(void)
  */
 static void __init p1010_rdb_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct device_node *np;
-#endif
-
 	if (ppc_md.progress)
 		ppc_md.progress("p1010_rdb_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-	for_each_node_by_type(np, "pci") {
-		if (of_device_is_compatible(np, "fsl,p1010-pcie"))
-			fsl_add_bridge(np, 0);
-	}
-
-#endif
+	mpc85xx_setup_arch(MPC85xx_NO_PRIMARY_PHB);
 
 	printk(KERN_INFO "P1010 RDB board from Freescale Semiconductor\n");
 }
arch/powerpc/platforms/85xx/p1022_ds.c +1 -38
index 6a7fc02..82da3dd 100644
@@ -245,41 +245,14 @@ void __init p1022_ds_pic_init(void)
 	mpc85xx_init_mpic(1, 1, 1);
 }
 
-#ifdef CONFIG_SMP
-void __init mpc85xx_smp_init(void);
-#endif
-
 /*
  * Setup the architecture
  */
 static void __init p1022_ds_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct device_node *np;
-#endif
-	dma_addr_t max = 0xffffffff;
-
 	if (ppc_md.progress)
 		ppc_md.progress("p1022_ds_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-	for_each_compatible_node(np, "pci", "fsl,p1022-pcie") {
-		struct resource rsrc;
-		struct pci_controller *hose;
-
-		of_address_to_resource(np, 0, &rsrc);
-
-		if ((rsrc.start & 0xfffff) == 0x8000)
-			fsl_add_bridge(np, 1);
-		else
-			fsl_add_bridge(np, 0);
-
-		hose = pci_find_hose_for_OF_device(np);
-		max = min(max, hose->dma_window_base_cur +
-			  hose->dma_window_size);
-	}
-#endif
-
 #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
 	diu_ops.get_pixel_format	= p1022ds_get_pixel_format;
 	diu_ops.set_gamma_table		= p1022ds_set_gamma_table;
@@ -289,17 +262,7 @@ static void __init p1022_ds_setup_arch(void)
 	diu_ops.set_sysfs_monitor_port	= p1022ds_set_sysfs_monitor_port;
 #endif
 
-#ifdef CONFIG_SMP
-	mpc85xx_smp_init();
-#endif
-
-#ifdef CONFIG_SWIOTLB
-	if (memblock_end_of_DRAM() > max) {
-		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_dma_ops);
-		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
-	}
-#endif
+	mpc85xx_setup_arch(0x8000);
 
 	pr_info("Freescale P1022 DS reference board\n");
 }
arch/powerpc/platforms/85xx/p1023_rds.c +1 -12
index f6fc2b7..0098775 100644
@@ -41,10 +41,6 @@
  * Setup the architecture
  *
  */
-#ifdef CONFIG_SMP
-void __init mpc85xx_smp_init(void);
-#endif
-
 static void __init mpc85xx_rds_setup_arch(void)
 {
 	struct device_node *np;
@@ -84,14 +80,7 @@ static void __init mpc85xx_rds_setup_arch(void)
 		}
 	}
 
-#ifdef CONFIG_PCI
-	for_each_compatible_node(np, "pci", "fsl,p1023-pcie")
-		fsl_add_bridge(np, 0);
-#endif
-
-#ifdef CONFIG_SMP
-	mpc85xx_smp_init();
-#endif
+	mpc85xx_setup_arch(MPC85xx_NO_PRIMARY_PHB);
 }
 
 static struct of_device_id p1023_ids[] = {
arch/powerpc/platforms/85xx/sbc8548.c +1 -17
index 862c16e..e948b4c 100644
@@ -87,26 +87,10 @@ static int __init sbc8548_hw_rev(void)
  */
 static void __init sbc8548_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct device_node *np;
-#endif
-
 	if (ppc_md.progress)
 		ppc_md.progress("sbc8548_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-	for_each_node_by_type(np, "pci") {
-		if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
-		    of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
-			struct resource rsrc;
-			of_address_to_resource(np, 0, &rsrc);
-			if ((rsrc.start & 0xfffff) == 0x8000)
-				fsl_add_bridge(np, 1);
-			else
-				fsl_add_bridge(np, 0);
-		}
-	}
-#endif
+	mpc85xx_setup_arch(0x8000);
 	sbc_rev = sbc8548_hw_rev();
 }
 
arch/powerpc/platforms/85xx/sbc8560.c +1 -8
index b211b63..b0c62f0 100644
@@ -124,10 +124,6 @@ static void __init init_ioports(void)
 
 static void __init sbc8560_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct device_node *np;
-#endif
-
 	if (ppc_md.progress)
 		ppc_md.progress("sbc8560_setup_arch()", 0);
 
@@ -136,10 +132,7 @@ static void __init sbc8560_setup_arch(void)
 	init_ioports();
 #endif
 
-#ifdef CONFIG_PCI
-	for_each_compatible_node(np, "pci", "fsl,mpc8540-pci")
-		fsl_add_bridge(np, 1);
-#endif
+	mpc85xx_setup_arch(0x8000);
 }
 
 static void sbc8560_show_cpuinfo(struct seq_file *m)
arch/powerpc/platforms/85xx/socrates.c +1 -8
index a390d67..67535a5 100644
@@ -64,17 +64,10 @@ static void __init socrates_pic_init(void)
  */
 static void __init socrates_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct device_node *np;
-#endif
-
 	if (ppc_md.progress)
 		ppc_md.progress("socrates_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-	for_each_compatible_node(np, "pci", "fsl,mpc8540-pci")
-		fsl_add_bridge(np, 1);
-#endif
+	mpc85xx_setup_arch(0x8000);
 }
 
 machine_device_initcall(socrates, mpc85xx_common_publish_devices);
arch/powerpc/platforms/85xx/stx_gp3.c +1 -8
index cdd2d35..18a9fc5 100644
@@ -58,10 +58,6 @@ static void __init stx_gp3_pic_init(void)
  */
 static void __init stx_gp3_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct device_node *np;
-#endif
-
 	if (ppc_md.progress)
 		ppc_md.progress("stx_gp3_setup_arch()", 0);
 
@@ -69,10 +65,7 @@ static void __init stx_gp3_setup_arch(void)
 	cpm2_reset();
 #endif
 
-#ifdef CONFIG_PCI
-	for_each_compatible_node(np, "pci", "fsl,mpc8540-pci")
-		fsl_add_bridge(np, 1);
-#endif
+	mpc85xx_setup_arch(0x8000);
 }
 
 static void stx_gp3_show_cpuinfo(struct seq_file *m)
arch/powerpc/platforms/85xx/tqm85xx.c +1 -18
index 800842b..56c5518 100644
@@ -56,10 +56,6 @@ static void __init tqm85xx_pic_init(void)
  */
 static void __init tqm85xx_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct device_node *np;
-#endif
-
 	if (ppc_md.progress)
 		ppc_md.progress("tqm85xx_setup_arch()", 0);
 
@@ -67,20 +63,7 @@ static void __init tqm85xx_setup_arch(void)
 	cpm2_reset();
 #endif
 
-#ifdef CONFIG_PCI
-	for_each_node_by_type(np, "pci") {
-		if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
-		    of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
-			struct resource rsrc;
-			if (!of_address_to_resource(np, 0, &rsrc)) {
-				if ((rsrc.start & 0xfffff) == 0x8000)
-					fsl_add_bridge(np, 1);
-				else
-					fsl_add_bridge(np, 0);
-			}
-		}
-	}
-#endif
+	mpc85xx_setup_arch(0x8000);
 }
 
 static void tqm85xx_show_cpuinfo(struct seq_file *m)
arch/powerpc/platforms/85xx/xes_mpc85xx.c +1 -31
index 136b732..e1ddff5 100644
@@ -108,21 +108,13 @@ static void xes_mpc85xx_fixups(void)
 	}
 }
 
-#ifdef CONFIG_PCI
 static int primary_phb_addr;
-#endif
 
 /*
  * Setup the architecture
  */
-#ifdef CONFIG_SMP
-extern void __init mpc85xx_smp_init(void);
-#endif
 static void __init xes_mpc85xx_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct device_node *np;
-#endif
 	struct device_node *root;
 	const char *model = "Unknown";
 
@@ -137,23 +129,7 @@ static void __init xes_mpc85xx_setup_arch(void)
 
 	xes_mpc85xx_fixups();
 
-#ifdef CONFIG_PCI
-	for_each_node_by_type(np, "pci") {
-		if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
-		    of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
-			struct resource rsrc;
-			of_address_to_resource(np, 0, &rsrc);
-			if ((rsrc.start & 0xfffff) == primary_phb_addr)
-				fsl_add_bridge(np, 1);
-			else
-				fsl_add_bridge(np, 0);
-		}
-	}
-#endif
-
-#ifdef CONFIG_SMP
-	mpc85xx_smp_init();
-#endif
+	mpc85xx_setup_arch(primary_phb_addr);
 }
 
 machine_device_initcall(xes_mpc8572, mpc85xx_common_publish_devices);
@@ -168,9 +144,7 @@ static int __init xes_mpc8572_probe(void)
 	unsigned long root = of_get_flat_dt_root();
 
 	if (of_flat_dt_is_compatible(root, "xes,MPC8572")) {
-#ifdef CONFIG_PCI
 		primary_phb_addr = 0x8000;
-#endif
 		return 1;
 	} else {
 		return 0;
@@ -182,9 +156,7 @@ static int __init xes_mpc8548_probe(void)
 	unsigned long root = of_get_flat_dt_root();
 
 	if (of_flat_dt_is_compatible(root, "xes,MPC8548")) {
-#ifdef CONFIG_PCI
 		primary_phb_addr = 0xb000;
-#endif
 		return 1;
 	} else {
 		return 0;
@@ -196,9 +168,7 @@ static int __init xes_mpc8540_probe(void)
 	unsigned long root = of_get_flat_dt_root();
 
 	if (of_flat_dt_is_compatible(root, "xes,MPC8540")) {
-#ifdef CONFIG_PCI
 		primary_phb_addr = 0xb000;
-#endif
 		return 1;
 	} else {
 		return 0;
Signature · 1 line
1.7.7.1
#19 lore raw

PATCH 6/6 poewrpc/85xx: headers cleanup

In reply to Dmitry Eremin-Solenikov

Drop lots of unused headers after board files merge/splitup

---
 arch/powerpc/platforms/85xx/corenet_ds.c  |   17 ---------------
 arch/powerpc/platforms/85xx/ksi8560.c     |   16 ---------------
 arch/powerpc/platforms/85xx/mpc8536_ds.c  |   13 ------------
 arch/powerpc/platforms/85xx/mpc85xx_ads.c |   10 ---------
 arch/powerpc/platforms/85xx/mpc85xx_cds.c |   23 ---------------------
 arch/powerpc/platforms/85xx/mpc85xx_ds.c  |   12 -----------
 arch/powerpc/platforms/85xx/mpc85xx_mds.c |   31 +++-------------------------
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c |   12 -----------
 arch/powerpc/platforms/85xx/p1010rdb.c    |   10 ---------
 arch/powerpc/platforms/85xx/p1022_ds.c    |    5 +--
 arch/powerpc/platforms/85xx/p1023_rds.c   |   13 ------------
 arch/powerpc/platforms/85xx/p2041_rdb.c   |   15 +-------------
 arch/powerpc/platforms/85xx/p3041_ds.c    |   15 +-------------
 arch/powerpc/platforms/85xx/p3060_qds.c   |    8 ++----
 arch/powerpc/platforms/85xx/p4080_ds.c    |   14 +------------
 arch/powerpc/platforms/85xx/p5020_ds.c    |   15 +-------------
 arch/powerpc/platforms/85xx/sbc8548.c     |   28 --------------------------
 arch/powerpc/platforms/85xx/sbc8560.c     |   15 +-------------
 arch/powerpc/platforms/85xx/socrates.c    |   15 +-------------
 arch/powerpc/platforms/85xx/stx_gp3.c     |   15 +-------------
 arch/powerpc/platforms/85xx/tqm85xx.c     |   13 +-----------
 arch/powerpc/platforms/85xx/xes_mpc85xx.c |   14 -------------
 22 files changed, 17 insertions(+), 312 deletions(-)
arch/powerpc/platforms/85xx/corenet_ds.c +0 -17
index d782d55..8028d37 100644
@@ -11,26 +11,9 @@
  * option) any later version.
  */
 
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/delay.h>
-#include <linux/interrupt.h>
-#include <linux/memblock.h>
-
-#include <asm/system.h>
-#include <asm/time.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <asm/ppc-pci.h>
-#include <mm/mmu_decl.h>
-#include <asm/prom.h>
-#include <asm/udbg.h>
-#include <asm/mpic.h>
 
 #include <linux/of_platform.h>
-#include <sysdev/fsl_soc.h>
-#include <sysdev/fsl_pci.h>
 
 #include "mpc85xx.h"
 
arch/powerpc/platforms/85xx/ksi8560.c +0 -16
index 2f5c3bb..2c7f9d9 100644
@@ -12,28 +12,12 @@
  *
  */
 
-#include <linux/stddef.h>
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
 #include <linux/of_platform.h>
 
-#include <asm/system.h>
-#include <asm/time.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
 #include <asm/mpic.h>
-#include <mm/mmu_decl.h>
-#include <asm/udbg.h>
-#include <asm/prom.h>
-
-#include <sysdev/fsl_soc.h>
-#include <sysdev/fsl_pci.h>
 
 #include <asm/cpm2.h>
-#include <sysdev/cpm2_pic.h>
 
 #include "mpc85xx.h"
 
arch/powerpc/platforms/85xx/mpc8536_ds.c +0 -13
index 8a7fc81..cc46db4 100644
@@ -9,22 +9,9 @@
  * option) any later version.
  */
 
-#include <linux/stddef.h>
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/interrupt.h>
 #include <linux/of_platform.h>
-#include <linux/memblock.h>
 
-#include <asm/system.h>
-#include <asm/time.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <mm/mmu_decl.h>
-#include <asm/prom.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
 #include <asm/swiotlb.h>
arch/powerpc/platforms/85xx/mpc85xx_ads.c +0 -10
index 384b4cc..27298ec 100644
@@ -11,20 +11,11 @@
  * option) any later version.
  */
 
-#include <linux/stddef.h>
-#include <linux/kernel.h>
 #include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
 #include <linux/of_platform.h>
 
-#include <asm/system.h>
-#include <asm/time.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
 #include <asm/mpic.h>
-#include <mm/mmu_decl.h>
 #include <asm/udbg.h>
 
 #include <sysdev/fsl_soc.h>
@@ -32,7 +23,6 @@
 
 #ifdef CONFIG_CPM2
 #include <asm/cpm2.h>
-#include <sysdev/cpm2_pic.h>
 #endif
 
 #include "mpc85xx.h"
arch/powerpc/platforms/85xx/mpc85xx_cds.c +0 -23
index 0e551d7..b9bb364 100644
@@ -11,35 +11,12 @@
  * option) any later version.
  */
 
-#include <linux/stddef.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/reboot.h>
 #include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/initrd.h>
-#include <linux/module.h>
 #include <linux/interrupt.h>
-#include <linux/fsl_devices.h>
 #include <linux/of_platform.h>
 
-#include <asm/system.h>
-#include <asm/pgtable.h>
-#include <asm/page.h>
-#include <linux/atomic.h>
-#include <asm/time.h>
-#include <asm/io.h>
 #include <asm/machdep.h>
-#include <asm/ipic.h>
-#include <asm/pci-bridge.h>
 #include <asm/irq.h>
-#include <mm/mmu_decl.h>
-#include <asm/prom.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
 #include <asm/i8259.h>
arch/powerpc/platforms/85xx/mpc85xx_ds.c +0 -12
index 246d33a..f43537c 100644
@@ -12,26 +12,14 @@
  * option) any later version.
  */
 
-#include <linux/stddef.h>
-#include <linux/kernel.h>
 #include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
 #include <linux/interrupt.h>
 #include <linux/of_platform.h>
-#include <linux/memblock.h>
 
-#include <asm/system.h>
-#include <asm/time.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <mm/mmu_decl.h>
-#include <asm/prom.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
 #include <asm/i8259.h>
-#include <asm/swiotlb.h>
 
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
arch/powerpc/platforms/85xx/mpc85xx_mds.c +4 -27
index 1f5f1af..69a80b8 100644
@@ -16,42 +16,19 @@
  * option) any later version.
  */
 
-#include <linux/stddef.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/initrd.h>
-#include <linux/module.h>
-#include <linux/fsl_devices.h>
 #include <linux/of_platform.h>
 #include <linux/of_device.h>
 #include <linux/phy.h>
-#include <linux/memblock.h>
 
-#include <asm/system.h>
-#include <linux/atomic.h>
-#include <asm/time.h>
-#include <asm/io.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <asm/irq.h>
-#include <mm/mmu_decl.h>
-#include <asm/prom.h>
 #include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
-#include <sysdev/fsl_pci.h>
-#include <sysdev/simple_gpio.h>
 #include <asm/qe.h>
 #include <asm/qe_ic.h>
 #include <asm/mpic.h>
-#include <asm/swiotlb.h>
+
+#include <sysdev/fsl_soc.h>
+#include <sysdev/fsl_pci.h>
+#include <sysdev/simple_gpio.h>
 
 #include "mpc85xx.h"
 
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +0 -12
index 82906b0..b6578a5 100644
@@ -9,21 +9,9 @@
  * option) any later version.
  */
 
-#include <linux/stddef.h>
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/interrupt.h>
 #include <linux/of_platform.h>
 
-#include <asm/system.h>
-#include <asm/time.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <mm/mmu_decl.h>
-#include <asm/prom.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
 
arch/powerpc/platforms/85xx/p1010rdb.c +0 -10
index 832ed1d..d68c5f8 100644
@@ -9,19 +9,9 @@
  * option) any later version.
  */
 
-#include <linux/stddef.h>
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/delay.h>
-#include <linux/interrupt.h>
 #include <linux/of_platform.h>
 
-#include <asm/system.h>
-#include <asm/time.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <mm/mmu_decl.h>
-#include <asm/prom.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
 
arch/powerpc/platforms/85xx/p1022_ds.c +2 -3
index 82da3dd..fd2ec71 100644
@@ -18,14 +18,13 @@
 
 #include <linux/pci.h>
 #include <linux/of_platform.h>
-#include <linux/memblock.h>
 #include <asm/div64.h>
+#include <asm/udbg.h>
 #include <asm/mpic.h>
-#include <asm/swiotlb.h>
+#include <asm/fsl_guts.h>
 
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
-#include <asm/fsl_guts.h>
 
 #include "mpc85xx.h"
 
arch/powerpc/platforms/85xx/p1023_rds.c +0 -13
index 0098775..f14b315 100644
@@ -12,22 +12,9 @@
  * option) any later version.
  */
 
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/pci.h>
-#include <linux/delay.h>
-#include <linux/module.h>
-#include <linux/fsl_devices.h>
 #include <linux/of_platform.h>
-#include <linux/of_device.h>
 
-#include <asm/system.h>
-#include <asm/time.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <mm/mmu_decl.h>
-#include <asm/prom.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
 
arch/powerpc/platforms/85xx/p2041_rdb.c +1 -14
index eda6ed5..985ee0e 100644
@@ -9,26 +9,13 @@
  * option) any later version.
  */
 
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/delay.h>
-#include <linux/interrupt.h>
-#include <linux/phy.h>
-
-#include <asm/system.h>
-#include <asm/time.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <mm/mmu_decl.h>
-#include <asm/prom.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
+#include <asm/ehv_pic.h>
 
-#include <linux/of_platform.h>
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
-#include <asm/ehv_pic.h>
 
 #include "corenet_ds.h"
 
arch/powerpc/platforms/85xx/p3041_ds.c +1 -14
index 96d99a3..b969c1f 100644
@@ -11,26 +11,13 @@
  * option) any later version.
  */
 
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/delay.h>
-#include <linux/interrupt.h>
-#include <linux/phy.h>
-
-#include <asm/system.h>
-#include <asm/time.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <mm/mmu_decl.h>
-#include <asm/prom.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
+#include <asm/ehv_pic.h>
 
-#include <linux/of_platform.h>
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
-#include <asm/ehv_pic.h>
 
 #include "corenet_ds.h"
 
arch/powerpc/platforms/85xx/p3060_qds.c +3 -5
index 01dcf44..318a2de 100644
@@ -9,16 +9,14 @@
  * option) any later version.
  */
 
-#include <linux/kernel.h>
-#include <linux/interrupt.h>
-#include <linux/phy.h>
 #include <asm/machdep.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
-#include <linux/of_platform.h>
+#include <asm/ehv_pic.h>
+
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
-#include <asm/ehv_pic.h>
+
 #include "corenet_ds.h"
 
 /*
arch/powerpc/platforms/85xx/p4080_ds.c +1 -13
index d1b21d7..bd5ded3 100644
@@ -11,25 +11,13 @@
  * option) any later version.
  */
 
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/delay.h>
-#include <linux/interrupt.h>
-
-#include <asm/system.h>
-#include <asm/time.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <mm/mmu_decl.h>
-#include <asm/prom.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
+#include <asm/ehv_pic.h>
 
-#include <linux/of_platform.h>
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
-#include <asm/ehv_pic.h>
 
 #include "corenet_ds.h"
 
arch/powerpc/platforms/85xx/p5020_ds.c +1 -14
index e8cba50..1ff0277 100644
@@ -11,26 +11,13 @@
  * option) any later version.
  */
 
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/delay.h>
-#include <linux/interrupt.h>
-#include <linux/phy.h>
-
-#include <asm/system.h>
-#include <asm/time.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <mm/mmu_decl.h>
-#include <asm/prom.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
+#include <asm/ehv_pic.h>
 
-#include <linux/of_platform.h>
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
-#include <asm/ehv_pic.h>
 
 #include "corenet_ds.h"
 
arch/powerpc/platforms/85xx/sbc8548.c +0 -28
index e948b4c..32f5d4d 100644
@@ -14,35 +14,7 @@
  * option) any later version.
  */
 
-#include <linux/stddef.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/initrd.h>
-#include <linux/module.h>
-#include <linux/interrupt.h>
-#include <linux/fsl_devices.h>
-#include <linux/of_platform.h>
-
-#include <asm/system.h>
-#include <asm/pgtable.h>
-#include <asm/page.h>
-#include <linux/atomic.h>
-#include <asm/time.h>
-#include <asm/io.h>
 #include <asm/machdep.h>
-#include <asm/ipic.h>
-#include <asm/pci-bridge.h>
-#include <asm/irq.h>
-#include <mm/mmu_decl.h>
-#include <asm/prom.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
 
arch/powerpc/platforms/85xx/sbc8560.c +1 -14
index b0c62f0..adae8a5 100644
@@ -13,21 +13,9 @@
  * option) any later version.
  */
 
-#include <linux/stddef.h>
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/of_platform.h>
-
-#include <asm/system.h>
-#include <asm/time.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <asm/mpic.h>
-#include <mm/mmu_decl.h>
 #include <asm/udbg.h>
+#include <asm/mpic.h>
 
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
@@ -36,7 +24,6 @@
 
 #ifdef CONFIG_CPM2
 #include <asm/cpm2.h>
-#include <sysdev/cpm2_pic.h>
 #endif
 
 static void __init sbc8560_pic_init(void)
arch/powerpc/platforms/85xx/socrates.c +1 -14
index 67535a5..d414ce7 100644
@@ -21,22 +21,9 @@
  * option) any later version.
  */
 
-#include <linux/stddef.h>
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/of_platform.h>
-
-#include <asm/system.h>
-#include <asm/time.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <asm/mpic.h>
-#include <asm/prom.h>
-#include <mm/mmu_decl.h>
 #include <asm/udbg.h>
+#include <asm/mpic.h>
 
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
arch/powerpc/platforms/85xx/stx_gp3.c +1 -14
index 18a9fc5..407abba 100644
@@ -20,22 +20,9 @@
  * option) any later version.
  */
 
-#include <linux/stddef.h>
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/of_platform.h>
-
-#include <asm/system.h>
-#include <asm/time.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <asm/mpic.h>
-#include <asm/prom.h>
-#include <mm/mmu_decl.h>
 #include <asm/udbg.h>
+#include <asm/mpic.h>
 
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
arch/powerpc/platforms/85xx/tqm85xx.c +1 -12
index 56c5518..3d89453 100644
@@ -18,22 +18,11 @@
  * option) any later version.
  */
 
-#include <linux/stddef.h>
-#include <linux/kernel.h>
 #include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/of_platform.h>
 
-#include <asm/system.h>
-#include <asm/time.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <asm/mpic.h>
-#include <asm/prom.h>
-#include <mm/mmu_decl.h>
 #include <asm/udbg.h>
+#include <asm/mpic.h>
 
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
arch/powerpc/platforms/85xx/xes_mpc85xx.c +0 -14
index e1ddff5..77b6a37 100644
@@ -12,21 +12,7 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/stddef.h>
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/interrupt.h>
-#include <linux/of_platform.h>
-
-#include <asm/system.h>
-#include <asm/time.h>
 #include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <mm/mmu_decl.h>
-#include <asm/prom.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
 
Signature · 1 line
1.7.7.1
#18 lore raw

PATCH 5/6 powerpc/85xx: separate i8259 handling to common function

In reply to Dmitry Eremin-Solenikov
---
 arch/powerpc/platforms/85xx/mpc85xx.h        |    4 +++
 arch/powerpc/platforms/85xx/mpc85xx_cds.c    |   25 +-----------------
 arch/powerpc/platforms/85xx/mpc85xx_common.c |   36 ++++++++++++++++++++++++++
 arch/powerpc/platforms/85xx/mpc85xx_ds.c     |   27 +------------------
 4 files changed, 42 insertions(+), 50 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx.h +4 -0
index e2a6631..1bf61f3 100644
@@ -12,4 +12,8 @@ static inline void __init mpc85xx_cpm2_pic_init(void) {}
 #define MPC85xx_NO_PRIMARY_PHB 0xffff
 extern void mpc85xx_setup_arch(unsigned primary_phb_addr);
 
+#ifdef CONFIG_PPC_I8259
+extern int mpc85xx_i8259_setup_irq(void);
+#endif
+
 #endif
arch/powerpc/platforms/85xx/mpc85xx_cds.c +1 -24
index 49366e7..0e551d7 100644
@@ -195,30 +195,7 @@ static void __init mpc85xx_cds_pic_init(void)
 static int mpc85xx_cds_8259_attach(void)
 {
 	int ret;
-	struct device_node *np = NULL;
-	struct device_node *cascade_node = NULL;
-	int cascade_irq;
-
-	/* Initialize the i8259 controller */
-	for_each_node_by_type(np, "interrupt-controller")
-		if (of_device_is_compatible(np, "chrp,iic")) {
-			cascade_node = np;
-			break;
-		}
-
-	if (cascade_node == NULL) {
-		printk(KERN_DEBUG "Could not find i8259 PIC\n");
-		return -ENODEV;
-	}
-
-	cascade_irq = irq_of_parse_and_map(cascade_node, 0);
-	if (cascade_irq == NO_IRQ) {
-		printk(KERN_ERR "Failed to map cascade interrupt\n");
-		return -ENXIO;
-	}
-
-	i8259_init(cascade_node, 0);
-	of_node_put(cascade_node);
+	int cascade_irq = mpc85xx_i8259_setup_irq();
 
 	/*
 	 *  Hook the interrupt to make sure desc->action is never NULL.
arch/powerpc/platforms/85xx/mpc85xx_common.c +36 -0
index 87e61a3..1602c7a 100644
@@ -9,6 +9,7 @@
 #include <linux/of_platform.h>
 #include <linux/pci.h>
 
+#include <asm/i8259.h>
 #include <asm/machdep.h>
 #include <asm/mpic.h>
 
@@ -158,3 +159,38 @@ void __init mpc85xx_setup_arch(unsigned primary_phb_addr)
 	}
 #endif
 }
+
+#ifdef CONFIG_PPC_I8259
+int __init mpc85xx_i8259_setup_irq(void)
+{
+	struct device_node *np;
+	struct device_node *cascade_node = NULL;
+	int cascade_irq;
+
+	/* Initialize the i8259 controller */
+	for_each_node_by_type(np, "interrupt-controller")
+		if (of_device_is_compatible(np, "chrp,iic")) {
+			cascade_node = np;
+			break;
+		}
+
+	if (cascade_node == NULL) {
+		printk(KERN_DEBUG "Could not find i8259 PIC\n");
+		return -ENODEV;
+	}
+
+	cascade_irq = irq_of_parse_and_map(cascade_node, 0);
+	if (cascade_irq == NO_IRQ) {
+		printk(KERN_ERR "Failed to map cascade interrupt\n");
+		return -ENXIO;
+	}
+
+	pr_debug("%s: cascade mapped to irq %d\n", __func__, cascade_irq);
+
+	i8259_init(cascade_node, 0);
+	of_node_put(cascade_node);
+
+	return cascade_irq;
+}
+
+#endif
arch/powerpc/platforms/85xx/mpc85xx_ds.c +1 -26
index bd9931a..246d33a 100644
@@ -60,32 +60,7 @@ static void mpc85xx_8259_cascade(unsigned int irq, struct irq_desc *desc)
 
 static void __init mpc85xx_ds_i8259_init(void)
 {
-	struct device_node *np;
-	struct device_node *cascade_node = NULL;
-	int cascade_irq;
-
-	/* Initialize the i8259 controller */
-	for_each_node_by_type(np, "interrupt-controller")
-	    if (of_device_is_compatible(np, "chrp,iic")) {
-		cascade_node = np;
-		break;
-	}
-
-	if (cascade_node == NULL) {
-		printk(KERN_DEBUG "Could not find i8259 PIC\n");
-		return;
-	}
-
-	cascade_irq = irq_of_parse_and_map(cascade_node, 0);
-	if (cascade_irq == NO_IRQ) {
-		printk(KERN_ERR "Failed to map cascade interrupt\n");
-		return;
-	}
-
-	DBG("mpc85xxds: cascade mapped to irq %d\n", cascade_irq);
-
-	i8259_init(cascade_node, 0);
-	of_node_put(cascade_node);
+	int cascade_irq = mpc85xx_i8259_setup_irq();
 
 	irq_set_chained_handler(cascade_irq, mpc85xx_8259_cascade);
 }
Signature · 1 line
1.7.7.1
#13 lore raw

Re: [PATCH 3/6] powerpc/85xx: separate MPIC handling code

In reply to Dmitry Eremin-Solenikov
Quoted 7 lines · Dmitry Eremin-Solenikov

All mpc85xx boards deal with MPIC initialization in more or less the same way. The only difrerences are some flags (WANTS_RESET, BROKEN_FRR_NIRQS, SINGLE_DEST_CPU), and some bugs like leaking device node counter, etc. To minimize problems, switch all boards to use one single instance of code.

<snip>

arch/powerpc/=

Quoted 1 line
arch/powerpc/= renamed from arch/powerpc/platforms/85xx/mpc85xx_common.c +0 -0

platforms/85xx/mpc85xx_common.c

Quoted 17 lines

index fe40668..7579e24 100644

arch/powerpc/platforms/85xx/mpc85xx_common.c +0 -0
@@ -7,6 +7,9 @@

=A0*/
=A0#include <linux/of_platform.h>

arch/powerpc/platforms/85xx/mpc85xx_common.c +3 -0
+#include <asm/machdep.h>
+#include <asm/mpic.h>
+

=A0#include <sysdev/cpm2_pic.h>

=A0#include "mpc85xx.h"

arch/powerpc/platforms/85xx/mpc85xx_common.c +0 -0
@@ -63,3 +66,43 @@ void __init mpc85xx_cpm2_pic_init(void)
 =A0 =A0 =A0 =A0irq_set_chained_handler(irq, cpm2_cascade);
 =A0}

=A0#endif

arch/powerpc/platforms/85xx/mpc85xx_common.c void __init mpc85xx_cpm2_pic_init(void)

Quoted 3 lines
arch/powerpc/platforms/85xx/mpc85xx_common.c +3 -0
+
+
+void __init mpc85xx_init_mpic(bool reset, bool broken_frr, bool singlede=

st)

Quoted 6 lines

+{
+ =A0 =A0 =A0 struct mpic *mpic;
+ =A0 =A0 =A0 struct resource r;
+ =A0 =A0 =A0 struct device_node *np =3D NULL;
+ =A0 =A0 =A0 unsigned int flags =3D MPIC_PRIMARY | MPIC_BIG_ENDIAN |
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 MPIC_BROKEN=

_FRR_NIRQS | MPIC_SINGLE_DEST_CPU;

since parameters broken_frr and singledest are used later, flags should probably be just:

        =A0 =A0 unsigned int flags =3D MPIC_PRIMARY | MPIC_BIG_ENDIAN;

arch/powerpc/platforms/85xx/mpc85xx_common.c

Quoted 5 lines
arch/powerpc/platforms/85xx/mpc85xx_common.c +5 -0
+
+ =A0 =A0 =A0 np =3D of_find_node_by_type(np, "open-pic");
+
+ =A0 =A0 =A0 if (np =3D=3D NULL) {
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 printk(KERN_ERR "Could not find open-pic no=

de\n");

Quoted 5 lines

+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 return;
+ =A0 =A0 =A0 }
+
+ =A0 =A0 =A0 if (of_address_to_resource(np, 0, &r)) {
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 printk(KERN_ERR "Failed to map mpic registe=

r space\n");

Quoted 4 lines

+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 of_node_put(np);
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 return;
+ =A0 =A0 =A0 }

arch/powerpc/platforms/85xx/mpc85xx_common.c +1 -0
+

arch/powerpc/platforms/85xx/mpc85xx_common.c

Quoted 10 lines
arch/powerpc/platforms/85xx/mpc85xx_common.c +10 -0
+ =A0 =A0 =A0 if (reset)
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 flags |=3D MPIC_WANTS_RESET;
+ =A0 =A0 =A0 if (broken_frr)
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 flags |=3D MPIC_BROKEN_FRR_NIRQS;
+ =A0 =A0 =A0 if (singledest)
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 flags |=3D MPIC_SINGLE_DEST_CPU;
+ =A0 =A0 =A0 if (ppc_md.get_irq =3D=3D mpic_get_coreint_irq)
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 flags |=3D MPIC_ENABLE_COREINT;
+
+ =A0 =A0 =A0 mpic =3D mpic_alloc(np, r.start, flags, 0, 256, " OpenPIC =

=A0");

Quoted 7 lines

+ =A0 =A0 =A0 BUG_ON(mpic =3D=3D NULL);

arch/powerpc/platforms/85xx/mpc85xx_common.c +6 -0
+
+ =A0 =A0 =A0 /* Return the mpic node */
+ =A0 =A0 =A0 of_node_put(np);
+
+ =A0 =A0 =A0 mpic_init(mpic);
+}

<snip>

Quoted 2 lines

--
1.7.7.1

#14 lore raw

Re: [PATCH 3/6] powerpc/85xx: separate MPIC handling code

Quoted 43 lines · Lee Nipper
Quoted 7 lines · Dmitry Eremin-Solenikov

All mpc85xx boards deal with MPIC initialization in more or less the same way. The only difrerences are some flags (WANTS_RESET, BROKEN_FRR_NIRQS, SINGLE_DEST_CPU), and some bugs like leaking device node counter, etc. To minimize problems, switch all boards to use one single instance of code.

<snip>

Quoted 17 lines
arch/powerpc/platforms/85xx/mpc85xx_common.c +3 -0
index fe40668..7579e24 100644
@@ -7,6 +7,9 @@
  */
  #include<linux/of_platform.h>
 
+#include<asm/machdep.h>
+#include<asm/mpic.h>
+
  #include<sysdev/cpm2_pic.h>
 
  #include "mpc85xx.h"
@@ -63,3 +66,43 @@ void __init mpc85xx_cpm2_pic_init(void)
        irq_set_chained_handler(irq, cpm2_cascade);
  }

arch/powerpc/platforms/85xx/mpc85xx_common.c void __init mpc85xx_cpm2_pic_init(void) · line 77

Quoted 10 lines
arch/powerpc/platforms/85xx/mpc85xx_common.c +9 -0
  #endif
+
+
+void __init mpc85xx_init_mpic(bool reset, bool broken_frr, bool singledest)
+{
+       struct mpic *mpic;
+       struct resource r;
+       struct device_node *np = NULL;
+       unsigned int flags = MPIC_PRIMARY | MPIC_BIG_ENDIAN |
+                               MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU;

since parameters broken_frr and singledest are used later, flags should probably be just:

Quoted 1 line
             unsigned int flags = MPIC_PRIMARY | MPIC_BIG_ENDIAN;

Yes, forgot about this when cleaning up. Sorry.

Quoted 37 lines
Quoted 32 lines
arch/powerpc/platforms/85xx/mpc85xx_common.c +31 -0
+
+       np = of_find_node_by_type(np, "open-pic");
+
+       if (np == NULL) {
+               printk(KERN_ERR "Could not find open-pic node\n");
+               return;
+       }
+
+       if (of_address_to_resource(np, 0,&r)) {
+               printk(KERN_ERR "Failed to map mpic register space\n");
+               of_node_put(np);
+               return;
+       }
+
+       if (reset)
+               flags |= MPIC_WANTS_RESET;
+       if (broken_frr)
+               flags |= MPIC_BROKEN_FRR_NIRQS;
+       if (singledest)
+               flags |= MPIC_SINGLE_DEST_CPU;
+       if (ppc_md.get_irq == mpic_get_coreint_irq)
+               flags |= MPIC_ENABLE_COREINT;
+
+       mpic = mpic_alloc(np, r.start, flags, 0, 256, " OpenPIC  ");
+       BUG_ON(mpic == NULL);
+
+       /* Return the mpic node */
+       of_node_put(np);
+
+       mpic_init(mpic);
+}

<snip>

Quoted 2 lines

--
1.7.7.1

Signature · 2 lines
With best wishes
Dmitry
#15 lore raw

Re: [PATCH 3/6] powerpc/85xx: separate MPIC handling code

Hi Dmitry,

Quoted 12 lines · On Thu, 17 Nov 2011 22:43:35 +0400 Dmitry Eremin-Solenikov…
Quoted 10 lines · Lee Nipper
Quoted 7 lines · Dmitry Eremin-Solenikov

All mpc85xx boards deal with MPIC initialization in more or less the same way. The only difrerences are some flags (WANTS_RESET, BROKEN_FRR_NIRQS, SINGLE_DEST_CPU), and some bugs like leaking device node counter, etc. To minimize problems, switch all boards to use one single instance of code.

Quoted 8 lines
Quoted 6 lines

<snip>

since parameters broken_frr and singledest are used later, flags should probably be just:

             unsigned int flags = MPIC_PRIMARY | MPIC_BIG_ENDIAN;

Yes, forgot about this when cleaning up. Sorry.

Since the three arguments to this function are just used to set flags, maybe it would be better to just pass in the extra flags required in each case as a single argument.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#20 lore raw

Re: [PATCH 6/6] poewrpc/85xx: headers cleanup

In reply to Dmitry Eremin-Solenikov

Hi Dmitry,

Quoted 2 lines · On Thu, 17 Nov 2011 21:56:21 +0400 Dmitry Eremin-Solenikov…

Drop lots of unused headers after board files merge/splitup

Again, I am concerned that you may have removed too many includes (though I didn't explicitly check this time).

In general, these clean ups look great.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#16 lore raw

Re: [PATCH 3/6] powerpc/85xx: separate MPIC handling code

In reply to Dmitry Eremin-Solenikov
Quoted 5 lines · Dmitry Eremin-Solenikov

All mpc85xx boards deal with MPIC initialization in more or less the same way. The only difrerences are some flags (WANTS_RESET, BROKEN_FRR_NIRQS, SINGLE_DEST_CPU), and some bugs like leaking device node counter, etc. To minimize problems, switch all boards to use one single instance of code.

SINGLE_DEST_CPU should apply to all 85xx (the boards that omit it are probably non-SMP where it doesn't matter), and probably BROKEN_FRR_NIRQS as well (shouldn't hurt, at least).

arch/powerpc/platforms/85xx/corenet_ds.c line 39

Quoted 1 line
arch/powerpc/platforms/85xx/corenet_ds.c +1 -0
+	mpc85xx_init_mpic(0, 1, 1);

This is awkward to read, named flags are better -- and already exist for this. :-)

Something like this should be clearer and still allow any override the board wishes (such as for 85xx CAMP):

#define MPC85XX_MPIC_FLAGS (...)

most_boards:

mpc85xx_init_mpic(MPC85XX_MPIC_FLAGS)

85xx CAMP:

mpc85xx_init_mpic(MPC85XX_MPIC_FLAGS & ~MPIC_WANTS_RESET);

-Scott

Applied
#21 lore raw
In reply to Dmitry Eremin-Solenikov
Quoted 1 line · Dmitry Eremin-Solenikov

Separate handling of CPM2 PIC initialization to =

mpc85xx_cpm2_pic_init()

Quoted 11 lines

function.
=20

---

arch/powerpc/platforms/85xx/Makefile         |    2 +
arch/powerpc/platforms/85xx/ksi8560.c        |   29 +--------------
arch/powerpc/platforms/85xx/mpc8536_ds.c     |    2 +
arch/powerpc/platforms/85xx/mpc85xx.h        |    9 +++++
arch/powerpc/platforms/85xx/mpc85xx_ads.c    |   34 ++----------------
arch/powerpc/platforms/85xx/mpc85xx_cds.c    |    2 +
arch/powerpc/platforms/85xx/mpc85xx_common.c |   49 =

++++++++++++++++++++++++++

Quoted 7 lines
arch/powerpc/platforms/85xx/mpc85xx_ds.c     |    2 +
arch/powerpc/platforms/85xx/mpc85xx_mds.c    |    2 +
arch/powerpc/platforms/85xx/mpc85xx_rdb.c    |    2 +
arch/powerpc/platforms/85xx/p1022_ds.c       |    2 +
arch/powerpc/platforms/85xx/sbc8560.c        |   34 ++----------------
arch/powerpc/platforms/85xx/socrates.c       |    1 +
arch/powerpc/platforms/85xx/stx_gp3.c        |   37 =

++------------------

Quoted 1 line

arch/powerpc/platforms/85xx/tqm85xx.c | 37 =

++------------------

Quoted 4 lines

arch/powerpc/platforms/85xx/xes_mpc85xx.c | 2 +

16 files changed, 89 insertions(+), 157 deletions(-)

create mode 100644 arch/powerpc/platforms/85xx/mpc85xx.h create mode 100644 arch/powerpc/platforms/85xx/mpc85xx_common.c

applied to next

- k=

Applied
#2 lore raw

Re: [PATCH 2/6] powerpc/85xx: consolidate of_platform_bus_probe calls

In reply to Dmitry Eremin-Solenikov
Quoted 6 lines · Dmitry Eremin-Solenikov

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.
=20

---

Quoted 8 lines
arch/powerpc/platforms/85xx/ksi8560.c        |   17 +---------
arch/powerpc/platforms/85xx/mpc8536_ds.c     |   14 +-------
arch/powerpc/platforms/85xx/mpc85xx.h        |    2 +
arch/powerpc/platforms/85xx/mpc85xx_ads.c    |   18 +----------
arch/powerpc/platforms/85xx/mpc85xx_cds.c    |   14 +-------
arch/powerpc/platforms/85xx/mpc85xx_common.c |   16 +++++++++
arch/powerpc/platforms/85xx/mpc85xx_ds.c     |   18 ++---------
arch/powerpc/platforms/85xx/mpc85xx_mds.c    |   44 =
+------------------------
> arch/powerpc/platforms/85xx/mpc85xx_rdb.c    |   16 +--------
> arch/powerpc/platforms/85xx/p1022_ds.c       |    5 +--
> arch/powerpc/platforms/85xx/sbc8548.c        |   18 ++---------
> arch/powerpc/platforms/85xx/sbc8560.c        |   18 +----------
> arch/powerpc/platforms/85xx/socrates.c       |   12 +------
> arch/powerpc/platforms/85xx/stx_gp3.c        |   14 +-------
> arch/powerpc/platforms/85xx/tqm85xx.c        |   14 +-------
> arch/powerpc/platforms/85xx/xes_mpc85xx.c    |   18 ++---------
Quoted 1 line
16 files changed, 40 insertions(+), 218 deletions(-)

applied to next

- k=

#3 lore raw

Re: [PATCH 2/6] powerpc/85xx: consolidate of_platform_bus_probe calls

In reply to Dmitry Eremin-Solenikov

arch/powerpc/platfo=

Quoted 1 line · Dmitry Eremin-Solenikov
arch/powerpc/platfo= renamed from arch/powerpc/platforms/85xx/p1022_ds.c +0 -0

rms/85xx/p1022_ds.c

Quoted 11 lines

index 00d93a4..cacb4d4 100644

arch/powerpc/platforms/85xx/p1022_ds.c +0 -4
@@ -330,10 +330,6 @@ static void __init p1022_ds_setup_arch(void)
 =A0}
 
 =A0static struct of_device_id __initdata p1022_ds_ids[] =3D {
- =A0 =A0 =A0 { .type =3D "soc", },
- =A0 =A0 =A0 { .compatible =3D "soc", },
- =A0 =A0 =A0 { .compatible =3D "simple-bus", },
- =A0 =A0 =A0 { .compatible =3D "gianfar", },
Quoted 1 line

=A0 =A0 =A0 =A0/* So that the DMA channel nodes can be probed individuall=

y: */

arch/powerpc/platforms/85xx/p1022_ds.c static int __init p1022_ds_publish_devices(void) · line 343

Quoted 8 lines

=A0 =A0 =A0 =A0{ .compatible =3D "fsl,eloplus-dma", }, =A0 =A0 =A0 =A0{},

arch/powerpc/platforms/85xx/p1022_ds.c +1 -0
@@ -343,6 +339,7 @@ static int __init p1022_ds_publish_devices(void)
 =A0{
 =A0 =A0 =A0 =A0return of_platform_bus_probe(NULL, p1022_ds_ids, NULL);
 =A0}
+machine_device_initcall(p1022_ds, mpc85xx_common_publish_devices);
 =A0machine_device_initcall(p1022_ds, p1022_ds_publish_devices);

I don't think this is working. =A0I need to investigate some more to be sure, but it looks like this is not picking up "fsl,eloplus-dma". None of the DMA channels are being probed in the audio driver (sound/soc/fsl_dma.c).

--
Timur Tabi
Linux kernel developer at Freescale=

#4 lore raw

Re: [PATCH 2/6] powerpc/85xx: consolidate of_platform_bus_probe calls

Quoted 4 lines · On Nov 28, 2011, at 5:42 PM, Tabi Timur-B04825 wrote:

On Thu, Nov 17, 2011 at 11:56 AM, Dmitry Eremin-Solenikov <[email protected]> wrote:
=20

=

Quoted 1 line
= renamed from arch/powerpc/platforms/85xx/p1022_ds.c +0 -0

b/arch/powerpc/platforms/85xx/p1022_ds.c

Quoted 4 lines
Quoted 4 lines

index 00d93a4..cacb4d4 100644

arch/powerpc/platforms/85xx/p1022_ds.c +0 -0
@@ -330,10 +330,6 @@ static void __init p1022_ds_setup_arch(void)
Quoted 8 lines

arch/powerpc/platforms/85xx/p1022_ds.c

Quoted 8 lines
arch/powerpc/platforms/85xx/p1022_ds.c +0 -0
 }

=20
static struct of_device_id __initdata p1022_ds_ids[] =3D {

arch/powerpc/platforms/85xx/p1022_ds.c +0 -4
-       { .type =3D "soc", },
-       { .compatible =3D "soc", },
-       { .compatible =3D "simple-bus", },
-       { .compatible =3D "gianfar", },
       /* So that the DMA channel nodes can be probed individually: =

*/

Quoted 5 lines
Quoted 5 lines
       { .compatible =3D "fsl,eloplus-dma", },
       {},
arch/powerpc/platforms/85xx/p1022_ds.c +0 -0
@@ -343,6 +339,7 @@ static int __init p1022_ds_publish_devices(void)
 {
       return of_platform_bus_probe(NULL, p1022_ds_ids, NULL);
Quoted 8 lines

arch/powerpc/platforms/85xx/p1022_ds.c static int __init p1022_ds_publish_devices(void) · line 343

Quoted 3 lines
arch/powerpc/platforms/85xx/p1022_ds.c +1 -0
 }
+machine_device_initcall(p1022_ds, mpc85xx_common_publish_devices);
 machine_device_initcall(p1022_ds, p1022_ds_publish_devices);

=20
I don't think this is working. I need to investigate some more to be sure, but it looks like this is not picking up "fsl,eloplus-dma". None of the DMA channels are being probed in the audio driver (sound/soc/fsl_dma.c).

Hmm, that's odd. Should see if the issues exists before the change.

- k=

#5 lore raw

Re: [PATCH 2/6] powerpc/85xx: consolidate of_platform_bus_probe calls

Quoted 6 lines · Kumar Gala
Quoted 4 lines

I don't think this is working. I need to investigate some more to be sure, but it looks like this is not picking up "fsl,eloplus-dma". None of the DMA channels are being probed in the audio driver (sound/soc/fsl_dma.c).

Hmm, that's odd. Should see if the issues exists before the change.

If I move the "fsl,eloplus-dma" into mpc85xx_common_ids[], then everything works.

I suspect there's some kind of state machine in of_platform_bus_probe() that allows it to find the DMA channel nodes if it's scanned everything else first. I'm trying to debug it now.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#6 lore raw

Re: [PATCH 2/6] powerpc/85xx: consolidate of_platform_bus_probe calls

Quoted 3 lines · Timur Tabi

If I move the "fsl,eloplus-dma" into mpc85xx_common_ids[], then everything works.

I suspect there's some kind of state machine in of_platform_bus_probe() that allows it to find the DMA channel nodes if it's scanned everything else first. I'm trying to debug it now.

So why do we need mpc85xx_common_ids[] at all? Why can't of_platform_bus_probe() just scan the entire tree?

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#7 lore raw

Re: [PATCH 2/6] powerpc/85xx: consolidate of_platform_bus_probe calls

Quoted 3 lines · Timur Tabi

Timur Tabi wrote:
=20

Quoted 1 line

If I move the "fsl,eloplus-dma" into mpc85xx_common_ids[], then =

everything works.

Quoted 2 lines
Quoted 2 lines

=20
I suspect there's some kind of state machine in =

of_platform_bus_probe() that allows it to find the DMA channel nodes if = it's scanned everything else first. I'm trying to debug it now.

Quoted 2 lines

=20
So why do we need mpc85xx_common_ids[] at all? Why can't =

of_platform_bus_probe() just scan the entire tree?

Ben would probably have to answer that. I can't remember why he wanted = it. I'm sure he has a good reason.

- k=

#8 lore raw

Re: [PATCH 2/6] powerpc/85xx: consolidate of_platform_bus_probe calls

Quoted 1 line · Kumar Gala

Ben would probably have to answer that. I can't remember why he wanted it. I'm sure he has a good reason.

Well, I'm not sure what's going on with the code. I *think* what's happening is that the first call of_platform_bus_probe() is scanning most, but not all, of the tree, and it's somehow reserving all of those nodes. Then we call of_platform_bus_probe() again, but it never finds the DMA nodes. of_platform_bus_probe() never actually calls of_platform_bus_create() this time around. Perhaps the recursive nature of of_platform_bus_create() is part of the problem.

The only fix I can think of is to move "fsl,eloplus-dma" into mpc85xx_common_ids[]. I'll post a patch that does that, and we can discuss it.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#11 lore raw

Re: [PATCH 2/6] powerpc/85xx: consolidate of_platform_bus_probe calls

In reply to Timur Tabi
Quoted 5 lines · Timur Tabi
Quoted 3 lines · Timur Tabi

If I move the "fsl,eloplus-dma" into mpc85xx_common_ids[], then everything works.

I suspect there's some kind of state machine in of_platform_bus_probe() that allows it to find the DMA channel nodes if it's scanned everything else first. I'm trying to debug it now.

Probably mpc85xx_common_ids[] can probe the soc node but not the dma node, and the p1022-specific list can probe the dma node but not the soc node, so it doesn't get to the dma node.

Quoted 1 line

So why do we need mpc85xx_common_ids[] at all? Why can't of_platform_bus_probe() just scan the entire tree?

That would generate a lot of useless platform devices that are either not really devices, or duplicate a device sitting on another bus (i2c, pci, etc). It could also result in a device being probed and matching a driver, when the device is unavailable in a way that is more complicated than status = "disabled" (such as p1022 muxing), or otherwise requires special handling.

-Scott

#9 lore raw

Re: [PATCH 2/6] powerpc/85xx: consolidate of_platform_bus_probe calls

In reply to Timur Tabi
Quoted 2 lines · Timur Tabi
Quoted 1 line · Kumar Gala

Ben would probably have to answer that. I can't remember why he =

wanted it. I'm sure he has a good reason.

Quoted 2 lines

=20
Well, I'm not sure what's going on with the code. I *think* what's =

happening is that the first call of_platform_bus_probe() is scanning = most, but not all, of the tree, and it's somehow reserving all of those = nodes. Then we call of_platform_bus_probe() again, but it never finds = the DMA nodes. of_platform_bus_probe() never actually calls = of_platform_bus_create() this time around. Perhaps the recursive nature = of of_platform_bus_create() is part of the problem.

Quoted 2 lines

=20
The only fix I can think of is to move "fsl,eloplus-dma" into =

mpc85xx_common_ids[]. I'll post a patch that does that, and we can = discuss it.

what if you make the p1022_ds_ids call first? Maybe we need to add = 'soc' to p1022_ds_ids list

- k=

#10 lore raw

Re: [PATCH 2/6] powerpc/85xx: consolidate of_platform_bus_probe calls

Quoted 3 lines · Kumar Gala
Quoted 1 line
Quoted 1 line

The only fix I can think of is to move "fsl,eloplus-dma" into mpc85xx_common_ids[]. I'll post a patch that does that, and we can discuss it.

what if you make the p1022_ds_ids call first? Maybe we need to add 'soc' to p1022_ds_ids list

Reversing the calls does not help. p1022_ds_ids[] is ignored either way. The same problem exists in mpc85xx_publish_devices(), so this patch breaks several boards.

Copying lines into p1022_ds_ids[] causes kernel BUGS() like this:

sysfs: cannot create duplicate filename '/devices/e0005000.localbus'

because we end up duplicating probes.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale