Skip to contentSkip to conversation

ARM: shmobile: TWD update

PATCH New Magnus Damm 2 participants 9 messages Mar 6, 2013 – Mar 19, 2013

Subsystems (5)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

cover ARM: shmobile: TWD update

ARM: shmobile: TWD update
[PATCH 01/04] ARM: shmobile: Register DT TWD from timer.c [PATCH 02/04] ARM: shmobile: Add EMEV2 specific timer_init [PATCH 03/04] ARM: shmobile: Add EMEV2 TWD support
[PATCH 04/04] ARM: shmobile: Remove r8a7779_register_twd() from common.

These patches are the first attempt to update the state of mach-shmobile TWD support. Patch 01/04 adds shared mach-shmobile code to allow TWD support via DT, patch 02/04 and 03/04 add TWD support to EMEV2 and the KZM9D board. Finally patch 04/04 removes unnecessary forward declaration.

---

Written against -next in renesas.git.

 arch/arm/boot/dts/emev2.dtsi                 |    6 ++++++
 arch/arm/mach-shmobile/board-kzm9d.c         |    2 +-
 arch/arm/mach-shmobile/clock-emev2.c         |    5 ++++-
 arch/arm/mach-shmobile/include/mach/common.h |    2 --
 arch/arm/mach-shmobile/include/mach/emev2.h  |    1 +
 arch/arm/mach-shmobile/setup-emev2.c         |   12 ++++++++++--
 arch/arm/mach-shmobile/smp-emev2.c           |    9 +++++++++
 arch/arm/mach-shmobile/timer.c               |    1 +
 8 files changed, 32 insertions(+), 6 deletions(-)
author maintainer
#1 lore raw

PATCH 1/4 ARM: shmobile: Register DT TWD from timer.c

From: Magnus Damm <[email protected]>

Add a call to twd_local_timer_of_register() in the function shmobile_timer_init(). In case we have TWD device information provided via DT this will make sure the TWD driver gets registered.

---

 arch/arm/mach-shmobile/timer.c |    1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-shmobile/timer.c +1 -0
@@ -65,4 +65,5 @@ void __init shmobile_timer_init(void)
 {
 	arch_timer_of_register();
 	arch_timer_sched_clock_init();
+	twd_local_timer_of_register();
 }
author maintainer
#2 lore raw

PATCH 2/4 ARM: shmobile: Add EMEV2 specific timer_init

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Add a emev2_timer_init() function to the EMEV2 setup code. This is preparation work for EMEV2 TWD support.

To allow registration of the TWD driver from the ->timer_init() callback the init code for EMEV2 clocks is from ->init_machine() to ->init_time().

This affects EMEV2 clock init order on the KZM9D board but leaves the generic EMEV2 DT case as-is due to no setup code for clocks in the DT case.

---

 arch/arm/mach-shmobile/board-kzm9d.c        |    2 +-
 arch/arm/mach-shmobile/include/mach/emev2.h |    1 +
 arch/arm/mach-shmobile/setup-emev2.c        |    8 ++++++--
 3 files changed, 8 insertions(+), 3 deletions(-)
arch/arm/mach-shmobile/board-kzm9d.c +1 -1
@@ -90,6 +90,6 @@ DT_MACHINE_START(KZM9D_DT, "kzm9d")
 	.init_irq	= emev2_init_irq,
 	.init_machine	= kzm9d_add_standard_devices,
 	.init_late	= shmobile_init_late,
-	.init_time	= shmobile_timer_init,
+	.init_time	= emev2_timer_init,
 	.dt_compat	= kzm9d_boards_compat_dt,
 MACHINE_END
arch/arm/mach-shmobile/include/mach/emev2.h +1 -0
@@ -5,6 +5,7 @@ extern void emev2_map_io(void);
 extern void emev2_init_irq(void);
 extern void emev2_add_early_devices(void);
 extern void emev2_add_standard_devices(void);
+extern void emev2_timer_init(void);
 extern void emev2_clock_init(void);
 extern void emev2_set_boot_vector(unsigned long value);
 
arch/arm/mach-shmobile/setup-emev2.c +6 -2
@@ -395,8 +395,6 @@ static struct platform_device *emev2_lat
 
 void __init emev2_add_standard_devices(void)
 {
-	emev2_clock_init();
-
 	platform_add_devices(emev2_early_devices,
 			     ARRAY_SIZE(emev2_early_devices));
 
@@ -404,6 +402,12 @@ void __init emev2_add_standard_devices(v
 			     ARRAY_SIZE(emev2_late_devices));
 }
 
+void __init emev2_timer_init(void)
+{
+	emev2_clock_init();
+	shmobile_timer_init();
+}
+
 static void __init emev2_init_delay(void)
 {
 	shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
author maintainer
#3 lore raw

PATCH 3/4 ARM: shmobile: Add EMEV2 TWD support

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Add TWD support for the EMEV2 SoC and the KZM9D board. TWD data is added via C for the KZM9D board and also via DT for the generic EMEV2 DT board support.

---

 arch/arm/boot/dts/emev2.dtsi         |    6 ++++++
 arch/arm/mach-shmobile/clock-emev2.c |    5 ++++-
 arch/arm/mach-shmobile/setup-emev2.c |    4 ++++
 arch/arm/mach-shmobile/smp-emev2.c   |    9 +++++++++
 4 files changed, 23 insertions(+), 1 deletion(-)
arch/arm/boot/dts/emev2.dtsi +6 -0
@@ -30,6 +30,12 @@
 		};
 	};
 
+	timer at e0030600 {
+		compatible = "arm,cortex-a9-twd-timer";
+		reg = <0xe0030600 0x20>;
+		interrupts = <1 1 0xf04>;
+	};
+
 	gic: interrupt-controller at e0020000 {
 		compatible = "arm,cortex-a9-gic";
 		interrupt-controller;
arch/arm/mach-shmobile/clock-emev2.c +4 -1
@@ -31,6 +31,7 @@
 #define USIBU2_RSTCTRL 0x0b0
 #define USIBU3_RSTCTRL 0x0b4
 #define STI_RSTCTRL 0x124
+#define INTAGCLKCTRL 0x40c
 #define USIAU0GCLKCTRL 0x4a0
 #define USIBU1GCLKCTRL 0x4b8
 #define USIBU2GCLKCTRL 0x4bc
@@ -105,7 +106,7 @@ static struct clk sclkdiv_clks[SCLKDIV_N
 };
 
 enum { GCLK_USIAU0_SCLK, GCLK_USIBU1_SCLK, GCLK_USIBU2_SCLK, GCLK_USIBU3_SCLK,
-	GCLK_STI_SCLK,
+	GCLK_STI_SCLK, GCLK_INTA_CLK,
 	GCLK_NR };
 
 #define GCLK_SCLK(_parent, _reg) \
@@ -125,6 +126,7 @@ static struct clk gclk_clks[GCLK_NR] = {
 	[GCLK_USIBU3_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIBU3],
 				       USIBU3GCLKCTRL),
 	[GCLK_STI_SCLK] = GCLK_SCLK(&c32k_clk, STIGCLKCTRL),
+	[GCLK_INTA_CLK] = GCLK_SCLK(&c32k_clk, INTAGCLKCTRL),
 };
 
 static int emev2_gclk_enable(struct clk *clk)
@@ -200,6 +202,7 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("e1050000.uart", &gclk_clks[GCLK_USIBU3_SCLK]),
 	CLKDEV_DEV_ID("em_sti.0", &gclk_clks[GCLK_STI_SCLK]),
 	CLKDEV_DEV_ID("e0180000.sti", &gclk_clks[GCLK_STI_SCLK]),
+	CLKDEV_DEV_ID("smp_twd", &gclk_clks[GCLK_INTA_CLK]),
 };
 
 void __init emev2_clock_init(void)
arch/arm/mach-shmobile/setup-emev2.c +4 -0
@@ -402,10 +402,14 @@ void __init emev2_add_standard_devices(v
 			     ARRAY_SIZE(emev2_late_devices));
 }
 
+/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
+void __init __weak emev2_register_twd(void) { }
+
 void __init emev2_timer_init(void)
 {
 	emev2_clock_init();
 	shmobile_timer_init();
+	emev2_register_twd();
 }
 
 static void __init emev2_init_delay(void)
arch/arm/mach-shmobile/smp-emev2.c +9 -0
@@ -28,9 +28,18 @@
 #include <mach/emev2.h>
 #include <asm/smp_plat.h>
 #include <asm/smp_scu.h>
+#include <asm/smp_twd.h>
 
 #define EMEV2_SCU_BASE 0x1e000000
 
+#ifdef CONFIG_HAVE_ARM_TWD
+static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xe0030600, 17);
+void __init emev2_register_twd(void)
+{
+	twd_local_timer_register(&twd_local_timer);
+}
+#endif
+
 static void __cpuinit emev2_secondary_init(unsigned int cpu)
 {
 	gic_secondary_init(0);
author maintainer
#4 lore raw

PATCH 4/4 ARM: shmobile: Remove r8a7779_register_twd() from common.h

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Remove unnecessary r8a7779_register_twd() from common.h

---

 arch/arm/mach-shmobile/include/mach/common.h |    2 --
 1 file changed, 2 deletions(-)
arch/arm/mach-shmobile/include/mach/common.h +0 -2
@@ -71,8 +71,6 @@ extern void r8a7779_pinmux_init(void);
 extern void r8a7779_pm_init(void);
 extern void r8a7740_meram_workaround(void);
 
-extern void r8a7779_register_twd(void);
-
 #ifdef CONFIG_SUSPEND
 int shmobile_suspend_init(void);
 #else
#5 lore raw

cover ARM: shmobile: TWD update

In reply to Magnus Damm
Quoted 11 lines · Magnus Damm

ARM: shmobile: TWD update
[PATCH 01/04] ARM: shmobile: Register DT TWD from timer.c [PATCH 02/04] ARM: shmobile: Add EMEV2 specific timer_init [PATCH 03/04] ARM: shmobile: Add EMEV2 TWD support
[PATCH 04/04] ARM: shmobile: Remove r8a7779_register_twd() from common.

These patches are the first attempt to update the state of mach-shmobile TWD support. Patch 01/04 adds shared mach-shmobile code to allow TWD support via DT, patch 02/04 and 03/04 add TWD support to EMEV2 and the KZM9D board. Finally patch 04/04 removes unnecessary forward declaration.

Hi Magnus,

these seem fine to me. Let me know when they have stabilised.

#6 lore raw

cover ARM: shmobile: TWD update

Quoted 13 lines · Simon Horman
Quoted 11 lines · Magnus Damm

ARM: shmobile: TWD update
[PATCH 01/04] ARM: shmobile: Register DT TWD from timer.c [PATCH 02/04] ARM: shmobile: Add EMEV2 specific timer_init [PATCH 03/04] ARM: shmobile: Add EMEV2 TWD support
[PATCH 04/04] ARM: shmobile: Remove r8a7779_register_twd() from common.

These patches are the first attempt to update the state of mach-shmobile TWD support. Patch 01/04 adds shared mach-shmobile code to allow TWD support via DT, patch 02/04 and 03/04 add TWD support to EMEV2 and the KZM9D board. Finally patch 04/04 removes unnecessary forward declaration.

Quoted 3 lines

Hi Magnus,

these seem fine to me. Let me know when they have stabilised.

Ping.

author maintainer
#7 lore raw

cover ARM: shmobile: TWD update

Quoted 14 lines · Simon Horman
Quoted 13 lines · Simon Horman
Quoted 11 lines · Magnus Damm

ARM: shmobile: TWD update
[PATCH 01/04] ARM: shmobile: Register DT TWD from timer.c [PATCH 02/04] ARM: shmobile: Add EMEV2 specific timer_init [PATCH 03/04] ARM: shmobile: Add EMEV2 TWD support
[PATCH 04/04] ARM: shmobile: Remove r8a7779_register_twd() from common.

These patches are the first attempt to update the state of mach-shmobile TWD support. Patch 01/04 adds shared mach-shmobile code to allow TWD support via DT, patch 02/04 and 03/04 add TWD support to EMEV2 and the KZM9D board. Finally patch 04/04 removes unnecessary forward declaration.

Quoted 5 lines
Quoted 3 lines

Hi Magnus,

these seem fine to me. Let me know when they have stabilised.

Ping.

Please wait with these for now. TWD by itself is OK, but it seems that the combination of TWD and STI doesn't work as I expected. Need to look into the clocks on EMEV2 in more detail, but no time for that at this point.

Thanks,

/ magnus

#8 lore raw

cover ARM: shmobile: TWD update

Quoted 17 lines · Magnus Damm
Quoted 16 lines · Simon Horman
Quoted 15 lines · Simon Horman
Quoted 11 lines · Magnus Damm

ARM: shmobile: TWD update
[PATCH 01/04] ARM: shmobile: Register DT TWD from timer.c [PATCH 02/04] ARM: shmobile: Add EMEV2 specific timer_init [PATCH 03/04] ARM: shmobile: Add EMEV2 TWD support
[PATCH 04/04] ARM: shmobile: Remove r8a7779_register_twd() from common.

These patches are the first attempt to update the state of mach-shmobile TWD support. Patch 01/04 adds shared mach-shmobile code to allow TWD support via DT, patch 02/04 and 03/04 add TWD support to EMEV2 and the KZM9D board. Finally patch 04/04 removes unnecessary forward declaration.

Hi Magnus,

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

these seem fine to me. Let me know when they have stabilised.

Ping.

Please wait with these for now. TWD by itself is OK, but it seems that the combination of TWD and STI doesn't work as I expected. Need to look into the clocks on EMEV2 in more detail, but no time for that at this point.

Thanks. Please either ping me or repost the patches if this status changes.