blob: e0a01ed07a5aeb2cf29950a4dc37371b81ce43e5 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Chin Liang See68e17472013-08-07 10:08:03 -05002/*
3 * Copyright (C) 2013 Altera Corporation <www.altera.com>
Chin Liang See68e17472013-08-07 10:08:03 -05004 */
5
6
7#include <common.h>
8#include <asm/io.h>
Marek Vasut65d372c2015-08-24 11:51:46 +02009#include <asm/arch/reset_manager.h>
Chin Liang See68e17472013-08-07 10:08:03 -050010
Ley Foon Tan3607a802018-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 See68e17472013-08-07 10:08:03 -050018static const struct socfpga_reset_manager *reset_manager_base =
19 (void *)SOCFPGA_RSTMGR_ADDRESS;
Ley Foon Tan3607a802018-05-18 22:05:23 +080020#endif
Marek Vasut31916112015-07-09 04:27:28 +020021
22/*
Chin Liang See68e17472013-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 Tan3607a802018-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 Tan2b09ea42017-04-26 02:44:34 +080032 writel(1 << RSTMGR_CTRL_SWWARMRSTREQ_LSB,
33 &reset_manager_base->ctrl);
Ley Foon Tan3607a802018-05-18 22:05:23 +080034#endif
Chin Liang See68e17472013-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}