1 // SPDX-License-Identifier: GPL-2.0+
3 * board/renesas/eagle/eagle.c
4 * This file is Eagle board support.
15 #include <dm/platform_data/serial_sh.h>
16 #include <asm/processor.h>
17 #include <asm/mach-types.h>
19 #include <linux/errno.h>
20 #include <asm/arch/sys_proto.h>
22 #include <asm/arch/gpio.h>
23 #include <asm/arch/rmobile.h>
24 #include <asm/arch/rcar-mstp.h>
25 #include <asm/arch/sh_sdhi.h>
29 DECLARE_GLOBAL_DATA_PTR;
31 #define CPGWPR 0xE6150900
32 #define CPGWPCR 0xE6150904
35 #define PLL0CR 0xE61500D8
36 #define PLL0_STC_MASK 0x7F000000
37 #define PLL0_STC_OFFSET 24
39 #define CLK2MHZ(clk) (clk / 1000 / 1000)
42 struct rcar_rwdt *rwdt = (struct rcar_rwdt *)RWDT_BASE;
43 struct rcar_swdt *swdt = (struct rcar_swdt *)SWDT_BASE;
47 writel(0xA5A5A500, &rwdt->rwtcsra);
48 writel(0xA5A5A500, &swdt->swtcsra);
50 /* CPU frequency setting. Set to 0.8GHz */
51 stc = ((800 / CLK2MHZ(CONFIG_SYS_CLK_FREQ)) - 1) << PLL0_STC_OFFSET;
52 clrsetbits_le32(PLL0CR, PLL0_STC_MASK, stc);
55 int board_early_init_f(void)
57 /* Unlock CPG access */
58 writel(0xA5A5FFFF, CPGWPR);
59 writel(0x5A5A0000, CPGWPCR);
66 /* adress of boot parameters */
67 gd->bd->bi_boot_params = CONFIG_SYS_TEXT_BASE + 0x50000;
72 #define RST_BASE 0xE6160000
73 #define RST_CA57RESCNT (RST_BASE + 0x40)
74 #define RST_CA53RESCNT (RST_BASE + 0x44)
75 #define RST_RSTOUTCR (RST_BASE + 0x58)
76 #define RST_CA57_CODE 0xA5A5000F
77 #define RST_CA53_CODE 0x5A5A000F
79 void reset_cpu(ulong addr)
81 unsigned long midr, cputype;
83 asm volatile("mrs %0, midr_el1" : "=r" (midr));
84 cputype = (midr >> 4) & 0xfff;
87 writel(RST_CA53_CODE, RST_CA53RESCNT);
88 else if (cputype == 0xd07)
89 writel(RST_CA57_CODE, RST_CA57RESCNT);