Marek Vasut | b700f03 | 2019-07-29 19:59:44 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * board/renesas/condor/condor.c |
| 4 | * This file is Condor board support. |
| 5 | * |
| 6 | * Copyright (C) 2019 Marek Vasut <marek.vasut+renesas@gmail.com> |
| 7 | */ |
| 8 | |
| 9 | #include <common.h> |
| 10 | #include <asm/processor.h> |
| 11 | #include <asm/mach-types.h> |
| 12 | #include <asm/io.h> |
| 13 | #include <linux/errno.h> |
| 14 | #include <asm/arch/sys_proto.h> |
| 15 | |
| 16 | DECLARE_GLOBAL_DATA_PTR; |
| 17 | |
| 18 | void s_init(void) |
| 19 | { |
| 20 | } |
| 21 | |
| 22 | int board_early_init_f(void) |
| 23 | { |
| 24 | return 0; |
| 25 | } |
| 26 | |
| 27 | int board_init(void) |
| 28 | { |
| 29 | /* adress of boot parameters */ |
| 30 | gd->bd->bi_boot_params = CONFIG_SYS_TEXT_BASE + 0x50000; |
| 31 | |
| 32 | return 0; |
| 33 | } |
| 34 | |
| 35 | #define RST_BASE 0xE6160000 |
| 36 | #define RST_CA57RESCNT (RST_BASE + 0x40) |
| 37 | #define RST_CA53RESCNT (RST_BASE + 0x44) |
| 38 | #define RST_RSTOUTCR (RST_BASE + 0x58) |
| 39 | #define RST_CA57_CODE 0xA5A5000F |
| 40 | #define RST_CA53_CODE 0x5A5A000F |
| 41 | |
| 42 | void reset_cpu(ulong addr) |
| 43 | { |
| 44 | unsigned long midr, cputype; |
| 45 | |
| 46 | asm volatile("mrs %0, midr_el1" : "=r" (midr)); |
| 47 | cputype = (midr >> 4) & 0xfff; |
| 48 | |
| 49 | if (cputype == 0xd03) |
| 50 | writel(RST_CA53_CODE, RST_CA53RESCNT); |
| 51 | else if (cputype == 0xd07) |
| 52 | writel(RST_CA57_CODE, RST_CA57RESCNT); |
| 53 | else |
| 54 | hang(); |
| 55 | } |