18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * reset.c -- common ColdFire SoC reset support 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * (C) Copyright 2012, Greg Ungerer <gerg@uclinux.org> 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 78c2ecf20Sopenharmony_ci * License. See the file COPYING in the main directory of this archive 88c2ecf20Sopenharmony_ci * for more details. 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <linux/kernel.h> 128c2ecf20Sopenharmony_ci#include <linux/init.h> 138c2ecf20Sopenharmony_ci#include <linux/io.h> 148c2ecf20Sopenharmony_ci#include <asm/machdep.h> 158c2ecf20Sopenharmony_ci#include <asm/coldfire.h> 168c2ecf20Sopenharmony_ci#include <asm/mcfsim.h> 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci/* 198c2ecf20Sopenharmony_ci * There are 2 common methods amongst the ColdFure parts for reseting 208c2ecf20Sopenharmony_ci * the CPU. But there are couple of exceptions, the 5272 and the 547x 218c2ecf20Sopenharmony_ci * have something completely special to them, and we let their specific 228c2ecf20Sopenharmony_ci * subarch code handle them. 238c2ecf20Sopenharmony_ci */ 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#ifdef MCFSIM_SYPCR 268c2ecf20Sopenharmony_cistatic void mcf_cpu_reset(void) 278c2ecf20Sopenharmony_ci{ 288c2ecf20Sopenharmony_ci local_irq_disable(); 298c2ecf20Sopenharmony_ci /* Set watchdog to soft reset, and enabled */ 308c2ecf20Sopenharmony_ci __raw_writeb(0xc0, MCFSIM_SYPCR); 318c2ecf20Sopenharmony_ci for (;;) 328c2ecf20Sopenharmony_ci /* wait for watchdog to timeout */; 338c2ecf20Sopenharmony_ci} 348c2ecf20Sopenharmony_ci#endif 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#ifdef MCF_RCR 378c2ecf20Sopenharmony_cistatic void mcf_cpu_reset(void) 388c2ecf20Sopenharmony_ci{ 398c2ecf20Sopenharmony_ci local_irq_disable(); 408c2ecf20Sopenharmony_ci __raw_writeb(MCF_RCR_SWRESET, MCF_RCR); 418c2ecf20Sopenharmony_ci} 428c2ecf20Sopenharmony_ci#endif 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_cistatic int __init mcf_setup_reset(void) 458c2ecf20Sopenharmony_ci{ 468c2ecf20Sopenharmony_ci mach_reset = mcf_cpu_reset; 478c2ecf20Sopenharmony_ci return 0; 488c2ecf20Sopenharmony_ci} 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ciarch_initcall(mcf_setup_reset); 51