aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorAnatolij Gustschin <agust@denx.de>2010-02-16 12:36:26 -0500
committerGrant Likely <grant.likely@secretlab.ca>2010-02-16 12:36:26 -0500
commita8dbceb755f82f760b56bac4283f9cfc7774e62b (patch)
treee67da86732c70100ecfa137ac99eba47ec64aa2b /arch/powerpc
parent284ed66fc3beca509a7549aae06af5c74023304c (diff)
powerpc/mpc5121: Add machine restart support
Add reset module registers representation and machine restart callback for mpc5121 platform. Signed-off-by: Piotr Ziecik <kosmo@semihalf.com> Signed-off-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Anatolij Gustschin <agust@denx.de> Reviewed-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/include/asm/mpc5121.h24
-rw-r--r--arch/powerpc/platforms/512x/mpc5121_ads.c1
-rw-r--r--arch/powerpc/platforms/512x/mpc5121_generic.c1
-rw-r--r--arch/powerpc/platforms/512x/mpc512x.h1
-rw-r--r--arch/powerpc/platforms/512x/mpc512x_shared.c30
5 files changed, 57 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/mpc5121.h b/arch/powerpc/include/asm/mpc5121.h
new file mode 100644
index 000000000000..e6a30bb1d16a
--- /dev/null
+++ b/arch/powerpc/include/asm/mpc5121.h
@@ -0,0 +1,24 @@
1/*
2 * MPC5121 Prototypes and definitions
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2.
6 */
7
8#ifndef __ASM_POWERPC_MPC5121_H__
9#define __ASM_POWERPC_MPC5121_H__
10
11/* MPC512x Reset module registers */
12struct mpc512x_reset_module {
13 u32 rcwlr; /* Reset Configuration Word Low Register */
14 u32 rcwhr; /* Reset Configuration Word High Register */
15 u32 reserved1;
16 u32 reserved2;
17 u32 rsr; /* Reset Status Register */
18 u32 rmr; /* Reset Mode Register */
19 u32 rpr; /* Reset Protection Register */
20 u32 rcr; /* Reset Control Register */
21 u32 rcer; /* Reset Control Enable Register */
22};
23
24#endif /* __ASM_POWERPC_MPC5121_H__ */
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c b/arch/powerpc/platforms/512x/mpc5121_ads.c
index 0f8f2e96ee55..ee6ae129c25c 100644
--- a/arch/powerpc/platforms/512x/mpc5121_ads.c
+++ b/arch/powerpc/platforms/512x/mpc5121_ads.c
@@ -68,4 +68,5 @@ define_machine(mpc5121_ads) {
68 .init_IRQ = mpc5121_ads_init_IRQ, 68 .init_IRQ = mpc5121_ads_init_IRQ,
69 .get_irq = ipic_get_irq, 69 .get_irq = ipic_get_irq,
70 .calibrate_decr = generic_calibrate_decr, 70 .calibrate_decr = generic_calibrate_decr,
71 .restart = mpc512x_restart,
71}; 72};
diff --git a/arch/powerpc/platforms/512x/mpc5121_generic.c b/arch/powerpc/platforms/512x/mpc5121_generic.c
index 9b8c9b0bedfb..a6c0e3a2615d 100644
--- a/arch/powerpc/platforms/512x/mpc5121_generic.c
+++ b/arch/powerpc/platforms/512x/mpc5121_generic.c
@@ -55,4 +55,5 @@ define_machine(mpc5121_generic) {
55 .init_IRQ = mpc512x_init_IRQ, 55 .init_IRQ = mpc512x_init_IRQ,
56 .get_irq = ipic_get_irq, 56 .get_irq = ipic_get_irq,
57 .calibrate_decr = generic_calibrate_decr, 57 .calibrate_decr = generic_calibrate_decr,
58 .restart = mpc512x_restart,
58}; 59};
diff --git a/arch/powerpc/platforms/512x/mpc512x.h b/arch/powerpc/platforms/512x/mpc512x.h
index ac3da1a0c4e5..b2daca0d1488 100644
--- a/arch/powerpc/platforms/512x/mpc512x.h
+++ b/arch/powerpc/platforms/512x/mpc512x.h
@@ -15,4 +15,5 @@ extern void __init mpc512x_init_IRQ(void);
15extern void __init mpc512x_init(void); 15extern void __init mpc512x_init(void);
16extern int __init mpc5121_clk_init(void); 16extern int __init mpc5121_clk_init(void);
17void __init mpc512x_declare_of_platform_devices(void); 17void __init mpc512x_declare_of_platform_devices(void);
18extern void mpc512x_restart(char *cmd);
18#endif /* __MPC512X_H__ */ 19#endif /* __MPC512X_H__ */
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c
index b683165a24e2..a45824af03fc 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -21,9 +21,38 @@
21#include <asm/ipic.h> 21#include <asm/ipic.h>
22#include <asm/prom.h> 22#include <asm/prom.h>
23#include <asm/time.h> 23#include <asm/time.h>
24#include <asm/mpc5121.h>
24 25
25#include "mpc512x.h" 26#include "mpc512x.h"
26 27
28static struct mpc512x_reset_module __iomem *reset_module_base;
29
30static void __init mpc512x_restart_init(void)
31{
32 struct device_node *np;
33
34 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-reset");
35 if (!np)
36 return;
37
38 reset_module_base = of_iomap(np, 0);
39 of_node_put(np);
40}
41
42void mpc512x_restart(char *cmd)
43{
44 if (reset_module_base) {
45 /* Enable software reset "RSTE" */
46 out_be32(&reset_module_base->rpr, 0x52535445);
47 /* Set software hard reset */
48 out_be32(&reset_module_base->rcr, 0x2);
49 } else {
50 pr_err("Restart module not mapped.\n");
51 }
52 for (;;)
53 ;
54}
55
27void __init mpc512x_init_IRQ(void) 56void __init mpc512x_init_IRQ(void)
28{ 57{
29 struct device_node *np; 58 struct device_node *np;
@@ -62,4 +91,5 @@ void __init mpc512x_init(void)
62{ 91{
63 mpc512x_declare_of_platform_devices(); 92 mpc512x_declare_of_platform_devices();
64 mpc5121_clk_init(); 93 mpc5121_clk_init();
94 mpc512x_restart_init();
65} 95}