Skip to contentSkip to conversation

soc: renesas: Add R-Car SYSC PM Domain Support

PATCH Superseded Geert Uytterhoeven 3 participants 15 messages Mar 9, 2016 – Mar 10, 2016

Subsystems (3)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

v3 cover soc: renesas: Add R-Car SYSC PM Domain Support

Hi all,

This patch series introduces a DT-based driver for the R-Car System Controller.

This is a dependency for the enablement of DU and VSP on R-Car H3, as the VSPs are located in a PM Domain.

Changes compared to v2:
- Add Reviewed-by,
- Rename driver from pm-rcar to rcar-sysc,
- Create PM Domains from hierarchy in C data instead of DT,
- Add support for an "always-on" domain, which is currently used on R-Car H3 only (support can be added for other R-Car SoCs, preferably after their migration to CPG/MSSR),
- Drop power area A3SH on R-Car H3, as it's no longer documented in the datasheet, and touching it seems to crash SYSC,
- Hook up the CPG/MSSR Clock Domain attach/detach callbacks instead of using our own copies,
- Initialize SYSCIER early, as SYSC needs the interrupt sources to be enabled to control power,
- Mask all SYSC interrupt sources for the CPU,
- Drop check for CONFIG_PM_GENERIC_DOMAINS, which is now always enabled on R-Car SoCs,
- Use early_initcall() instead of core_initcall(),
- Do not power up CPU power areas during initialization, as this is handled later (directly or indirectly) by the SMP code,
- Extract bindings into its own series, "[PATCH v3 0/7] PM / Domains:
Add DT bindings for the R-Car System Controller".

Changes compared to v1 (more details in the individual patches):
- Moved pm-rcar from arch/arm/mach-shmobile/ to drivers/soc/renesas/,
- Added R-Car H3 (r8a7795) support, incl. support for devices part of a SYSC PM domain and the CPG/MSSR clock domain,
- Use "renesas,<type>-sysc" instead of "renesas,sysc-<type>",
- Added fallback compatibility strings for R-Car Gen2 and Gen3.
- Changed one-line summary prefix to match current arm-soc practices,
- The L2 cache-controller patches have been extracted into a separate series ("[PATCH v3 0/7] ARM/arm64: dts: renesas: Add/complete L2 cache-controller nodes"),
- Minor fixes.

Dependencies:
- renesas-devel-20160307-v4.5-rc7,
- "[PATCH 0/4] clk: renesas: PM Domain Cleanups and Preparation".

This has been tested on r8a7779/marzen, r8a7790/lager, r8a7791/koelsch, and r8a7795/salvator-x.

Thanks for your comments!

Geert Uytterhoeven (11):
soc: renesas: Move pm-rcar to drivers/soc/renesas/rcar-sysc
soc: renesas: rcar-sysc: Improve rcar_sysc_power() debug info
soc: renesas: rcar-sysc: Add DT support for SYSC PM domains
soc: renesas: rcar-sysc: Make rcar_sysc_power_is_off() static
soc: renesas: rcar-sysc: Enable Clock Domain for r8a7795 I/O devices
soc: renesas: rcar-sysc: Add support for R-Car H1 power areas
soc: renesas: rcar-sysc: Add support for R-Car H2 power areas
soc: renesas: rcar-sysc: Add support for R-Car M2-W power areas
soc: renesas: rcar-sysc: Add support for R-Car M2-N power areas
soc: renesas: rcar-sysc: Add support for R-Car E2 power areas
soc: renesas: rcar-sysc: Add support for R-Car H3 power areas

 arch/arm/mach-shmobile/Kconfig                     |  11 +-
 arch/arm/mach-shmobile/Makefile                    |   1 -
 arch/arm/mach-shmobile/pm-r8a7779.c                |   3 +-
 arch/arm/mach-shmobile/pm-rcar-gen2.c              |   2 +-
 arch/arm/mach-shmobile/pm-rcar.c                   | 164 ---------
 arch/arm/mach-shmobile/smp-r8a7779.c               |   2 +-
 arch/arm/mach-shmobile/smp-r8a7790.c               |   2 +-
 drivers/soc/Makefile                               |   3 +-
 drivers/soc/renesas/Makefile                       |   7 +
 drivers/soc/renesas/r8a7779-sysc.c                 |  31 ++
 drivers/soc/renesas/r8a7790-sysc.c                 |  45 +++
 drivers/soc/renesas/r8a7791-sysc.c                 |  32 ++
 drivers/soc/renesas/r8a7794-sysc.c                 |  32 ++
 drivers/soc/renesas/r8a7795-sysc.c                 |  56 +++
 drivers/soc/renesas/rcar-sysc.c                    | 394 +++++++++++++++++++++
 drivers/soc/renesas/rcar-sysc.h                    |  60 ++++
 .../linux/soc/renesas/rcar-sysc.h                  |   9 +-
 17 files changed, 673 insertions(+), 181 deletions(-)
 delete mode 100644 arch/arm/mach-shmobile/pm-rcar.c
 create mode 100644 drivers/soc/renesas/Makefile
 create mode 100644 drivers/soc/renesas/r8a7779-sysc.c
 create mode 100644 drivers/soc/renesas/r8a7790-sysc.c
 create mode 100644 drivers/soc/renesas/r8a7791-sysc.c
 create mode 100644 drivers/soc/renesas/r8a7794-sysc.c
 create mode 100644 drivers/soc/renesas/r8a7795-sysc.c
 create mode 100644 drivers/soc/renesas/rcar-sysc.c
 create mode 100644 drivers/soc/renesas/rcar-sysc.h
 rename arch/arm/mach-shmobile/pm-rcar.h => include/linux/soc/renesas/rcar-sysc.h (60%)
Signature · 12 lines
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
author maintainer
#1 lore raw

PATCH v3 1/11 soc: renesas: Move pm-rcar to drivers/soc/renesas/rcar-sysc

Move the pm-rcar driver from arch/arm/mach-shmobile/ to drivers/soc/renesas/, and its header file to include/linux/soc/renesas/, so it can be shared between arm32 (R-Car H1 and Gen2) and arm64 (R-Car Gen3). Rename it to rcar-sysc as it's really a driver for the R-Car System Controller (SYSC).

Kill the intermediate PM_RCAR config symbol, as it's not user configurable anymore, and to prepare for SoC-specific make rules.

Add the missing #include <linux/types.h> to rcar-sysc.h, which was exposed by different include order.

---
v3:
- Add Reviewed-by,
- Rename driver from pm-rcar to rcar-sysc,
- Kill CONFIG_PM_RCAR,
- Add missing include,

v2:
- New.

---
 arch/arm/mach-shmobile/Kconfig                                | 11 ++++-------
 arch/arm/mach-shmobile/Makefile                               |  1 -
 arch/arm/mach-shmobile/pm-r8a7779.c                           |  3 ++-
 arch/arm/mach-shmobile/pm-rcar-gen2.c                         |  2 +-
 arch/arm/mach-shmobile/smp-r8a7779.c                          |  2 +-
 arch/arm/mach-shmobile/smp-r8a7790.c                          |  2 +-
 drivers/soc/Makefile                                          |  3 ++-
 drivers/soc/renesas/Makefile                                  |  5 +++++
 .../pm-rcar.c => drivers/soc/renesas/rcar-sysc.c              |  2 +-
 .../pm-rcar.h => include/linux/soc/renesas/rcar-sysc.h        |  8 +++++---
 10 files changed, 22 insertions(+), 17 deletions(-)
 create mode 100644 drivers/soc/renesas/Makefile
 rename arch/arm/mach-shmobile/pm-rcar.c => drivers/soc/renesas/rcar-sysc.c (99%)
 rename arch/arm/mach-shmobile/pm-rcar.h => include/linux/soc/renesas/rcar-sysc.h (66%)
arch/arm/mach-shmobile/Kconfig +4 -7
index f2bc5c353119e96d..fe4ccb52f9213d8b 100644
@@ -4,11 +4,6 @@ config ARCH_SHMOBILE
 config ARCH_SHMOBILE_MULTI
 	bool
 
-config PM_RCAR
-	bool
-	select PM
-	select PM_GENERIC_DOMAINS
-
 config PM_RMOBILE
 	bool
 	select PM
@@ -16,13 +11,15 @@ config PM_RMOBILE
 
 config ARCH_RCAR_GEN1
 	bool
-	select PM_RCAR
+	select PM
+	select PM_GENERIC_DOMAINS
 	select RENESAS_INTC_IRQPIN
 	select SYS_SUPPORTS_SH_TMU
 
 config ARCH_RCAR_GEN2
 	bool
-	select PM_RCAR
+	select PM
+	select PM_GENERIC_DOMAINS
 	select RENESAS_IRQC
 	select SYS_SUPPORTS_SH_CMT
 	select PCI_DOMAINS if PCI
arch/arm/mach-shmobile/Makefile +0 -1
index a65c80ac9009d51f..ebb909c55b856a58 100644
@@ -39,7 +39,6 @@ smp-$(CONFIG_ARCH_EMEV2)	+= smp-emev2.o headsmp-scu.o platsmp-scu.o
 # PM objects
 obj-$(CONFIG_SUSPEND)		+= suspend.o
 obj-$(CONFIG_CPU_FREQ)		+= cpufreq.o
-obj-$(CONFIG_PM_RCAR)		+= pm-rcar.o
 obj-$(CONFIG_PM_RMOBILE)	+= pm-rmobile.o
 obj-$(CONFIG_ARCH_RCAR_GEN2)	+= pm-rcar-gen2.o
 
arch/arm/mach-shmobile/pm-r8a7779.c +2 -1
index 14c42a1bdf1ef20d..4174cbcbc467d047 100644
@@ -9,9 +9,10 @@
  * for more details.
  */
 
+#include <linux/soc/renesas/rcar-sysc.h>
+
 #include <asm/io.h>
 
-#include "pm-rcar.h"
 #include "r8a7779.h"
 
 /* SYSC */
arch/arm/mach-shmobile/pm-rcar-gen2.c +1 -1
index 6815781ad1165ef3..691ac166a277c03f 100644
@@ -13,9 +13,9 @@
 #include <linux/kernel.h>
 #include <linux/of.h>
 #include <linux/smp.h>
+#include <linux/soc/renesas/rcar-sysc.h>
 #include <asm/io.h>
 #include "common.h"
-#include "pm-rcar.h"
 #include "rcar-gen2.h"
 
 /* RST */
arch/arm/mach-shmobile/smp-r8a7779.c +1 -1
index f5c31fbc10b2efbf..c6951ee245889b8f 100644
@@ -19,13 +19,13 @@
 #include <linux/spinlock.h>
 #include <linux/io.h>
 #include <linux/delay.h>
+#include <linux/soc/renesas/rcar-sysc.h>
 
 #include <asm/cacheflush.h>
 #include <asm/smp_plat.h>
 #include <asm/smp_scu.h>
 
 #include "common.h"
-#include "pm-rcar.h"
 #include "r8a7779.h"
 
 #define AVECR IOMEM(0xfe700040)
arch/arm/mach-shmobile/smp-r8a7790.c +1 -1
index f6426c6fdefcb489..28f26d5362d8d4d2 100644
@@ -17,12 +17,12 @@
 #include <linux/init.h>
 #include <linux/smp.h>
 #include <linux/io.h>
+#include <linux/soc/renesas/rcar-sysc.h>
 
 #include <asm/smp_plat.h>
 
 #include "common.h"
 #include "platsmp-apmu.h"
-#include "pm-rcar.h"
 #include "rcar-gen2.h"
 #include "r8a7790.h"
 
drivers/soc/Makefile +2 -1
index 2afdc74f7491adf0..298ee4157bb6d9a0 100644
@@ -9,7 +9,8 @@ obj-$(CONFIG_MACH_DOVE)		+= dove/
 obj-y				+= fsl/
 obj-$(CONFIG_ARCH_MEDIATEK)	+= mediatek/
 obj-$(CONFIG_ARCH_QCOM)		+= qcom/
-obj-$(CONFIG_ARCH_ROCKCHIP)		+= rockchip/
+obj-$(CONFIG_ARCH_RENESAS)	+= renesas/
+obj-$(CONFIG_ARCH_ROCKCHIP)	+= rockchip/
 obj-$(CONFIG_ARCH_SUNXI)	+= sunxi/
 obj-$(CONFIG_ARCH_TEGRA)	+= tegra/
 obj-$(CONFIG_SOC_TI)		+= ti/
drivers/soc/renesas/Makefile new file +5 -0
new file mode 100644
index 0000000000000000..2b64f6c9468136f9
@@ -0,0 +1,5 @@
+obj-$(CONFIG_ARCH_R8A7779)	+= rcar-sysc.o
+obj-$(CONFIG_ARCH_R8A7790)	+= rcar-sysc.o
+obj-$(CONFIG_ARCH_R8A7791)	+= rcar-sysc.o
+obj-$(CONFIG_ARCH_R8A7793)	+= rcar-sysc.o
+obj-$(CONFIG_ARCH_R8A7794)	+= rcar-sysc.o
drivers/soc/renesas/rcar-sysc.c renamed from arch/arm/mach-shmobile/pm-rcar.c +1 -1
similarity index 99%
rename from arch/arm/mach-shmobile/pm-rcar.c
rename to drivers/soc/renesas/rcar-sysc.c
index 0af05d288b09c3ab..d59bcdf78f0b56ba 100644
@@ -13,7 +13,7 @@
 #include <linux/mm.h>
 #include <linux/spinlock.h>
 #include <linux/io.h>
-#include "pm-rcar.h"
+#include <linux/soc/renesas/rcar-sysc.h>
 
 /* SYSC Common */
 #define SYSCSR			0x00	/* SYSC Status Register */
include/linux/soc/renesas/rcar-sysc.h renamed from arch/arm/mach-shmobile/pm-rcar.h +5 -3
similarity index 66%
rename from arch/arm/mach-shmobile/pm-rcar.h
rename to include/linux/soc/renesas/rcar-sysc.h
index 1b901db4a24c4633..96f30c2883881d97 100644
@@ -1,5 +1,7 @@
-#ifndef PM_RCAR_H
-#define PM_RCAR_H
+#ifndef __LINUX_SOC_RENESAS_RCAR_SYSC_H__
+#define __LINUX_SOC_RENESAS_RCAR_SYSC_H__
+
+#include <linux/types.h>
 
 struct rcar_sysc_ch {
 	u16 chan_offs;
@@ -12,4 +14,4 @@ int rcar_sysc_power_up(const struct rcar_sysc_ch *sysc_ch);
 bool rcar_sysc_power_is_off(const struct rcar_sysc_ch *sysc_ch);
 void __iomem *rcar_sysc_init(phys_addr_t base);
 
-#endif /* PM_RCAR_H */
+#endif /* __LINUX_SOC_RENESAS_RCAR_SYSC_H__ */
Signature · 1 line
1.9.1
author maintainer
#2 lore raw

PATCH v3 2/11 soc: renesas: rcar-sysc: Improve rcar_sysc_power() debug info

In reply to Geert Uytterhoeven

Print requested power domain state.

---
v3:
- Add Reviewed-by,

v2:
- New.

---
 drivers/soc/renesas/rcar-sysc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/renesas/rcar-sysc.c +1 -1
index d59bcdf78f0b56ba..9ba5fd15c53bf9b9 100644
@@ -128,7 +128,7 @@ static int rcar_sysc_power(const struct rcar_sysc_ch *sysc_ch, bool on)
  out:
 	spin_unlock_irqrestore(&rcar_sysc_lock, flags);
 
-	pr_debug("sysc power domain %d: %08x -> %d\n",
+	pr_debug("sysc power %s domain %d: %08x -> %d\n", on ? "on" : "off",
 		 sysc_ch->isr_bit, ioread32(rcar_sysc_base + SYSCISR), ret);
 	return ret;
 }
Signature · 1 line
1.9.1
author maintainer
#3 lore raw

PATCH v3 3/11 soc: renesas: rcar-sysc: Add DT support for SYSC PM domains

In reply to Geert Uytterhoeven

Populate the SYSC PM domains from DT, based on the presence of a device node for the System Controller. The actual power area hiearchy, and features of specific areas are obtained from tables in the C code.

The SYSCIER register value is derived from the power areas present, which will help to get rid of the hardcoded values in pm-rcar-gen2.c later.

Initialization is done from an early_initcall(), to make sure the PM Domains are initialized before SMP.

---
v3:
- Drop check for CONFIG_PM_GENERIC_DOMAINS, which is now always enabled on R-Car SoCs,
- Create PM Domains from hierarchy in C data instead of DT,
- Initialize SYSCIER early, as SYSC needs the interrupt sources to be enabled to control power,
- Mask all SYSC interrupt sources for the CPU,
- Add support for an "always-on" domain,
- Use early_initcall() instead of core_initcall(),
- Do not power up CPU power areas during initialization, as this is handled later (directly or indirectly) by the SMP code,

v2:
- Add missing definitions for SYSC_PWR_CA15_CPU and SYSC_PWR_CA7_CPU,
- Add R-Car H3 (r8a7795) support,
- Drop tests for CONFIG_ARCH_SHMOBILE_LEGACY,
- Add missing break statements in rcar_sysc_pwr_on_off(),
- Add missing calls to of_node_put() in error paths,
- Fix build if CONFIG_PM=n,
- Update compatible values,
- Update copyright.

---
 drivers/soc/renesas/rcar-sysc.c | 202 ++++++++++++++++++++++++++++++++++++++++
 drivers/soc/renesas/rcar-sysc.h |  53 +++++++++++
 2 files changed, 255 insertions(+)
 create mode 100644 drivers/soc/renesas/rcar-sysc.h
drivers/soc/renesas/rcar-sysc.c +202 -0
index 9ba5fd15c53bf9b9..6b21ea2a65bf59b9 100644
@@ -2,6 +2,7 @@
  * R-Car SYSC Power management support
  *
  * Copyright (C) 2014  Magnus Damm
+ * Copyright (C) 2015-2016 Glider bvba
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -11,10 +12,15 @@
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/mm.h>
+#include <linux/of_address.h>
+#include <linux/pm_domain.h>
+#include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/io.h>
 #include <linux/soc/renesas/rcar-sysc.h>
 
+#include "rcar-sysc.h"
+
 /* SYSC Common */
 #define SYSCSR			0x00	/* SYSC Status Register */
 #define SYSCISR			0x04	/* Interrupt Status Register */
@@ -162,3 +168,199 @@ void __iomem *rcar_sysc_init(phys_addr_t base)
 
 	return rcar_sysc_base;
 }
+
+struct rcar_sysc_pd {
+	struct generic_pm_domain genpd;
+	struct rcar_sysc_ch ch;
+	unsigned int flags;
+	char name[0];
+};
+
+static inline struct rcar_sysc_pd *to_rcar_pd(struct generic_pm_domain *d)
+{
+	return container_of(d, struct rcar_sysc_pd, genpd);
+}
+
+static bool rcar_sysc_active_wakeup(struct device *dev)
+{
+	return true;
+}
+
+static int rcar_sysc_pd_power_off(struct generic_pm_domain *genpd)
+{
+	struct rcar_sysc_pd *pd = to_rcar_pd(genpd);
+
+	pr_debug("%s: %s\n", __func__, genpd->name);
+
+	if (pd->flags & PD_NO_CR) {
+		pr_debug("%s: Cannot control %s\n", __func__, genpd->name);
+		return -EBUSY;
+	}
+
+	if (pd->flags & PD_BUSY) {
+		pr_debug("%s: %s busy\n", __func__, genpd->name);
+		return -EBUSY;
+	}
+
+	return rcar_sysc_power_down(&pd->ch);
+}
+
+static int rcar_sysc_pd_power_on(struct generic_pm_domain *genpd)
+{
+	struct rcar_sysc_pd *pd = to_rcar_pd(genpd);
+
+	pr_debug("%s: %s\n", __func__, genpd->name);
+
+	if (pd->flags & PD_NO_CR) {
+		pr_debug("%s: Cannot control %s\n", __func__, genpd->name);
+		return 0;
+	}
+
+	return rcar_sysc_power_up(&to_rcar_pd(genpd)->ch);
+}
+
+static void __init rcar_sysc_pd_setup(struct device_node *np,
+				      struct rcar_sysc_pd *pd)
+{
+	struct generic_pm_domain *genpd = &pd->genpd;
+	const char *name = pd->genpd.name;
+	struct dev_power_governor *gov = &simple_qos_governor;
+
+	if (pd->flags & PD_CPU) {
+		/*
+		 * This domain contains a CPU core and therefore it should
+		 * only be turned off if the CPU is not in use.
+		 */
+		pr_debug("PM domain %s contains CPU\n", name);
+		pd->flags |= PD_BUSY;
+		gov = &pm_domain_always_on_gov;
+	} else if (pd->flags & PD_SCU) {
+		/*
+		 * This domain contains an SCU and cache-controller, and
+		 * therefore it should only be turned off if the CPU cores are
+		 * not in use.
+		 */
+		pr_debug("PM domain %s contains SCU\n", name);
+		pd->flags |= PD_BUSY;
+		gov = &pm_domain_always_on_gov;
+	} else if (pd->flags & PD_NO_CR) {
+		/*
+		 * This domain cannot be turned off.
+		 */
+		pd->flags |= PD_BUSY;
+		gov = &pm_domain_always_on_gov;
+	}
+
+	pm_genpd_init(genpd, gov, false);
+	genpd->dev_ops.active_wakeup = rcar_sysc_active_wakeup;
+	genpd->power_off = rcar_sysc_pd_power_off;
+	genpd->power_on = rcar_sysc_pd_power_on;
+
+	if (pd->flags & (PD_CPU | PD_NO_CR)) {
+		/* Skip CPUs (handled by SMP code) and areas without control */
+		pr_debug("%s: Not touching %s\n", __func__, genpd->name);
+		return;
+	}
+
+	if (!rcar_sysc_power_is_off(&pd->ch)) {
+		pr_debug("%s: %s is already powered\n", __func__, genpd->name);
+		return;
+	}
+
+	rcar_sysc_power_up(&pd->ch);
+}
+
+static const struct of_device_id rcar_sysc_matches[] = {
+	{ /* sentinel */ }
+};
+
+struct rcar_pm_domains {
+	struct genpd_onecell_data onecell_data;
+	struct generic_pm_domain *domains[0];
+};
+
+static int __init rcar_sysc_pd_init(void)
+{
+	const struct rcar_sysc_info *info;
+	const struct of_device_id *match;
+	struct rcar_pm_domains *domains;
+	struct device_node *np;
+	unsigned int i, n = 0;
+	void __iomem *base;
+	u32 syscier = 0;
+	int error;
+
+	np = of_find_matching_node_and_match(NULL, rcar_sysc_matches, &match);
+	if (!np)
+		return -ENODEV;
+
+	info = match->data;
+
+	base = of_iomap(np, 0);
+	if (!base) {
+		pr_warn("%s cannot map reg 0\n", np->full_name);
+		error = -ENOMEM;
+		goto fail_put;
+	}
+
+	rcar_sysc_base = base;
+
+	for (i = 0; i < info->num_areas; i++) {
+		n = max_t(unsigned int, n, info->areas[i].isr_bit + 1);
+		syscier |= BIT(info->areas[i].isr_bit);
+	}
+
+	/*
+	 * SYSC needs all interrupt sources to be enabled to control power.
+	 * Mask all interrupt sources to prevent the CPU from receiving them.
+	 */
+	pr_debug("%s: syscier = 0x%08x\n", np->full_name, syscier);
+	iowrite32(syscier, rcar_sysc_base + SYSCIER);
+	iowrite32(syscier, rcar_sysc_base + SYSCIMR);
+
+	domains = kzalloc(sizeof(*domains) + n * sizeof(domains->domains[0]),
+			  GFP_KERNEL);
+	if (!domains) {
+		error = -ENOMEM;
+		goto fail_unmap;
+	}
+
+	for (i = 0; i < info->num_areas; i++) {
+		const struct rcar_sysc_area *area = &info->areas[i];
+		struct rcar_sysc_pd *pd;
+
+		pd = kzalloc(sizeof(*pd) + strlen(area->name) + 1, GFP_KERNEL);
+		if (!pd) {
+			error = -ENOMEM;
+			goto fail_unmap;
+		}
+
+		strcpy(pd->name, area->name);
+		pd->genpd.name = pd->name;
+		pd->ch.chan_offs = area->chan_offs;
+		pd->ch.chan_bit = area->chan_bit;
+		pd->ch.isr_bit = area->isr_bit;
+		pd->flags = area->flags;
+
+		rcar_sysc_pd_setup(np, pd);
+		if (area->parent >= 0)
+			pm_genpd_add_subdomain(domains->domains[area->parent],
+					       &pd->genpd);
+
+		domains->domains[area->isr_bit] = &pd->genpd;
+	}
+
+	domains->onecell_data.domains = domains->domains;
+	domains->onecell_data.num_domains = n;
+	of_genpd_add_provider_onecell(np, &domains->onecell_data);
+	of_node_put(np);
+	return 0;
+
+fail_unmap:
+	iounmap(base);
+fail_put:
+	of_node_put(np);
+	return error;
+}
+
+early_initcall(rcar_sysc_pd_init);
drivers/soc/renesas/rcar-sysc.h new file +53 -0

53 lines not on this page · raw message

Signature · 1 line
1.9.1
author maintainer
#4 lore raw

PATCH v3 4/11 soc: renesas: rcar-sysc: Make rcar_sysc_power_is_off() static

In reply to Geert Uytterhoeven

As of commit b12ff41658171f53 ("ARM: shmobile: r8a7779: Remove legacy PM Domain remainings"), rcar_sysc_power_is_off() is no longer used from SoC-specific code.

---
v3:
- New.

---
 drivers/soc/renesas/rcar-sysc.c       | 2 +-
 include/linux/soc/renesas/rcar-sysc.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/soc/renesas/rcar-sysc.c +1 -1
index 6b21ea2a65bf59b9..28af0b704fc008d2 100644
@@ -149,7 +149,7 @@ int rcar_sysc_power_up(const struct rcar_sysc_ch *sysc_ch)
 	return rcar_sysc_power(sysc_ch, true);
 }
 
-bool rcar_sysc_power_is_off(const struct rcar_sysc_ch *sysc_ch)
+static bool rcar_sysc_power_is_off(const struct rcar_sysc_ch *sysc_ch)
 {
 	unsigned int st;
 
include/linux/soc/renesas/rcar-sysc.h +0 -1
index 96f30c2883881d97..92fc613ab23db091 100644
@@ -11,7 +11,6 @@ struct rcar_sysc_ch {
 
 int rcar_sysc_power_down(const struct rcar_sysc_ch *sysc_ch);
 int rcar_sysc_power_up(const struct rcar_sysc_ch *sysc_ch);
-bool rcar_sysc_power_is_off(const struct rcar_sysc_ch *sysc_ch);
 void __iomem *rcar_sysc_init(phys_addr_t base);
 
 #endif /* __LINUX_SOC_RENESAS_RCAR_SYSC_H__ */
Signature · 1 line
1.9.1
#5 lore raw

PATCH v3 4/11 soc: renesas: rcar-sysc: Make rcar_sysc_power_is_off() static

Hi Geert,

Thank you for the patch.

Quoted 5 lines · On Wednesday 09 March 2016 20:18:40 Geert Uytterhoeven wrote:

As of commit b12ff41658171f53 ("ARM: shmobile: r8a7779: Remove legacy PM Domain remainings"), rcar_sysc_power_is_off() is no longer used from SoC-specific code.

Quoted 35 lines

---
v3:
- New.

---
 drivers/soc/renesas/rcar-sysc.c       | 2 +-
 include/linux/soc/renesas/rcar-sysc.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/soc/renesas/rcar-sysc.c index 6b21ea2a65bf59b9..28af0b704fc008d2 100644

drivers/soc/renesas/rcar-sysc.c +1 -1
@@ -149,7 +149,7 @@ int rcar_sysc_power_up(const struct rcar_sysc_ch
 *sysc_ch) return rcar_sysc_power(sysc_ch, true);
 }
 
-bool rcar_sysc_power_is_off(const struct rcar_sysc_ch *sysc_ch)
+static bool rcar_sysc_power_is_off(const struct rcar_sysc_ch *sysc_ch)
 {
 	unsigned int st;
 
(quoted diff) +0 -0

b/include/linux/soc/renesas/rcar-sysc.h index
96f30c2883881d97..92fc613ab23db091 100644

include/linux/soc/renesas/rcar-sysc.h +0 -1
@@ -11,7 +11,6 @@ struct rcar_sysc_ch {
 
 int rcar_sysc_power_down(const struct rcar_sysc_ch *sysc_ch);
 int rcar_sysc_power_up(const struct rcar_sysc_ch *sysc_ch);
-bool rcar_sysc_power_is_off(const struct rcar_sysc_ch *sysc_ch);
 void __iomem *rcar_sysc_init(phys_addr_t base);
 
 #endif /* __LINUX_SOC_RENESAS_RCAR_SYSC_H__ */
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#6 lore raw

PATCH v3 5/11 soc: renesas: rcar-sysc: Enable Clock Domain for r8a7795 I/O devices

In reply to Geert Uytterhoeven

On R-Car H3, some power areas (e.g. A3VP) contain I/O devices, which are also part of the CPG/MSSR Clock Domain. Hook up the CPG/MSSR Clock Domain attach/detach callbacks to enable power management using module clocks.

This also allows to support the Clock Domain for devices in the "always-on" power area.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>

---
v3:
- Hook up the CPG/MSSR Clock Domain attach/detach callbacks instead of using our own copies,

v2:
- New.

---
 drivers/soc/renesas/rcar-sysc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/soc/renesas/rcar-sysc.c +10 -0
index 28af0b704fc008d2..2d6fbeb481883be7 100644
@@ -9,6 +9,7 @@
  * for more details.
  */
 
+#include <linux/clk/renesas.h>
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/mm.h>
@@ -251,6 +252,15 @@ static void __init rcar_sysc_pd_setup(struct device_node *np,
 		gov = &pm_domain_always_on_gov;
 	}
 
+#ifdef CONFIG_ARCH_R8A7795
+	if (!(pd->flags & (PD_CPU | PD_SCU))) {
+		/* Enable Clock Domain for I/O devices */
+		genpd->flags = GENPD_FLAG_PM_CLK;
+		genpd->attach_dev = cpg_mssr_attach_dev;
+		genpd->detach_dev = cpg_mssr_detach_dev;
+	}
+#endif
+
 	pm_genpd_init(genpd, gov, false);
 	genpd->dev_ops.active_wakeup = rcar_sysc_active_wakeup;
 	genpd->power_off = rcar_sysc_pd_power_off;
Signature · 1 line
1.9.1
#7 lore raw

PATCH v3 5/11 soc: renesas: rcar-sysc: Enable Clock Domain for r8a7795 I/O devices

Hi Geert,

Thank you for the patch.

Quoted 36 lines · On Wednesday 09 March 2016 20:18:41 Geert Uytterhoeven wrote:

On R-Car H3, some power areas (e.g. A3VP) contain I/O devices, which are also part of the CPG/MSSR Clock Domain. Hook up the CPG/MSSR Clock Domain attach/detach callbacks to enable power management using module clocks.

This also allows to support the Clock Domain for devices in the "always-on" power area.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>

---
v3:
- Hook up the CPG/MSSR Clock Domain attach/detach callbacks instead of using our own copies,

v2:
- New.

---
 drivers/soc/renesas/rcar-sysc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
(quoted diff) +0 -0

b/drivers/soc/renesas/rcar-sysc.c index 28af0b704fc008d2..2d6fbeb481883be7 100644

drivers/soc/renesas/rcar-sysc.c +1 -0
@@ -9,6 +9,7 @@
  * for more details.
  */
 
+#include <linux/clk/renesas.h>
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/mm.h>

drivers/soc/renesas/rcar-sysc.c static void __init rcar_sysc_pd_setup(struct · line 255

Quoted 4 lines
drivers/soc/renesas/rcar-sysc.c +1 -0
@@ -251,6 +252,15 @@ static void __init rcar_sysc_pd_setup(struct
 device_node *np, gov = &pm_domain_always_on_gov;
 	}
 
+#ifdef CONFIG_ARCH_R8A7795

This is fine for now as the R8A7795 is the only ARM64 model in the R-Car family, but how do you plan to move forward on this ? Will it be enabled for ARM64 SoCs straight away, and for ARM32 SoCs when switching from the cpg to the always-on power domain ?

Quoted 11 lines
drivers/soc/renesas/rcar-sysc.c +8 -0
+	if (!(pd->flags & (PD_CPU | PD_SCU))) {
+		/* Enable Clock Domain for I/O devices */
+		genpd->flags = GENPD_FLAG_PM_CLK;
+		genpd->attach_dev = cpg_mssr_attach_dev;
+		genpd->detach_dev = cpg_mssr_detach_dev;
+	}
+#endif
+
 	pm_genpd_init(genpd, gov, false);
 	genpd->dev_ops.active_wakeup = rcar_sysc_active_wakeup;
 	genpd->power_off = rcar_sysc_pd_power_off;
Signature · 3 lines
Regards,

Laurent Pinchart
#8 lore raw

PATCH v3 5/11 soc: renesas: rcar-sysc: Enable Clock Domain for r8a7795 I/O devices

Hi Laurent,

Quoted 18 lines · Laurent Pinchart
Quoted 17 lines · On Wednesday 09 March 2016 20:18:41 Geert Uytterhoeven wrote:

On R-Car H3, some power areas (e.g. A3VP) contain I/O devices, which are also part of the CPG/MSSR Clock Domain. Hook up the CPG/MSSR Clock Domain attach/detach callbacks to enable power management using module clocks.

This also allows to support the Clock Domain for devices in the "always-on" power area.

drivers/soc/renesas/rcar-sysc.c +0 -0
@@ -251,6 +252,15 @@ static void __init rcar_sysc_pd_setup(struct
 device_node *np, gov = &pm_domain_always_on_gov;
      }
 
Quoted 14 lines

drivers/soc/renesas/rcar-sysc.c static void __init rcar_sysc_pd_setup(struct device_node *np, · line 255

Quoted 1 line
drivers/soc/renesas/rcar-sysc.c +1 -0
+#ifdef CONFIG_ARCH_R8A7795

This is fine for now as the R8A7795 is the only ARM64 model in the R-Car family, but how do you plan to move forward on this ? Will it be enabled for ARM64 SoCs straight away, and for ARM32 SoCs when switching from the cpg to the always-on power domain ?

Quoted 7 lines
drivers/soc/renesas/rcar-sysc.c +7 -0
+     if (!(pd->flags & (PD_CPU | PD_SCU))) {
+             /* Enable Clock Domain for I/O devices */
+             genpd->flags = GENPD_FLAG_PM_CLK;
+             genpd->attach_dev = cpg_mssr_attach_dev;
+             genpd->detach_dev = cpg_mssr_detach_dev;
+     }
+#endif

When enabling the always-on power domain for R-Car H1 and Gen2, this should become:

        if (!(pd->flags & (PD_CPU | PD_SCU))) {
                /* Enable Clock Domain for I/O devices */
                genpd->flags = GENPD_FLAG_PM_CLK;
#ifdef CONFIG_ARCH_R8A7795 /* or CONFIG_ARM64 */
                genpd->attach_dev = cpg_mssr_attach_dev;
                genpd->detach_dev = cpg_mssr_detach_dev;
#else
                genpd->attach_dev = cpg_mstp_attach_dev;
                genpd->detach_dev = cpg_mstp_detach_dev;

#endif

It becomes more gory when migrating R-Car H1 and Gen2 to CPG/MSSR, and maintaining backwards compatibility, as which callbacks to choose will depend on the presence of "renesas,cpg-mstp-clocks" device nodes in DT, and a new CONFIG_CLK_RENESAS_LEGACY option.
Needless to say, it'll be more complex if not all SoCs migrate at once...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#9 lore raw

PATCH v3 6/11 soc: renesas: rcar-sysc: Add support for R-Car H1 power areas

In reply to Geert Uytterhoeven

---
v3:
- New (converted from DT to C).

---
 drivers/soc/renesas/Makefile       |  2 +-
 drivers/soc/renesas/r8a7779-sysc.c | 31 +++++++++++++++++++++++++++++++
 drivers/soc/renesas/rcar-sysc.c    |  3 +++
 drivers/soc/renesas/rcar-sysc.h    |  1 +
 4 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 drivers/soc/renesas/r8a7779-sysc.c
drivers/soc/renesas/Makefile +1 -1
index 2b64f6c9468136f9..b8aa9db4fdd95eb8 100644
@@ -1,4 +1,4 @@
-obj-$(CONFIG_ARCH_R8A7779)	+= rcar-sysc.o
+obj-$(CONFIG_ARCH_R8A7779)	+= rcar-sysc.o r8a7779-sysc.o
 obj-$(CONFIG_ARCH_R8A7790)	+= rcar-sysc.o
 obj-$(CONFIG_ARCH_R8A7791)	+= rcar-sysc.o
 obj-$(CONFIG_ARCH_R8A7793)	+= rcar-sysc.o
drivers/soc/renesas/r8a7779-sysc.c new file +31 -0
new file mode 100644
index 0000000000000000..4449657bdb88a586
@@ -0,0 +1,31 @@
+/*
+ * Renesas R-Car H1 System Controller
+ *
+ * Copyright (C) 2016 Glider bvba
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ */
+
+#include <linux/bug.h>
+#include <linux/kernel.h>
+
+#include <dt-bindings/power/r8a7779-sysc.h>
+
+#include "rcar-sysc.h"
+
+static const struct rcar_sysc_area r8a7779_areas[] __initconst = {
+	{ "arm1",	 0x40, 1, R8A7779_PD_ARM1,	-1, PD_CPU_CR, },
+	{ "arm2",	 0x40, 2, R8A7779_PD_ARM2,	-1, PD_CPU_CR, },
+	{ "arm3",	 0x40, 3, R8A7779_PD_ARM3,	-1, PD_CPU_CR, },
+	{ "sh",		 0x80, 0, R8A7779_PD_SH,	-1, },
+	{ "sgx",	 0xc0, 0, R8A7779_PD_SGX,	-1, },
+	{ "vdp",	0x100, 0, R8A7779_PD_VDP,	-1, },
+	{ "imp",	0x140, 0, R8A7779_PD_IMP,	-1, },
+};
+
+const struct rcar_sysc_info r8a7779_sysc_info __initconst = {
+	.areas = r8a7779_areas,
+	.num_areas = ARRAY_SIZE(r8a7779_areas),
+};
drivers/soc/renesas/rcar-sysc.c +3 -0
index 2d6fbeb481883be7..3d039009a2222820 100644
@@ -281,6 +281,9 @@ static void __init rcar_sysc_pd_setup(struct device_node *np,
 }
 
 static const struct of_device_id rcar_sysc_matches[] = {
+#ifdef CONFIG_ARCH_R8A7779
+	{ .compatible = "renesas,r8a7779-sysc", .data = &r8a7779_sysc_info },
+#endif
 	{ /* sentinel */ }
 };
 
drivers/soc/renesas/rcar-sysc.h +1 -0
index 7bb48b4f7334f960..7cf58b9cd544f4b9 100644
@@ -50,4 +50,5 @@ struct rcar_sysc_info {
 	unsigned int num_areas;
 };
 
+extern const struct rcar_sysc_info r8a7779_sysc_info;
 #endif /* __SOC_RENESAS_RCAR_SYSC_H__ */
Signature · 1 line
1.9.1
author maintainer
#10 lore raw

PATCH v3 7/11 soc: renesas: rcar-sysc: Add support for R-Car H2 power areas

In reply to Geert Uytterhoeven

---
v3:
- New (converted from DT to C).

---
 drivers/soc/renesas/Makefile       |  2 +-
 drivers/soc/renesas/r8a7790-sysc.c | 45 ++++++++++++++++++++++++++++++++++++++
 drivers/soc/renesas/rcar-sysc.c    |  3 +++
 drivers/soc/renesas/rcar-sysc.h    |  1 +
 4 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 drivers/soc/renesas/r8a7790-sysc.c
drivers/soc/renesas/Makefile +1 -1
index b8aa9db4fdd95eb8..6588be3c6776fadf 100644
@@ -1,5 +1,5 @@
 obj-$(CONFIG_ARCH_R8A7779)	+= rcar-sysc.o r8a7779-sysc.o
-obj-$(CONFIG_ARCH_R8A7790)	+= rcar-sysc.o
+obj-$(CONFIG_ARCH_R8A7790)	+= rcar-sysc.o r8a7790-sysc.o
 obj-$(CONFIG_ARCH_R8A7791)	+= rcar-sysc.o
 obj-$(CONFIG_ARCH_R8A7793)	+= rcar-sysc.o
 obj-$(CONFIG_ARCH_R8A7794)	+= rcar-sysc.o
drivers/soc/renesas/r8a7790-sysc.c new file +45 -0

45 lines not on this page · raw message

drivers/soc/renesas/rcar-sysc.c +3 -0
index 3d039009a2222820..44b8ef764cbc33d1 100644
@@ -284,6 +284,9 @@ static const struct of_device_id rcar_sysc_matches[] = {
 #ifdef CONFIG_ARCH_R8A7779
 	{ .compatible = "renesas,r8a7779-sysc", .data = &r8a7779_sysc_info },
 #endif
+#ifdef CONFIG_ARCH_R8A7790
+	{ .compatible = "renesas,r8a7790-sysc", .data = &r8a7790_sysc_info },
+#endif
 	{ /* sentinel */ }
 };
 
drivers/soc/renesas/rcar-sysc.h +1 -0
index 7cf58b9cd544f4b9..33c8f2d00a01eac6 100644
@@ -51,4 +51,5 @@ struct rcar_sysc_info {
 };
 
 extern const struct rcar_sysc_info r8a7779_sysc_info;
+extern const struct rcar_sysc_info r8a7790_sysc_info;
 #endif /* __SOC_RENESAS_RCAR_SYSC_H__ */
Signature · 1 line
1.9.1
author maintainer
#11 lore raw

PATCH v3 8/11 soc: renesas: rcar-sysc: Add support for R-Car M2-W power areas

In reply to Geert Uytterhoeven

---
v3:
- New (converted from DT to C).

---
 drivers/soc/renesas/Makefile       |  2 +-
 drivers/soc/renesas/r8a7791-sysc.c | 32 ++++++++++++++++++++++++++++++++
 drivers/soc/renesas/rcar-sysc.c    |  3 +++
 drivers/soc/renesas/rcar-sysc.h    |  1 +
 4 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 drivers/soc/renesas/r8a7791-sysc.c
drivers/soc/renesas/Makefile +1 -1
index 6588be3c6776fadf..96463c05ee594335 100644
@@ -1,5 +1,5 @@
 obj-$(CONFIG_ARCH_R8A7779)	+= rcar-sysc.o r8a7779-sysc.o
 obj-$(CONFIG_ARCH_R8A7790)	+= rcar-sysc.o r8a7790-sysc.o
-obj-$(CONFIG_ARCH_R8A7791)	+= rcar-sysc.o
+obj-$(CONFIG_ARCH_R8A7791)	+= rcar-sysc.o r8a7791-sysc.o
 obj-$(CONFIG_ARCH_R8A7793)	+= rcar-sysc.o
 obj-$(CONFIG_ARCH_R8A7794)	+= rcar-sysc.o
drivers/soc/renesas/r8a7791-sysc.c new file +32 -0
new file mode 100644
index 0000000000000000..b8db6f345720b6ba
@@ -0,0 +1,32 @@
+/*
+ * Renesas R-Car M2-W/N System Controller
+ *
+ * Copyright (C) 2016 Glider bvba
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ */
+
+#include <linux/bug.h>
+#include <linux/kernel.h>
+
+#include <dt-bindings/power/r8a7791-sysc.h>
+
+#include "rcar-sysc.h"
+
+static const struct rcar_sysc_area r8a7791_areas[] __initconst = {
+	{ "ca15-scu",	0x180, 0, R8A7791_PD_CA15_SCU,	-1,
+	  PD_SCU },
+	{ "ca15-cpu0",	 0x40, 0, R8A7791_PD_CA15_CPU0,	R8A7791_PD_CA15_SCU,
+	  PD_CPU_NOCR, },
+	{ "ca15-cpu1",	 0x40, 1, R8A7791_PD_CA15_CPU1,	R8A7791_PD_CA15_SCU,
+	  PD_CPU_NOCR, },
+	{ "sh",		 0x80, 0, R8A7791_PD_SH,	-1, },
+	{ "sgx",	 0xc0, 0, R8A7791_PD_SGX,	-1, },
+};
+
+const struct rcar_sysc_info r8a7791_sysc_info __initconst = {
+	.areas = r8a7791_areas,
+	.num_areas = ARRAY_SIZE(r8a7791_areas),
+};
drivers/soc/renesas/rcar-sysc.c +3 -0
index 44b8ef764cbc33d1..c7f78ea59be7a9e3 100644
@@ -287,6 +287,9 @@ static const struct of_device_id rcar_sysc_matches[] = {
 #ifdef CONFIG_ARCH_R8A7790
 	{ .compatible = "renesas,r8a7790-sysc", .data = &r8a7790_sysc_info },
 #endif
+#ifdef CONFIG_ARCH_R8A7791
+	{ .compatible = "renesas,r8a7791-sysc", .data = &r8a7791_sysc_info },
+#endif
 	{ /* sentinel */ }
 };
 
drivers/soc/renesas/rcar-sysc.h +1 -0
index 33c8f2d00a01eac6..d58b39400e790a46 100644
@@ -52,4 +52,5 @@ struct rcar_sysc_info {
 
 extern const struct rcar_sysc_info r8a7779_sysc_info;
 extern const struct rcar_sysc_info r8a7790_sysc_info;
+extern const struct rcar_sysc_info r8a7791_sysc_info;
 #endif /* __SOC_RENESAS_RCAR_SYSC_H__ */
Signature · 1 line
1.9.1
author maintainer
#12 lore raw

PATCH v3 9/11 soc: renesas: rcar-sysc: Add support for R-Car M2-N power areas

In reply to Geert Uytterhoeven

R-Car M2-N is identical to R-Car M2-W w.r.t. power domains, so reuse the definitions from the latter.

---
v3:
- New (converted from DT to C).

---
 drivers/soc/renesas/Makefile    | 3 ++-
 drivers/soc/renesas/rcar-sysc.c | 3 +++
 drivers/soc/renesas/rcar-sysc.h | 2 ++
 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/soc/renesas/Makefile +2 -1
index 96463c05ee594335..c6c4ce7ef8a145ea 100644
@@ -1,5 +1,6 @@
 obj-$(CONFIG_ARCH_R8A7779)	+= rcar-sysc.o r8a7779-sysc.o
 obj-$(CONFIG_ARCH_R8A7790)	+= rcar-sysc.o r8a7790-sysc.o
 obj-$(CONFIG_ARCH_R8A7791)	+= rcar-sysc.o r8a7791-sysc.o
-obj-$(CONFIG_ARCH_R8A7793)	+= rcar-sysc.o
+# R-Car M2-N is identical to R-Car M2-W w.r.t. power domains.
+obj-$(CONFIG_ARCH_R8A7793)	+= rcar-sysc.o r8a7791-sysc.o
 obj-$(CONFIG_ARCH_R8A7794)	+= rcar-sysc.o
drivers/soc/renesas/rcar-sysc.c +3 -0
index c7f78ea59be7a9e3..6bee5880ac62db31 100644
@@ -290,6 +290,9 @@ static const struct of_device_id rcar_sysc_matches[] = {
 #ifdef CONFIG_ARCH_R8A7791
 	{ .compatible = "renesas,r8a7791-sysc", .data = &r8a7791_sysc_info },
 #endif
+#ifdef CONFIG_ARCH_R8A7793
+	{ .compatible = "renesas,r8a7793-sysc", .data = &r8a7793_sysc_info },
+#endif
 	{ /* sentinel */ }
 };
 
drivers/soc/renesas/rcar-sysc.h +2 -0
index d58b39400e790a46..d5594874cfef818f 100644
@@ -53,4 +53,6 @@ struct rcar_sysc_info {
 extern const struct rcar_sysc_info r8a7779_sysc_info;
 extern const struct rcar_sysc_info r8a7790_sysc_info;
 extern const struct rcar_sysc_info r8a7791_sysc_info;
+/* R-Car M2-N is identical to R-Car M2-W w.r.t. power domains. */
+#define r8a7793_sysc_info r8a7791_sysc_info
 #endif /* __SOC_RENESAS_RCAR_SYSC_H__ */
Signature · 1 line
1.9.1
author maintainer
#13 lore raw

PATCH v3 10/11 soc: renesas: rcar-sysc: Add support for R-Car E2 power areas

In reply to Geert Uytterhoeven

---
v3:
- New (converted from DT to C).

---
 drivers/soc/renesas/Makefile       |  2 +-
 drivers/soc/renesas/r8a7794-sysc.c | 32 ++++++++++++++++++++++++++++++++
 drivers/soc/renesas/rcar-sysc.c    |  3 +++
 drivers/soc/renesas/rcar-sysc.h    |  1 +
 4 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 drivers/soc/renesas/r8a7794-sysc.c
drivers/soc/renesas/Makefile +1 -1
index c6c4ce7ef8a145ea..b328205fef36441a 100644
@@ -3,4 +3,4 @@ obj-$(CONFIG_ARCH_R8A7790)	+= rcar-sysc.o r8a7790-sysc.o
 obj-$(CONFIG_ARCH_R8A7791)	+= rcar-sysc.o r8a7791-sysc.o
 # R-Car M2-N is identical to R-Car M2-W w.r.t. power domains.
 obj-$(CONFIG_ARCH_R8A7793)	+= rcar-sysc.o r8a7791-sysc.o
-obj-$(CONFIG_ARCH_R8A7794)	+= rcar-sysc.o
+obj-$(CONFIG_ARCH_R8A7794)	+= rcar-sysc.o r8a7794-sysc.o
drivers/soc/renesas/r8a7794-sysc.c new file +32 -0
new file mode 100644
index 0000000000000000..5e469566a683d249
@@ -0,0 +1,32 @@
+/*
+ * Renesas R-Car E2 System Controller
+ *
+ * Copyright (C) 2016 Glider bvba
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ */
+
+#include <linux/bug.h>
+#include <linux/kernel.h>
+
+#include <dt-bindings/power/r8a7794-sysc.h>
+
+#include "rcar-sysc.h"
+
+static const struct rcar_sysc_area r8a7794_areas[] __initconst = {
+	{ "ca7-scu",	0x100, 0, R8A7794_PD_CA7_SCU,	-1,
+	  PD_SCU },
+	{ "ca7-cpu0",	0x1c0, 0, R8A7794_PD_CA7_CPU0,	R8A7794_PD_CA7_SCU,
+	  PD_CPU_NOCR, },
+	{ "ca7-cpu1",	0x1c0, 1, R8A7794_PD_CA7_CPU1,	R8A7794_PD_CA7_SCU,
+	  PD_CPU_NOCR, },
+	{ "sh",		 0x80, 0, R8A7794_PD_SH,	-1, },
+	{ "sgx",	 0xc0, 0, R8A7794_PD_SGX,	-1, },
+};
+
+const struct rcar_sysc_info r8a7794_sysc_info __initconst = {
+	.areas = r8a7794_areas,
+	.num_areas = ARRAY_SIZE(r8a7794_areas),
+};
drivers/soc/renesas/rcar-sysc.c +3 -0
index 6bee5880ac62db31..21fd70aea4a4e7b5 100644
@@ -293,6 +293,9 @@ static const struct of_device_id rcar_sysc_matches[] = {
 #ifdef CONFIG_ARCH_R8A7793
 	{ .compatible = "renesas,r8a7793-sysc", .data = &r8a7793_sysc_info },
 #endif
+#ifdef CONFIG_ARCH_R8A7794
+	{ .compatible = "renesas,r8a7794-sysc", .data = &r8a7794_sysc_info },
+#endif
 	{ /* sentinel */ }
 };
 
drivers/soc/renesas/rcar-sysc.h +1 -0
index d5594874cfef818f..953c85dd04943980 100644
@@ -55,4 +55,5 @@ extern const struct rcar_sysc_info r8a7790_sysc_info;
 extern const struct rcar_sysc_info r8a7791_sysc_info;
 /* R-Car M2-N is identical to R-Car M2-W w.r.t. power domains. */
 #define r8a7793_sysc_info r8a7791_sysc_info
+extern const struct rcar_sysc_info r8a7794_sysc_info;
 #endif /* __SOC_RENESAS_RCAR_SYSC_H__ */
Signature · 1 line
1.9.1
author maintainer
#14 lore raw

PATCH v3 11/11 soc: renesas: rcar-sysc: Add support for R-Car H3 power areas

In reply to Geert Uytterhoeven

---
v3:
- New (converted from DT to C).

---
 drivers/soc/renesas/Makefile       |  1 +
 drivers/soc/renesas/r8a7795-sysc.c | 56 ++++++++++++++++++++++++++++++++++++++
 drivers/soc/renesas/rcar-sysc.c    |  3 ++
 drivers/soc/renesas/rcar-sysc.h    |  1 +
 4 files changed, 61 insertions(+)
 create mode 100644 drivers/soc/renesas/r8a7795-sysc.c
drivers/soc/renesas/Makefile +1 -0
index b328205fef36441a..151fcd3f025b01f3 100644
@@ -4,3 +4,4 @@ obj-$(CONFIG_ARCH_R8A7791)	+= rcar-sysc.o r8a7791-sysc.o
 # R-Car M2-N is identical to R-Car M2-W w.r.t. power domains.
 obj-$(CONFIG_ARCH_R8A7793)	+= rcar-sysc.o r8a7791-sysc.o
 obj-$(CONFIG_ARCH_R8A7794)	+= rcar-sysc.o r8a7794-sysc.o
+obj-$(CONFIG_ARCH_R8A7795)	+= rcar-sysc.o r8a7795-sysc.o
drivers/soc/renesas/r8a7795-sysc.c new file +56 -0

56 lines not on this page · raw message

drivers/soc/renesas/rcar-sysc.c +3 -0
index 21fd70aea4a4e7b5..7d2a139d7a660ed3 100644
@@ -296,6 +296,9 @@ static const struct of_device_id rcar_sysc_matches[] = {
 #ifdef CONFIG_ARCH_R8A7794
 	{ .compatible = "renesas,r8a7794-sysc", .data = &r8a7794_sysc_info },
 #endif
+#ifdef CONFIG_ARCH_R8A7795
+	{ .compatible = "renesas,r8a7795-sysc", .data = &r8a7795_sysc_info },
+#endif
 	{ /* sentinel */ }
 };
 
drivers/soc/renesas/rcar-sysc.h +1 -0
index 953c85dd04943980..f5aeac18f1c92813 100644
@@ -56,4 +56,5 @@ extern const struct rcar_sysc_info r8a7791_sysc_info;
 /* R-Car M2-N is identical to R-Car M2-W w.r.t. power domains. */
 #define r8a7793_sysc_info r8a7791_sysc_info
 extern const struct rcar_sysc_info r8a7794_sysc_info;
+extern const struct rcar_sysc_info r8a7795_sysc_info;
 #endif /* __SOC_RENESAS_RCAR_SYSC_H__ */
Signature · 1 line
1.9.1