Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Gemini Device Tree boot support
0004  */
0005 #include <linux/kernel.h>
0006 #include <linux/init.h>
0007 #include <linux/io.h>
0008 
0009 #include <asm/mach/arch.h>
0010 #include <asm/mach/map.h>
0011 #include <asm/system_misc.h>
0012 #include <asm/proc-fns.h>
0013 
0014 #ifdef CONFIG_DEBUG_GEMINI
0015 /* This is needed for LL-debug/earlyprintk/debug-macro.S */
0016 static struct map_desc gemini_io_desc[] __initdata = {
0017     {
0018         .virtual = CONFIG_DEBUG_UART_VIRT,
0019         .pfn = __phys_to_pfn(CONFIG_DEBUG_UART_PHYS),
0020         .length = SZ_4K,
0021         .type = MT_DEVICE,
0022     },
0023 };
0024 
0025 static void __init gemini_map_io(void)
0026 {
0027     iotable_init(gemini_io_desc, ARRAY_SIZE(gemini_io_desc));
0028 }
0029 #else
0030 #define gemini_map_io NULL
0031 #endif
0032 
0033 static void gemini_idle(void)
0034 {
0035     /*
0036      * Because of broken hardware we have to enable interrupts or the CPU
0037      * will never wakeup... Acctualy it is not very good to enable
0038      * interrupts first since scheduler can miss a tick, but there is
0039      * no other way around this. Platforms that needs it for power saving
0040      * should enable it in init code, since by default it is
0041      * disabled.
0042      */
0043 
0044     /* FIXME: Enabling interrupts here is racy! */
0045     local_irq_enable();
0046     cpu_do_idle();
0047 }
0048 
0049 static void __init gemini_init_machine(void)
0050 {
0051     arm_pm_idle = gemini_idle;
0052 }
0053 
0054 static const char *gemini_board_compat[] = {
0055     "cortina,gemini",
0056     NULL,
0057 };
0058 
0059 DT_MACHINE_START(GEMINI_DT, "Gemini (Device Tree)")
0060     .map_io     = gemini_map_io,
0061     .init_machine   = gemini_init_machine,
0062     .dt_compat  = gemini_board_compat,
0063 MACHINE_END