blob: ba904609ae744b3238d6afb4c4b07d3e314c4612 [file] [log] [blame]
Chris Brandt1f3b6672017-08-23 14:53:59 -05001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2017 Renesas Electronics
4 * Copyright (C) Chris Brandt
5 */
6
7#include <common.h>
Simon Glassafb02152019-12-28 10:45:01 -07008#include <cpu_func.h>
Chris Brandt1f3b6672017-08-23 14:53:59 -05009#include <asm/io.h>
10#include <asm/arch/sys_proto.h>
11
12#define RZA1_WDT_BASE 0xfcfe0000
13#define WTCSR 0x00
14#define WTCNT 0x02
15#define WRCSR 0x04
16
17DECLARE_GLOBAL_DATA_PTR;
18
19int board_init(void)
20{
21 gd->bd->bi_boot_params = (CONFIG_SYS_SDRAM_BASE + 0x100);
22
23 return 0;
24}
25
26int dram_init(void)
27{
28 if (fdtdec_setup_mem_size_base() != 0)
29 return -EINVAL;
30
31 return 0;
32}
33
34int dram_init_banksize(void)
35{
36 fdtdec_setup_memory_banksize();
37
38 return 0;
39}
40
41void reset_cpu(ulong addr)
42{
43 /* Dummy read (must read WRCSR:WOVF at least once before clearing) */
44 readb(RZA1_WDT_BASE + WRCSR);
45
46 writew(0xa500, RZA1_WDT_BASE + WRCSR);
47 writew(0x5a5f, RZA1_WDT_BASE + WRCSR);
48 writew(0x5a00, RZA1_WDT_BASE + WTCNT);
49 writew(0xa578, RZA1_WDT_BASE + WTCSR);
50
51 for (;;)
52 asm volatile("wfi");
53}