xref: /openbmc/u-boot/arch/arm/mach-bcm283x/reset.c (revision a7da6f8c)
1 /*
2  * (C) Copyright 2012 Stephen Warren
3  *
4  * See file CREDITS for list of people who contributed to this
5  * project.
6  *
7  * SPDX-License-Identifier:	GPL-2.0
8  */
9 
10 #include <common.h>
11 #include <asm/io.h>
12 #include <asm/arch/wdog.h>
13 
14 #define RESET_TIMEOUT 10
15 
16 void reset_cpu(ulong addr)
17 {
18 	struct bcm2835_wdog_regs *regs =
19 		(struct bcm2835_wdog_regs *)BCM2835_WDOG_PHYSADDR;
20 	uint32_t rstc;
21 
22 	rstc = readl(&regs->rstc);
23 	rstc &= ~BCM2835_WDOG_RSTC_WRCFG_MASK;
24 	rstc |= BCM2835_WDOG_RSTC_WRCFG_FULL_RESET;
25 
26 	writel(BCM2835_WDOG_PASSWORD | RESET_TIMEOUT, &regs->wdog);
27 	writel(BCM2835_WDOG_PASSWORD | rstc, &regs->rstc);
28 }
29