]> git.karo-electronics.de Git - linux-beck.git/commitdiff
powerpc/86xx: Consolidate common platform code
authorAlessio Igor Bogani <alessio.bogani@elettra.eu>
Thu, 11 Feb 2016 14:38:46 +0000 (15:38 +0100)
committerScott Wood <oss@buserror.net>
Sat, 12 Mar 2016 01:14:12 +0000 (19:14 -0600)
Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu>
Signed-off-by: Scott Wood <oss@buserror.net>
arch/powerpc/platforms/86xx/Makefile
arch/powerpc/platforms/86xx/common.c [new file with mode: 0644]
arch/powerpc/platforms/86xx/gef_ppc9a.c
arch/powerpc/platforms/86xx/gef_sbc310.c
arch/powerpc/platforms/86xx/gef_sbc610.c
arch/powerpc/platforms/86xx/mpc8610_hpcd.c
arch/powerpc/platforms/86xx/mpc86xx.h
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
arch/powerpc/platforms/86xx/sbc8641d.c

index ede815d6489dbc8fbce9bea2b08fe05549737db7..2d889ad7dc89dee81ee6fcc79f8877845843e55d 100644 (file)
@@ -2,7 +2,7 @@
 # Makefile for the PowerPC 86xx linux kernel.
 #
 
-obj-y                          := pic.o
+obj-y                          := pic.o common.o
 obj-$(CONFIG_SMP)              += mpc86xx_smp.o
 obj-$(CONFIG_MPC8641_HPCN)     += mpc86xx_hpcn.o
 obj-$(CONFIG_SBC8641D)         += sbc8641d.o
diff --git a/arch/powerpc/platforms/86xx/common.c b/arch/powerpc/platforms/86xx/common.c
new file mode 100644 (file)
index 0000000..0f7b7fc
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Routines common to most mpc86xx-based boards.
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/of_platform.h>
+#include <asm/synch.h>
+
+#include "mpc86xx.h"
+
+static const struct of_device_id mpc86xx_common_ids[] __initconst = {
+       { .type = "soc", },
+       { .compatible = "soc", },
+       { .compatible = "simple-bus", },
+       { .name = "localbus", },
+       { .compatible = "gianfar", },
+       { .compatible = "fsl,mpc8641-pcie", },
+       {},
+};
+
+int __init mpc86xx_common_publish_devices(void)
+{
+       return of_platform_bus_probe(NULL, mpc86xx_common_ids, NULL);
+}
+
+long __init mpc86xx_time_init(void)
+{
+       unsigned int temp;
+
+       /* Set the time base to zero */
+       mtspr(SPRN_TBWL, 0);
+       mtspr(SPRN_TBWU, 0);
+
+       temp = mfspr(SPRN_HID0);
+       temp |= HID0_TBEN;
+       mtspr(SPRN_HID0, temp);
+       isync();
+
+       return 0;
+}
index bf17933b20f32c315caf1393d0e666c88cf8876a..8e63b752712c8cce2f876bc82cee140c82651bad 100644 (file)
@@ -197,37 +197,7 @@ static int __init gef_ppc9a_probe(void)
        return 0;
 }
 
-static long __init mpc86xx_time_init(void)
-{
-       unsigned int temp;
-
-       /* Set the time base to zero */
-       mtspr(SPRN_TBWL, 0);
-       mtspr(SPRN_TBWU, 0);
-
-       temp = mfspr(SPRN_HID0);
-       temp |= HID0_TBEN;
-       mtspr(SPRN_HID0, temp);
-       asm volatile("isync");
-
-       return 0;
-}
-
-static const struct of_device_id of_bus_ids[] __initconst = {
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
-       { .compatible = "fsl,mpc8641-pcie", },
-       {},
-};
-
-static int __init declare_of_platform_devices(void)
-{
-       printk(KERN_DEBUG "Probe platform devices\n");
-       of_platform_bus_probe(NULL, of_bus_ids, NULL);
-
-       return 0;
-}
-machine_arch_initcall(gef_ppc9a, declare_of_platform_devices);
+machine_arch_initcall(gef_ppc9a, mpc86xx_common_publish_devices);
 
 define_machine(gef_ppc9a) {
        .name                   = "GE PPC9A",
index 8facf5873866ad94e583cdae37ad42b6573a4d3a..0e0be94f551fb2f9c0e67b7de6f734cb093855c1 100644 (file)
@@ -184,37 +184,7 @@ static int __init gef_sbc310_probe(void)
        return 0;
 }
 
-static long __init mpc86xx_time_init(void)
-{
-       unsigned int temp;
-
-       /* Set the time base to zero */
-       mtspr(SPRN_TBWL, 0);
-       mtspr(SPRN_TBWU, 0);
-
-       temp = mfspr(SPRN_HID0);
-       temp |= HID0_TBEN;
-       mtspr(SPRN_HID0, temp);
-       asm volatile("isync");
-
-       return 0;
-}
-
-static const struct of_device_id of_bus_ids[] __initconst = {
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
-       { .compatible = "fsl,mpc8641-pcie", },
-       {},
-};
-
-static int __init declare_of_platform_devices(void)
-{
-       printk(KERN_DEBUG "Probe platform devices\n");
-       of_platform_bus_probe(NULL, of_bus_ids, NULL);
-
-       return 0;
-}
-machine_arch_initcall(gef_sbc310, declare_of_platform_devices);
+machine_arch_initcall(gef_sbc310, mpc86xx_common_publish_devices);
 
 define_machine(gef_sbc310) {
        .name                   = "GE SBC310",
index 8c9058df5642d13eb30e8e6c66e14523c2dd3d4e..e8292b492d7e650aeec86e06792c336446ea4524 100644 (file)
@@ -174,37 +174,7 @@ static int __init gef_sbc610_probe(void)
        return 0;
 }
 
-static long __init mpc86xx_time_init(void)
-{
-       unsigned int temp;
-
-       /* Set the time base to zero */
-       mtspr(SPRN_TBWL, 0);
-       mtspr(SPRN_TBWU, 0);
-
-       temp = mfspr(SPRN_HID0);
-       temp |= HID0_TBEN;
-       mtspr(SPRN_HID0, temp);
-       asm volatile("isync");
-
-       return 0;
-}
-
-static const struct of_device_id of_bus_ids[] __initconst = {
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
-       { .compatible = "fsl,mpc8641-pcie", },
-       {},
-};
-
-static int __init declare_of_platform_devices(void)
-{
-       printk(KERN_DEBUG "Probe platform devices\n");
-       of_platform_bus_probe(NULL, of_bus_ids, NULL);
-
-       return 0;
-}
-machine_arch_initcall(gef_sbc610, declare_of_platform_devices);
+machine_arch_initcall(gef_sbc610, mpc86xx_common_publish_devices);
 
 define_machine(gef_sbc610) {
        .name                   = "GE SBC610",
index 437a9c372ae1ef405c081db17a8cf0bc76951cef..957473e5c8e5109cccf962791bc2508cfbdd0047 100644 (file)
@@ -88,12 +88,10 @@ static inline void mpc8610_suspend_init(void) { }
 static const struct of_device_id mpc8610_ids[] __initconst = {
        { .compatible = "fsl,mpc8610-immr", },
        { .compatible = "fsl,mpc8610-guts", },
-       { .compatible = "simple-bus", },
        /* So that the DMA channel nodes can be probed individually: */
        { .compatible = "fsl,eloplus-dma", },
        /* PCI controllers */
        { .compatible = "fsl,mpc8610-pci", },
-       { .compatible = "fsl,mpc8641-pcie", },
        {}
 };
 
@@ -105,6 +103,8 @@ static int __init mpc8610_declare_of_platform_devices(void)
        /* Enable wakeup on PIXIS' event IRQ. */
        mpc8610_suspend_init();
 
+       mpc86xx_common_publish_devices();
+
        /* Without this call, the SSI device driver won't get probed. */
        of_platform_bus_probe(NULL, mpc8610_ids, NULL);
 
@@ -327,22 +327,6 @@ static int __init mpc86xx_hpcd_probe(void)
        return 0;
 }
 
-static long __init mpc86xx_time_init(void)
-{
-       unsigned int temp;
-
-       /* Set the time base to zero */
-       mtspr(SPRN_TBWL, 0);
-       mtspr(SPRN_TBWU, 0);
-
-       temp = mfspr(SPRN_HID0);
-       temp |= HID0_TBEN;
-       mtspr(SPRN_HID0, temp);
-       asm volatile("isync");
-
-       return 0;
-}
-
 define_machine(mpc86xx_hpcd) {
        .name                   = "MPC86xx HPCD",
        .probe                  = mpc86xx_hpcd_probe,
index 08efb57559d1ceaa7c230e7eddaf10c31dcfc23b..53500db6b644301ff3aaa9414a7cb04952b2402b 100644 (file)
@@ -17,5 +17,7 @@
 
 extern void mpc86xx_smp_init(void);
 extern void mpc86xx_init_irq(void);
+extern long mpc86xx_time_init(void);
+extern int mpc86xx_common_publish_devices(void);
 
 #endif /* __MPC86XX_H__ */
index 07ccb1b0cc7de168cc46eec53c8723a8c43491d1..e5084811b9c62b5c45383051bd2deaf8b54b59b1 100644 (file)
@@ -110,33 +110,14 @@ static int __init mpc86xx_hpcn_probe(void)
        return 0;
 }
 
-static long __init
-mpc86xx_time_init(void)
-{
-       unsigned int temp;
-
-       /* Set the time base to zero */
-       mtspr(SPRN_TBWL, 0);
-       mtspr(SPRN_TBWU, 0);
-
-       temp = mfspr(SPRN_HID0);
-       temp |= HID0_TBEN;
-       mtspr(SPRN_HID0, temp);
-       asm volatile("isync");
-
-       return 0;
-}
-
 static const struct of_device_id of_bus_ids[] __initconst = {
-       { .compatible = "simple-bus", },
        { .compatible = "fsl,srio", },
-       { .compatible = "gianfar", },
-       { .compatible = "fsl,mpc8641-pcie", },
        {},
 };
 
 static int __init declare_of_platform_devices(void)
 {
+       mpc86xx_common_publish_devices();
        of_platform_bus_probe(NULL, of_bus_ids, NULL);
 
        return 0;
index 6810b71d54a795803a6a8cdc6d021af84ebf4b21..2a9cf278c12a7af4367710d180eca90c157622b0 100644 (file)
@@ -75,37 +75,7 @@ static int __init sbc8641_probe(void)
        return 0;
 }
 
-static long __init
-mpc86xx_time_init(void)
-{
-       unsigned int temp;
-
-       /* Set the time base to zero */
-       mtspr(SPRN_TBWL, 0);
-       mtspr(SPRN_TBWU, 0);
-
-       temp = mfspr(SPRN_HID0);
-       temp |= HID0_TBEN;
-       mtspr(SPRN_HID0, temp);
-       asm volatile("isync");
-
-       return 0;
-}
-
-static const struct of_device_id of_bus_ids[] __initconst = {
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
-       { .compatible = "fsl,mpc8641-pcie", },
-       {},
-};
-
-static int __init declare_of_platform_devices(void)
-{
-       of_platform_bus_probe(NULL, of_bus_ids, NULL);
-
-       return 0;
-}
-machine_arch_initcall(sbc8641, declare_of_platform_devices);
+machine_arch_initcall(sbc8641, mpc86xx_common_publish_devices);
 
 define_machine(sbc8641) {
        .name                   = "SBC8641D",