David Gibson | a1d0d98 | 2011-04-14 22:32:06 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2008-2011, IBM Corporation |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version |
| 7 | * 2 of the License, or (at your option) any later version. |
| 8 | */ |
| 9 | |
| 10 | #include <linux/delay.h> |
| 11 | #include <linux/init.h> |
| 12 | #include <linux/irq.h> |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/mm.h> |
| 15 | #include <linux/of.h> |
| 16 | #include <linux/smp.h> |
Jimi Xenidis | cc35b67 | 2011-09-30 04:26:13 +0000 | [diff] [blame] | 17 | #include <linux/time.h> |
David Gibson | a1d0d98 | 2011-04-14 22:32:06 +0000 | [diff] [blame] | 18 | |
| 19 | #include <asm/machdep.h> |
| 20 | #include <asm/system.h> |
David Gibson | a1d0d98 | 2011-04-14 22:32:06 +0000 | [diff] [blame] | 21 | #include <asm/udbg.h> |
| 22 | |
| 23 | #include "ics.h" |
| 24 | #include "wsp.h" |
| 25 | |
| 26 | |
| 27 | static void psr2_spin(void) |
| 28 | { |
| 29 | hard_irq_disable(); |
Jimi Xenidis | cc35b67 | 2011-09-30 04:26:13 +0000 | [diff] [blame] | 30 | for (;;) |
| 31 | continue; |
David Gibson | a1d0d98 | 2011-04-14 22:32:06 +0000 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | static void psr2_restart(char *cmd) |
| 35 | { |
| 36 | psr2_spin(); |
| 37 | } |
| 38 | |
David Gibson | a1d0d98 | 2011-04-14 22:32:06 +0000 | [diff] [blame] | 39 | static int __init psr2_probe(void) |
| 40 | { |
| 41 | unsigned long root = of_get_flat_dt_root(); |
| 42 | |
Jimi Xenidis | cc35b67 | 2011-09-30 04:26:13 +0000 | [diff] [blame] | 43 | if (of_flat_dt_is_compatible(root, "ibm,wsp-chroma")) { |
| 44 | /* chroma systems also claim they are psr2s */ |
| 45 | return 0; |
| 46 | } |
| 47 | |
David Gibson | a1d0d98 | 2011-04-14 22:32:06 +0000 | [diff] [blame] | 48 | if (!of_flat_dt_is_compatible(root, "ibm,psr2")) |
| 49 | return 0; |
| 50 | |
| 51 | return 1; |
| 52 | } |
| 53 | |
David Gibson | a1d0d98 | 2011-04-14 22:32:06 +0000 | [diff] [blame] | 54 | define_machine(psr2_md) { |
| 55 | .name = "PSR2 A2", |
| 56 | .probe = psr2_probe, |
Jimi Xenidis | cc35b67 | 2011-09-30 04:26:13 +0000 | [diff] [blame] | 57 | .setup_arch = wsp_setup_arch, |
David Gibson | a1d0d98 | 2011-04-14 22:32:06 +0000 | [diff] [blame] | 58 | .restart = psr2_restart, |
| 59 | .power_off = psr2_spin, |
| 60 | .halt = psr2_spin, |
| 61 | .calibrate_decr = generic_calibrate_decr, |
Jimi Xenidis | cc35b67 | 2011-09-30 04:26:13 +0000 | [diff] [blame] | 62 | .init_IRQ = wsp_setup_irq, |
David Gibson | a1d0d98 | 2011-04-14 22:32:06 +0000 | [diff] [blame] | 63 | .progress = udbg_progress, |
| 64 | .power_save = book3e_idle, |
| 65 | }; |
Jimi Xenidis | cc35b67 | 2011-09-30 04:26:13 +0000 | [diff] [blame] | 66 | |
| 67 | machine_arch_initcall(psr2_md, wsp_probe_devices); |