Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gamecube.c
Go to the documentation of this file.
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 {
43  gamecube_spin();
44 }
45 
46 static void gamecube_power_off(void)
47 {
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 {
76 }
77 
78 define_machine(gamecube) {
79  .name = "gamecube",
80  .probe = gamecube_probe,
81  .init_early = gamecube_init_early,
82  .restart = gamecube_restart,
83  .power_off = gamecube_power_off,
84  .halt = gamecube_halt,
85  .init_IRQ = flipper_pic_probe,
86  .get_irq = flipper_pic_get_irq,
87  .calibrate_decr = generic_calibrate_decr,
88  .progress = udbg_progress,
89  .machine_shutdown = gamecube_shutdown,
90 };
91 
92 
93 static struct of_device_id gamecube_of_bus[] = {
94  { .compatible = "nintendo,flipper", },
95  { },
96 };
97 
98 static int __init gamecube_device_probe(void)
99 {
100  if (!machine_is(gamecube))
101  return 0;
102 
103  of_platform_bus_probe(NULL, gamecube_of_bus, NULL);
104  return 0;
105 }
106 device_initcall(gamecube_device_probe);
107