4xx: Create common ppc4xx_reset_system() in ppc4xx_soc.c
Subsystems (2)
PATCH 1/1 4xx: Create common ppc4xx_reset_system() in ppc4xx_soc.c
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).
---
This patch applies to the linux-next tree of today (2008-03-27).
arch/powerpc/platforms/40x/ep405.c | 2 ++ arch/powerpc/platforms/40x/kilauea.c | 4 +++- arch/powerpc/platforms/40x/makalu.c | 2 ++ arch/powerpc/platforms/40x/virtex.c | 2 ++ arch/powerpc/platforms/40x/walnut.c | 4 +++- arch/powerpc/platforms/44x/44x.h | 1 - arch/powerpc/platforms/44x/Kconfig | 1 - arch/powerpc/platforms/44x/bamboo.c | 15 +++++++-------- arch/powerpc/platforms/44x/canyonlands.c | 5 ++--- arch/powerpc/platforms/44x/ebony.c | 5 ++--- arch/powerpc/platforms/44x/katmai.c | 5 ++--- arch/powerpc/platforms/44x/misc_44x.S | 11 ----------- arch/powerpc/platforms/44x/rainier.c | 4 ++-- arch/powerpc/platforms/44x/sequoia.c | 4 +--- arch/powerpc/platforms/44x/taishan.c | 5 ++--- arch/powerpc/platforms/44x/warp.c | 6 ++---- arch/powerpc/platforms/Kconfig.cputype | 2 ++ arch/powerpc/sysdev/ppc4xx_soc.c | 11 +++++++++++ include/asm-powerpc/ppc4xx.h | 18 ++++++++++++++++++ 19 files changed, 63 insertions(+), 44 deletions(-) create mode 100644 include/asm-powerpc/ppc4xx.h
arch/powerpc/platforms/40x/ep405.c +2 -0
@@ -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, };
arch/powerpc/platforms/40x/kilauea.c +3 -1
@@ -1,7 +1,7 @@/* * Kilauea board specific routines * -* Copyright 2007 DENX Software Engineering, Stefan Roese <[email protected]> +* Copyright 2007-2008 DENX Software Engineering, Stefan Roese <[email protected]> * * Based on the Walnut code by * Josh Boyer <[email protected]>
@@ -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, };
arch/powerpc/platforms/40x/makalu.c +2 -0
@@ -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, };
arch/powerpc/platforms/40x/virtex.c +2 -0
@@ -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, };
arch/powerpc/platforms/40x/walnut.c +3 -1
@@ -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, };
arch/powerpc/platforms/44x/44x.h +0 -1
@@ -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 */
arch/powerpc/platforms/44x/Kconfig +0 -1
@@ -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
arch/powerpc/platforms/44x/bamboo.c +7 -8
@@ -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, };
arch/powerpc/platforms/44x/canyonlands.c +2 -3
@@ -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, };
arch/powerpc/platforms/44x/ebony.c +2 -3
@@ -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, };
arch/powerpc/platforms/44x/katmai.c +2 -3
@@ -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, };
arch/powerpc/platforms/44x/misc_44x.S +0 -11
@@ -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 */
arch/powerpc/platforms/44x/rainier.c +2 -2
@@ -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, };
arch/powerpc/platforms/44x/sequoia.c +1 -3
@@ -23,8 +23,6 @@#include <asm/uic.h> #include <asm/pci-bridge.h> -#include "44x.h" -static __initdata struct of_device_id sequoia_of_bus[] = { { .compatible ="ibm,plb4" , }, { .compatible ="ibm,opb" , },
@@ -58,6 +56,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, };
arch/powerpc/platforms/44x/taishan.c +2 -3
@@ -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, };
arch/powerpc/platforms/44x/warp.c +2 -4
@@ -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, };
arch/powerpc/platforms/Kconfig.cputype +2 -0
@@ -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"
arch/powerpc/sysdev/ppc4xx_soc.c +11 -0
@@ -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 */ +}
include/asm-powerpc/ppc4xx.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* PPC4xx Prototypes and definitions +* +* Copyright 2008 DENX Software Engineering, Stefan Roese <[email protected]> +* +* 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__ */
Signature · 1 line
1.5.4.4
Quoted 4 lines · Stefan Roese
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.
Well... they're sort of common. The source looks the same, but the SPR number of DBCR0 is different on 40x and 44x, which is a potentially serious gotcha.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 9 lines · On Fri, 28 Mar 2008 10:56:18 +1100 David Gibson <[email protected]>…
Quoted 4 lines · Stefan Roese
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.Well... they're sort of common. The source looks the same, but the SPR number of DBCR0 is different on 40x and 44x, which is a potentially serious gotcha.
Except that since 40x and 44x should never be built into the same kernel. So the #defines for DBCR0 should be picked correctly from reg_booke.h.
I thought about that too, but I can't see where it will be an issue in practice.
josh
arch/powerpc/platforms/44x/sequoia.c line 27
Quoted 10 lines · On Thu, 27 Mar 2008 15:43:31 +0100 Stefan Roese <[email protected]> wrote:
arch/powerpc/platforms/44x/sequoia.c +0
-2@@ -23,8 +23,6 @@#include <asm/uic.h> #include <asm/pci-bridge.h> -#include "44x.h" -
Almost a perfect patch. Alas, missing a #include <asm/ppc4xx.h> which breaks the sequoia build.
I'll fix it up locally :).
josh
Quoted 11 lines · Josh Boyer
On Thu, 27 Mar 2008 15:43:31 +0100
Quoted 8 lines · Stefan Roese
(quoted diff) +0
-0
b/arch/powerpc/platforms/44x/sequoia.cindex d279db4..1782d41 100644arch/powerpc/platforms/44x/sequoia.c +0
-0@@ -23,8 +23,6 @@#include <asm/uic.h> #include <asm/pci-bridge.h>
Quoted 7 lines
arch/powerpc/platforms/44x/sequoia.c line 27
Quoted 2 lines
arch/powerpc/platforms/44x/sequoia.c +0
-2-#include "44x.h" -Almost a perfect patch. Alas, missing a #include <
asm/ppc4xx.h> which breaks the sequoia build.I'll fix it up locally :).
Thanks Josh. I missed that one.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================