]> err.no Git - linux-2.6/commitdiff
[POWERPC] mpc512x: Basic platform support
authorJohn Rigby <jrigby@freescale.com>
Mon, 28 Jan 2008 17:28:53 +0000 (04:28 +1100)
committerGrant Likely <grant.likely@secretlab.ca>
Wed, 6 Feb 2008 21:03:10 +0000 (14:03 -0700)
512x is very similar to 83xx and most
of this is patterned after code from 83xx.

New platform:
    changed:
arch/powerpc/Kconfig
arch/powerpc/platforms/Kconfig
arch/powerpc/platforms/Kconfig.cputype
arch/powerpc/platforms/Makefile
    new:
arch/powerpc/platforms/512x/*
include/asm-powerpc/mpc512x.h

Signed-off-by: John Rigby <jrigby@freescale.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
arch/powerpc/Kconfig
arch/powerpc/platforms/512x/Kconfig [new file with mode: 0644]
arch/powerpc/platforms/512x/Makefile [new file with mode: 0644]
arch/powerpc/platforms/512x/mpc5121_ads.c [new file with mode: 0644]
arch/powerpc/platforms/Kconfig
arch/powerpc/platforms/Kconfig.cputype
arch/powerpc/platforms/Makefile
include/asm-powerpc/mpc512x.h [new file with mode: 0644]

index 2bf2f3f5302929755919f2908a7c814fb16c7776..88ea64bd991af6b23f7fe6d56f953f9dffbe9b03 100644 (file)
@@ -489,7 +489,7 @@ config PCI
        bool "PCI support" if 40x || CPM2 || PPC_83xx || PPC_85xx || PPC_86xx \
                || PPC_MPC52xx || (EMBEDDED && (PPC_PSERIES || PPC_ISERIES)) \
                || PPC_PS3 || 44x
-       default y if !40x && !CPM2 && !8xx && !PPC_83xx \
+       default y if !40x && !CPM2 && !8xx && !PPC_MPC512x && !PPC_83xx \
                && !PPC_85xx && !PPC_86xx
        default PCI_PERMEDIA if !4xx && !CPM2 && !8xx
        default PCI_QSPAN if !4xx && !CPM2 && 8xx
diff --git a/arch/powerpc/platforms/512x/Kconfig b/arch/powerpc/platforms/512x/Kconfig
new file mode 100644 (file)
index 0000000..c6fa49e
--- /dev/null
@@ -0,0 +1,20 @@
+config PPC_MPC512x
+       bool
+       select FSL_SOC
+       select IPIC
+       default n
+
+config PPC_MPC5121
+       bool
+       select PPC_MPC512x
+       default n
+
+config MPC5121_ADS
+       bool "Freescale MPC5121E ADS"
+       depends on PPC_MULTIPLATFORM && PPC32
+       select DEFAULT_UIMAGE
+       select WANT_DEVICE_TREE
+       select PPC_MPC5121
+       help
+         This option enables support for the MPC5121E ADS board.
+       default n
diff --git a/arch/powerpc/platforms/512x/Makefile b/arch/powerpc/platforms/512x/Makefile
new file mode 100644 (file)
index 0000000..232c89f
--- /dev/null
@@ -0,0 +1,4 @@
+#
+# Makefile for the Freescale PowerPC 512x linux kernel.
+#
+obj-$(CONFIG_MPC5121_ADS)      += mpc5121_ads.o
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c b/arch/powerpc/platforms/512x/mpc5121_ads.c
new file mode 100644 (file)
index 0000000..50bd3a3
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * Author: John Rigby, <jrigby@freescale.com>, Thur Mar 29 2007
+ *
+ * Description:
+ * MPC5121 ADS board setup
+ *
+ * This 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.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/of_platform.h>
+
+#include <asm/machdep.h>
+#include <asm/ipic.h>
+#include <asm/prom.h>
+#include <asm/time.h>
+
+/**
+ *     mpc512x_find_ips_freq - Find the IPS bus frequency for a device
+ *     @node:  device node
+ *
+ *     Returns IPS bus frequency, or 0 if the bus frequency cannot be found.
+ */
+unsigned long
+mpc512x_find_ips_freq(struct device_node *node)
+{
+       struct device_node *np;
+       const unsigned int *p_ips_freq = NULL;
+
+       of_node_get(node);
+       while (node) {
+               p_ips_freq = of_get_property(node, "bus-frequency", NULL);
+               if (p_ips_freq)
+                       break;
+
+               np = of_get_parent(node);
+               of_node_put(node);
+               node = np;
+       }
+       if (node)
+               of_node_put(node);
+
+       return p_ips_freq ? *p_ips_freq : 0;
+}
+EXPORT_SYMBOL(mpc512x_find_ips_freq);
+
+static struct of_device_id __initdata of_bus_ids[] = {
+       { .name = "soc", },
+       { .name = "localbus", },
+       {},
+};
+
+static void __init mpc5121_ads_declare_of_platform_devices(void)
+{
+       /* Find every child of the SOC node and add it to of_platform */
+       if (of_platform_bus_probe(NULL, of_bus_ids, NULL))
+               printk(KERN_ERR __FILE__ ": "
+                       "Error while probing of_platform bus\n");
+}
+
+static void __init mpc5121_ads_init_IRQ(void)
+{
+       struct device_node *np;
+
+       np = of_find_compatible_node(NULL, NULL, "fsl,ipic");
+       if (!np)
+               return;
+
+       ipic_init(np, 0);
+       of_node_put(np);
+
+       /*
+        * Initialize the default interrupt mapping priorities,
+        * in case the boot rom changed something on us.
+        */
+       ipic_set_default_priority();
+}
+
+/*
+ * Called very early, MMU is off, device-tree isn't unflattened
+ */
+static int __init mpc5121_ads_probe(void)
+{
+       unsigned long root = of_get_flat_dt_root();
+
+       return of_flat_dt_is_compatible(root, "fsl,mpc5121ads");
+}
+
+define_machine(mpc5121_ads) {
+       .name                   = "MPC5121 ADS",
+       .probe                  = mpc5121_ads_probe,
+       .init                   = mpc5121_ads_declare_of_platform_devices,
+       .init_IRQ               = mpc5121_ads_init_IRQ,
+       .get_irq                = ipic_get_irq,
+       .calibrate_decr         = generic_calibrate_decr,
+};
index fdce10c4f07440e2e23dddd28018c710712e6399..e2c952619805c7e8a05de3196b94e1ad7170d090 100644 (file)
@@ -41,6 +41,7 @@ config CLASSIC32
 source "arch/powerpc/platforms/pseries/Kconfig"
 source "arch/powerpc/platforms/iseries/Kconfig"
 source "arch/powerpc/platforms/chrp/Kconfig"
+source "arch/powerpc/platforms/512x/Kconfig"
 source "arch/powerpc/platforms/52xx/Kconfig"
 source "arch/powerpc/platforms/powermac/Kconfig"
 source "arch/powerpc/platforms/prep/Kconfig"
index 7fc41104d53eb8aee659bc9b909ad2da2680e0dd..51030ab2a023a5aeae4b567cf91f767e7955e5d8 100644 (file)
@@ -14,7 +14,7 @@ choice
          There are five families of 32 bit PowerPC chips supported.
          The most common ones are the desktop and server CPUs (601, 603,
          604, 740, 750, 74xx) CPUs from Freescale and IBM, with their
-         embedded 52xx/82xx/83xx/86xx counterparts.
+         embedded 512x/52xx/82xx/83xx/86xx counterparts.
          The other embeeded parts, namely 4xx, 8xx, e200 (55xx) and e500
          (85xx) each form a family of their own that is not compatible
          with the others.
@@ -22,7 +22,7 @@ choice
          If unsure, select 52xx/6xx/7xx/74xx/82xx/83xx/86xx.
 
 config 6xx
-       bool "52xx/6xx/7xx/74xx/82xx/83xx/86xx"
+       bool "512x/52xx/6xx/7xx/74xx/82xx/83xx/86xx"
        select PPC_FPU
 
 config PPC_85xx
@@ -221,7 +221,7 @@ config NR_CPUS
 
 config NOT_COHERENT_CACHE
        bool
-       depends on 4xx || 8xx || E200
+       depends on 4xx || 8xx || E200 || PPC_MPC512x
        default y
 
 config CHECK_CACHE_COHERENCY
index 6d9079da5f5a917c9357faa19f22300dab43f178..a984894466d91c23dcafe92e97932e31c9d43bf3 100644 (file)
@@ -11,6 +11,7 @@ endif
 obj-$(CONFIG_PPC_CHRP)         += chrp/
 obj-$(CONFIG_40x)              += 40x/
 obj-$(CONFIG_44x)              += 44x/
+obj-$(CONFIG_PPC_MPC512x)      += 512x/
 obj-$(CONFIG_PPC_MPC52xx)      += 52xx/
 obj-$(CONFIG_PPC_8xx)          += 8xx/
 obj-$(CONFIG_PPC_82xx)         += 82xx/
diff --git a/include/asm-powerpc/mpc512x.h b/include/asm-powerpc/mpc512x.h
new file mode 100644 (file)
index 0000000..c48a165
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * Author: John Rigby, <jrigby@freescale.com>, Friday Apr 13 2007
+ *
+ * Description:
+ * MPC5121 Prototypes and definitions
+ *
+ * This 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.
+ *
+ */
+
+#ifndef __ASM_POWERPC_MPC512x_H__
+#define __ASM_POWERPC_MPC512x_H__
+
+extern unsigned long mpc512x_find_ips_freq(struct device_node *node);
+
+#endif /* __ASM_POWERPC_MPC512x_H__ */
+