diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2005-05-23 02:54:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-23 14:51:24 -0400 |
commit | f10d20c1f192aa90fc935207f22da32462e793ee (patch) | |
tree | 0aac03c010745c6cb499a34a96de259480f05a64 /arch | |
parent | e16fa6b9d2ad9467cf5bdf517e6b6f45e5867ad6 (diff) |
[PATCH] ppc64: Fix g5 hw timebase sync
The hardware sync of the timebase on SMP G5s uses a black magic
incantation to the i2c clock chip that was inspired from what Darwin
does.
However, this was an earlier version of Darwin that was ... buggy !
heh. This causes the latest models to break though when starting SMP,
so it's worth fixing.
Here's a new version of the incantation based on careful transcription
of the said incantations as found in the latest version of apple's
temple.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ppc64/kernel/pmac_smp.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/arch/ppc64/kernel/pmac_smp.c b/arch/ppc64/kernel/pmac_smp.c index c27588ede2fe..a23de37227bf 100644 --- a/arch/ppc64/kernel/pmac_smp.c +++ b/arch/ppc64/kernel/pmac_smp.c | |||
@@ -68,6 +68,7 @@ extern struct smp_ops_t *smp_ops; | |||
68 | 68 | ||
69 | static void (*pmac_tb_freeze)(int freeze); | 69 | static void (*pmac_tb_freeze)(int freeze); |
70 | static struct device_node *pmac_tb_clock_chip_host; | 70 | static struct device_node *pmac_tb_clock_chip_host; |
71 | static u8 pmac_tb_pulsar_addr; | ||
71 | static DEFINE_SPINLOCK(timebase_lock); | 72 | static DEFINE_SPINLOCK(timebase_lock); |
72 | static unsigned long timebase; | 73 | static unsigned long timebase; |
73 | 74 | ||
@@ -106,12 +107,9 @@ static void smp_core99_pulsar_tb_freeze(int freeze) | |||
106 | u8 data; | 107 | u8 data; |
107 | int rc; | 108 | int rc; |
108 | 109 | ||
109 | /* Strangely, the device-tree says address is 0xd2, but darwin | ||
110 | * accesses 0xd0 ... | ||
111 | */ | ||
112 | pmac_low_i2c_setmode(pmac_tb_clock_chip_host, pmac_low_i2c_mode_combined); | 110 | pmac_low_i2c_setmode(pmac_tb_clock_chip_host, pmac_low_i2c_mode_combined); |
113 | rc = pmac_low_i2c_xfer(pmac_tb_clock_chip_host, | 111 | rc = pmac_low_i2c_xfer(pmac_tb_clock_chip_host, |
114 | 0xd4 | pmac_low_i2c_read, | 112 | pmac_tb_pulsar_addr | pmac_low_i2c_read, |
115 | 0x2e, &data, 1); | 113 | 0x2e, &data, 1); |
116 | if (rc != 0) | 114 | if (rc != 0) |
117 | goto bail; | 115 | goto bail; |
@@ -120,7 +118,7 @@ static void smp_core99_pulsar_tb_freeze(int freeze) | |||
120 | 118 | ||
121 | pmac_low_i2c_setmode(pmac_tb_clock_chip_host, pmac_low_i2c_mode_stdsub); | 119 | pmac_low_i2c_setmode(pmac_tb_clock_chip_host, pmac_low_i2c_mode_stdsub); |
122 | rc = pmac_low_i2c_xfer(pmac_tb_clock_chip_host, | 120 | rc = pmac_low_i2c_xfer(pmac_tb_clock_chip_host, |
123 | 0xd4 | pmac_low_i2c_write, | 121 | pmac_tb_pulsar_addr | pmac_low_i2c_write, |
124 | 0x2e, &data, 1); | 122 | 0x2e, &data, 1); |
125 | bail: | 123 | bail: |
126 | if (rc != 0) { | 124 | if (rc != 0) { |
@@ -185,6 +183,12 @@ static int __init smp_core99_probe(void) | |||
185 | if (ncpus <= 1) | 183 | if (ncpus <= 1) |
186 | return 1; | 184 | return 1; |
187 | 185 | ||
186 | /* HW sync only on these platforms */ | ||
187 | if (!machine_is_compatible("PowerMac7,2") && | ||
188 | !machine_is_compatible("PowerMac7,3") && | ||
189 | !machine_is_compatible("RackMac3,1")) | ||
190 | goto nohwsync; | ||
191 | |||
188 | /* Look for the clock chip */ | 192 | /* Look for the clock chip */ |
189 | for (cc = NULL; (cc = of_find_node_by_name(cc, "i2c-hwclock")) != NULL;) { | 193 | for (cc = NULL; (cc = of_find_node_by_name(cc, "i2c-hwclock")) != NULL;) { |
190 | struct device_node *p = of_get_parent(cc); | 194 | struct device_node *p = of_get_parent(cc); |
@@ -198,11 +202,18 @@ static int __init smp_core99_probe(void) | |||
198 | goto next; | 202 | goto next; |
199 | switch (*reg) { | 203 | switch (*reg) { |
200 | case 0xd2: | 204 | case 0xd2: |
201 | pmac_tb_freeze = smp_core99_cypress_tb_freeze; | 205 | if (device_is_compatible(cc, "pulsar-legacy-slewing")) { |
202 | printk(KERN_INFO "Timebase clock is Cypress chip\n"); | 206 | pmac_tb_freeze = smp_core99_pulsar_tb_freeze; |
207 | pmac_tb_pulsar_addr = 0xd2; | ||
208 | printk(KERN_INFO "Timebase clock is Pulsar chip\n"); | ||
209 | } else if (device_is_compatible(cc, "cy28508")) { | ||
210 | pmac_tb_freeze = smp_core99_cypress_tb_freeze; | ||
211 | printk(KERN_INFO "Timebase clock is Cypress chip\n"); | ||
212 | } | ||
203 | break; | 213 | break; |
204 | case 0xd4: | 214 | case 0xd4: |
205 | pmac_tb_freeze = smp_core99_pulsar_tb_freeze; | 215 | pmac_tb_freeze = smp_core99_pulsar_tb_freeze; |
216 | pmac_tb_pulsar_addr = 0xd4; | ||
206 | printk(KERN_INFO "Timebase clock is Pulsar chip\n"); | 217 | printk(KERN_INFO "Timebase clock is Pulsar chip\n"); |
207 | break; | 218 | break; |
208 | } | 219 | } |
@@ -210,12 +221,15 @@ static int __init smp_core99_probe(void) | |||
210 | pmac_tb_clock_chip_host = p; | 221 | pmac_tb_clock_chip_host = p; |
211 | smp_ops->give_timebase = smp_core99_give_timebase; | 222 | smp_ops->give_timebase = smp_core99_give_timebase; |
212 | smp_ops->take_timebase = smp_core99_take_timebase; | 223 | smp_ops->take_timebase = smp_core99_take_timebase; |
224 | of_node_put(cc); | ||
225 | of_node_put(p); | ||
213 | break; | 226 | break; |
214 | } | 227 | } |
215 | next: | 228 | next: |
216 | of_node_put(p); | 229 | of_node_put(p); |
217 | } | 230 | } |
218 | 231 | ||
232 | nohwsync: | ||
219 | mpic_request_ipis(); | 233 | mpic_request_ipis(); |
220 | 234 | ||
221 | return ncpus; | 235 | return ncpus; |