Skip to content

Commit f37d211

Browse files
Fabrizio Castrohorms
authored andcommitted
soc: renesas: rcar-sysc: Add r8a774c0 support
Add support for the RZ/G2E (R8A774C0) SoC power areas to the R-Car SYSC driver. Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com> Reviewed-by: Biju Das <biju.das@bp.renesas.com> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
1 parent 39dc9a1 commit f37d211

File tree

5 files changed

+78
-0
lines changed

5 files changed

+78
-0
lines changed

drivers/soc/renesas/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ config SOC_RENESAS
1111
select SYSC_R8A7745 if ARCH_R8A7745
1212
select SYSC_R8A77470 if ARCH_R8A77470
1313
select SYSC_R8A774A1 if ARCH_R8A774A1
14+
select SYSC_R8A774C0 if ARCH_R8A774C0
1415
select SYSC_R8A7779 if ARCH_R8A7779
1516
select SYSC_R8A7790 if ARCH_R8A7790
1617
select SYSC_R8A7791 if ARCH_R8A7791 || ARCH_R8A7793
@@ -43,6 +44,10 @@ config SYSC_R8A774A1
4344
bool "RZ/G2M System Controller support" if COMPILE_TEST
4445
select SYSC_RCAR
4546

47+
config SYSC_R8A774C0
48+
bool "RZ/G2E System Controller support" if COMPILE_TEST
49+
select SYSC_RCAR
50+
4651
config SYSC_R8A7779
4752
bool "R-Car H1 System Controller support" if COMPILE_TEST
4853
select SYSC_RCAR

drivers/soc/renesas/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ obj-$(CONFIG_SYSC_R8A7743) += r8a7743-sysc.o
77
obj-$(CONFIG_SYSC_R8A7745) += r8a7745-sysc.o
88
obj-$(CONFIG_SYSC_R8A77470) += r8a77470-sysc.o
99
obj-$(CONFIG_SYSC_R8A774A1) += r8a774a1-sysc.o
10+
obj-$(CONFIG_SYSC_R8A774C0) += r8a774c0-sysc.o
1011
obj-$(CONFIG_SYSC_R8A7779) += r8a7779-sysc.o
1112
obj-$(CONFIG_SYSC_R8A7790) += r8a7790-sysc.o
1213
obj-$(CONFIG_SYSC_R8A7791) += r8a7791-sysc.o

drivers/soc/renesas/r8a774c0-sysc.c

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Renesas RZ/G2E System Controller
4+
* Copyright (C) 2018 Renesas Electronics Corp.
5+
*
6+
* Based on Renesas R-Car E3 System Controller
7+
*/
8+
9+
#include <linux/bug.h>
10+
#include <linux/kernel.h>
11+
#include <linux/sys_soc.h>
12+
13+
#include <dt-bindings/power/r8a774c0-sysc.h>
14+
15+
#include "rcar-sysc.h"
16+
17+
static struct rcar_sysc_area r8a774c0_areas[] __initdata = {
18+
{ "always-on", 0, 0, R8A774C0_PD_ALWAYS_ON, -1, PD_ALWAYS_ON },
19+
{ "ca53-scu", 0x140, 0, R8A774C0_PD_CA53_SCU, R8A774C0_PD_ALWAYS_ON,
20+
PD_SCU },
21+
{ "ca53-cpu0", 0x200, 0, R8A774C0_PD_CA53_CPU0, R8A774C0_PD_CA53_SCU,
22+
PD_CPU_NOCR },
23+
{ "ca53-cpu1", 0x200, 1, R8A774C0_PD_CA53_CPU1, R8A774C0_PD_CA53_SCU,
24+
PD_CPU_NOCR },
25+
{ "a3vc", 0x380, 0, R8A774C0_PD_A3VC, R8A774C0_PD_ALWAYS_ON },
26+
{ "a2vc1", 0x3c0, 1, R8A774C0_PD_A2VC1, R8A774C0_PD_A3VC },
27+
{ "3dg-a", 0x100, 0, R8A774C0_PD_3DG_A, R8A774C0_PD_ALWAYS_ON },
28+
{ "3dg-b", 0x100, 1, R8A774C0_PD_3DG_B, R8A774C0_PD_3DG_A },
29+
};
30+
31+
static void __init rcar_sysc_fix_parent(struct rcar_sysc_area *areas,
32+
unsigned int num_areas, u8 id,
33+
int new_parent)
34+
{
35+
unsigned int i;
36+
37+
for (i = 0; i < num_areas; i++)
38+
if (areas[i].isr_bit == id) {
39+
areas[i].parent = new_parent;
40+
return;
41+
}
42+
}
43+
44+
/* Fixups for RZ/G2E ES1.0 revision */
45+
static const struct soc_device_attribute r8a774c0[] __initconst = {
46+
{ .soc_id = "r8a774c0", .revision = "ES1.0" },
47+
{ /* sentinel */ }
48+
};
49+
50+
static int __init r8a774c0_sysc_init(void)
51+
{
52+
if (soc_device_match(r8a774c0)) {
53+
rcar_sysc_fix_parent(r8a774c0_areas,
54+
ARRAY_SIZE(r8a774c0_areas),
55+
R8A774C0_PD_3DG_A, R8A774C0_PD_3DG_B);
56+
rcar_sysc_fix_parent(r8a774c0_areas,
57+
ARRAY_SIZE(r8a774c0_areas),
58+
R8A774C0_PD_3DG_B, R8A774C0_PD_ALWAYS_ON);
59+
}
60+
61+
return 0;
62+
}
63+
64+
const struct rcar_sysc_info r8a774c0_sysc_info __initconst = {
65+
.init = r8a774c0_sysc_init,
66+
.areas = r8a774c0_areas,
67+
.num_areas = ARRAY_SIZE(r8a774c0_areas),
68+
};

drivers/soc/renesas/rcar-sysc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ static const struct of_device_id rcar_sysc_matches[] __initconst = {
275275
#ifdef CONFIG_SYSC_R8A774A1
276276
{ .compatible = "renesas,r8a774a1-sysc", .data = &r8a774a1_sysc_info },
277277
#endif
278+
#ifdef CONFIG_SYSC_R8A774C0
279+
{ .compatible = "renesas,r8a774c0-sysc", .data = &r8a774c0_sysc_info },
280+
#endif
278281
#ifdef CONFIG_SYSC_R8A7779
279282
{ .compatible = "renesas,r8a7779-sysc", .data = &r8a7779_sysc_info },
280283
#endif

drivers/soc/renesas/rcar-sysc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ extern const struct rcar_sysc_info r8a7743_sysc_info;
5050
extern const struct rcar_sysc_info r8a7745_sysc_info;
5151
extern const struct rcar_sysc_info r8a77470_sysc_info;
5252
extern const struct rcar_sysc_info r8a774a1_sysc_info;
53+
extern const struct rcar_sysc_info r8a774c0_sysc_info;
5354
extern const struct rcar_sysc_info r8a7779_sysc_info;
5455
extern const struct rcar_sysc_info r8a7790_sysc_info;
5556
extern const struct rcar_sysc_info r8a7791_sysc_info;

0 commit comments

Comments
 (0)