xref: /openbmc/u-boot/arch/arm/mach-bcm283x/reset.c (revision ddf6bd4876a1838bdf3202b34f5a36f165c279b1)
1*ddf6bd48SMasahiro Yamada /*
2*ddf6bd48SMasahiro Yamada  * (C) Copyright 2012 Stephen Warren
3*ddf6bd48SMasahiro Yamada  *
4*ddf6bd48SMasahiro Yamada  * See file CREDITS for list of people who contributed to this
5*ddf6bd48SMasahiro Yamada  * project.
6*ddf6bd48SMasahiro Yamada  *
7*ddf6bd48SMasahiro Yamada  * This program is free software; you can redistribute it and/or
8*ddf6bd48SMasahiro Yamada  * modify it under the terms of the GNU General Public License
9*ddf6bd48SMasahiro Yamada  * version 2 as published by the Free Software Foundation.
10*ddf6bd48SMasahiro Yamada  *
11*ddf6bd48SMasahiro Yamada  * This program is distributed in the hope that it will be useful, but
12*ddf6bd48SMasahiro Yamada  * WITHOUT ANY WARRANTY; without even the implied warranty of
13*ddf6bd48SMasahiro Yamada  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*ddf6bd48SMasahiro Yamada  * GNU General Public License for more details.
15*ddf6bd48SMasahiro Yamada  */
16*ddf6bd48SMasahiro Yamada 
17*ddf6bd48SMasahiro Yamada #include <common.h>
18*ddf6bd48SMasahiro Yamada #include <asm/io.h>
19*ddf6bd48SMasahiro Yamada #include <asm/arch/wdog.h>
20*ddf6bd48SMasahiro Yamada 
21*ddf6bd48SMasahiro Yamada #define RESET_TIMEOUT 10
22*ddf6bd48SMasahiro Yamada 
23*ddf6bd48SMasahiro Yamada void reset_cpu(ulong addr)
24*ddf6bd48SMasahiro Yamada {
25*ddf6bd48SMasahiro Yamada 	struct bcm2835_wdog_regs *regs =
26*ddf6bd48SMasahiro Yamada 		(struct bcm2835_wdog_regs *)BCM2835_WDOG_PHYSADDR;
27*ddf6bd48SMasahiro Yamada 	uint32_t rstc;
28*ddf6bd48SMasahiro Yamada 
29*ddf6bd48SMasahiro Yamada 	rstc = readl(&regs->rstc);
30*ddf6bd48SMasahiro Yamada 	rstc &= ~BCM2835_WDOG_RSTC_WRCFG_MASK;
31*ddf6bd48SMasahiro Yamada 	rstc |= BCM2835_WDOG_RSTC_WRCFG_FULL_RESET;
32*ddf6bd48SMasahiro Yamada 
33*ddf6bd48SMasahiro Yamada 	writel(BCM2835_WDOG_PASSWORD | RESET_TIMEOUT, &regs->wdog);
34*ddf6bd48SMasahiro Yamada 	writel(BCM2835_WDOG_PASSWORD | rstc, &regs->rstc);
35*ddf6bd48SMasahiro Yamada }
36