Re: [PATCH 3/8][Version 2] MPC5121 Add generic board support

2008-06-29 Thread Grant Likely
On Tue, Jun 24, 2008 at 3:24 PM, John Rigby <[EMAIL PROTECTED]> wrote:
> Move shared code from mpc5121_ads.c to mpc512x_shared.c.
> Add new generic board setup mpc5121_generic.c
>
> Signed-off-by: John Rigby <[EMAIL PROTECTED]>
> ---
> +void __init mpc512x_init_IRQ(void)
> +{
> +   struct device_node *np;
> +
> +   np = of_find_compatible_node(NULL, NULL, "fsl,ipic");

Along with all my other device-tree conventions comments; you should
really be testing for fsl,mpc5121-ipic here.  fsl,ipic is not a good
value for compatible.

g.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 3/8][Version 2] MPC5121 Add generic board support

2008-06-24 Thread John Rigby
Move shared code from mpc5121_ads.c to mpc512x_shared.c.
Add new generic board setup mpc5121_generic.c

Signed-off-by: John Rigby <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/512x/Kconfig   |   15 -
 arch/powerpc/platforms/512x/Makefile  |3 +-
 arch/powerpc/platforms/512x/mpc5121_ads.c |   45 +---
 arch/powerpc/platforms/512x/mpc5121_generic.c |   72 +
 arch/powerpc/platforms/512x/mpc512x.h |   14 +
 arch/powerpc/platforms/512x/mpc512x_shared.c  |   66 ++
 6 files changed, 168 insertions(+), 47 deletions(-)
 create mode 100644 arch/powerpc/platforms/512x/mpc5121_generic.c
 create mode 100644 arch/powerpc/platforms/512x/mpc512x.h
 create mode 100644 arch/powerpc/platforms/512x/mpc512x_shared.c

diff --git a/arch/powerpc/platforms/512x/Kconfig 
b/arch/powerpc/platforms/512x/Kconfig
index 4c0da0c..f9a04da 100644
--- a/arch/powerpc/platforms/512x/Kconfig
+++ b/arch/powerpc/platforms/512x/Kconfig
@@ -2,12 +2,10 @@ 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"
@@ -16,4 +14,15 @@ config MPC5121_ADS
select PPC_MPC5121
help
  This option enables support for the MPC5121E ADS board.
-   default n
+
+config MPC5121_GENERIC
+   bool "Generic support for simple MPC5121 based boards"
+   depends on PPC_MULTIPLATFORM && PPC32
+   select DEFAULT_UIMAGE
+   select PPC_MPC5121
+   help
+ This option enables support for simple MPC5121 based boards
+ which do not need custome platform specific setup.
+
+ Compatible boards include:  Protonic LVT base boards (ZANMCU
+ and VICVT2).
diff --git a/arch/powerpc/platforms/512x/Makefile 
b/arch/powerpc/platforms/512x/Makefile
index ef6c925..e6674c8 100644
--- a/arch/powerpc/platforms/512x/Makefile
+++ b/arch/powerpc/platforms/512x/Makefile
@@ -1,5 +1,6 @@
 #
 # Makefile for the Freescale PowerPC 512x linux kernel.
 #
-obj-y  := clock.o
+obj-y  := clock.o mpc512x_shared.o
 obj-$(CONFIG_MPC5121_ADS)  += mpc5121_ads.o
+obj-$(CONFIG_MPC5121_GENERIC)  += mpc5121_generic.o
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c 
b/arch/powerpc/platforms/512x/mpc5121_ads.c
index 50bd3a3..45bb2ef 100644
--- a/arch/powerpc/platforms/512x/mpc5121_ads.c
+++ b/arch/powerpc/platforms/512x/mpc5121_ads.c
@@ -15,7 +15,6 @@
 
 #include 
 #include 
-#include 
 #include 
 
 #include 
@@ -23,34 +22,7 @@
 #include 
 #include 
 
-/**
- * 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);
+#include "mpc512x.h"
 
 static struct of_device_id __initdata of_bus_ids[] = {
{ .name = "soc", },
@@ -68,20 +40,7 @@ static void __init 
mpc5121_ads_declare_of_platform_devices(void)
 
 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();
+   mpc512x_init_IRQ();
 }
 
 /*
diff --git a/arch/powerpc/platforms/512x/mpc5121_generic.c 
b/arch/powerpc/platforms/512x/mpc5121_generic.c
new file mode 100644
index 000..0111a98
--- /dev/null
+++ b/arch/powerpc/platforms/512x/mpc5121_generic.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2007,2008 Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * Author: John Rigby, <[EMAIL PROTECTED]>
+ *
+ * Description:
+ * MPC5121 SoC 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 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "mpc512x.h"
+
+static struct of_device_id __initdata of_bus_ids[] = {
+   { .name = "soc", },
+   { .name = "loca