summaryrefslogtreecommitdiffstats
path: root/bsps/arm/raspberrypi/start/bspreset.c
blob: 98c28bea9dea3bf30275286fbf67b5b74edc6b83 (plain) (blame)
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
/**
 * @file
 *
 * @ingroup raspberrypi
 *
 * @brief Raspberry pi restart chip function
 */

#include <bsp/bootcard.h>
#include <bsp/raspberrypi.h>
#include <bsp.h>
#include <rtems.h>

void bsp_reset(void)
{
  uint32_t rstc;

  BCM2835_REG(BCM2835_PM_WDOG) = BCM2835_PM_PASSWD_MAGIC | 20;
  rstc = BCM2835_REG(BCM2835_PM_RSTC);
  rstc &= ~BCM2835_PM_RSTC_WRCFG;
  rstc |= BCM2835_PM_PASSWD_MAGIC | BCM2835_PM_RSTC_WRCFG_FULL;
  BCM2835_REG(BCM2835_PM_RSTC) = rstc;
  BCM2835_REG(BCM2835_PM_WDOG) = BCM2835_PM_PASSWD_MAGIC | 1;

  while (1) ;
}