Skip to contentSkip to conversation

ARM: shmobile: r8a7794 SYSC setup code

PATCH In review Gaku Inami 3 participants 6 messages Mar 3, 2015 – Mar 6, 2015

Subsystems (4)
lore
Share & tools
lore

Gaku Inami

author
#0 lore raw

PATCH 1/5 ARM: shmobile: r8a7794 SYSC setup code

Add r8a7794 SYSC power management support.

---
 arch/arm/mach-shmobile/Makefile     |    2 +-
 arch/arm/mach-shmobile/pm-r8a7794.c |   44 +++++++++++++++++++++++++++++++++++
 arch/arm/mach-shmobile/r8a7794.h    |    6 +++++
 3 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-shmobile/pm-r8a7794.c
 create mode 100644 arch/arm/mach-shmobile/r8a7794.h
arch/arm/mach-shmobile/Makefile +1 -1
index d3aca07..cde95f8 100644
@@ -13,7 +13,7 @@ obj-$(CONFIG_ARCH_R8A7778)	+= setup-r8a7778.o
 obj-$(CONFIG_ARCH_R8A7779)	+= setup-r8a7779.o pm-r8a7779.o
 obj-$(CONFIG_ARCH_R8A7790)	+= setup-r8a7790.o pm-r8a7790.o
 obj-$(CONFIG_ARCH_R8A7791)	+= setup-r8a7791.o pm-r8a7791.o
-obj-$(CONFIG_ARCH_R8A7794)	+= setup-r8a7794.o
+obj-$(CONFIG_ARCH_R8A7794)	+= setup-r8a7794.o pm-r8a7794.o
 obj-$(CONFIG_ARCH_EMEV2)	+= setup-emev2.o
 obj-$(CONFIG_ARCH_R7S72100)	+= setup-r7s72100.o
 
arch/arm/mach-shmobile/pm-r8a7794.c new file +44 -0

44 lines not on this page · raw message

arch/arm/mach-shmobile/r8a7794.h new file +6 -0
new file mode 100644
index 0000000..b83d387
@@ -0,0 +1,6 @@
+#ifndef __ASM_R8A7794_H__
+#define __ASM_R8A7794_H__
+
+void r8a7794_pm_init(void);
+
+#endif /* __ASM_R8A7794_H__ */
Signature · 1 line
1.7.9.5
#1 lore raw

Hi Inami-san,

Quoted 46 lines · Gaku Inami

Add r8a7794 SYSC power management support.

---
 arch/arm/mach-shmobile/Makefile     |    2 +-
 arch/arm/mach-shmobile/pm-r8a7794.c |   44 +++++++++++++++++++++++++++++++++++
 arch/arm/mach-shmobile/r8a7794.h    |    6 +++++
 3 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-shmobile/pm-r8a7794.c
 create mode 100644 arch/arm/mach-shmobile/r8a7794.h
arch/arm/mach-shmobile/Makefile +1 -1
index d3aca07..cde95f8 100644
@@ -13,7 +13,7 @@ obj-$(CONFIG_ARCH_R8A7778)	+= setup-r8a7778.o
 obj-$(CONFIG_ARCH_R8A7779)	+= setup-r8a7779.o pm-r8a7779.o
 obj-$(CONFIG_ARCH_R8A7790)	+= setup-r8a7790.o pm-r8a7790.o
 obj-$(CONFIG_ARCH_R8A7791)	+= setup-r8a7791.o pm-r8a7791.o
-obj-$(CONFIG_ARCH_R8A7794)	+= setup-r8a7794.o
+obj-$(CONFIG_ARCH_R8A7794)	+= setup-r8a7794.o pm-r8a7794.o
 obj-$(CONFIG_ARCH_EMEV2)	+= setup-emev2.o
 obj-$(CONFIG_ARCH_R7S72100)	+= setup-r7s72100.o
 
arch/arm/mach-shmobile/pm-r8a7794.c new file +16 -0
new file mode 100644
index 0000000..a8a94cf
@@ -0,0 +1,44 @@
+/*
+ * r8a7794 Power management support
+ *
+ * Copyright (C) 2015  Renesas Electronics Corporation
+ *
+ * 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
+ * for more details.
+ */
+
+#include <asm/io.h>
+#include "pm-rcar.h"
+#include "r8a7794.h"
+
+/* SYSC */
+#define SYSCIER 0x0c

arch/arm/mach-shmobile/pm-r8a7794.c line 26

Quoted 10 lines
arch/arm/mach-shmobile/pm-r8a7794.c new file +10 -0
+#define SYSCIMR 0x10
+
+#if defined(CONFIG_SMP)
+
+static void __init r8a7794_sysc_init(void)
+{
+	void __iomem *base = rcar_sysc_init(0xe6180000);
+
+	/* enable all interrupt sources, but do not use interrupt handler */
+	iowrite32(0x00310060, base + SYSCIER);

Is it intentional that 0x00310060 differs from the value of 0x0131000e used on the r8a7790 and r8a7791?

Could we consolidate this function across the R-Car Gen2 SoCs that use them?

Quoted 33 lines
arch/arm/mach-shmobile/pm-r8a7794.c new file +18 -0
+	iowrite32(0, base + SYSCIMR);
+}
+
+#else /* CONFIG_SMP */
+
+static inline void r8a7794_sysc_init(void) {}
+
+#endif /* CONFIG_SMP */
+
+void __init r8a7794_pm_init(void)
+{
+	static int once;
+
+	if (once++)
+		return;
+
+	r8a7794_sysc_init();
+}
arch/arm/mach-shmobile/r8a7794.h new file +6 -0
new file mode 100644
index 0000000..b83d387
@@ -0,0 +1,6 @@
+#ifndef __ASM_R8A7794_H__
+#define __ASM_R8A7794_H__
+
+void r8a7794_pm_init(void);
+
+#endif /* __ASM_R8A7794_H__ */
Signature · 1 line
1.7.9.5
author
#2 lore raw
In reply to Gaku Inami

Hi Simon-san,

Thank you for your feedback.

Quoted 53 lines · Simon Horman

Hi Inami-san,

Quoted 50 lines · Gaku Inami

Add r8a7794 SYSC power management support.

---
 arch/arm/mach-shmobile/Makefile     |    2 +-
 arch/arm/mach-shmobile/pm-r8a7794.c |   44 +++++++++++++++++++++++++++++++++++
 arch/arm/mach-shmobile/r8a7794.h    |    6 +++++
 3 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-shmobile/pm-r8a7794.c
 create mode 100644 arch/arm/mach-shmobile/r8a7794.h
arch/arm/mach-shmobile/Makefile +1 -1
index d3aca07..cde95f8 100644
@@ -13,7 +13,7 @@ obj-$(CONFIG_ARCH_R8A7778)	+= setup-r8a7778.o
 obj-$(CONFIG_ARCH_R8A7779)	+= setup-r8a7779.o pm-r8a7779.o
 obj-$(CONFIG_ARCH_R8A7790)	+= setup-r8a7790.o pm-r8a7790.o
 obj-$(CONFIG_ARCH_R8A7791)	+= setup-r8a7791.o pm-r8a7791.o
-obj-$(CONFIG_ARCH_R8A7794)	+= setup-r8a7794.o
+obj-$(CONFIG_ARCH_R8A7794)	+= setup-r8a7794.o pm-r8a7794.o
 obj-$(CONFIG_ARCH_EMEV2)	+= setup-emev2.o
 obj-$(CONFIG_ARCH_R7S72100)	+= setup-r7s72100.o
 
arch/arm/mach-shmobile/pm-r8a7794.c new file +20 -0
new file mode 100644
index 0000000..a8a94cf
@@ -0,0 +1,44 @@
+/*
+ * r8a7794 Power management support
+ *
+ * Copyright (C) 2015  Renesas Electronics Corporation
+ *
+ * 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
+ * for more details.
+ */
+
+#include <asm/io.h>
+#include "pm-rcar.h"
+#include "r8a7794.h"
+
+/* SYSC */
+#define SYSCIER 0x0c
+#define SYSCIMR 0x10
+
+#if defined(CONFIG_SMP)
+
Quoted 8 lines

arch/arm/mach-shmobile/pm-r8a7794.c line 26

Quoted 6 lines
arch/arm/mach-shmobile/pm-r8a7794.c new file +6 -0
+static void __init r8a7794_sysc_init(void)
+{
+	void __iomem *base = rcar_sysc_init(0xe6180000);
+
+	/* enable all interrupt sources, but do not use interrupt handler */
+	iowrite32(0x00310060, base + SYSCIER);

Is it intentional that 0x00310060 differs from the value of 0x0131000e used on the r8a7790 and r8a7791?

Yes. According to R-CAR Gen2 HW manual, interrupt bits are different in each SoC. Therefore, I think the setting value of SYSCIER should be set to a different value in each SoC.

*Setting value of SYSCIER
r8a7790 : 0x013111EF
r8a7791 : 0x00111003
r8a7794 : 0x00310060

I don't know why the value of 0x0131000e is used on the r8a7790 and the r8a7791. (maybe wrong value)

Quoted 2 lines

Could we consolidate this function across the R-Car Gen2 SoCs that use them?

I will consider to consolidate these functions into one.

Regards,
Inami

#3 lore raw
In reply to Gaku Inami

Hi Inami-san,

Quoted 13 lines · Gaku Inami
Quoted 8 lines

arch/arm/mach-shmobile/pm-r8a7794.c line 26

Quoted 6 lines
arch/arm/mach-shmobile/pm-r8a7794.c new file +6 -0
+static void __init r8a7794_sysc_init(void)
+{
+    void __iomem *base = rcar_sysc_init(0xe6180000);
+
+    /* enable all interrupt sources, but do not use interrupt handler */
+    iowrite32(0x00310060, base + SYSCIER);

Is it intentional that 0x00310060 differs from the value of 0x0131000e used on the r8a7790 and r8a7791?

Yes. According to R-CAR Gen2 HW manual, interrupt bits are different in each SoC. Therefore, I think the setting value of SYSCIER should be set to a different value in each SoC.

Quoted 7 lines

*Setting value of SYSCIER
r8a7790 : 0x013111EF
r8a7791 : 0x00111003
r8a7794 : 0x00310060

I don't know why the value of 0x0131000e is used on the r8a7790 and the r8a7791. (maybe wrong value)

This value was most probably just copied from pm-r8a7779.c R-Car H1 has 4 four ARM cores, but there's no interrupt bit for ARM0, hence the 0xe value for the lowest nibble.

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
#4 lore raw
In reply to Gaku Inami

Hi Geert-san,

Quoted 20 lines · Geert Uytterhoeven

Hi Inami-san,

Quoted 17 lines · Gaku Inami
Quoted 8 lines

arch/arm/mach-shmobile/pm-r8a7794.c line 26

Quoted 6 lines
arch/arm/mach-shmobile/pm-r8a7794.c new file +6 -0
+static void __init r8a7794_sysc_init(void)
+{
+    void __iomem *base = rcar_sysc_init(0xe6180000);
+
+    /* enable all interrupt sources, but do not use interrupt handler */
+    iowrite32(0x00310060, base + SYSCIER);

Is it intentional that 0x00310060 differs from the value of 0x0131000e used on the r8a7790 and r8a7791?

Yes. According to R-CAR Gen2 HW manual, interrupt bits are different in each SoC. Therefore, I think the setting value of SYSCIER should be set to a different value in each SoC.

*Setting value of SYSCIER
r8a7790 : 0x013111EF
r8a7791 : 0x00111003
r8a7794 : 0x00310060

Quoted 6 lines
Quoted 2 lines

I don't know why the value of 0x0131000e is used on the r8a7790 and the r8a7791. (maybe wrong value)

This value was most probably just copied from pm-r8a7779.c R-Car H1 has 4 four ARM cores, but there's no interrupt bit for ARM0, hence the 0xe value for the lowest nibble.

Thank you for your comment. That make sense.

Regards,
Inami

#5 lore raw
In reply to Gaku Inami
Quoted 23 lines · Gaku Inami

Hi Geert-san,

Quoted 20 lines · Geert Uytterhoeven

Hi Inami-san,

Quoted 17 lines · Gaku Inami
Quoted 8 lines

arch/arm/mach-shmobile/pm-r8a7794.c line 26

Quoted 6 lines
arch/arm/mach-shmobile/pm-r8a7794.c new file +6 -0
+static void __init r8a7794_sysc_init(void)
+{
+    void __iomem *base = rcar_sysc_init(0xe6180000);
+
+    /* enable all interrupt sources, but do not use interrupt handler */
+    iowrite32(0x00310060, base + SYSCIER);

Is it intentional that 0x00310060 differs from the value of 0x0131000e used on the r8a7790 and r8a7791?

Yes. According to R-CAR Gen2 HW manual, interrupt bits are different in each SoC. Therefore, I think the setting value of SYSCIER should be set to a different value in each SoC.

*Setting value of SYSCIER
r8a7790 : 0x013111EF
r8a7791 : 0x00111003
r8a7794 : 0x00310060

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

I don't know why the value of 0x0131000e is used on the r8a7790 and the r8a7791. (maybe wrong value)

This value was most probably just copied from pm-r8a7779.c R-Car H1 has 4 four ARM cores, but there's no interrupt bit for ARM0, hence the 0xe value for the lowest nibble.

Thank you for your comment. That make sense.

Lets get this fixed. I'm happy to create some patches if no one else wants to take it.