summaryrefslogtreecommitdiff
path: root/arch/arm/mach-bcm283x/reset.c
blob: 72cdc31d870eb700d315701dc3f71387a741b1a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * (C) Copyright 2012 Stephen Warren
 *
 * See file CREDITS for list of people who contributed to this
 * project.
 *
 * SPDX-License-Identifier:	GPL-2.0
 */

#include <common.h>
#include <asm/io.h>
#include <asm/arch/wdog.h>

#define RESET_TIMEOUT 10

void reset_cpu(ulong addr)
{
	struct bcm2835_wdog_regs *regs =
		(struct bcm2835_wdog_regs *)BCM2835_WDOG_PHYSADDR;
	uint32_t rstc;

	rstc = readl(&regs->rstc);
	rstc &= ~BCM2835_WDOG_RSTC_WRCFG_MASK;
	rstc |= BCM2835_WDOG_RSTC_WRCFG_FULL_RESET;

	writel(BCM2835_WDOG_PASSWORD | RESET_TIMEOUT, &regs->wdog);
	writel(BCM2835_WDOG_PASSWORD | rstc, &regs->rstc);
}