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