aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-10-22 18:45:23 -0400
committerPaul Mackerras <paulus@samba.org>2007-10-22 18:45:23 -0400
commit3cfa8f6c542467bd046aedb9d2e394b3d0e8467f (patch)
treefe8e6c5e4ad1bfb51bc1896b6dd8f616f266eb76 /arch
parent55b70a0300b873c0ec7ea6e33752af56f41250ce (diff)
parent9dda78b711ca4d507251a7e896b2f41ec019fc58 (diff)
Merge branch 'for-2.6.24' of git://git.secretlab.ca/git/linux-2.6-mpc52xx
Diffstat (limited to 'arch')
-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
5 files changed, 95 insertions, 41 deletions
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);