Skip to contentSkip to conversation

ARM: shmobile: r8a7790 SYSC, SCU and CCI setup code

PATCH New Magnus Damm 3 participants 7 messages Jan 15, 2014 – Feb 6, 2014

Subsystems (4)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

cover ARM: shmobile: r8a7790 SYSC, SCU and CCI setup code

ARM: shmobile: r8a7790 SYSC, SCU and CCI setup code

[PATCH 01/04] ARM: shmobile: r8a7790 SYSC setup code [PATCH 02/04] ARM: shmobile: r8a7790 CA7-SCU enablement [PATCH 03/04] ARM: shmobile: r8a7790 CA15-SCU enablement [PATCH 04/04] ARM: shmobile: r8a7790 CCI configuration

Add r8a7790 specific SYSC, SCU and CCI setup code.

[damm at opensource.se: Converted to use broken out SYSC code]

---

Written against renesas.git tag renesas-devel-v3.13-rc8-20140115, also requires "[PATCH] ARM: shmobile: Break out R-Car SYSC PM code"

 arch/arm/mach-shmobile/Makefile               |    1 
 arch/arm/mach-shmobile/include/mach/r8a7790.h |    1 
 arch/arm/mach-shmobile/pm-r8a7790.c           |   45 +++++++++++++++++++++++++
 arch/arm/mach-shmobile/smp-r8a7790.c          |   32 +++++++++++++++++
 4 files changed, 79 insertions(+)
author maintainer
#1 lore raw

PATCH 1/4 ARM: shmobile: r8a7790 SYSC setup code

From: Hisashi Nakamura <[email protected]>

Add r8a7790 SYSC power management support.

[damm at opensource.se: Converted to use broken out SYSC code]

---

 arch/arm/mach-shmobile/Makefile               |    1 
 arch/arm/mach-shmobile/include/mach/r8a7790.h |    1 
 arch/arm/mach-shmobile/pm-r8a7790.c           |   45 +++++++++++++++++++++++++
 3 files changed, 47 insertions(+)
arch/arm/mach-shmobile/Makefile +1 -0
@@ -53,6 +53,7 @@ obj-$(CONFIG_ARCH_SH7372)	+= pm-sh7372.o
 obj-$(CONFIG_ARCH_SH73A0)	+= pm-sh73a0.o
 obj-$(CONFIG_ARCH_R8A7740)	+= pm-r8a7740.o pm-rmobile.o
 obj-$(CONFIG_ARCH_R8A7779)	+= pm-r8a7779.o pm-rcar.o
+obj-$(CONFIG_ARCH_R8A7790)	+= pm-r8a7790.o pm-rcar.o
 
 # Board objects
 ifdef CONFIG_ARCH_SHMOBILE_MULTI
arch/arm/mach-shmobile/include/mach/r8a7790.h +1 -0
@@ -32,6 +32,7 @@ void r8a7790_add_standard_devices(void);
 void r8a7790_add_dt_devices(void);
 void r8a7790_clock_init(void);
 void r8a7790_pinmux_init(void);
+void r8a7790_pm_init(void);
 void r8a7790_init_early(void);
 extern struct smp_operations r8a7790_smp_ops;
 
arch/arm/mach-shmobile/pm-r8a7790.c new file +45 -0

45 lines not on this page · raw message

author maintainer
#2 lore raw

PATCH 2/4 ARM: shmobile: r8a7790 CA7-SCU enablement

In reply to Magnus Damm

From: Gaku Inami <[email protected]>

Power on CA7 SCU in case of booting from a CA15 core.

[damm at opensource.se: Converted to use broken out SYSC code]

---

 arch/arm/mach-shmobile/smp-r8a7790.c |   11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/mach-shmobile/smp-r8a7790.c +11 -0
@@ -19,6 +19,8 @@
 #include <linux/io.h>
 #include <asm/smp_plat.h>
 #include <mach/common.h>
+#include <mach/pm-rcar.h>
+#include <mach/r8a7790.h>
 
 #define RST		0xe6160000
 #define CA15BAR		0x0020
@@ -27,6 +29,11 @@
 #define CA7RESCNT	0x0044
 #define MERAM		0xe8080000
 
+static struct rcar_sysc_ch r8a7790_ca7_scu = {
+	.chan_offs = 0x100, /* PWRSR3 .. PWRER3 */
+	.isr_bit = 21, /* CA7-SCU */
+};
+
 static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus)
 {
 	void __iomem *p;
@@ -54,6 +61,10 @@ static void __init r8a7790_smp_prepare_c
 	writel_relaxed((readl_relaxed(p + CA7RESCNT) & ~0x0f) | 0x5a5a0000,
 		       p + CA7RESCNT);
 	iounmap(p);
+
+	/* turn on power to SCU */
+	r8a7790_pm_init();
+	rcar_sysc_power_up(&r8a7790_ca7_scu);
 }
 
 struct smp_operations r8a7790_smp_ops __initdata = {
author maintainer
#3 lore raw

PATCH 3/4 ARM: shmobile: r8a7790 CA15-SCU enablement

In reply to Magnus Damm

From: Keita Kobayashi <[email protected]>

Power on CA15 SCU in case of booting from a CA7 core.

[damm at opensource.se: Converted to use broken out SYSC code]

---

 arch/arm/mach-shmobile/smp-r8a7790.c |    6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/mach-shmobile/smp-r8a7790.c +6 -0
@@ -29,6 +29,11 @@
 #define CA7RESCNT	0x0044
 #define MERAM		0xe8080000
 
+static struct rcar_sysc_ch r8a7790_ca15_scu = {
+	.chan_offs = 0x180, /* PWRSR5 .. PWRER5 */
+	.isr_bit = 12, /* CA15-SCU */
+};
+
 static struct rcar_sysc_ch r8a7790_ca7_scu = {
 	.chan_offs = 0x100, /* PWRSR3 .. PWRER3 */
 	.isr_bit = 21, /* CA7-SCU */
@@ -64,6 +69,7 @@ static void __init r8a7790_smp_prepare_c
 
 	/* turn on power to SCU */
 	r8a7790_pm_init();
+	rcar_sysc_power_up(&r8a7790_ca15_scu);
 	rcar_sysc_power_up(&r8a7790_ca7_scu);
 }
 
author maintainer
#4 lore raw

PATCH 4/4 ARM: shmobile: r8a7790 CCI configuration

In reply to Magnus Damm

From: Gaku Inami <[email protected]>

Add the settings of CCI-400 for enabling ca15/ca7 snoop on r8a7790.

---

 arch/arm/mach-shmobile/smp-r8a7790.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/mach-shmobile/smp-r8a7790.c +15 -0
@@ -28,6 +28,11 @@
 #define CA15RESCNT	0x0040
 #define CA7RESCNT	0x0044
 #define MERAM		0xe8080000
+#define CCI_BASE	0xf0090000
+#define CCI_SLAVE3	0x4000
+#define CCI_SLAVE4	0x5000
+#define CCI_SNOOP	0x0000
+#define CCI_STATUS	0x000c
 
 static struct rcar_sysc_ch r8a7790_ca15_scu = {
 	.chan_offs = 0x180, /* PWRSR5 .. PWRER5 */
@@ -71,6 +76,16 @@ static void __init r8a7790_smp_prepare_c
 	r8a7790_pm_init();
 	rcar_sysc_power_up(&r8a7790_ca15_scu);
 	rcar_sysc_power_up(&r8a7790_ca7_scu);
+
+	/* enable snoop and DVM */
+	p = ioremap_nocache(CCI_BASE, 0x8000);
+	writel_relaxed(readl_relaxed(p + CCI_SLAVE3 + CCI_SNOOP) | 0x3,
+		p + CCI_SLAVE3 + CCI_SNOOP);    /* ca15 */
+	writel_relaxed(readl_relaxed(p + CCI_SLAVE4 + CCI_SNOOP) | 0x3,
+		p + CCI_SLAVE4 + CCI_SNOOP);    /* ca7 */
+	while (__raw_readl(p + CCI_STATUS));
+	/* wait for pending bit low */
+	iounmap(p);
 }
 
 struct smp_operations r8a7790_smp_ops __initdata = {
#5 lore raw

PATCH 4/4 ARM: shmobile: r8a7790 CCI configuration

Hi,

Quoted 30 lines · Magnus Damm

From: Gaku Inami <[email protected]>

Add the settings of CCI-400 for enabling ca15/ca7 snoop on r8a7790.

---

 arch/arm/mach-shmobile/smp-r8a7790.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/mach-shmobile/smp-r8a7790.c +6 -0
@@ -28,6 +28,11 @@
 #define CA15RESCNT	0x0040
 #define CA7RESCNT	0x0044
 #define MERAM		0xe8080000
+#define CCI_BASE	0xf0090000
+#define CCI_SLAVE3	0x4000
+#define CCI_SLAVE4	0x5000
+#define CCI_SNOOP	0x0000
+#define CCI_STATUS	0x000c
 
 static struct rcar_sysc_ch r8a7790_ca15_scu = {
 	.chan_offs = 0x180, /* PWRSR5 .. PWRER5 */
@@ -71,6 +76,16 @@ static void __init r8a7790_smp_prepare_c
 	r8a7790_pm_init();
 	rcar_sysc_power_up(&r8a7790_ca15_scu);
 	rcar_sysc_power_up(&r8a7790_ca7_scu);
+

arch/arm/mach-shmobile/smp-r8a7790.c static void __init r8a7790_smp_prepare_c · line 89

Quoted 10 lines
arch/arm/mach-shmobile/smp-r8a7790.c +9 -0
+	/* enable snoop and DVM */
+	p = ioremap_nocache(CCI_BASE, 0x8000);
+	writel_relaxed(readl_relaxed(p + CCI_SLAVE3 + CCI_SNOOP) | 0x3,
+		p + CCI_SLAVE3 + CCI_SNOOP);    /* ca15 */
+	writel_relaxed(readl_relaxed(p + CCI_SLAVE4 + CCI_SNOOP) | 0x3,
+		p + CCI_SLAVE4 + CCI_SNOOP);    /* ca7 */
+	while (__raw_readl(p + CCI_STATUS));
+	/* wait for pending bit low */
+	iounmap(p);
 }

I have mentioned this before, please use drivers/bus/arm-cci.c That already does the job you need here and you need to use CCI DT bindings for base address.

Regards,
Sudeep

#6 lore raw

cover ARM: shmobile: r8a7790 SYSC, SCU and CCI setup code

In reply to Magnus Damm
Quoted 5 lines · Magnus Damm

ARM: shmobile: r8a7790 SYSC, SCU and CCI setup code

[PATCH 01/04] ARM: shmobile: r8a7790 SYSC setup code [PATCH 02/04] ARM: shmobile: r8a7790 CA7-SCU enablement [PATCH 03/04] ARM: shmobile: r8a7790 CA15-SCU enablement

Thanks, I have queued up the above three patches.

Quoted 1 line

[PATCH 04/04] ARM: shmobile: r8a7790 CCI configuration

This one seems not quite ready.

Quoted 20 lines

Add r8a7790 specific SYSC, SCU and CCI setup code.

[damm at opensource.se: Converted to use broken out SYSC code]

---

Written against renesas.git tag renesas-devel-v3.13-rc8-20140115, also requires "[PATCH] ARM: shmobile: Break out R-Car SYSC PM code"

 arch/arm/mach-shmobile/Makefile               |    1 
 arch/arm/mach-shmobile/include/mach/r8a7790.h |    1 
 arch/arm/mach-shmobile/pm-r8a7790.c           |   45 +++++++++++++++++++++++++
 arch/arm/mach-shmobile/smp-r8a7790.c          |   32 +++++++++++++++++
 4 files changed, 79 insertions(+)