[POWERPC] 4xx: Create common ppc4xx_reset_system() in ppc4xx_soc.c
authorStefan Roese <sr@denx.de>
Thu, 27 Mar 2008 14:43:31 +0000 (01:43 +1100)
committerJosh Boyer <jwboyer@linux.vnet.ibm.com>
Thu, 3 Apr 2008 01:44:56 +0000 (20:44 -0500)
This patch creates a common system reset routine for all 40x and 44x
systems. Previously only a 44x routine existed. But since this system
reset via the debug control register is common for 40x and 44x let's
share this code for all those platforms in ppc4xx_soc.c.

This patch also enables CONFIG_4xx_SOC for all 40x and 44x platforms.

Tested on Kilauea (405EX) and Canyonlands (440EX).

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
19 files changed:
arch/powerpc/platforms/40x/ep405.c
arch/powerpc/platforms/40x/kilauea.c
arch/powerpc/platforms/40x/makalu.c
arch/powerpc/platforms/40x/virtex.c
arch/powerpc/platforms/40x/walnut.c
arch/powerpc/platforms/44x/44x.h
arch/powerpc/platforms/44x/Kconfig
arch/powerpc/platforms/44x/bamboo.c
arch/powerpc/platforms/44x/canyonlands.c
arch/powerpc/platforms/44x/ebony.c
arch/powerpc/platforms/44x/katmai.c
arch/powerpc/platforms/44x/misc_44x.S
arch/powerpc/platforms/44x/rainier.c
arch/powerpc/platforms/44x/sequoia.c
arch/powerpc/platforms/44x/taishan.c
arch/powerpc/platforms/44x/warp.c
arch/powerpc/platforms/Kconfig.cputype
arch/powerpc/sysdev/ppc4xx_soc.c
include/asm-powerpc/ppc4xx.h [new file with mode: 0644]

index 13d1345026daebff6f8e1eb55662157d93aee9f0..ae2e7f67c18ecc794af053472fa208000ebed328 100644 (file)
@@ -29,6 +29,7 @@
 #include <asm/time.h>
 #include <asm/uic.h>
 #include <asm/pci-bridge.h>
+#include <asm/ppc4xx.h>
 
 static struct device_node *bcsr_node;
 static void __iomem *bcsr_regs;
@@ -119,5 +120,6 @@ define_machine(ep405) {
        .progress               = udbg_progress,
        .init_IRQ               = uic_init_tree,
        .get_irq                = uic_get_irq,
+       .restart                = ppc4xx_reset_system,
        .calibrate_decr         = generic_calibrate_decr,
 };
index f9206a7fede08f51b1e5823245379564869ed931..1dd24ffc0dc1d07496ac4898f748adc0b6e4ceb6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Kilauea board specific routines
  *
- * Copyright 2007 DENX Software Engineering, Stefan Roese <sr@denx.de>
+ * Copyright 2007-2008 DENX Software Engineering, Stefan Roese <sr@denx.de>
  *
  * Based on the Walnut code by
  * Josh Boyer <jwboyer@linux.vnet.ibm.com>
@@ -20,6 +20,7 @@
 #include <asm/time.h>
 #include <asm/uic.h>
 #include <asm/pci-bridge.h>
+#include <asm/ppc4xx.h>
 
 static __initdata struct of_device_id kilauea_of_bus[] = {
        { .compatible = "ibm,plb4", },
@@ -54,5 +55,6 @@ define_machine(kilauea) {
        .progress                       = udbg_progress,
        .init_IRQ                       = uic_init_tree,
        .get_irq                        = uic_get_irq,
+       .restart                        = ppc4xx_reset_system,
        .calibrate_decr                 = generic_calibrate_decr,
 };
index 4e4df72fc9cd79ea3a5fec664cdd4c84aef46161..a6a1d6017b7191497e0c6e94a3e124e35b820786 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/time.h>
 #include <asm/uic.h>
 #include <asm/pci-bridge.h>
+#include <asm/ppc4xx.h>
 
 static __initdata struct of_device_id makalu_of_bus[] = {
        { .compatible = "ibm,plb4", },
@@ -54,5 +55,6 @@ define_machine(makalu) {
        .progress                       = udbg_progress,
        .init_IRQ                       = uic_init_tree,
        .get_irq                        = uic_get_irq,
+       .restart                        = ppc4xx_reset_system,
        .calibrate_decr                 = generic_calibrate_decr,
 };
index 0422590040db5dbf12468db78624dab41f69adb5..fc7fb001276ce6ae6606440a34ed216eab0a91ec 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/prom.h>
 #include <asm/time.h>
 #include <asm/xilinx_intc.h>
+#include <asm/ppc4xx.h>
 
 static struct of_device_id xilinx_of_bus_ids[] __initdata = {
        { .compatible = "xlnx,plb-v46-1.00.a", },
@@ -48,5 +49,6 @@ define_machine(virtex) {
        .probe                  = virtex_probe,
        .init_IRQ               = xilinx_intc_init_tree,
        .get_irq                = xilinx_intc_get_irq,
+       .restart                = ppc4xx_reset_system,
        .calibrate_decr         = generic_calibrate_decr,
 };
index b8b257efeb773aaa0c3ee8b642088670c82db7e0..335df91fbee58e9e0430fe54649d3810ff70ae85 100644 (file)
@@ -26,6 +26,7 @@
 #include <asm/time.h>
 #include <asm/uic.h>
 #include <asm/pci-bridge.h>
+#include <asm/ppc4xx.h>
 
 static __initdata struct of_device_id walnut_of_bus[] = {
        { .compatible = "ibm,plb3", },
@@ -61,5 +62,6 @@ define_machine(walnut) {
        .progress               = udbg_progress,
        .init_IRQ               = uic_init_tree,
        .get_irq                = uic_get_irq,
-       .calibrate_decr = generic_calibrate_decr,
+       .restart                = ppc4xx_reset_system,
+       .calibrate_decr         = generic_calibrate_decr,
 };
index 42eabf87fea3e65d833f715b55c9f808e544289a..dbc4d2b4301abef2791c646f8a597689361fda6f 100644 (file)
@@ -3,6 +3,5 @@
 
 extern u8 as1_readb(volatile u8 __iomem  *addr);
 extern void as1_writeb(u8 data, volatile u8 __iomem *addr);
-extern void ppc44x_reset_system(char *cmd);
 
 #endif /* __POWERPC_PLATFORMS_44X_44X_H */
index 5fc28aa459e356553c224b728ad832ae6244638d..6abe91357eee742afbeb5efc32472064339c7aff 100644 (file)
@@ -129,7 +129,6 @@ config 440GP
 
 config 440GX
        bool
-       select 4xx_SOC
        select IBM_NEW_EMAC_EMAC4
        select IBM_NEW_EMAC_RGMII
        select IBM_NEW_EMAC_ZMII #test only
index fb9a22a7e8d085c18dc5ada58067207541947b57..cef169e9515612d78a94884380084f3dc824e088 100644 (file)
@@ -22,8 +22,7 @@
 #include <asm/time.h>
 #include <asm/uic.h>
 #include <asm/pci-bridge.h>
-
-#include "44x.h"
+#include <asm/ppc4xx.h>
 
 static __initdata struct of_device_id bamboo_of_bus[] = {
        { .compatible = "ibm,plb4", },
@@ -53,11 +52,11 @@ static int __init bamboo_probe(void)
 }
 
 define_machine(bamboo) {
-       .name                           = "Bamboo",
-       .probe                          = bamboo_probe,
-       .progress                       = udbg_progress,
-       .init_IRQ                       = uic_init_tree,
-       .get_irq                        = uic_get_irq,
-       .restart                        = ppc44x_reset_system,
+       .name                   = "Bamboo",
+       .probe                  = bamboo_probe,
+       .progress               = udbg_progress,
+       .init_IRQ               = uic_init_tree,
+       .get_irq                = uic_get_irq,
+       .restart                = ppc4xx_reset_system,
        .calibrate_decr         = generic_calibrate_decr,
 };
index dac5b32036963e07a90953bec20d49ba7c29edfd..3949289f51dfa7e1b90999e4669c780597020b5a 100644 (file)
@@ -23,8 +23,7 @@
 #include <asm/time.h>
 #include <asm/uic.h>
 #include <asm/pci-bridge.h>
-
-#include "44x.h"
+#include <asm/ppc4xx.h>
 
 static __initdata struct of_device_id canyonlands_of_bus[] = {
        { .compatible = "ibm,plb4", },
@@ -59,6 +58,6 @@ define_machine(canyonlands) {
        .progress                       = udbg_progress,
        .init_IRQ                       = uic_init_tree,
        .get_irq                        = uic_get_irq,
-       .restart                        = ppc44x_reset_system,
+       .restart                        = ppc4xx_reset_system,
        .calibrate_decr                 = generic_calibrate_decr,
 };
index 1a8d467bff8522fd1db5d8c3c5f2d10bb40bd0df..a0e8fe4662f61246ab02f8d7c668453d5ca2a676 100644 (file)
@@ -26,8 +26,7 @@
 #include <asm/time.h>
 #include <asm/uic.h>
 #include <asm/pci-bridge.h>
-
-#include "44x.h"
+#include <asm/ppc4xx.h>
 
 static __initdata struct of_device_id ebony_of_bus[] = {
        { .compatible = "ibm,plb4", },
@@ -66,6 +65,6 @@ define_machine(ebony) {
        .progress               = udbg_progress,
        .init_IRQ               = uic_init_tree,
        .get_irq                = uic_get_irq,
-       .restart                = ppc44x_reset_system,
+       .restart                = ppc4xx_reset_system,
        .calibrate_decr         = generic_calibrate_decr,
 };
index 11134121f272d36f33687d84091cadb0bc078017..44f4b3a00cedee98206e2e1ec563a31de564d590 100644 (file)
@@ -22,8 +22,7 @@
 #include <asm/time.h>
 #include <asm/uic.h>
 #include <asm/pci-bridge.h>
-
-#include "44x.h"
+#include <asm/ppc4xx.h>
 
 static __initdata struct of_device_id katmai_of_bus[] = {
        { .compatible = "ibm,plb4", },
@@ -58,6 +57,6 @@ define_machine(katmai) {
        .progress                       = udbg_progress,
        .init_IRQ                       = uic_init_tree,
        .get_irq                        = uic_get_irq,
-       .restart                        = ppc44x_reset_system,
+       .restart                        = ppc4xx_reset_system,
        .calibrate_decr                 = generic_calibrate_decr,
 };
index 3bce71d5d75632b6e96bad53922a6af5cf00168d..dc12b8009e48f49e7f6114bfeacaba4533fc4a99 100644 (file)
@@ -44,14 +44,3 @@ _GLOBAL(as1_writeb)
        sync
        isync
        blr
-
-/*
- * void ppc44x_reset_system(char *cmd)
- *
- * At present, this routine just applies a system reset.
- */
-_GLOBAL(ppc44x_reset_system)
-       mfspr   r13,SPRN_DBCR0
-       oris    r13,r13,DBCR0_RST_SYSTEM@h
-       mtspr   SPRN_DBCR0,r13
-       b       .                       /* Just in case the reset doesn't work */
index a7fae1cf69c1cdd76cf116543c51a4136c2d8b65..4f1ff84c4b6366e2ceb291c56284dc014a243d42 100644 (file)
@@ -22,7 +22,7 @@
 #include <asm/time.h>
 #include <asm/uic.h>
 #include <asm/pci-bridge.h>
-#include "44x.h"
+#include <asm/ppc4xx.h>
 
 static __initdata struct of_device_id rainier_of_bus[] = {
        { .compatible = "ibm,plb4", },
@@ -57,6 +57,6 @@ define_machine(rainier) {
        .progress                       = udbg_progress,
        .init_IRQ                       = uic_init_tree,
        .get_irq                        = uic_get_irq,
-       .restart                        = ppc44x_reset_system,
+       .restart                        = ppc4xx_reset_system,
        .calibrate_decr                 = generic_calibrate_decr,
 };
index d279db42c896d1f0c0532f38abd611d2131b96d8..49eb73daacdfbdb8e89773371a2fa71b33482772 100644 (file)
@@ -23,7 +23,7 @@
 #include <asm/uic.h>
 #include <asm/pci-bridge.h>
 
-#include "44x.h"
+#include <asm/ppc4xx.h>
 
 static __initdata struct of_device_id sequoia_of_bus[] = {
        { .compatible = "ibm,plb4", },
@@ -58,6 +58,6 @@ define_machine(sequoia) {
        .progress                       = udbg_progress,
        .init_IRQ                       = uic_init_tree,
        .get_irq                        = uic_get_irq,
-       .restart                        = ppc44x_reset_system,
+       .restart                        = ppc4xx_reset_system,
        .calibrate_decr                 = generic_calibrate_decr,
 };
index 28ab7e2e02c391b024292b560180bd060aef5116..49c78b2098b428579ad09f9e98a4f572eadd516c 100644 (file)
@@ -29,8 +29,7 @@
 #include <asm/time.h>
 #include <asm/uic.h>
 #include <asm/pci-bridge.h>
-
-#include "44x.h"
+#include <asm/ppc4xx.h>
 
 static __initdata struct of_device_id taishan_of_bus[] = {
        { .compatible = "ibm,plb4", },
@@ -68,6 +67,6 @@ define_machine(taishan) {
        .progress               = udbg_progress,
        .init_IRQ               = uic_init_tree,
        .get_irq                = uic_get_irq,
-       .restart                = ppc44x_reset_system,
+       .restart                = ppc4xx_reset_system,
        .calibrate_decr         = generic_calibrate_decr,
 };
index da5b7b7599dbc3d0a19b649630d8e2d6fcc739ae..39cf6150a72b2701af6eb62348ce364b3d88ce26 100644 (file)
@@ -18,9 +18,7 @@
 #include <asm/udbg.h>
 #include <asm/time.h>
 #include <asm/uic.h>
-
-#include "44x.h"
-
+#include <asm/ppc4xx.h>
 
 static __initdata struct of_device_id warp_of_bus[] = {
        { .compatible = "ibm,plb4", },
@@ -49,7 +47,7 @@ define_machine(warp) {
        .progress       = udbg_progress,
        .init_IRQ       = uic_init_tree,
        .get_irq        = uic_get_irq,
-       .restart        = ppc44x_reset_system,
+       .restart        = ppc4xx_reset_system,
        .calibrate_decr = generic_calibrate_decr,
 };
 
index 0c3face0ddbb4d78010e1efcbd12569e8343e25c..5fc7fac10e938515c24c6cb157a6944b746ccf2b 100644 (file)
@@ -41,11 +41,13 @@ config 40x
        bool "AMCC 40x"
        select PPC_DCR_NATIVE
        select PPC_UDBG_16550
+       select 4xx_SOC
 
 config 44x
        bool "AMCC 44x"
        select PPC_DCR_NATIVE
        select PPC_UDBG_16550
+       select 4xx_SOC
 
 config E200
        bool "Freescale e200"
index 4b8617e443146bf215cc7d926e394b8a823ece22..5b32adc9a9b249a3ae49392ce26d9e0c0c755fe1 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <asm/dcr.h>
 #include <asm/dcr-regs.h>
+#include <asm/reg.h>
 
 static u32 dcrbase_l2c;
 
@@ -187,3 +188,13 @@ static int __init ppc4xx_l2c_probe(void)
        return 0;
 }
 arch_initcall(ppc4xx_l2c_probe);
+
+/*
+ * At present, this routine just applies a system reset.
+ */
+void ppc4xx_reset_system(char *cmd)
+{
+       mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_RST_SYSTEM);
+       while (1)
+               ;       /* Just in case the reset doesn't work */
+}
diff --git a/include/asm-powerpc/ppc4xx.h b/include/asm-powerpc/ppc4xx.h
new file mode 100644 (file)
index 0000000..033039a
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * PPC4xx Prototypes and definitions
+ *
+ * Copyright 2008 DENX Software Engineering, Stefan Roese <sr@denx.de>
+ *
+ * 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_PPC4xx_H__
+#define __ASM_POWERPC_PPC4xx_H__
+
+extern void ppc4xx_reset_system(char *cmd);
+
+#endif /* __ASM_POWERPC_PPC4xx_H__ */