1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  *  Copyright (C) 2013 Altera Corporation <www.altera.com>
4  */
5 
6 
7 #include <common.h>
8 #include <asm/io.h>
9 #include <asm/arch/reset_manager.h>
10 
11 #if defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
12 #include <asm/arch/mailbox_s10.h>
13 #endif
14 
15 DECLARE_GLOBAL_DATA_PTR;
16 
17 #if !defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
18 static const struct socfpga_reset_manager *reset_manager_base =
19 		(void *)SOCFPGA_RSTMGR_ADDRESS;
20 #endif
21 
22 /*
23  * Write the reset manager register to cause reset
24  */
25 void reset_cpu(ulong addr)
26 {
27 	/* request a warm reset */
28 #if defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
29 	puts("Mailbox: Issuing mailbox cmd REBOOT_HPS\n");
30 	mbox_reset_cold();
31 #else
32 	writel(1 << RSTMGR_CTRL_SWWARMRSTREQ_LSB,
33 	       &reset_manager_base->ctrl);
34 #endif
35 	/*
36 	 * infinite loop here as watchdog will trigger and reset
37 	 * the processor
38 	 */
39 	while (1)
40 		;
41 }
42