14 #define DRV_MODULE_NAME "wii"
15 #define pr_fmt(fmt) DRV_MODULE_NAME ": " fmt
17 #include <linux/kernel.h>
26 #include <asm/machdep.h>
36 #define HW_CTRL_COMPATIBLE "nintendo,hollywood-control"
38 #define HW_CTRL_RESETS 0x94
39 #define HW_CTRL_RESETS_SYS (1<<0)
42 #define HW_GPIO_COMPATIBLE "nintendo,hollywood-gpio"
44 #define HW_GPIO_BASE(idx) (idx * 0x20)
45 #define HW_GPIO_OUT(idx) (HW_GPIO_BASE(idx) + 0)
46 #define HW_GPIO_DIR(idx) (HW_GPIO_BASE(idx) + 4)
48 #define HW_GPIO_SHUTDOWN (1<<1)
49 #define HW_GPIO_SLOT_LED (1<<5)
50 #define HW_GPIO_SENSOR_BAR (1<<8)
60 static int __init page_aligned(
unsigned long x)
67 struct memblock_region *
p = memblock.memory.regions;
79 BUG_ON(memblock.memory.cnt != 2);
80 BUG_ON(!page_aligned(p[0].
base) || !page_aligned(p[1].base));
92 BUG_ON(memblock.memory.cnt != 1);
107 for (bl = 128<<10; bl <
max_size; bl <<= 1) {
115 static void wii_spin(
void)
131 pr_err(
"no compatible node found for %s\n", compatible);
136 pr_err(
"no valid reg found for %s\n", np->
name);
142 pr_info(
"%s at 0x%08x mapped to 0x%p\n", name,
152 static void __init wii_setup_arch(
void)
163 static void wii_restart(
char *
cmd)
174 static void wii_power_off(
void)
188 static void wii_halt(
void)
195 static void __init wii_init_early(
void)
200 static void __init wii_pic_probe(
void)
206 static int __init wii_probe(
void)
208 unsigned long dt_root;
210 dt_root = of_get_flat_dt_root();
211 if (!of_flat_dt_is_compatible(dt_root,
"nintendo,wii"))
217 static void wii_shutdown(
void)
226 .init_early = wii_init_early,
227 .setup_arch = wii_setup_arch,
228 .restart = wii_restart,
229 .power_off = wii_power_off,
231 .init_IRQ = wii_pic_probe,
235 .machine_shutdown = wii_shutdown,
239 { .compatible =
"nintendo,hollywood", },
243 static int __init wii_device_probe(
void)
245 if (!machine_is(wii))
248 of_platform_bus_probe(
NULL, wii_of_bus,
NULL);