1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
241d9830cSLinus Walleij /*
341d9830cSLinus Walleij * Gemini Device Tree boot support
441d9830cSLinus Walleij */
541d9830cSLinus Walleij #include <linux/kernel.h>
641d9830cSLinus Walleij #include <linux/init.h>
741d9830cSLinus Walleij #include <linux/io.h>
841d9830cSLinus Walleij
941d9830cSLinus Walleij #include <asm/mach/arch.h>
1041d9830cSLinus Walleij #include <asm/mach/map.h>
116dbb708aSLinus Walleij #include <asm/system_misc.h>
126dbb708aSLinus Walleij #include <asm/proc-fns.h>
1341d9830cSLinus Walleij
1441d9830cSLinus Walleij #ifdef CONFIG_DEBUG_GEMINI
1541d9830cSLinus Walleij /* This is needed for LL-debug/earlyprintk/debug-macro.S */
1641d9830cSLinus Walleij static struct map_desc gemini_io_desc[] __initdata = {
1741d9830cSLinus Walleij {
1841d9830cSLinus Walleij .virtual = CONFIG_DEBUG_UART_VIRT,
1941d9830cSLinus Walleij .pfn = __phys_to_pfn(CONFIG_DEBUG_UART_PHYS),
2041d9830cSLinus Walleij .length = SZ_4K,
2141d9830cSLinus Walleij .type = MT_DEVICE,
2241d9830cSLinus Walleij },
2341d9830cSLinus Walleij };
2441d9830cSLinus Walleij
gemini_map_io(void)2541d9830cSLinus Walleij static void __init gemini_map_io(void)
2641d9830cSLinus Walleij {
2741d9830cSLinus Walleij iotable_init(gemini_io_desc, ARRAY_SIZE(gemini_io_desc));
2841d9830cSLinus Walleij }
2941d9830cSLinus Walleij #else
3041d9830cSLinus Walleij #define gemini_map_io NULL
3141d9830cSLinus Walleij #endif
3241d9830cSLinus Walleij
gemini_idle(void)336dbb708aSLinus Walleij static void gemini_idle(void)
346dbb708aSLinus Walleij {
356dbb708aSLinus Walleij /*
366dbb708aSLinus Walleij * Because of broken hardware we have to enable interrupts or the CPU
376dbb708aSLinus Walleij * will never wakeup... Acctualy it is not very good to enable
386dbb708aSLinus Walleij * interrupts first since scheduler can miss a tick, but there is
396dbb708aSLinus Walleij * no other way around this. Platforms that needs it for power saving
406dbb708aSLinus Walleij * should enable it in init code, since by default it is
416dbb708aSLinus Walleij * disabled.
426dbb708aSLinus Walleij */
436dbb708aSLinus Walleij
446dbb708aSLinus Walleij /* FIXME: Enabling interrupts here is racy! */
45*89b30987SPeter Zijlstra raw_local_irq_enable();
466dbb708aSLinus Walleij cpu_do_idle();
47*89b30987SPeter Zijlstra raw_local_irq_disable();
486dbb708aSLinus Walleij }
496dbb708aSLinus Walleij
gemini_init_machine(void)506dbb708aSLinus Walleij static void __init gemini_init_machine(void)
516dbb708aSLinus Walleij {
526dbb708aSLinus Walleij arm_pm_idle = gemini_idle;
536dbb708aSLinus Walleij }
546dbb708aSLinus Walleij
5541d9830cSLinus Walleij static const char *gemini_board_compat[] = {
5641d9830cSLinus Walleij "cortina,gemini",
5741d9830cSLinus Walleij NULL,
5841d9830cSLinus Walleij };
5941d9830cSLinus Walleij
6041d9830cSLinus Walleij DT_MACHINE_START(GEMINI_DT, "Gemini (Device Tree)")
6141d9830cSLinus Walleij .map_io = gemini_map_io,
626dbb708aSLinus Walleij .init_machine = gemini_init_machine,
6341d9830cSLinus Walleij .dt_compat = gemini_board_compat,
6441d9830cSLinus Walleij MACHINE_END
65