Commit bdde3d3e authored by Geert Uytterhoeven's avatar Geert Uytterhoeven
Browse files

soc: renesas: rcar-sysc: Add R8A77961 support



Add support for the power areas in the Renesas R-Car M3-W+ (R8A77961)
SoC to the R-Car System Controller driver.

R-Car M3-W+ (aka R-Car M3-W ES3.0) is very similar to R-Car
M3-W (R8A77960), which allows for both SoCs to share a driver:
  - R-Car M3-W+ lacks the A2VC power area, so its area must be
    nullified,
  - The existing support for the SYSCEXTMASK register added in commit
    9bd645af9d2a49ac ("soc: renesas: r8a7796-sysc: Fix power request
    conflicts") applies to ES3.0 and later only.
    As R-Car M3-W+ uses a different compatible value, differentiate
    based on that, instead of on the ES version.

Based on a patch in the BSP by Dien Pham <dien.pham.ry@renesas.com>.

Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/r/20191023123342.13100-7-geert+renesas@glider.be
parent 41684bff
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -213,6 +213,7 @@ config ARCH_R8A7796
config ARCH_R8A77961
	bool "Renesas R-Car M3-W+ SoC Platform"
	select ARCH_RCAR_GEN3
	select SYSC_R8A77961
	help
	  This enables support for the Renesas R-Car M3-W+ SoC.

@@ -306,6 +307,10 @@ config SYSC_R8A77960
	bool "R-Car M3-W System Controller support" if COMPILE_TEST
	select SYSC_RCAR

config SYSC_R8A77961
	bool "R-Car M3-W+ System Controller support" if COMPILE_TEST
	select SYSC_RCAR

config SYSC_R8A77965
	bool "R-Car M3-N System Controller support" if COMPILE_TEST
	select SYSC_RCAR
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ obj-$(CONFIG_SYSC_R8A7792) += r8a7792-sysc.o
obj-$(CONFIG_SYSC_R8A7794)	+= r8a7794-sysc.o
obj-$(CONFIG_SYSC_R8A7795)	+= r8a7795-sysc.o
obj-$(CONFIG_SYSC_R8A77960)	+= r8a7796-sysc.o
obj-$(CONFIG_SYSC_R8A77961)	+= r8a7796-sysc.o
obj-$(CONFIG_SYSC_R8A77965)	+= r8a77965-sysc.o
obj-$(CONFIG_SYSC_R8A77970)	+= r8a77970-sysc.o
obj-$(CONFIG_SYSC_R8A77980)	+= r8a77980-sysc.o
+15 −12
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * Renesas R-Car M3-W System Controller
 * Renesas R-Car M3-W/W+ System Controller
 *
 * Copyright (C) 2016 Glider bvba
 * Copyright (C) 2018-2019 Renesas Electronics Corporation
 */

#include <linux/bits.h>
#include <linux/kernel.h>
#include <linux/sys_soc.h>

#include <dt-bindings/power/r8a7796-sysc.h>

#include "rcar-sysc.h"

static const struct rcar_sysc_area r8a7796_areas[] __initconst = {
static struct rcar_sysc_area r8a7796_areas[] __initdata = {
	{ "always-on",	    0, 0, R8A7796_PD_ALWAYS_ON,	-1, PD_ALWAYS_ON },
	{ "ca57-scu",	0x1c0, 0, R8A7796_PD_CA57_SCU,	R8A7796_PD_ALWAYS_ON,
	  PD_SCU },
@@ -41,24 +41,27 @@ static const struct rcar_sysc_area r8a7796_areas[] __initconst = {
};


/* Fixups for R-Car M3-W ES1.x revision */
static const struct soc_device_attribute r8a7796es1[] __initconst = {
	{ .soc_id = "r8a7796", .revision = "ES1.*" },
	{ /* sentinel */ }
#ifdef CONFIG_SYSC_R8A77960
const struct rcar_sysc_info r8a77960_sysc_info __initconst = {
	.areas = r8a7796_areas,
	.num_areas = ARRAY_SIZE(r8a7796_areas),
};
#endif /* CONFIG_SYSC_R8A77960 */

static int __init r8a77960_sysc_init(void)
#ifdef CONFIG_SYSC_R8A77961
static int __init r8a77961_sysc_init(void)
{
	if (soc_device_match(r8a7796es1))
		r8a77960_sysc_info.extmask_val = 0;
	rcar_sysc_nullify(r8a7796_areas, ARRAY_SIZE(r8a7796_areas),
			  R8A7796_PD_A2VC0);

	return 0;
}

struct rcar_sysc_info r8a77960_sysc_info __initdata = {
	.init = r8a77960_sysc_init,
const struct rcar_sysc_info r8a77961_sysc_info __initconst = {
	.init = r8a77961_sysc_init,
	.areas = r8a7796_areas,
	.num_areas = ARRAY_SIZE(r8a7796_areas),
	.extmask_offs = 0x2f8,
	.extmask_val = BIT(0),
};
#endif /* CONFIG_SYSC_R8A77961 */
+3 −0
Original line number Diff line number Diff line
@@ -316,6 +316,9 @@ static const struct of_device_id rcar_sysc_matches[] __initconst = {
#ifdef CONFIG_SYSC_R8A77960
	{ .compatible = "renesas,r8a7796-sysc", .data = &r8a77960_sysc_info },
#endif
#ifdef CONFIG_SYSC_R8A77961
	{ .compatible = "renesas,r8a77961-sysc", .data = &r8a77961_sysc_info },
#endif
#ifdef CONFIG_SYSC_R8A77965
	{ .compatible = "renesas,r8a77965-sysc", .data = &r8a77965_sysc_info },
#endif
+2 −1
Original line number Diff line number Diff line
@@ -61,7 +61,8 @@ extern const struct rcar_sysc_info r8a7791_sysc_info;
extern const struct rcar_sysc_info r8a7792_sysc_info;
extern const struct rcar_sysc_info r8a7794_sysc_info;
extern struct rcar_sysc_info r8a7795_sysc_info;
extern struct rcar_sysc_info r8a77960_sysc_info;
extern const struct rcar_sysc_info r8a77960_sysc_info;
extern const struct rcar_sysc_info r8a77961_sysc_info;
extern const struct rcar_sysc_info r8a77965_sysc_info;
extern const struct rcar_sysc_info r8a77970_sysc_info;
extern const struct rcar_sysc_info r8a77980_sysc_info;