blob: e0a01ed07a5aeb2cf29950a4dc37371b81ce43e5 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Chin Liang See1922dad2013-08-07 10:08:03 -05002/*
3 * Copyright (C) 2013 Altera Corporation <www.altera.com>
Chin Liang See1922dad2013-08-07 10:08:03 -05004 */
5
6
7#include <common.h>
8#include <asm/io.h>
Marek Vasutb10a6072015-08-24 11:51:46 +02009#include <asm/arch/reset_manager.h>
Chin Liang See1922dad2013-08-07 10:08:03 -050010
Ley Foon Tan449cbae2018-05-18 22:05:23 +080011#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
12#include <asm/arch/mailbox_s10.h>
13#endif
14
15DECLARE_GLOBAL_DATA_PTR;
16
17#if !defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
Chin Liang See1922dad2013-08-07 10:08:03 -050018static const struct socfpga_reset_manager *reset_manager_base =
19 (void *)SOCFPGA_RSTMGR_ADDRESS;
Ley Foon Tan449cbae2018-05-18 22:05:23 +080020#endif
Marek Vasut49edbd42015-07-09 04:27:28 +020021
22/*
Chin Liang See1922dad2013-08-07 10:08:03 -050023 * Write the reset manager register to cause reset
24 */
25void reset_cpu(ulong addr)
26{
27 /* request a warm reset */
Ley Foon Tan449cbae2018-05-18 22:05:23 +080028#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
29 puts("Mailbox: Issuing mailbox cmd REBOOT_HPS\n");
30 mbox_reset_cold();
31#else
Ley Foon Tandd5d12d2017-04-26 02:44:34 +080032 writel(1 << RSTMGR_CTRL_SWWARMRSTREQ_LSB,
33 &reset_manager_base->ctrl);
Ley Foon Tan449cbae2018-05-18 22:05:23 +080034#endif
Chin Liang See1922dad2013-08-07 10:08:03 -050035 /*
36 * infinite loop here as watchdog will trigger and reset
37 * the processor
38 */
39 while (1)
40 ;
41}