18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Gemini Device Tree boot support 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci#include <linux/kernel.h> 68c2ecf20Sopenharmony_ci#include <linux/init.h> 78c2ecf20Sopenharmony_ci#include <linux/io.h> 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <asm/mach/arch.h> 108c2ecf20Sopenharmony_ci#include <asm/mach/map.h> 118c2ecf20Sopenharmony_ci#include <asm/system_misc.h> 128c2ecf20Sopenharmony_ci#include <asm/proc-fns.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#ifdef CONFIG_DEBUG_GEMINI 158c2ecf20Sopenharmony_ci/* This is needed for LL-debug/earlyprintk/debug-macro.S */ 168c2ecf20Sopenharmony_cistatic struct map_desc gemini_io_desc[] __initdata = { 178c2ecf20Sopenharmony_ci { 188c2ecf20Sopenharmony_ci .virtual = CONFIG_DEBUG_UART_VIRT, 198c2ecf20Sopenharmony_ci .pfn = __phys_to_pfn(CONFIG_DEBUG_UART_PHYS), 208c2ecf20Sopenharmony_ci .length = SZ_4K, 218c2ecf20Sopenharmony_ci .type = MT_DEVICE, 228c2ecf20Sopenharmony_ci }, 238c2ecf20Sopenharmony_ci}; 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_cistatic void __init gemini_map_io(void) 268c2ecf20Sopenharmony_ci{ 278c2ecf20Sopenharmony_ci iotable_init(gemini_io_desc, ARRAY_SIZE(gemini_io_desc)); 288c2ecf20Sopenharmony_ci} 298c2ecf20Sopenharmony_ci#else 308c2ecf20Sopenharmony_ci#define gemini_map_io NULL 318c2ecf20Sopenharmony_ci#endif 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_cistatic void gemini_idle(void) 348c2ecf20Sopenharmony_ci{ 358c2ecf20Sopenharmony_ci /* 368c2ecf20Sopenharmony_ci * Because of broken hardware we have to enable interrupts or the CPU 378c2ecf20Sopenharmony_ci * will never wakeup... Acctualy it is not very good to enable 388c2ecf20Sopenharmony_ci * interrupts first since scheduler can miss a tick, but there is 398c2ecf20Sopenharmony_ci * no other way around this. Platforms that needs it for power saving 408c2ecf20Sopenharmony_ci * should enable it in init code, since by default it is 418c2ecf20Sopenharmony_ci * disabled. 428c2ecf20Sopenharmony_ci */ 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci /* FIXME: Enabling interrupts here is racy! */ 458c2ecf20Sopenharmony_ci local_irq_enable(); 468c2ecf20Sopenharmony_ci cpu_do_idle(); 478c2ecf20Sopenharmony_ci} 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_cistatic void __init gemini_init_machine(void) 508c2ecf20Sopenharmony_ci{ 518c2ecf20Sopenharmony_ci arm_pm_idle = gemini_idle; 528c2ecf20Sopenharmony_ci} 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_cistatic const char *gemini_board_compat[] = { 558c2ecf20Sopenharmony_ci "cortina,gemini", 568c2ecf20Sopenharmony_ci NULL, 578c2ecf20Sopenharmony_ci}; 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ciDT_MACHINE_START(GEMINI_DT, "Gemini (Device Tree)") 608c2ecf20Sopenharmony_ci .map_io = gemini_map_io, 618c2ecf20Sopenharmony_ci .init_machine = gemini_init_machine, 628c2ecf20Sopenharmony_ci .dt_compat = gemini_board_compat, 638c2ecf20Sopenharmony_ciMACHINE_END 64