[POWERPC] mpc5200: Add generic support for simple MPC5200 based boards
authorMarian Balakowicz <m8@semihalf.com>
Thu, 15 Nov 2007 11:40:21 +0000 (22:40 +1100)
committerGrant Likely <grant.likely@secretlab.ca>
Sat, 19 Jan 2008 03:57:09 +0000 (20:57 -0700)
This patch adds support for 'mpc5200-simple-platform' compatible
boards which do not need a platform specific setup. Such boards
are supported assuming the following:

- GPIO pins are configured by the firmware,
- CDM configuration (clocking) is setup correctly by firmware,
- if the 'fsl,has-wdt' property is present in one of the
  gpt nodes, then it is safe to use such gpt to reset the board,
- PCI is supported if enabled in the kernel configuration
  and if there is a PCI bus node defined in the device tree.

Signed-off-by: Marian Balakowicz <m8@semihalf.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
arch/powerpc/boot/dts/lite5200.dts
arch/powerpc/boot/dts/lite5200b.dts
arch/powerpc/platforms/52xx/Kconfig
arch/powerpc/platforms/52xx/Makefile
arch/powerpc/platforms/52xx/mpc5200_simple.c [new file with mode: 0644]

index 23eeeb1fc61eccc350cf554eefea3a9ca67e8f2a..e1d6f441532ff3bf3f7e911d44dfa548cf7793d4 100644 (file)
@@ -19,7 +19,7 @@
 / {
        model = "fsl,lite5200";
        // revision = "1.0";
-       compatible = "fsl,lite5200","generic-mpc5200";
+       compatible = "fsl,lite5200";
        #address-cells = <1>;
        #size-cells = <1>;
 
index f94e073de9a79bed7ac615580f7bc6154fd61e67..3e06f58a0a71af1a11e64b3087d6ce4f28f8b570 100644 (file)
@@ -19,7 +19,7 @@
 / {
        model = "fsl,lite5200b";
        // revision = "1.0";
-       compatible = "fsl,lite5200b","generic-mpc5200";
+       compatible = "fsl,lite5200b";
        #address-cells = <1>;
        #size-cells = <1>;
 
index 2938d4927b83b0e20879dbbaa84c25557362d833..733a8063d40099ea0d42bc9f7c9c5ace3507134c 100644 (file)
@@ -19,6 +19,28 @@ config PPC_MPC5200_BUGFIX
 
          It is safe to say 'Y' here
 
+config PPC_MPC5200_SIMPLE
+       bool "Generic support for simple MPC5200 based boards"
+       depends on PPC_MULTIPLATFORM && PPC32
+       select PPC_MPC5200
+       select DEFAULT_UIMAGE
+       select WANT_DEVICE_TREE
+       default n
+       help
+         This option enables support for a simple MPC52xx based boards which
+         do not need a custom platform specific setup. Such boards are
+         supported assuming the following:
+
+         - GPIO pins are configured by the firmware,
+         - CDM configuration (clocking) is setup correctly by firmware,
+         - if the 'fsl,has-wdt' property is present in one of the
+           gpt nodes, then it is safe to use such gpt to reset the board,
+         - PCI is supported if enabled in the kernel configuration
+           and if there is a PCI bus node defined in the device tree.
+
+         Boards that are compatible with this generic platform support
+         are: 'tqc,tqm5200', 'promess,motionpro', 'schindler,cm5200'.
+
 config PPC_EFIKA
        bool "bPlan Efika 5k2. MPC5200B based computer"
        depends on PPC_MULTIPLATFORM && PPC32
@@ -31,8 +53,7 @@ config PPC_EFIKA
 config PPC_LITE5200
        bool "Freescale Lite5200 Eval Board"
        depends on PPC_MULTIPLATFORM && PPC32
-       select WANT_DEVICE_TREE
        select PPC_MPC5200
+       select DEFAULT_UIMAGE
+       select WANT_DEVICE_TREE
        default n
-
-
index 307dbc178091954ef91f9afb2a0d08bbc8d301c1..fe1b81bb522426d5678dbbe8f127152718c4f98f 100644 (file)
@@ -6,6 +6,7 @@ obj-y                           += mpc52xx_pic.o mpc52xx_common.o
 obj-$(CONFIG_PCI)              += mpc52xx_pci.o
 endif
 
+obj-$(CONFIG_PPC_MPC5200_SIMPLE) += mpc5200_simple.o
 obj-$(CONFIG_PPC_EFIKA)                += efika.o
 obj-$(CONFIG_PPC_LITE5200)     += lite5200.o
 
diff --git a/arch/powerpc/platforms/52xx/mpc5200_simple.c b/arch/powerpc/platforms/52xx/mpc5200_simple.c
new file mode 100644 (file)
index 0000000..754aa93
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Support for 'mpc5200-simple-platform' compatible boards.
+ *
+ * Written by Marian Balakowicz <m8@semihalf.com>
+ * Copyright (C) 2007 Semihalf
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ * Description:
+ * This code implements support for a simple MPC52xx based boards which
+ * do not need a custom platform specific setup. Such boards are
+ * supported assuming the following:
+ *
+ * - GPIO pins are configured by the firmware,
+ * - CDM configuration (clocking) is setup correctly by firmware,
+ * - if the 'fsl,has-wdt' property is present in one of the
+ *   gpt nodes, then it is safe to use such gpt to reset the board,
+ * - PCI is supported if enabled in the kernel configuration
+ *   and if there is a PCI bus node defined in the device tree.
+ *
+ * Boards that are compatible with this generic platform support
+ * are listed in a 'board' table.
+ */
+
+#undef DEBUG
+#include <asm/time.h>
+#include <asm/prom.h>
+#include <asm/machdep.h>
+#include <asm/mpc52xx.h>
+
+/*
+ * Setup the architecture
+ */
+static void __init mpc5200_simple_setup_arch(void)
+{
+       if (ppc_md.progress)
+               ppc_md.progress("mpc5200_simple_setup_arch()", 0);
+
+       /* Some mpc5200 & mpc5200b related configuration */
+       mpc5200_setup_xlb_arbiter();
+
+       /* Map wdt for mpc52xx_restart() */
+       mpc52xx_map_wdt();
+
+       mpc52xx_setup_pci();
+}
+
+/* list of the supported boards */
+static char *board[] __initdata = {
+       "promess,motionpro",
+       "schindler,cm5200",
+       "tqc,tqm5200",
+       NULL
+};
+
+/*
+ * Called very early, MMU is off, device-tree isn't unflattened
+ */
+static int __init mpc5200_simple_probe(void)
+{
+       unsigned long node = of_get_flat_dt_root();
+       int i = 0;
+
+       while (board[i]) {
+               if (of_flat_dt_is_compatible(node, board[i]))
+                       break;
+               i++;
+       }
+       
+       return (board[i] != NULL);
+}
+
+define_machine(mpc5200_simple_platform) {
+       .name           = "mpc5200-simple-platform",
+       .probe          = mpc5200_simple_probe,
+       .setup_arch     = mpc5200_simple_setup_arch,
+       .init           = mpc52xx_declare_of_platform_devices,
+       .init_IRQ       = mpc52xx_init_irq,
+       .get_irq        = mpc52xx_get_irq,
+       .restart        = mpc52xx_restart,
+       .calibrate_decr = generic_calibrate_decr,
+};