18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Renesas R-Car M3-W/W+ System Controller
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2016 Glider bvba
68c2ecf20Sopenharmony_ci * Copyright (C) 2018-2019 Renesas Electronics Corporation
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/bits.h>
108c2ecf20Sopenharmony_ci#include <linux/kernel.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <dt-bindings/power/r8a7796-sysc.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include "rcar-sysc.h"
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_cistatic struct rcar_sysc_area r8a7796_areas[] __initdata = {
178c2ecf20Sopenharmony_ci	{ "always-on",	    0, 0, R8A7796_PD_ALWAYS_ON,	-1, PD_ALWAYS_ON },
188c2ecf20Sopenharmony_ci	{ "ca57-scu",	0x1c0, 0, R8A7796_PD_CA57_SCU,	R8A7796_PD_ALWAYS_ON,
198c2ecf20Sopenharmony_ci	  PD_SCU },
208c2ecf20Sopenharmony_ci	{ "ca57-cpu0",	 0x80, 0, R8A7796_PD_CA57_CPU0,	R8A7796_PD_CA57_SCU,
218c2ecf20Sopenharmony_ci	  PD_CPU_NOCR },
228c2ecf20Sopenharmony_ci	{ "ca57-cpu1",	 0x80, 1, R8A7796_PD_CA57_CPU1,	R8A7796_PD_CA57_SCU,
238c2ecf20Sopenharmony_ci	  PD_CPU_NOCR },
248c2ecf20Sopenharmony_ci	{ "ca53-scu",	0x140, 0, R8A7796_PD_CA53_SCU,	R8A7796_PD_ALWAYS_ON,
258c2ecf20Sopenharmony_ci	  PD_SCU },
268c2ecf20Sopenharmony_ci	{ "ca53-cpu0",	0x200, 0, R8A7796_PD_CA53_CPU0,	R8A7796_PD_CA53_SCU,
278c2ecf20Sopenharmony_ci	  PD_CPU_NOCR },
288c2ecf20Sopenharmony_ci	{ "ca53-cpu1",	0x200, 1, R8A7796_PD_CA53_CPU1,	R8A7796_PD_CA53_SCU,
298c2ecf20Sopenharmony_ci	  PD_CPU_NOCR },
308c2ecf20Sopenharmony_ci	{ "ca53-cpu2",	0x200, 2, R8A7796_PD_CA53_CPU2,	R8A7796_PD_CA53_SCU,
318c2ecf20Sopenharmony_ci	  PD_CPU_NOCR },
328c2ecf20Sopenharmony_ci	{ "ca53-cpu3",	0x200, 3, R8A7796_PD_CA53_CPU3,	R8A7796_PD_CA53_SCU,
338c2ecf20Sopenharmony_ci	  PD_CPU_NOCR },
348c2ecf20Sopenharmony_ci	{ "cr7",	0x240, 0, R8A7796_PD_CR7,	R8A7796_PD_ALWAYS_ON },
358c2ecf20Sopenharmony_ci	{ "a3vc",	0x380, 0, R8A7796_PD_A3VC,	R8A7796_PD_ALWAYS_ON },
368c2ecf20Sopenharmony_ci	{ "a2vc0",	0x3c0, 0, R8A7796_PD_A2VC0,	R8A7796_PD_A3VC },
378c2ecf20Sopenharmony_ci	{ "a2vc1",	0x3c0, 1, R8A7796_PD_A2VC1,	R8A7796_PD_A3VC },
388c2ecf20Sopenharmony_ci	{ "3dg-a",	0x100, 0, R8A7796_PD_3DG_A,	R8A7796_PD_ALWAYS_ON },
398c2ecf20Sopenharmony_ci	{ "3dg-b",	0x100, 1, R8A7796_PD_3DG_B,	R8A7796_PD_3DG_A },
408c2ecf20Sopenharmony_ci	{ "a3ir",	0x180, 0, R8A7796_PD_A3IR,	R8A7796_PD_ALWAYS_ON },
418c2ecf20Sopenharmony_ci};
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#ifdef CONFIG_SYSC_R8A77960
458c2ecf20Sopenharmony_ciconst struct rcar_sysc_info r8a77960_sysc_info __initconst = {
468c2ecf20Sopenharmony_ci	.areas = r8a7796_areas,
478c2ecf20Sopenharmony_ci	.num_areas = ARRAY_SIZE(r8a7796_areas),
488c2ecf20Sopenharmony_ci};
498c2ecf20Sopenharmony_ci#endif /* CONFIG_SYSC_R8A77960 */
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci#ifdef CONFIG_SYSC_R8A77961
528c2ecf20Sopenharmony_cistatic int __init r8a77961_sysc_init(void)
538c2ecf20Sopenharmony_ci{
548c2ecf20Sopenharmony_ci	rcar_sysc_nullify(r8a7796_areas, ARRAY_SIZE(r8a7796_areas),
558c2ecf20Sopenharmony_ci			  R8A7796_PD_A2VC0);
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci	return 0;
588c2ecf20Sopenharmony_ci}
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ciconst struct rcar_sysc_info r8a77961_sysc_info __initconst = {
618c2ecf20Sopenharmony_ci	.init = r8a77961_sysc_init,
628c2ecf20Sopenharmony_ci	.areas = r8a7796_areas,
638c2ecf20Sopenharmony_ci	.num_areas = ARRAY_SIZE(r8a7796_areas),
648c2ecf20Sopenharmony_ci	.extmask_offs = 0x2f8,
658c2ecf20Sopenharmony_ci	.extmask_val = BIT(0),
668c2ecf20Sopenharmony_ci};
678c2ecf20Sopenharmony_ci#endif /* CONFIG_SYSC_R8A77961 */
68