1 // SPDX-License-Identifier: GPL-2.0+
3 * board/renesas/ebisu/ebisu.c
4 * This file is Ebisu board support.
6 * Copyright (C) 2018 Marek Vasut <marek.vasut+renesas@gmail.com>
13 #include <dm/platform_data/serial_sh.h>
14 #include <asm/processor.h>
15 #include <asm/mach-types.h>
17 #include <linux/errno.h>
18 #include <asm/arch/sys_proto.h>
20 #include <asm/arch/gpio.h>
21 #include <asm/arch/rmobile.h>
22 #include <asm/arch/rcar-mstp.h>
23 #include <asm/arch/sh_sdhi.h>
27 DECLARE_GLOBAL_DATA_PTR;
33 int board_early_init_f(void)
40 /* adress of boot parameters */
41 gd->bd->bi_boot_params = CONFIG_SYS_TEXT_BASE + 0x50000;
47 * If the firmware passed a device tree use it for U-Boot DRAM setup.
49 extern u64 rcar_atf_boot_args[];
53 const void *atf_fdt_blob = (const void *)(rcar_atf_boot_args[1]);
56 /* Check if ATF passed us DTB. If not, fall back to builtin DTB. */
57 if (fdt_magic(atf_fdt_blob) == FDT_MAGIC)
62 return fdtdec_setup_mem_size_base_fdt(blob);
65 int dram_init_banksize(void)
67 const void *atf_fdt_blob = (const void *)(rcar_atf_boot_args[1]);
70 /* Check if ATF passed us DTB. If not, fall back to builtin DTB. */
71 if (fdt_magic(atf_fdt_blob) == FDT_MAGIC)
76 fdtdec_setup_memory_banksize_fdt(blob);
81 #define RST_BASE 0xE6160000
82 #define RST_CA57RESCNT (RST_BASE + 0x40)
83 #define RST_CA53RESCNT (RST_BASE + 0x44)
84 #define RST_RSTOUTCR (RST_BASE + 0x58)
85 #define RST_CA57_CODE 0xA5A5000F
86 #define RST_CA53_CODE 0x5A5A000F
88 void reset_cpu(ulong addr)
90 unsigned long midr, cputype;
92 asm volatile("mrs %0, midr_el1" : "=r" (midr));
93 cputype = (midr >> 4) & 0xfff;
96 writel(RST_CA53_CODE, RST_CA53RESCNT);
97 else if (cputype == 0xd07)
98 writel(RST_CA57_CODE, RST_CA57RESCNT);