2 * board/renesas/salvator-x/salvator-x.c
3 * This file is Salvator-X board support.
5 * Copyright (C) 2015 Renesas Electronics Corporation
6 * Copyright (C) 2015 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
8 * SPDX-License-Identifier: GPL-2.0+
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>
28 DECLARE_GLOBAL_DATA_PTR
;
30 #define CPGWPCR 0xE6150904
31 #define CPGWPR 0xE615090C
33 #define CLK2MHZ(clk) (clk / 1000 / 1000)
36 struct rcar_rwdt
*rwdt
= (struct rcar_rwdt
*)RWDT_BASE
;
37 struct rcar_swdt
*swdt
= (struct rcar_swdt
*)SWDT_BASE
;
40 writel(0xA5A5A500, &rwdt
->rwtcsra
);
41 writel(0xA5A5A500, &swdt
->swtcsra
);
43 writel(0xA5A50000, CPGWPCR
);
44 writel(0xFFFFFFFF, CPGWPR
);
47 #define GSX_MSTP112 (1 << 12) /* 3DG */
48 #define TMU0_MSTP125 (1 << 25) /* secure */
49 #define TMU1_MSTP124 (1 << 24) /* non-secure */
50 #define SCIF2_MSTP310 (1 << 10) /* SCIF2 */
52 int board_early_init_f(void)
54 /* TMU0,1 */ /* which use ? */
55 mstp_clrbits_le32(MSTPSR1
, SMSTPCR1
, TMU0_MSTP125
| TMU1_MSTP124
);
57 mstp_clrbits_le32(MSTPSR3
, SMSTPCR3
, SCIF2_MSTP310
);
63 /* R/- 32 Power status register 2(3DG) */
64 #define SYSC_PWRSR2 0xE6180100
65 /* -/W 32 Power resume control register 2 (3DG) */
66 #define SYSC_PWRONCR2 0xE618010C
68 DECLARE_GLOBAL_DATA_PTR
;
71 /* adress of boot parameters */
72 gd
->bd
->bi_boot_params
= CONFIG_SYS_TEXT_BASE
+ 0x50000;
74 /* Init PFC controller */
75 r8a7795_pinmux_init();
77 /* GSX: force power and clock supply */
78 writel(0x0000001F, SYSC_PWRONCR2
);
79 while (readl(SYSC_PWRSR2
) != 0x000003E0)
82 mstp_clrbits_le32(MSTPSR1
, SMSTPCR1
, GSX_MSTP112
);
89 gd
->ram_size
= CONFIG_SYS_SDRAM_SIZE
;
94 const struct rmobile_sysinfo sysinfo
= {
95 CONFIG_RCAR_BOARD_STRING
98 #define RST_BASE 0xE6160000
99 #define RST_CA57RESCNT (RST_BASE + 0x40)
100 #define RST_CA53RESCNT (RST_BASE + 0x44)
101 #define RST_RSTOUTCR (RST_BASE + 0x58)
102 #define RST_CODE 0xA5A5000F
104 void reset_cpu(ulong addr
)
107 writel(RST_CODE
, RST_CA57RESCNT
);
110 static const struct sh_serial_platdata serial_platdata
= {
113 .clk
= 14745600, /* 0xE10000 */
117 U_BOOT_DEVICE(salvator_x_scif2
) = {
119 .platdata
= &serial_platdata
,