board-dt.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Gemini Device Tree boot support
  4. */
  5. #include <linux/kernel.h>
  6. #include <linux/init.h>
  7. #include <linux/io.h>
  8. #include <asm/mach/arch.h>
  9. #include <asm/mach/map.h>
  10. #include <asm/system_misc.h>
  11. #include <asm/proc-fns.h>
  12. #ifdef CONFIG_DEBUG_GEMINI
  13. /* This is needed for LL-debug/earlyprintk/debug-macro.S */
  14. static struct map_desc gemini_io_desc[] __initdata = {
  15. {
  16. .virtual = CONFIG_DEBUG_UART_VIRT,
  17. .pfn = __phys_to_pfn(CONFIG_DEBUG_UART_PHYS),
  18. .length = SZ_4K,
  19. .type = MT_DEVICE,
  20. },
  21. };
  22. static void __init gemini_map_io(void)
  23. {
  24. iotable_init(gemini_io_desc, ARRAY_SIZE(gemini_io_desc));
  25. }
  26. #else
  27. #define gemini_map_io NULL
  28. #endif
  29. static void gemini_idle(void)
  30. {
  31. /*
  32. * Because of broken hardware we have to enable interrupts or the CPU
  33. * will never wakeup... Acctualy it is not very good to enable
  34. * interrupts first since scheduler can miss a tick, but there is
  35. * no other way around this. Platforms that needs it for power saving
  36. * should enable it in init code, since by default it is
  37. * disabled.
  38. */
  39. /* FIXME: Enabling interrupts here is racy! */
  40. local_irq_enable();
  41. cpu_do_idle();
  42. }
  43. static void __init gemini_init_machine(void)
  44. {
  45. arm_pm_idle = gemini_idle;
  46. }
  47. static const char *gemini_board_compat[] = {
  48. "cortina,gemini",
  49. NULL,
  50. };
  51. DT_MACHINE_START(GEMINI_DT, "Gemini (Device Tree)")
  52. .map_io = gemini_map_io,
  53. .init_machine = gemini_init_machine,
  54. .dt_compat = gemini_board_compat,
  55. MACHINE_END