spi-topcliff-pch: add recovery processing in case wait-event timeout
[zen-stable.git] / arch / powerpc / platforms / wsp / smp.c
blob0ba103ae83a53c5218c5517227e942bf800753ba
1 /*
2 * SMP Support for A2 platforms
4 * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
13 #include <linux/cpumask.h>
14 #include <linux/init.h>
15 #include <linux/kernel.h>
16 #include <linux/of.h>
17 #include <linux/smp.h>
19 #include <asm/dbell.h>
20 #include <asm/machdep.h>
21 #include <asm/xics.h>
23 #include "ics.h"
24 #include "wsp.h"
26 static void __devinit smp_a2_setup_cpu(int cpu)
28 doorbell_setup_this_cpu();
30 if (cpu != boot_cpuid)
31 xics_setup_cpu();
34 int __devinit smp_a2_kick_cpu(int nr)
36 const char *enable_method;
37 struct device_node *np;
38 int thr_idx;
40 if (nr < 0 || nr >= NR_CPUS)
41 return -ENOENT;
43 np = of_get_cpu_node(nr, &thr_idx);
44 if (!np)
45 return -ENODEV;
47 enable_method = of_get_property(np, "enable-method", NULL);
48 pr_devel("CPU%d has enable-method: \"%s\"\n", nr, enable_method);
50 if (!enable_method) {
51 printk(KERN_ERR "CPU%d has no enable-method\n", nr);
52 return -ENOENT;
53 } else if (strcmp(enable_method, "ibm,a2-scom") == 0) {
54 if (a2_scom_startup_cpu(nr, thr_idx, np))
55 return -1;
56 } else {
57 printk(KERN_ERR "CPU%d: Don't understand enable-method \"%s\"\n",
58 nr, enable_method);
59 return -EINVAL;
63 * The processor is currently spinning, waiting for the
64 * cpu_start field to become non-zero After we set cpu_start,
65 * the processor will continue on to secondary_start
67 paca[nr].cpu_start = 1;
69 return 0;
72 static int __init smp_a2_probe(void)
74 return num_possible_cpus();
77 static struct smp_ops_t a2_smp_ops = {
78 .message_pass = NULL, /* Use smp_muxed_ipi_message_pass */
79 .cause_ipi = doorbell_cause_ipi,
80 .probe = smp_a2_probe,
81 .kick_cpu = smp_a2_kick_cpu,
82 .setup_cpu = smp_a2_setup_cpu,
85 void __init a2_setup_smp(void)
87 smp_ops = &a2_smp_ops;