aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/powerpc/mpc52xx-device-tree-bindings.txt4
-rw-r--r--arch/powerpc/boot/dts/lite5200.dts26
-rw-r--r--arch/powerpc/boot/dts/lite5200b.dts26
-rw-r--r--arch/powerpc/platforms/52xx/lite5200.c4
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_common.c71
-rw-r--r--arch/powerpc/sysdev/bestcomm/bestcomm.c9
-rw-r--r--drivers/watchdog/mpc5200_wdt.c3
-rw-r--r--include/asm-powerpc/mpc52xx.h9
8 files changed, 109 insertions, 43 deletions
diff --git a/Documentation/powerpc/mpc52xx-device-tree-bindings.txt b/Documentation/powerpc/mpc52xx-device-tree-bindings.txt
index 5f7d536cb0c6..5e03610e186f 100644
--- a/Documentation/powerpc/mpc52xx-device-tree-bindings.txt
+++ b/Documentation/powerpc/mpc52xx-device-tree-bindings.txt
@@ -185,7 +185,7 @@ bestcomm@<addr> dma-controller mpc5200-bestcomm 5200 pic also requires
185Recommended soc5200 child nodes; populate as needed for your board 185Recommended soc5200 child nodes; populate as needed for your board
186name device_type compatible Description 186name device_type compatible Description
187---- ----------- ---------- ----------- 187---- ----------- ---------- -----------
188gpt@<addr> gpt mpc5200-gpt General purpose timers 188gpt@<addr> gpt fsl,mpc5200-gpt General purpose timers
189rtc@<addr> rtc mpc5200-rtc Real time clock 189rtc@<addr> rtc mpc5200-rtc Real time clock
190mscan@<addr> mscan mpc5200-mscan CAN bus controller 190mscan@<addr> mscan mpc5200-mscan CAN bus controller
191pci@<addr> pci mpc5200-pci PCI bridge 191pci@<addr> pci mpc5200-pci PCI bridge
@@ -213,7 +213,7 @@ cell-index int When multiple devices are present, is the
2135) General Purpose Timer nodes (child of soc5200 node) 2135) General Purpose Timer nodes (child of soc5200 node)
214On the mpc5200 and 5200b, GPT0 has a watchdog timer function. If the board 214On the mpc5200 and 5200b, GPT0 has a watchdog timer function. If the board
215design supports the internal wdt, then the device node for GPT0 should 215design supports the internal wdt, then the device node for GPT0 should
216include the empty property 'has-wdt'. 216include the empty property 'fsl,has-wdt'.
217 217
2186) PSC nodes (child of soc5200 node) 2186) PSC nodes (child of soc5200 node)
219PSC nodes can define the optional 'port-number' property to force assignment 219PSC nodes can define the optional 'port-number' property to force assignment
diff --git a/arch/powerpc/boot/dts/lite5200.dts b/arch/powerpc/boot/dts/lite5200.dts
index bc45f5fbb060..6731763f0282 100644
--- a/arch/powerpc/boot/dts/lite5200.dts
+++ b/arch/powerpc/boot/dts/lite5200.dts
@@ -70,18 +70,16 @@
70 }; 70 };
71 71
72 gpt@600 { // General Purpose Timer 72 gpt@600 { // General Purpose Timer
73 compatible = "mpc5200-gpt"; 73 compatible = "fsl,mpc5200-gpt";
74 device_type = "gpt";
75 cell-index = <0>; 74 cell-index = <0>;
76 reg = <600 10>; 75 reg = <600 10>;
77 interrupts = <1 9 0>; 76 interrupts = <1 9 0>;
78 interrupt-parent = <&mpc5200_pic>; 77 interrupt-parent = <&mpc5200_pic>;
79 has-wdt; 78 fsl,has-wdt;
80 }; 79 };
81 80
82 gpt@610 { // General Purpose Timer 81 gpt@610 { // General Purpose Timer
83 compatible = "mpc5200-gpt"; 82 compatible = "fsl,mpc5200-gpt";
84 device_type = "gpt";
85 cell-index = <1>; 83 cell-index = <1>;
86 reg = <610 10>; 84 reg = <610 10>;
87 interrupts = <1 a 0>; 85 interrupts = <1 a 0>;
@@ -89,8 +87,7 @@
89 }; 87 };
90 88
91 gpt@620 { // General Purpose Timer 89 gpt@620 { // General Purpose Timer
92 compatible = "mpc5200-gpt"; 90 compatible = "fsl,mpc5200-gpt";
93 device_type = "gpt";
94 cell-index = <2>; 91 cell-index = <2>;
95 reg = <620 10>; 92 reg = <620 10>;
96 interrupts = <1 b 0>; 93 interrupts = <1 b 0>;
@@ -98,8 +95,7 @@
98 }; 95 };
99 96
100 gpt@630 { // General Purpose Timer 97 gpt@630 { // General Purpose Timer
101 compatible = "mpc5200-gpt"; 98 compatible = "fsl,mpc5200-gpt";
102 device_type = "gpt";
103 cell-index = <3>; 99 cell-index = <3>;
104 reg = <630 10>; 100 reg = <630 10>;
105 interrupts = <1 c 0>; 101 interrupts = <1 c 0>;
@@ -107,8 +103,7 @@
107 }; 103 };
108 104
109 gpt@640 { // General Purpose Timer 105 gpt@640 { // General Purpose Timer
110 compatible = "mpc5200-gpt"; 106 compatible = "fsl,mpc5200-gpt";
111 device_type = "gpt";
112 cell-index = <4>; 107 cell-index = <4>;
113 reg = <640 10>; 108 reg = <640 10>;
114 interrupts = <1 d 0>; 109 interrupts = <1 d 0>;
@@ -116,8 +111,7 @@
116 }; 111 };
117 112
118 gpt@650 { // General Purpose Timer 113 gpt@650 { // General Purpose Timer
119 compatible = "mpc5200-gpt"; 114 compatible = "fsl,mpc5200-gpt";
120 device_type = "gpt";
121 cell-index = <5>; 115 cell-index = <5>;
122 reg = <650 10>; 116 reg = <650 10>;
123 interrupts = <1 e 0>; 117 interrupts = <1 e 0>;
@@ -125,8 +119,7 @@
125 }; 119 };
126 120
127 gpt@660 { // General Purpose Timer 121 gpt@660 { // General Purpose Timer
128 compatible = "mpc5200-gpt"; 122 compatible = "fsl,mpc5200-gpt";
129 device_type = "gpt";
130 cell-index = <6>; 123 cell-index = <6>;
131 reg = <660 10>; 124 reg = <660 10>;
132 interrupts = <1 f 0>; 125 interrupts = <1 f 0>;
@@ -134,8 +127,7 @@
134 }; 127 };
135 128
136 gpt@670 { // General Purpose Timer 129 gpt@670 { // General Purpose Timer
137 compatible = "mpc5200-gpt"; 130 compatible = "fsl,mpc5200-gpt";
138 device_type = "gpt";
139 cell-index = <7>; 131 cell-index = <7>;
140 reg = <670 10>; 132 reg = <670 10>;
141 interrupts = <1 10 0>; 133 interrupts = <1 10 0>;
diff --git a/arch/powerpc/boot/dts/lite5200b.dts b/arch/powerpc/boot/dts/lite5200b.dts
index 6582c9a39b27..b540388c608c 100644
--- a/arch/powerpc/boot/dts/lite5200b.dts
+++ b/arch/powerpc/boot/dts/lite5200b.dts
@@ -70,18 +70,16 @@
70 }; 70 };
71 71
72 gpt@600 { // General Purpose Timer 72 gpt@600 { // General Purpose Timer
73 compatible = "mpc5200b-gpt","mpc5200-gpt"; 73 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
74 device_type = "gpt";
75 cell-index = <0>; 74 cell-index = <0>;
76 reg = <600 10>; 75 reg = <600 10>;
77 interrupts = <1 9 0>; 76 interrupts = <1 9 0>;
78 interrupt-parent = <&mpc5200_pic>; 77 interrupt-parent = <&mpc5200_pic>;
79 has-wdt; 78 fsl,has-wdt;
80 }; 79 };
81 80
82 gpt@610 { // General Purpose Timer 81 gpt@610 { // General Purpose Timer
83 compatible = "mpc5200b-gpt","mpc5200-gpt"; 82 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
84 device_type = "gpt";
85 cell-index = <1>; 83 cell-index = <1>;
86 reg = <610 10>; 84 reg = <610 10>;
87 interrupts = <1 a 0>; 85 interrupts = <1 a 0>;
@@ -89,8 +87,7 @@
89 }; 87 };
90 88
91 gpt@620 { // General Purpose Timer 89 gpt@620 { // General Purpose Timer
92 compatible = "mpc5200b-gpt","mpc5200-gpt"; 90 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
93 device_type = "gpt";
94 cell-index = <2>; 91 cell-index = <2>;
95 reg = <620 10>; 92 reg = <620 10>;
96 interrupts = <1 b 0>; 93 interrupts = <1 b 0>;
@@ -98,8 +95,7 @@
98 }; 95 };
99 96
100 gpt@630 { // General Purpose Timer 97 gpt@630 { // General Purpose Timer
101 compatible = "mpc5200b-gpt","mpc5200-gpt"; 98 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
102 device_type = "gpt";
103 cell-index = <3>; 99 cell-index = <3>;
104 reg = <630 10>; 100 reg = <630 10>;
105 interrupts = <1 c 0>; 101 interrupts = <1 c 0>;
@@ -107,8 +103,7 @@
107 }; 103 };
108 104
109 gpt@640 { // General Purpose Timer 105 gpt@640 { // General Purpose Timer
110 compatible = "mpc5200b-gpt","mpc5200-gpt"; 106 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
111 device_type = "gpt";
112 cell-index = <4>; 107 cell-index = <4>;
113 reg = <640 10>; 108 reg = <640 10>;
114 interrupts = <1 d 0>; 109 interrupts = <1 d 0>;
@@ -116,8 +111,7 @@
116 }; 111 };
117 112
118 gpt@650 { // General Purpose Timer 113 gpt@650 { // General Purpose Timer
119 compatible = "mpc5200b-gpt","mpc5200-gpt"; 114 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
120 device_type = "gpt";
121 cell-index = <5>; 115 cell-index = <5>;
122 reg = <650 10>; 116 reg = <650 10>;
123 interrupts = <1 e 0>; 117 interrupts = <1 e 0>;
@@ -125,8 +119,7 @@
125 }; 119 };
126 120
127 gpt@660 { // General Purpose Timer 121 gpt@660 { // General Purpose Timer
128 compatible = "mpc5200b-gpt","mpc5200-gpt"; 122 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
129 device_type = "gpt";
130 cell-index = <6>; 123 cell-index = <6>;
131 reg = <660 10>; 124 reg = <660 10>;
132 interrupts = <1 f 0>; 125 interrupts = <1 f 0>;
@@ -134,8 +127,7 @@
134 }; 127 };
135 128
136 gpt@670 { // General Purpose Timer 129 gpt@670 { // General Purpose Timer
137 compatible = "mpc5200b-gpt","mpc5200-gpt"; 130 compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
138 device_type = "gpt";
139 cell-index = <7>; 131 cell-index = <7>;
140 reg = <670 10>; 132 reg = <670 10>;
141 interrupts = <1 10 0>; 133 interrupts = <1 10 0>;
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index 65b7ae426238..25d2bfa3d9dc 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -145,6 +145,9 @@ static void __init lite5200_setup_arch(void)
145 /* Some mpc5200 & mpc5200b related configuration */ 145 /* Some mpc5200 & mpc5200b related configuration */
146 mpc5200_setup_xlb_arbiter(); 146 mpc5200_setup_xlb_arbiter();
147 147
148 /* Map wdt for mpc52xx_restart() */
149 mpc52xx_map_wdt();
150
148#ifdef CONFIG_PM 151#ifdef CONFIG_PM
149 mpc52xx_suspend.board_suspend_prepare = lite5200_suspend_prepare; 152 mpc52xx_suspend.board_suspend_prepare = lite5200_suspend_prepare;
150 mpc52xx_suspend.board_resume_finish = lite5200_resume_finish; 153 mpc52xx_suspend.board_resume_finish = lite5200_resume_finish;
@@ -183,5 +186,6 @@ define_machine(lite5200) {
183 .init = mpc52xx_declare_of_platform_devices, 186 .init = mpc52xx_declare_of_platform_devices,
184 .init_IRQ = mpc52xx_init_irq, 187 .init_IRQ = mpc52xx_init_irq,
185 .get_irq = mpc52xx_get_irq, 188 .get_irq = mpc52xx_get_irq,
189 .restart = mpc52xx_restart,
186 .calibrate_decr = generic_calibrate_decr, 190 .calibrate_decr = generic_calibrate_decr,
187}; 191};
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 3bc201e07e6b..9850685c5429 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -18,15 +18,20 @@
18#include <asm/prom.h> 18#include <asm/prom.h>
19#include <asm/mpc52xx.h> 19#include <asm/mpc52xx.h>
20 20
21/*
22 * This variable is mapped in mpc52xx_map_wdt() and used in mpc52xx_restart().
23 * Permanent mapping is required because mpc52xx_restart() can be called
24 * from interrupt context while node mapping (which calls ioremap())
25 * cannot be used at such point.
26 */
27static volatile struct mpc52xx_gpt *mpc52xx_wdt = NULL;
21 28
22void __iomem * 29static void __iomem *
23mpc52xx_find_and_map(const char *compatible) 30mpc52xx_map_node(struct device_node *ofn)
24{ 31{
25 struct device_node *ofn;
26 const u32 *regaddr_p; 32 const u32 *regaddr_p;
27 u64 regaddr64, size64; 33 u64 regaddr64, size64;
28 34
29 ofn = of_find_compatible_node(NULL, NULL, compatible);
30 if (!ofn) 35 if (!ofn)
31 return NULL; 36 return NULL;
32 37
@@ -42,8 +47,23 @@ mpc52xx_find_and_map(const char *compatible)
42 47
43 return ioremap((u32)regaddr64, (u32)size64); 48 return ioremap((u32)regaddr64, (u32)size64);
44} 49}
50
51void __iomem *
52mpc52xx_find_and_map(const char *compatible)
53{
54 return mpc52xx_map_node(
55 of_find_compatible_node(NULL, NULL, compatible));
56}
57
45EXPORT_SYMBOL(mpc52xx_find_and_map); 58EXPORT_SYMBOL(mpc52xx_find_and_map);
46 59
60void __iomem *
61mpc52xx_find_and_map_path(const char *path)
62{
63 return mpc52xx_map_node(of_find_node_by_path(path));
64}
65
66EXPORT_SYMBOL(mpc52xx_find_and_map_path);
47 67
48/** 68/**
49 * mpc52xx_find_ipb_freq - Find the IPB bus frequency for a device 69 * mpc52xx_find_ipb_freq - Find the IPB bus frequency for a device
@@ -113,3 +133,46 @@ mpc52xx_declare_of_platform_devices(void)
113 "Error while probing of_platform bus\n"); 133 "Error while probing of_platform bus\n");
114} 134}
115 135
136void __init
137mpc52xx_map_wdt(void)
138{
139 const void *has_wdt;
140 struct device_node *np;
141
142 /* mpc52xx_wdt is mapped here and used in mpc52xx_restart,
143 * possibly from a interrupt context. wdt is only implement
144 * on a gpt0, so check has-wdt property before mapping.
145 */
146 for_each_compatible_node(np, NULL, "fsl,mpc5200-gpt") {
147 has_wdt = of_get_property(np, "fsl,has-wdt", NULL);
148 if (has_wdt) {
149 mpc52xx_wdt = mpc52xx_map_node(np);
150 return;
151 }
152 }
153 for_each_compatible_node(np, NULL, "mpc5200-gpt") {
154 has_wdt = of_get_property(np, "has-wdt", NULL);
155 if (has_wdt) {
156 mpc52xx_wdt = mpc52xx_map_node(np);
157 return;
158 }
159 }
160}
161
162void
163mpc52xx_restart(char *cmd)
164{
165 local_irq_disable();
166
167 /* Turn on the watchdog and wait for it to expire.
168 * It effectively does a reset. */
169 if (mpc52xx_wdt) {
170 out_be32(&mpc52xx_wdt->mode, 0x00000000);
171 out_be32(&mpc52xx_wdt->count, 0x000000ff);
172 out_be32(&mpc52xx_wdt->mode, 0x00009004);
173 } else
174 printk("mpc52xx_restart: Can't access wdt. "
175 "Restart impossible, system halted.\n");
176
177 while (1);
178}
diff --git a/arch/powerpc/sysdev/bestcomm/bestcomm.c b/arch/powerpc/sysdev/bestcomm/bestcomm.c
index 48492a83e5a7..740ad73ce5cc 100644
--- a/arch/powerpc/sysdev/bestcomm/bestcomm.c
+++ b/arch/powerpc/sysdev/bestcomm/bestcomm.c
@@ -269,6 +269,7 @@ bcom_engine_init(void)
269 int task; 269 int task;
270 phys_addr_t tdt_pa, ctx_pa, var_pa, fdt_pa; 270 phys_addr_t tdt_pa, ctx_pa, var_pa, fdt_pa;
271 unsigned int tdt_size, ctx_size, var_size, fdt_size; 271 unsigned int tdt_size, ctx_size, var_size, fdt_size;
272 u16 regval;
272 273
273 /* Allocate & clear SRAM zones for FDT, TDTs, contexts and vars/incs */ 274 /* Allocate & clear SRAM zones for FDT, TDTs, contexts and vars/incs */
274 tdt_size = BCOM_MAX_TASKS * sizeof(struct bcom_tdt); 275 tdt_size = BCOM_MAX_TASKS * sizeof(struct bcom_tdt);
@@ -319,9 +320,11 @@ bcom_engine_init(void)
319 /* Init 'always' initiator */ 320 /* Init 'always' initiator */
320 out_8(&bcom_eng->regs->ipr[BCOM_INITIATOR_ALWAYS], BCOM_IPR_ALWAYS); 321 out_8(&bcom_eng->regs->ipr[BCOM_INITIATOR_ALWAYS], BCOM_IPR_ALWAYS);
321 322
322 /* Disable COMM Bus Prefetch, apparently it's not reliable yet */ 323 /* Disable COMM Bus Prefetch on the original 5200; it's broken */
323 /* FIXME: This should be done on 5200 and not 5200B ... */ 324 if ((mfspr(SPRN_SVR) & MPC5200_SVR_MASK) == MPC5200_SVR) {
324 out_be16(&bcom_eng->regs->PtdCntrl, in_be16(&bcom_eng->regs->PtdCntrl) | 1); 325 regval = in_be16(&bcom_eng->regs->PtdCntrl);
326 out_be16(&bcom_eng->regs->PtdCntrl, regval | 1);
327 }
325 328
326 /* Init lock */ 329 /* Init lock */
327 spin_lock_init(&bcom_eng->lock); 330 spin_lock_init(&bcom_eng->lock);
diff --git a/drivers/watchdog/mpc5200_wdt.c b/drivers/watchdog/mpc5200_wdt.c
index 9cfb97576623..11f6a111e75b 100644
--- a/drivers/watchdog/mpc5200_wdt.c
+++ b/drivers/watchdog/mpc5200_wdt.c
@@ -176,6 +176,8 @@ static int mpc5200_wdt_probe(struct of_device *op, const struct of_device_id *ma
176 176
177 has_wdt = of_get_property(op->node, "has-wdt", NULL); 177 has_wdt = of_get_property(op->node, "has-wdt", NULL);
178 if (!has_wdt) 178 if (!has_wdt)
179 has_wdt = of_get_property(op->node, "fsl,has-wdt", NULL);
180 if (!has_wdt)
179 return -ENODEV; 181 return -ENODEV;
180 182
181 wdt = kzalloc(sizeof(*wdt), GFP_KERNEL); 183 wdt = kzalloc(sizeof(*wdt), GFP_KERNEL);
@@ -254,6 +256,7 @@ static int mpc5200_wdt_shutdown(struct of_device *op)
254 256
255static struct of_device_id mpc5200_wdt_match[] = { 257static struct of_device_id mpc5200_wdt_match[] = {
256 { .compatible = "mpc5200-gpt", }, 258 { .compatible = "mpc5200-gpt", },
259 { .compatible = "fsl,mpc5200-gpt", },
257 {}, 260 {},
258}; 261};
259static struct of_platform_driver mpc5200_wdt_driver = { 262static struct of_platform_driver mpc5200_wdt_driver = {
diff --git a/include/asm-powerpc/mpc52xx.h b/include/asm-powerpc/mpc52xx.h
index 568135fe52ea..fcb2ebbfddbc 100644
--- a/include/asm-powerpc/mpc52xx.h
+++ b/include/asm-powerpc/mpc52xx.h
@@ -20,6 +20,11 @@
20 20
21#include <linux/suspend.h> 21#include <linux/suspend.h>
22 22
23/* Variants of the 5200(B) */
24#define MPC5200_SVR 0x80110010
25#define MPC5200_SVR_MASK 0xfffffff0
26#define MPC5200B_SVR 0x80110020
27#define MPC5200B_SVR_MASK 0xfffffff0
23 28
24/* ======================================================================== */ 29/* ======================================================================== */
25/* Structures mapping of some unit register set */ 30/* Structures mapping of some unit register set */
@@ -244,6 +249,7 @@ struct mpc52xx_cdm {
244#ifndef __ASSEMBLY__ 249#ifndef __ASSEMBLY__
245 250
246extern void __iomem * mpc52xx_find_and_map(const char *); 251extern void __iomem * mpc52xx_find_and_map(const char *);
252extern void __iomem * mpc52xx_find_and_map_path(const char *path);
247extern unsigned int mpc52xx_find_ipb_freq(struct device_node *node); 253extern unsigned int mpc52xx_find_ipb_freq(struct device_node *node);
248extern void mpc5200_setup_xlb_arbiter(void); 254extern void mpc5200_setup_xlb_arbiter(void);
249extern void mpc52xx_declare_of_platform_devices(void); 255extern void mpc52xx_declare_of_platform_devices(void);
@@ -253,6 +259,9 @@ extern unsigned int mpc52xx_get_irq(void);
253 259
254extern int __init mpc52xx_add_bridge(struct device_node *node); 260extern int __init mpc52xx_add_bridge(struct device_node *node);
255 261
262extern void __init mpc52xx_map_wdt(void);
263extern void mpc52xx_restart(char *cmd);
264
256#endif /* __ASSEMBLY__ */ 265#endif /* __ASSEMBLY__ */
257 266
258#ifdef CONFIG_PM 267#ifdef CONFIG_PM