blob: 01b2663f96c9288395b14d0209ff332ac527b976 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Jean-Christophe PLAGNIOL-VILLARD9c5c8242009-05-31 12:44:45 +02002/*
3 * (C) Copyright 2007-2008
Stelian Pop5ee0c7f2011-11-01 00:00:39 +01004 * Stelian Pop <stelian@popies.net>
Jean-Christophe PLAGNIOL-VILLARD9c5c8242009-05-31 12:44:45 +02005 * Lead Tech Design <www.leadtechdesign.com>
Jean-Christophe PLAGNIOL-VILLARD9c5c8242009-05-31 12:44:45 +02006 */
7
Simon Glassafb02152019-12-28 10:45:01 -07008#include <cpu_func.h>
Reinhard Meyerb06208c2010-11-07 13:26:14 +01009#include <asm/io.h>
Jean-Christophe PLAGNIOL-VILLARD9c5c8242009-05-31 12:44:45 +020010#include <asm/arch/hardware.h>
11#include <asm/arch/at91_rstc.h>
Jean-Christophe PLAGNIOL-VILLARD9c5c8242009-05-31 12:44:45 +020012
Reinhard Meyer609e6312010-08-09 13:25:37 +020013/* Reset the cpu by telling the reset controller to do so */
Harald Seiler6f14d5f2020-12-15 16:47:52 +010014void reset_cpu(void)
Jean-Christophe PLAGNIOL-VILLARD9c5c8242009-05-31 12:44:45 +020015{
Reinhard Meyere260d0b2010-11-03 15:39:55 +010016 at91_rstc_t *rstc = (at91_rstc_t *) ATMEL_BASE_RSTC;
Jens Scharsiga4db1ca2010-02-03 22:46:58 +010017
Reinhard Meyer609e6312010-08-09 13:25:37 +020018 writel(AT91_RSTC_KEY
19 | AT91_RSTC_CR_PROCRST /* Processor Reset */
20 | AT91_RSTC_CR_PERRST /* Peripheral Reset */
21#ifdef CONFIG_AT91RESET_EXTRST
22 | AT91_RSTC_CR_EXTRST /* External Reset (assert nRST pin) */
23#endif
24 , &rstc->cr);
25 /* never reached */
26 while (1)
27 ;
Jean-Christophe PLAGNIOL-VILLARD9c5c8242009-05-31 12:44:45 +020028}