Path: blob/master/arch/powerpc/platforms/embedded6xx/gamecube.c
10818 views
/*1* arch/powerpc/platforms/embedded6xx/gamecube.c2*3* Nintendo GameCube board-specific support4* Copyright (C) 2004-2009 The GameCube Linux Team5* Copyright (C) 2007,2008,2009 Albert Herranz6*7* This program is free software; you can redistribute it and/or8* modify it under the terms of the GNU General Public License9* as published by the Free Software Foundation; either version 210* of the License, or (at your option) any later version.11*12*/1314#include <linux/kernel.h>15#include <linux/init.h>16#include <linux/irq.h>17#include <linux/kexec.h>18#include <linux/seq_file.h>19#include <linux/of_platform.h>2021#include <asm/io.h>22#include <asm/machdep.h>23#include <asm/prom.h>24#include <asm/time.h>25#include <asm/udbg.h>2627#include "flipper-pic.h"28#include "usbgecko_udbg.h"293031static void gamecube_spin(void)32{33/* spin until power button pressed */34for (;;)35cpu_relax();36}3738static void gamecube_restart(char *cmd)39{40local_irq_disable();41flipper_platform_reset();42gamecube_spin();43}4445static void gamecube_power_off(void)46{47local_irq_disable();48gamecube_spin();49}5051static void gamecube_halt(void)52{53gamecube_restart(NULL);54}5556static void __init gamecube_init_early(void)57{58ug_udbg_init();59}6061static int __init gamecube_probe(void)62{63unsigned long dt_root;6465dt_root = of_get_flat_dt_root();66if (!of_flat_dt_is_compatible(dt_root, "nintendo,gamecube"))67return 0;6869return 1;70}7172static void gamecube_shutdown(void)73{74flipper_quiesce();75}7677define_machine(gamecube) {78.name = "gamecube",79.probe = gamecube_probe,80.init_early = gamecube_init_early,81.restart = gamecube_restart,82.power_off = gamecube_power_off,83.halt = gamecube_halt,84.init_IRQ = flipper_pic_probe,85.get_irq = flipper_pic_get_irq,86.calibrate_decr = generic_calibrate_decr,87.progress = udbg_progress,88.machine_shutdown = gamecube_shutdown,89};909192static struct of_device_id gamecube_of_bus[] = {93{ .compatible = "nintendo,flipper", },94{ },95};9697static int __init gamecube_device_probe(void)98{99if (!machine_is(gamecube))100return 0;101102of_platform_bus_probe(NULL, gamecube_of_bus, NULL);103return 0;104}105device_initcall(gamecube_device_probe);106107108109