gamecube.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * arch/powerpc/platforms/embedded6xx/gamecube.c
  4. *
  5. * Nintendo GameCube board-specific support
  6. * Copyright (C) 2004-2009 The GameCube Linux Team
  7. * Copyright (C) 2007,2008,2009 Albert Herranz
  8. */
  9. #include <linux/kernel.h>
  10. #include <linux/init.h>
  11. #include <linux/irq.h>
  12. #include <linux/kexec.h>
  13. #include <linux/seq_file.h>
  14. #include <linux/of_platform.h>
  15. #include <asm/io.h>
  16. #include <asm/machdep.h>
  17. #include <asm/time.h>
  18. #include <asm/udbg.h>
  19. #include "flipper-pic.h"
  20. #include "usbgecko_udbg.h"
  21. static void __noreturn gamecube_spin(void)
  22. {
  23. /* spin until power button pressed */
  24. for (;;)
  25. cpu_relax();
  26. }
  27. static void __noreturn gamecube_restart(char *cmd)
  28. {
  29. local_irq_disable();
  30. flipper_platform_reset();
  31. gamecube_spin();
  32. }
  33. static void gamecube_power_off(void)
  34. {
  35. local_irq_disable();
  36. gamecube_spin();
  37. }
  38. static void __noreturn gamecube_halt(void)
  39. {
  40. gamecube_restart(NULL);
  41. }
  42. static int __init gamecube_probe(void)
  43. {
  44. pm_power_off = gamecube_power_off;
  45. ug_udbg_init();
  46. return 1;
  47. }
  48. static void gamecube_shutdown(void)
  49. {
  50. flipper_quiesce();
  51. }
  52. define_machine(gamecube) {
  53. .name = "gamecube",
  54. .compatible = "nintendo,gamecube",
  55. .probe = gamecube_probe,
  56. .restart = gamecube_restart,
  57. .halt = gamecube_halt,
  58. .init_IRQ = flipper_pic_probe,
  59. .get_irq = flipper_pic_get_irq,
  60. .progress = udbg_progress,
  61. .machine_shutdown = gamecube_shutdown,
  62. };
  63. static const struct of_device_id gamecube_of_bus[] = {
  64. { .compatible = "nintendo,flipper", },
  65. { },
  66. };
  67. static int __init gamecube_device_probe(void)
  68. {
  69. of_platform_bus_probe(NULL, gamecube_of_bus, NULL);
  70. return 0;
  71. }
  72. machine_device_initcall(gamecube, gamecube_device_probe);