diff options
author | Albert Herranz <albert_herranz@yahoo.es> | 2009-12-12 01:31:42 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2009-12-13 00:24:28 -0500 |
commit | e90d71d0f52fb3d619b96ba92b7614fed7cb819e (patch) | |
tree | 8b9243e0b494d158c3a6834137177c1d69159641 | |
parent | 028ee972f032b636b5776b779c0f085ba9cfd30f (diff) |
powerpc: gamecube: platform support
Add platform support for the Nintendo GameCube video game console.
Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r-- | arch/powerpc/platforms/embedded6xx/Kconfig | 8 | ||||
-rw-r--r-- | arch/powerpc/platforms/embedded6xx/Makefile | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/embedded6xx/gamecube.c | 118 |
3 files changed, 127 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig index 464e4147ad63..e318ced39e72 100644 --- a/arch/powerpc/platforms/embedded6xx/Kconfig +++ b/arch/powerpc/platforms/embedded6xx/Kconfig | |||
@@ -107,3 +107,11 @@ config USBGECKO_UDBG | |||
107 | 107 | ||
108 | If in doubt, say N here. | 108 | If in doubt, say N here. |
109 | 109 | ||
110 | config GAMECUBE | ||
111 | bool "Nintendo-GameCube" | ||
112 | depends on EMBEDDED6xx | ||
113 | select GAMECUBE_COMMON | ||
114 | help | ||
115 | Select GAMECUBE if configuring for the Nintendo GameCube. | ||
116 | More information at: <http://gc-linux.sourceforge.net/> | ||
117 | |||
diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/platforms/embedded6xx/Makefile index b80f47cf4412..9365edda2977 100644 --- a/arch/powerpc/platforms/embedded6xx/Makefile +++ b/arch/powerpc/platforms/embedded6xx/Makefile | |||
@@ -9,3 +9,4 @@ obj-$(CONFIG_PPC_PRPMC2800) += prpmc2800.o | |||
9 | obj-$(CONFIG_PPC_C2K) += c2k.o | 9 | obj-$(CONFIG_PPC_C2K) += c2k.o |
10 | obj-$(CONFIG_USBGECKO_UDBG) += usbgecko_udbg.o | 10 | obj-$(CONFIG_USBGECKO_UDBG) += usbgecko_udbg.o |
11 | obj-$(CONFIG_GAMECUBE_COMMON) += flipper-pic.o | 11 | obj-$(CONFIG_GAMECUBE_COMMON) += flipper-pic.o |
12 | obj-$(CONFIG_GAMECUBE) += gamecube.o | ||
diff --git a/arch/powerpc/platforms/embedded6xx/gamecube.c b/arch/powerpc/platforms/embedded6xx/gamecube.c new file mode 100644 index 000000000000..1106fd99627f --- /dev/null +++ b/arch/powerpc/platforms/embedded6xx/gamecube.c | |||
@@ -0,0 +1,118 @@ | |||
1 | /* | ||
2 | * arch/powerpc/platforms/embedded6xx/gamecube.c | ||
3 | * | ||
4 | * Nintendo GameCube board-specific support | ||
5 | * Copyright (C) 2004-2009 The GameCube Linux Team | ||
6 | * Copyright (C) 2007,2008,2009 Albert Herranz | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version 2 | ||
11 | * of the License, or (at your option) any later version. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/irq.h> | ||
18 | #include <linux/kexec.h> | ||
19 | #include <linux/seq_file.h> | ||
20 | #include <linux/of_platform.h> | ||
21 | |||
22 | #include <asm/io.h> | ||
23 | #include <asm/machdep.h> | ||
24 | #include <asm/prom.h> | ||
25 | #include <asm/time.h> | ||
26 | #include <asm/udbg.h> | ||
27 | |||
28 | #include "flipper-pic.h" | ||
29 | #include "usbgecko_udbg.h" | ||
30 | |||
31 | |||
32 | static void gamecube_spin(void) | ||
33 | { | ||
34 | /* spin until power button pressed */ | ||
35 | for (;;) | ||
36 | cpu_relax(); | ||
37 | } | ||
38 | |||
39 | static void gamecube_restart(char *cmd) | ||
40 | { | ||
41 | local_irq_disable(); | ||
42 | flipper_platform_reset(); | ||
43 | gamecube_spin(); | ||
44 | } | ||
45 | |||
46 | static void gamecube_power_off(void) | ||
47 | { | ||
48 | local_irq_disable(); | ||
49 | gamecube_spin(); | ||
50 | } | ||
51 | |||
52 | static void gamecube_halt(void) | ||
53 | { | ||
54 | gamecube_restart(NULL); | ||
55 | } | ||
56 | |||
57 | static void __init gamecube_init_early(void) | ||
58 | { | ||
59 | ug_udbg_init(); | ||
60 | } | ||
61 | |||
62 | static int __init gamecube_probe(void) | ||
63 | { | ||
64 | unsigned long dt_root; | ||
65 | |||
66 | dt_root = of_get_flat_dt_root(); | ||
67 | if (!of_flat_dt_is_compatible(dt_root, "nintendo,gamecube")) | ||
68 | return 0; | ||
69 | |||
70 | return 1; | ||
71 | } | ||
72 | |||
73 | static void gamecube_shutdown(void) | ||
74 | { | ||
75 | flipper_quiesce(); | ||
76 | } | ||
77 | |||
78 | #ifdef CONFIG_KEXEC | ||
79 | static int gamecube_kexec_prepare(struct kimage *image) | ||
80 | { | ||
81 | return 0; | ||
82 | } | ||
83 | #endif /* CONFIG_KEXEC */ | ||
84 | |||
85 | |||
86 | define_machine(gamecube) { | ||
87 | .name = "gamecube", | ||
88 | .probe = gamecube_probe, | ||
89 | .init_early = gamecube_init_early, | ||
90 | .restart = gamecube_restart, | ||
91 | .power_off = gamecube_power_off, | ||
92 | .halt = gamecube_halt, | ||
93 | .init_IRQ = flipper_pic_probe, | ||
94 | .get_irq = flipper_pic_get_irq, | ||
95 | .calibrate_decr = generic_calibrate_decr, | ||
96 | .progress = udbg_progress, | ||
97 | .machine_shutdown = gamecube_shutdown, | ||
98 | #ifdef CONFIG_KEXEC | ||
99 | .machine_kexec_prepare = gamecube_kexec_prepare, | ||
100 | #endif | ||
101 | }; | ||
102 | |||
103 | |||
104 | static struct of_device_id gamecube_of_bus[] = { | ||
105 | { .compatible = "nintendo,flipper", }, | ||
106 | { }, | ||
107 | }; | ||
108 | |||
109 | static int __init gamecube_device_probe(void) | ||
110 | { | ||
111 | if (!machine_is(gamecube)) | ||
112 | return 0; | ||
113 | |||
114 | of_platform_bus_probe(NULL, gamecube_of_bus, NULL); | ||
115 | return 0; | ||
116 | } | ||
117 | device_initcall(gamecube_device_probe); | ||
118 | |||