aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhang Nguyen <khang.nguyen.xv@rvc.renesas.com>2018-04-13 11:10:14 +0700
committerThuy Tran <thuy.tran.xh@rvc.renesas.com>2018-04-21 09:04:25 +0700
commit9fb019b704003afc186d8ec3eca13b6822af8d24 (patch)
tree3f45e212afe2ab88e9411257c801697b43bfc076
parentbf8dcc8e87213c0077af7b13f41f42f9f23370a4 (diff)
rcar-gen3: linux-renesas: Apply the power control patches for H3 Ver.3.0
This commit applies the power control patches in R-Car H3 Ver.3.0. Signed-off-by: Khang Nguyen <khang.nguyen.xv@rvc.renesas.com> Signed-off-by: Takamitsu Honda <takamitsu.honda.pv@renesas.com>
-rw-r--r--meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-soc-renesas-rcar-sysc-Update-power-control-flow-for-.patch108
-rw-r--r--meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch60
-rw-r--r--meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch58
-rw-r--r--meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0004-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch42
-rw-r--r--meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0005-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch42
-rw-r--r--meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0006-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch42
-rw-r--r--meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers_4.14.bb10
-rw-r--r--meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-soc-renesas-rcar-sysc-Update-power-control-flow-for-.patch108
-rw-r--r--meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0002-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch60
-rw-r--r--meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0003-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch58
-rw-r--r--meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0004-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch42
-rw-r--r--meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0005-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch42
-rw-r--r--meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0006-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch42
-rw-r--r--meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb10
14 files changed, 724 insertions, 0 deletions
diff --git a/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-soc-renesas-rcar-sysc-Update-power-control-flow-for-.patch b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-soc-renesas-rcar-sysc-Update-power-control-flow-for-.patch
new file mode 100644
index 0000000..a8403b5
--- /dev/null
+++ b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-soc-renesas-rcar-sysc-Update-power-control-flow-for-.patch
@@ -0,0 +1,108 @@
+From c8623487a0716301221dfbceee63856ed6f0c15f Mon Sep 17 00:00:00 2001
+From: Dien Pham <dien.pham.ry@renesas.com>
+Date: Wed, 11 Apr 2018 16:19:03 +0700
+Subject: [PATCH 1/6] soc: renesas: rcar-sysc: Update power control flow for
+ SYSCEXTMASK register
+
+On H3 v3.0, it can observe the system hang up after changing
+power domains many times (~2000 times) continuously.
+This occurs because there is conflict when changing state
+of power domains.
+
+To overcome this issue, power domain on/off control flow
+need to be updated. It needs to set/clear value of SYSCEXTMASK register.
+
+This patch is updated for above purpose.
+
+Signed-off-by: Dien Pham <dien.pham.ry@renesas.com>
+---
+ drivers/soc/renesas/rcar-sysc.c | 22 +++++++++++++++++++++-
+ drivers/soc/renesas/rcar-sysc.h | 8 ++++++++
+ 2 files changed, 29 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/soc/renesas/rcar-sysc.c b/drivers/soc/renesas/rcar-sysc.c
+index a063887..b170f9b 100644
+--- a/drivers/soc/renesas/rcar-sysc.c
++++ b/drivers/soc/renesas/rcar-sysc.c
+@@ -96,10 +96,24 @@
+
+ static void __iomem *rcar_sysc_base;
+ static DEFINE_SPINLOCK(rcar_sysc_lock); /* SMP CPUs + I/O devices */
+-
++static struct rcar_sysc_extra_regs *extra_regs;
+
+ static const char *to_pd_name(const struct rcar_sysc_ch *sysc_ch);
+
++static void rcar_sysc_extmask_ctrl(bool on)
++{
++ u32 extmask_msks = 0;
++
++ if (!extra_regs || !extra_regs->sysc_extmask_msks)
++ return;
++
++ if (on)
++ extmask_msks = extra_regs->sysc_extmask_msks;
++
++ iowrite32(extmask_msks,
++ rcar_sysc_base + extra_regs->sysc_extmask_offs);
++}
++
+ static int rcar_sysc_pwr_on_off(const struct rcar_sysc_ch *sysc_ch, bool on)
+ {
+ unsigned int sr_bit, reg_offs;
+@@ -147,6 +161,7 @@ static int rcar_sysc_power(const struct rcar_sysc_ch *sysc_ch, bool on)
+
+ spin_lock_irqsave(&rcar_sysc_lock, flags);
+
++ rcar_sysc_extmask_ctrl(1); /* set EXTMSK0 */
+ iowrite32(isr_mask, rcar_sysc_base + SYSCISCR);
+
+ /* Submit power shutoff or resume request until it was accepted */
+@@ -181,6 +196,7 @@ static int rcar_sysc_power(const struct rcar_sysc_ch *sysc_ch, bool on)
+ iowrite32(isr_mask, rcar_sysc_base + SYSCISCR);
+
+ out:
++ rcar_sysc_extmask_ctrl(0); /* clear EXTMSK0 */
+ spin_unlock_irqrestore(&rcar_sysc_lock, flags);
+
+ pr_debug("sysc power %s domain %d: %08x -> %d\n", on ? "on" : "off",
+@@ -436,6 +452,10 @@ static int __init rcar_sysc_pd_init(void)
+
+ rcar_sysc_base = base;
+
++ /* Check and get extra registers */
++ if (info->extra_regs)
++ extra_regs = info->extra_regs;
++
+ domains = kzalloc(sizeof(*domains), GFP_KERNEL);
+ if (!domains) {
+ error = -ENOMEM;
+diff --git a/drivers/soc/renesas/rcar-sysc.h b/drivers/soc/renesas/rcar-sysc.h
+index cfc7e30..1c3aedb 100644
+--- a/drivers/soc/renesas/rcar-sysc.h
++++ b/drivers/soc/renesas/rcar-sysc.h
+@@ -38,6 +38,13 @@ struct rcar_sysc_area {
+ unsigned int flags; /* See PD_* */
+ };
+
++/*
++ * List of registers that are not common in all platform.
++ */
++struct rcar_sysc_extra_regs {
++ u16 sysc_extmask_offs; /* Offset of SYSCEXTMASK register */
++ u32 sysc_extmask_msks; /* Mask value of SYSCEXTMASK register */
++};
+
+ /*
+ * SoC-specific Power Area Description
+@@ -47,6 +54,7 @@ struct rcar_sysc_info {
+ int (*init)(void); /* Optional */
+ const struct rcar_sysc_area *areas;
+ unsigned int num_areas;
++ struct rcar_sysc_extra_regs *extra_regs;
+ };
+
+ extern const struct rcar_sysc_info r8a7743_sysc_info;
+--
+1.9.1
+
diff --git a/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
new file mode 100644
index 0000000..c29cfee
--- /dev/null
+++ b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
@@ -0,0 +1,60 @@
+From e1fcb7cf84d92cbb31f5e1bcff24247fbc23fa77 Mon Sep 17 00:00:00 2001
+From: Dien Pham <dien.pham.ry@renesas.com>
+Date: Wed, 11 Apr 2018 16:20:49 +0700
+Subject: [PATCH 2/6] soc: renesas: rcar-sysc: Add SYSCEXTMASK info for r8a7795
+
+Add specific SYSCEXTMASK register info so that
+it is controlled during power domain on/off.
+
+Signed-off-by: Dien Pham <dien.pham.ry@renesas.com>
+---
+ drivers/soc/renesas/r8a7795-sysc.c | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/drivers/soc/renesas/r8a7795-sysc.c b/drivers/soc/renesas/r8a7795-sysc.c
+index 7412666..aac1053 100644
+--- a/drivers/soc/renesas/r8a7795-sysc.c
++++ b/drivers/soc/renesas/r8a7795-sysc.c
+@@ -8,6 +8,7 @@
+ * the Free Software Foundation; version 2 of the License.
+ */
+
++#include <linux/bitops.h>
+ #include <linux/bug.h>
+ #include <linux/kernel.h>
+ #include <linux/sys_soc.h>
+@@ -62,17 +63,31 @@
+ { /* sentinel */ }
+ };
+
++static const struct soc_device_attribute r8a7795es2[] __initconst = {
++ { .soc_id = "r8a7795", .revision = "ES2.*" },
++ { /* sentinel */ }
++};
++
+ static int __init r8a7795_sysc_init(void)
+ {
+ if (!soc_device_match(r8a7795es1))
+ rcar_sysc_nullify(r8a7795_areas, ARRAY_SIZE(r8a7795_areas),
+ R8A7795_PD_A2VC0);
+
++ if (soc_device_match(r8a7795es1) || soc_device_match(r8a7795es2))
++ r8a7795_sysc_info.extra_regs->sysc_extmask_msks = 0;
++
+ return 0;
+ }
+
++static struct rcar_sysc_extra_regs r8a7795_extra_regs = {
++ .sysc_extmask_offs = 0x2F8, .sysc_extmask_msks = BIT(0)
++};
++
++
+ const struct rcar_sysc_info r8a7795_sysc_info __initconst = {
+ .init = r8a7795_sysc_init,
+ .areas = r8a7795_areas,
+ .num_areas = ARRAY_SIZE(r8a7795_areas),
++ .extra_regs = &r8a7795_extra_regs,
+ };
+--
+1.9.1
+
diff --git a/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
new file mode 100644
index 0000000..39d3fb1
--- /dev/null
+++ b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
@@ -0,0 +1,58 @@
+From 7a0a2b88f8b1fe0f36ffaa1c56e404b12eb5effc Mon Sep 17 00:00:00 2001
+From: Dien Pham <dien.pham.ry@renesas.com>
+Date: Thu, 12 Apr 2018 16:03:30 +0700
+Subject: [PATCH 3/6] soc: renesas: rcar-sysc: Add SYSCEXTMASK info for r8a7796
+
+Add specific SYSCEXTMASK register info so that
+it is controlled during power domain on/off.
+
+Signed-off-by: Dien Pham <dien.pham.ry@renesas.com>
+---
+ drivers/soc/renesas/r8a7796-sysc.c | 21 +++++++++++++++++++++
+ 1 file changed, 21 insertions(+)
+
+diff --git a/drivers/soc/renesas/r8a7796-sysc.c b/drivers/soc/renesas/r8a7796-sysc.c
+index f700c84..afab100 100644
+--- a/drivers/soc/renesas/r8a7796-sysc.c
++++ b/drivers/soc/renesas/r8a7796-sysc.c
+@@ -8,8 +8,10 @@
+ * the Free Software Foundation; version 2 of the License.
+ */
+
++#include <linux/bitops.h>
+ #include <linux/bug.h>
+ #include <linux/kernel.h>
++#include <linux/sys_soc.h>
+
+ #include <dt-bindings/power/r8a7796-sysc.h>
+
+@@ -42,7 +44,26 @@
+ { "a3ir", 0x180, 0, R8A7796_PD_A3IR, R8A7796_PD_ALWAYS_ON },
+ };
+
++static const struct soc_device_attribute r8a7796es1[] __initconst = {
++ { .soc_id = "r8a7796", .revision = "ES1.*" },
++ { /* sentinel */ }
++};
++
++static int __init r8a7796_sysc_init(void)
++{
++ if (soc_device_match(r8a7796es1))
++ r8a7796_sysc_info.extra_regs->sysc_extmask_msks = 0;
++
++ return 0;
++}
++
++static struct rcar_sysc_extra_regs r8a7796_extra_regs = {
++ .sysc_extmask_offs = 0x2F8, .sysc_extmask_msks = BIT(0)
++};
++
+ const struct rcar_sysc_info r8a7796_sysc_info __initconst = {
++ .init = r8a7796_sysc_init,
+ .areas = r8a7796_areas,
+ .num_areas = ARRAY_SIZE(r8a7796_areas),
++ .extra_regs = &r8a7796_extra_regs,
+ };
+--
+1.9.1
+
diff --git a/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0004-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0004-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
new file mode 100644
index 0000000..839c2a7
--- /dev/null
+++ b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0004-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
@@ -0,0 +1,42 @@
+From 3a194570273ba919d6e8bd2276a3da7c4a4e56bf Mon Sep 17 00:00:00 2001
+From: Dien Pham <dien.pham.ry@renesas.com>
+Date: Thu, 12 Apr 2018 16:19:39 +0700
+Subject: [PATCH 4/6] soc: renesas: rcar-sysc: Add SYSCEXTMASK info for
+ r8a77990
+
+Add specific SYSCEXTMASK register info so that
+it is controlled during power domain on/off.
+
+Signed-off-by: Dien Pham <dien.pham.ry@renesas.com>
+---
+ drivers/soc/renesas/r8a77990-sysc.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/drivers/soc/renesas/r8a77990-sysc.c b/drivers/soc/renesas/r8a77990-sysc.c
+index 84789f0..f011256 100644
+--- a/drivers/soc/renesas/r8a77990-sysc.c
++++ b/drivers/soc/renesas/r8a77990-sysc.c
+@@ -8,6 +8,7 @@
+ * the Free Software Foundation; version 2 of the License.
+ */
+
++#include <linux/bitops.h>
+ #include <linux/bug.h>
+ #include <linux/kernel.h>
+
+@@ -30,7 +31,12 @@
+ { "3dg-a", 0x100, 0, R8A77990_PD_3DG_A, R8A77990_PD_3DG_B },
+ };
+
++static struct rcar_sysc_extra_regs r8a77990_extra_regs = {
++ .sysc_extmask_offs = 0x2F8, .sysc_extmask_msks = BIT(0)
++};
++
+ const struct rcar_sysc_info r8a77990_sysc_info __initconst = {
+ .areas = r8a77990_areas,
+ .num_areas = ARRAY_SIZE(r8a77990_areas),
++ .extra_regs = &r8a77990_extra_regs,
+ };
+--
+1.9.1
+
diff --git a/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0005-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0005-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
new file mode 100644
index 0000000..fa43c4c
--- /dev/null
+++ b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0005-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
@@ -0,0 +1,42 @@
+From 5ff3017324652ef42ca7cf3a1d6ae3c33f6192a9 Mon Sep 17 00:00:00 2001
+From: Dien Pham <dien.pham.ry@renesas.com>
+Date: Thu, 12 Apr 2018 16:22:58 +0700
+Subject: [PATCH 5/6] soc: renesas: rcar-sysc: Add SYSCEXTMASK info for
+ r8a77965
+
+Add specific SYSCEXTMASK register info so that
+it is controlled during power domain on/off.
+
+Signed-off-by: Dien Pham <dien.pham.ry@renesas.com>
+---
+ drivers/soc/renesas/r8a77965-sysc.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/drivers/soc/renesas/r8a77965-sysc.c b/drivers/soc/renesas/r8a77965-sysc.c
+index 65e805e..60751cf 100644
+--- a/drivers/soc/renesas/r8a77965-sysc.c
++++ b/drivers/soc/renesas/r8a77965-sysc.c
+@@ -8,6 +8,7 @@
+ * the Free Software Foundation; version 2 of the License.
+ */
+
++#include <linux/bitops.h>
+ #include <linux/bug.h>
+ #include <linux/kernel.h>
+
+@@ -32,7 +33,12 @@
+ { "a3ir", 0x180, 0, R8A77965_PD_A3IR, R8A77965_PD_ALWAYS_ON },
+ };
+
++static struct rcar_sysc_extra_regs r8a77965_extra_regs = {
++ .sysc_extmask_offs = 0x2F8, .sysc_extmask_msks = BIT(0)
++};
++
+ const struct rcar_sysc_info r8a77965_sysc_info __initconst = {
+ .areas = r8a77965_areas,
+ .num_areas = ARRAY_SIZE(r8a77965_areas),
++ .extra_regs = &r8a77965_extra_regs,
+ };
+--
+1.9.1
+
diff --git a/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0006-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0006-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
new file mode 100644
index 0000000..2d59618
--- /dev/null
+++ b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0006-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
@@ -0,0 +1,42 @@
+From 9264b321a1de7ff851f2015384cc0fcbd35e2736 Mon Sep 17 00:00:00 2001
+From: Dien Pham <dien.pham.ry@renesas.com>
+Date: Thu, 12 Apr 2018 16:27:44 +0700
+Subject: [PATCH 6/6] soc: renesas: rcar-sysc: Add SYSCEXTMASK info for
+ r8a77970
+
+Add specific SYSCEXTMASK register info so that
+it is controlled during power domain on/off.
+
+Signed-off-by: Dien Pham <dien.pham.ry@renesas.com>
+---
+ drivers/soc/renesas/r8a77970-sysc.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/drivers/soc/renesas/r8a77970-sysc.c b/drivers/soc/renesas/r8a77970-sysc.c
+index 8c61416..db7b0de 100644
+--- a/drivers/soc/renesas/r8a77970-sysc.c
++++ b/drivers/soc/renesas/r8a77970-sysc.c
+@@ -8,6 +8,7 @@
+ * published by the Free Software Foundation.
+ */
+
++#include <linux/bitops.h>
+ #include <linux/bug.h>
+ #include <linux/kernel.h>
+
+@@ -33,7 +34,12 @@
+ { "a2sc1", 0x400, 5, R8A77970_PD_A2SC1, R8A77970_PD_A2SC0 },
+ };
+
++static struct rcar_sysc_extra_regs r8a77970_extra_regs = {
++ .sysc_extmask_offs = 0x1B0, .sysc_extmask_msks = BIT(0)
++};
++
+ const struct rcar_sysc_info r8a77970_sysc_info __initconst = {
+ .areas = r8a77970_areas,
+ .num_areas = ARRAY_SIZE(r8a77970_areas),
++ .extra_regs = &r8a77970_extra_regs,
+ };
+--
+1.9.1
+
diff --git a/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers_4.14.bb b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers_4.14.bb
index 40fdeb2..87f9aed 100644
--- a/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers_4.14.bb
+++ b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers_4.14.bb
@@ -13,4 +13,14 @@ SRC_URI_append = " \
${@base_conditional("USE_ICCOM", "1", " file://0001-rpmsg-Add-message-to-be-able-to-configure-RPMSG_VIRT.patch", "", d)} \
"
+# Patches for sysc
+SRC_URI_append = " \
+ file://0001-soc-renesas-rcar-sysc-Update-power-control-flow-for-.patch \
+ file://0002-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch \
+ file://0003-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch \
+ file://0004-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch \
+ file://0005-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch \
+ file://0006-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch \
+"
+
S = "${WORKDIR}/git"
diff --git a/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-soc-renesas-rcar-sysc-Update-power-control-flow-for-.patch b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-soc-renesas-rcar-sysc-Update-power-control-flow-for-.patch
new file mode 100644
index 0000000..a8403b5
--- /dev/null
+++ b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-soc-renesas-rcar-sysc-Update-power-control-flow-for-.patch
@@ -0,0 +1,108 @@
+From c8623487a0716301221dfbceee63856ed6f0c15f Mon Sep 17 00:00:00 2001
+From: Dien Pham <dien.pham.ry@renesas.com>
+Date: Wed, 11 Apr 2018 16:19:03 +0700
+Subject: [PATCH 1/6] soc: renesas: rcar-sysc: Update power control flow for
+ SYSCEXTMASK register
+
+On H3 v3.0, it can observe the system hang up after changing
+power domains many times (~2000 times) continuously.
+This occurs because there is conflict when changing state
+of power domains.
+
+To overcome this issue, power domain on/off control flow
+need to be updated. It needs to set/clear value of SYSCEXTMASK register.
+
+This patch is updated for above purpose.
+
+Signed-off-by: Dien Pham <dien.pham.ry@renesas.com>
+---
+ drivers/soc/renesas/rcar-sysc.c | 22 +++++++++++++++++++++-
+ drivers/soc/renesas/rcar-sysc.h | 8 ++++++++
+ 2 files changed, 29 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/soc/renesas/rcar-sysc.c b/drivers/soc/renesas/rcar-sysc.c
+index a063887..b170f9b 100644
+--- a/drivers/soc/renesas/rcar-sysc.c
++++ b/drivers/soc/renesas/rcar-sysc.c
+@@ -96,10 +96,24 @@
+
+ static void __iomem *rcar_sysc_base;
+ static DEFINE_SPINLOCK(rcar_sysc_lock); /* SMP CPUs + I/O devices */
+-
++static struct rcar_sysc_extra_regs *extra_regs;
+
+ static const char *to_pd_name(const struct rcar_sysc_ch *sysc_ch);
+
++static void rcar_sysc_extmask_ctrl(bool on)
++{
++ u32 extmask_msks = 0;
++
++ if (!extra_regs || !extra_regs->sysc_extmask_msks)
++ return;
++
++ if (on)
++ extmask_msks = extra_regs->sysc_extmask_msks;
++
++ iowrite32(extmask_msks,
++ rcar_sysc_base + extra_regs->sysc_extmask_offs);
++}
++
+ static int rcar_sysc_pwr_on_off(const struct rcar_sysc_ch *sysc_ch, bool on)
+ {
+ unsigned int sr_bit, reg_offs;
+@@ -147,6 +161,7 @@ static int rcar_sysc_power(const struct rcar_sysc_ch *sysc_ch, bool on)
+
+ spin_lock_irqsave(&rcar_sysc_lock, flags);
+
++ rcar_sysc_extmask_ctrl(1); /* set EXTMSK0 */
+ iowrite32(isr_mask, rcar_sysc_base + SYSCISCR);
+
+ /* Submit power shutoff or resume request until it was accepted */
+@@ -181,6 +196,7 @@ static int rcar_sysc_power(const struct rcar_sysc_ch *sysc_ch, bool on)
+ iowrite32(isr_mask, rcar_sysc_base + SYSCISCR);
+
+ out:
++ rcar_sysc_extmask_ctrl(0); /* clear EXTMSK0 */
+ spin_unlock_irqrestore(&rcar_sysc_lock, flags);
+
+ pr_debug("sysc power %s domain %d: %08x -> %d\n", on ? "on" : "off",
+@@ -436,6 +452,10 @@ static int __init rcar_sysc_pd_init(void)
+
+ rcar_sysc_base = base;
+
++ /* Check and get extra registers */
++ if (info->extra_regs)
++ extra_regs = info->extra_regs;
++
+ domains = kzalloc(sizeof(*domains), GFP_KERNEL);
+ if (!domains) {
+ error = -ENOMEM;
+diff --git a/drivers/soc/renesas/rcar-sysc.h b/drivers/soc/renesas/rcar-sysc.h
+index cfc7e30..1c3aedb 100644
+--- a/drivers/soc/renesas/rcar-sysc.h
++++ b/drivers/soc/renesas/rcar-sysc.h
+@@ -38,6 +38,13 @@ struct rcar_sysc_area {
+ unsigned int flags; /* See PD_* */
+ };
+
++/*
++ * List of registers that are not common in all platform.
++ */
++struct rcar_sysc_extra_regs {
++ u16 sysc_extmask_offs; /* Offset of SYSCEXTMASK register */
++ u32 sysc_extmask_msks; /* Mask value of SYSCEXTMASK register */
++};
+
+ /*
+ * SoC-specific Power Area Description
+@@ -47,6 +54,7 @@ struct rcar_sysc_info {
+ int (*init)(void); /* Optional */
+ const struct rcar_sysc_area *areas;
+ unsigned int num_areas;
++ struct rcar_sysc_extra_regs *extra_regs;
+ };
+
+ extern const struct rcar_sysc_info r8a7743_sysc_info;
+--
+1.9.1
+
diff --git a/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0002-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0002-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
new file mode 100644
index 0000000..c29cfee
--- /dev/null
+++ b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0002-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
@@ -0,0 +1,60 @@
+From e1fcb7cf84d92cbb31f5e1bcff24247fbc23fa77 Mon Sep 17 00:00:00 2001
+From: Dien Pham <dien.pham.ry@renesas.com>
+Date: Wed, 11 Apr 2018 16:20:49 +0700
+Subject: [PATCH 2/6] soc: renesas: rcar-sysc: Add SYSCEXTMASK info for r8a7795
+
+Add specific SYSCEXTMASK register info so that
+it is controlled during power domain on/off.
+
+Signed-off-by: Dien Pham <dien.pham.ry@renesas.com>
+---
+ drivers/soc/renesas/r8a7795-sysc.c | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/drivers/soc/renesas/r8a7795-sysc.c b/drivers/soc/renesas/r8a7795-sysc.c
+index 7412666..aac1053 100644
+--- a/drivers/soc/renesas/r8a7795-sysc.c
++++ b/drivers/soc/renesas/r8a7795-sysc.c
+@@ -8,6 +8,7 @@
+ * the Free Software Foundation; version 2 of the License.
+ */
+
++#include <linux/bitops.h>
+ #include <linux/bug.h>
+ #include <linux/kernel.h>
+ #include <linux/sys_soc.h>
+@@ -62,17 +63,31 @@
+ { /* sentinel */ }
+ };
+
++static const struct soc_device_attribute r8a7795es2[] __initconst = {
++ { .soc_id = "r8a7795", .revision = "ES2.*" },
++ { /* sentinel */ }
++};
++
+ static int __init r8a7795_sysc_init(void)
+ {
+ if (!soc_device_match(r8a7795es1))
+ rcar_sysc_nullify(r8a7795_areas, ARRAY_SIZE(r8a7795_areas),
+ R8A7795_PD_A2VC0);
+
++ if (soc_device_match(r8a7795es1) || soc_device_match(r8a7795es2))
++ r8a7795_sysc_info.extra_regs->sysc_extmask_msks = 0;
++
+ return 0;
+ }
+
++static struct rcar_sysc_extra_regs r8a7795_extra_regs = {
++ .sysc_extmask_offs = 0x2F8, .sysc_extmask_msks = BIT(0)
++};
++
++
+ const struct rcar_sysc_info r8a7795_sysc_info __initconst = {
+ .init = r8a7795_sysc_init,
+ .areas = r8a7795_areas,
+ .num_areas = ARRAY_SIZE(r8a7795_areas),
++ .extra_regs = &r8a7795_extra_regs,
+ };
+--
+1.9.1
+
diff --git a/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0003-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0003-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
new file mode 100644
index 0000000..39d3fb1
--- /dev/null
+++ b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0003-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
@@ -0,0 +1,58 @@
+From 7a0a2b88f8b1fe0f36ffaa1c56e404b12eb5effc Mon Sep 17 00:00:00 2001
+From: Dien Pham <dien.pham.ry@renesas.com>
+Date: Thu, 12 Apr 2018 16:03:30 +0700
+Subject: [PATCH 3/6] soc: renesas: rcar-sysc: Add SYSCEXTMASK info for r8a7796
+
+Add specific SYSCEXTMASK register info so that
+it is controlled during power domain on/off.
+
+Signed-off-by: Dien Pham <dien.pham.ry@renesas.com>
+---
+ drivers/soc/renesas/r8a7796-sysc.c | 21 +++++++++++++++++++++
+ 1 file changed, 21 insertions(+)
+
+diff --git a/drivers/soc/renesas/r8a7796-sysc.c b/drivers/soc/renesas/r8a7796-sysc.c
+index f700c84..afab100 100644
+--- a/drivers/soc/renesas/r8a7796-sysc.c
++++ b/drivers/soc/renesas/r8a7796-sysc.c
+@@ -8,8 +8,10 @@
+ * the Free Software Foundation; version 2 of the License.
+ */
+
++#include <linux/bitops.h>
+ #include <linux/bug.h>
+ #include <linux/kernel.h>
++#include <linux/sys_soc.h>
+
+ #include <dt-bindings/power/r8a7796-sysc.h>
+
+@@ -42,7 +44,26 @@
+ { "a3ir", 0x180, 0, R8A7796_PD_A3IR, R8A7796_PD_ALWAYS_ON },
+ };
+
++static const struct soc_device_attribute r8a7796es1[] __initconst = {
++ { .soc_id = "r8a7796", .revision = "ES1.*" },
++ { /* sentinel */ }
++};
++
++static int __init r8a7796_sysc_init(void)
++{
++ if (soc_device_match(r8a7796es1))
++ r8a7796_sysc_info.extra_regs->sysc_extmask_msks = 0;
++
++ return 0;
++}
++
++static struct rcar_sysc_extra_regs r8a7796_extra_regs = {
++ .sysc_extmask_offs = 0x2F8, .sysc_extmask_msks = BIT(0)
++};
++
+ const struct rcar_sysc_info r8a7796_sysc_info __initconst = {
++ .init = r8a7796_sysc_init,
+ .areas = r8a7796_areas,
+ .num_areas = ARRAY_SIZE(r8a7796_areas),
++ .extra_regs = &r8a7796_extra_regs,
+ };
+--
+1.9.1
+
diff --git a/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0004-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0004-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
new file mode 100644
index 0000000..839c2a7
--- /dev/null
+++ b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0004-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
@@ -0,0 +1,42 @@
+From 3a194570273ba919d6e8bd2276a3da7c4a4e56bf Mon Sep 17 00:00:00 2001
+From: Dien Pham <dien.pham.ry@renesas.com>
+Date: Thu, 12 Apr 2018 16:19:39 +0700
+Subject: [PATCH 4/6] soc: renesas: rcar-sysc: Add SYSCEXTMASK info for
+ r8a77990
+
+Add specific SYSCEXTMASK register info so that
+it is controlled during power domain on/off.
+
+Signed-off-by: Dien Pham <dien.pham.ry@renesas.com>
+---
+ drivers/soc/renesas/r8a77990-sysc.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/drivers/soc/renesas/r8a77990-sysc.c b/drivers/soc/renesas/r8a77990-sysc.c
+index 84789f0..f011256 100644
+--- a/drivers/soc/renesas/r8a77990-sysc.c
++++ b/drivers/soc/renesas/r8a77990-sysc.c
+@@ -8,6 +8,7 @@
+ * the Free Software Foundation; version 2 of the License.
+ */
+
++#include <linux/bitops.h>
+ #include <linux/bug.h>
+ #include <linux/kernel.h>
+
+@@ -30,7 +31,12 @@
+ { "3dg-a", 0x100, 0, R8A77990_PD_3DG_A, R8A77990_PD_3DG_B },
+ };
+
++static struct rcar_sysc_extra_regs r8a77990_extra_regs = {
++ .sysc_extmask_offs = 0x2F8, .sysc_extmask_msks = BIT(0)
++};
++
+ const struct rcar_sysc_info r8a77990_sysc_info __initconst = {
+ .areas = r8a77990_areas,
+ .num_areas = ARRAY_SIZE(r8a77990_areas),
++ .extra_regs = &r8a77990_extra_regs,
+ };
+--
+1.9.1
+
diff --git a/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0005-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0005-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
new file mode 100644
index 0000000..fa43c4c
--- /dev/null
+++ b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0005-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
@@ -0,0 +1,42 @@
+From 5ff3017324652ef42ca7cf3a1d6ae3c33f6192a9 Mon Sep 17 00:00:00 2001
+From: Dien Pham <dien.pham.ry@renesas.com>
+Date: Thu, 12 Apr 2018 16:22:58 +0700
+Subject: [PATCH 5/6] soc: renesas: rcar-sysc: Add SYSCEXTMASK info for
+ r8a77965
+
+Add specific SYSCEXTMASK register info so that
+it is controlled during power domain on/off.
+
+Signed-off-by: Dien Pham <dien.pham.ry@renesas.com>
+---
+ drivers/soc/renesas/r8a77965-sysc.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/drivers/soc/renesas/r8a77965-sysc.c b/drivers/soc/renesas/r8a77965-sysc.c
+index 65e805e..60751cf 100644
+--- a/drivers/soc/renesas/r8a77965-sysc.c
++++ b/drivers/soc/renesas/r8a77965-sysc.c
+@@ -8,6 +8,7 @@
+ * the Free Software Foundation; version 2 of the License.
+ */
+
++#include <linux/bitops.h>
+ #include <linux/bug.h>
+ #include <linux/kernel.h>
+
+@@ -32,7 +33,12 @@
+ { "a3ir", 0x180, 0, R8A77965_PD_A3IR, R8A77965_PD_ALWAYS_ON },
+ };
+
++static struct rcar_sysc_extra_regs r8a77965_extra_regs = {
++ .sysc_extmask_offs = 0x2F8, .sysc_extmask_msks = BIT(0)
++};
++
+ const struct rcar_sysc_info r8a77965_sysc_info __initconst = {
+ .areas = r8a77965_areas,
+ .num_areas = ARRAY_SIZE(r8a77965_areas),
++ .extra_regs = &r8a77965_extra_regs,
+ };
+--
+1.9.1
+
diff --git a/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0006-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0006-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
new file mode 100644
index 0000000..2d59618
--- /dev/null
+++ b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0006-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch
@@ -0,0 +1,42 @@
+From 9264b321a1de7ff851f2015384cc0fcbd35e2736 Mon Sep 17 00:00:00 2001
+From: Dien Pham <dien.pham.ry@renesas.com>
+Date: Thu, 12 Apr 2018 16:27:44 +0700
+Subject: [PATCH 6/6] soc: renesas: rcar-sysc: Add SYSCEXTMASK info for
+ r8a77970
+
+Add specific SYSCEXTMASK register info so that
+it is controlled during power domain on/off.
+
+Signed-off-by: Dien Pham <dien.pham.ry@renesas.com>
+---
+ drivers/soc/renesas/r8a77970-sysc.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/drivers/soc/renesas/r8a77970-sysc.c b/drivers/soc/renesas/r8a77970-sysc.c
+index 8c61416..db7b0de 100644
+--- a/drivers/soc/renesas/r8a77970-sysc.c
++++ b/drivers/soc/renesas/r8a77970-sysc.c
+@@ -8,6 +8,7 @@
+ * published by the Free Software Foundation.
+ */
+
++#include <linux/bitops.h>
+ #include <linux/bug.h>
+ #include <linux/kernel.h>
+
+@@ -33,7 +34,12 @@
+ { "a2sc1", 0x400, 5, R8A77970_PD_A2SC1, R8A77970_PD_A2SC0 },
+ };
+
++static struct rcar_sysc_extra_regs r8a77970_extra_regs = {
++ .sysc_extmask_offs = 0x1B0, .sysc_extmask_msks = BIT(0)
++};
++
+ const struct rcar_sysc_info r8a77970_sysc_info __initconst = {
+ .areas = r8a77970_areas,
+ .num_areas = ARRAY_SIZE(r8a77970_areas),
++ .extra_regs = &r8a77970_extra_regs,
+ };
+--
+1.9.1
+
diff --git a/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb
index 5c94645..37d812c 100644
--- a/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb
+++ b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb
@@ -24,6 +24,16 @@ SRC_URI_append = " \
${@base_conditional("USE_AVB", "1", " file://usb-video-class.cfg", "", d)} \
"
+# Patches for sysc
+SRC_URI_append = " \
+ file://0001-soc-renesas-rcar-sysc-Update-power-control-flow-for-.patch \
+ file://0002-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch \
+ file://0003-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch \
+ file://0004-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch \
+ file://0005-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch \
+ file://0006-soc-renesas-rcar-sysc-Add-SYSCEXTMASK-info-for-r8a77.patch \
+"
+
# Enable RPMSG_VIRTIO depend on ICCOM
SUPPORT_ICCOM = " \
file://0001-rpmsg-Add-message-to-be-able-to-configure-RPMSG_VIRT.patch \