Chris Brandt | ba932bc | 2017-08-23 14:53:59 -0500 | [diff] [blame] | 1 | // 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 Glass | 9a3b4ce | 2019-12-28 10:45:01 -0700 | [diff] [blame] | 8 | #include <cpu_func.h> |
Simon Glass | 691d719 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 9 | #include <init.h> |
Simon Glass | 401d1c4 | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 10 | #include <asm/global_data.h> |
Chris Brandt | ba932bc | 2017-08-23 14:53:59 -0500 | [diff] [blame] | 11 | #include <asm/io.h> |
| 12 | #include <asm/arch/sys_proto.h> |
| 13 | |
| 14 | #define RZA1_WDT_BASE 0xfcfe0000 |
| 15 | #define WTCSR 0x00 |
| 16 | #define WTCNT 0x02 |
| 17 | #define WRCSR 0x04 |
| 18 | |
| 19 | DECLARE_GLOBAL_DATA_PTR; |
| 20 | |
| 21 | int board_init(void) |
| 22 | { |
| 23 | gd->bd->bi_boot_params = (CONFIG_SYS_SDRAM_BASE + 0x100); |
| 24 | |
| 25 | return 0; |
| 26 | } |
| 27 | |
| 28 | int dram_init(void) |
| 29 | { |
| 30 | if (fdtdec_setup_mem_size_base() != 0) |
| 31 | return -EINVAL; |
| 32 | |
| 33 | return 0; |
| 34 | } |
| 35 | |
| 36 | int dram_init_banksize(void) |
| 37 | { |
| 38 | fdtdec_setup_memory_banksize(); |
| 39 | |
| 40 | return 0; |
| 41 | } |
| 42 | |
Harald Seiler | 35b65dd | 2020-12-15 16:47:52 +0100 | [diff] [blame] | 43 | void reset_cpu(void) |
Chris Brandt | ba932bc | 2017-08-23 14:53:59 -0500 | [diff] [blame] | 44 | { |
| 45 | /* Dummy read (must read WRCSR:WOVF at least once before clearing) */ |
| 46 | readb(RZA1_WDT_BASE + WRCSR); |
| 47 | |
| 48 | writew(0xa500, RZA1_WDT_BASE + WRCSR); |
| 49 | writew(0x5a5f, RZA1_WDT_BASE + WRCSR); |
| 50 | writew(0x5a00, RZA1_WDT_BASE + WTCNT); |
| 51 | writew(0xa578, RZA1_WDT_BASE + WTCSR); |
| 52 | |
| 53 | for (;;) |
| 54 | asm volatile("wfi"); |
| 55 | } |