Skip to contentSkip to conversation

ARM: shmobile: Add A4S cpuidle state on sh7372

PATCH In review Rafael J. Wysocki 2 participants 3 messages Aug 16, 2012 – Aug 18, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: shmobile: Add A4S cpuidle state on sh7372

Add a "C5" cpuidle state to the SH7372 SoC connected to the A4S power domain in such a way that A4S may be turned off by cpuidle if all I/O devices in that domain have been suspended (or do not have attached drivers).

This requires some reorganization of the initialization of SH7372 power management which affects the the boards based on it, Mackerel and AP4EVB.

---
 arch/arm/mach-shmobile/board-ap4evb.c        |    2 
 arch/arm/mach-shmobile/board-mackerel.c      |    2 
 arch/arm/mach-shmobile/include/mach/sh7372.h |    2 
 arch/arm/mach-shmobile/pm-sh7372.c           |   56 ++++++++++++++++++++++-----
 4 files changed, 50 insertions(+), 12 deletions(-)
arch/arm/mach-shmobile/board-ap4evb.c +1 -1
Index: linux/arch/arm/mach-shmobile/board-ap4evb.c
===================================================================
@@ -1486,6 +1486,6 @@ MACHINE_START(AP4EVB, "ap4evb")
 	.init_irq	= sh7372_init_irq,
 	.handle_irq	= shmobile_handle_irq_intc,
 	.init_machine	= ap4evb_init,
-	.init_late	= shmobile_init_late,
+	.init_late	= sh7372_pm_init_late,
 	.timer		= &shmobile_timer,
 MACHINE_END
arch/arm/mach-shmobile/board-mackerel.c +1 -1
Index: linux/arch/arm/mach-shmobile/board-mackerel.c
===================================================================
@@ -1654,6 +1654,6 @@ MACHINE_START(MACKEREL, "mackerel")
 	.init_irq	= sh7372_init_irq,
 	.handle_irq	= shmobile_handle_irq_intc,
 	.init_machine	= mackerel_init,
-	.init_late	= shmobile_init_late,
+	.init_late	= sh7372_pm_init_late,
 	.timer		= &shmobile_timer,
 MACHINE_END
arch/arm/mach-shmobile/include/mach/sh7372.h +2 -0
Index: linux/arch/arm/mach-shmobile/include/mach/sh7372.h
===================================================================
@@ -489,4 +489,6 @@ extern void __init sh7372_init_pm_domain
 static inline void sh7372_init_pm_domains(void) {}
 #endif
 
+extern void __init sh7372_pm_init_late(void);
+
 #endif /* __ASM_SH7372_H__ */
arch/arm/mach-shmobile/pm-sh7372.c +46 -10

90 lines not on this page · raw message

maintainer
#1 lore raw

Hi Rafael,

Thanks for your patch. Please see below for my comment.

Quoted 12 lines · Rafael J. Wysocki

Add a "C5" cpuidle state to the SH7372 SoC connected to the A4S power domain in such a way that A4S may be turned off by cpuidle if all I/O devices in that domain have been suspended (or do not have attached drivers).

This requires some reorganization of the initialization of SH7372 power management which affects the the boards based on it, Mackerel and AP4EVB.

---

[snip]

Quoted 9 lines
arch/arm/mach-shmobile/pm-sh7372.c +3 -0
@@ -339,6 +339,21 @@ static void sh7372_enter_a3sm_common(int
        sh7372_set_reset_vector(__pa(sh7372_resume_core_standby_sysc));
        sh7372_enter_sysc(pllc0_on, 1 << 12);
 }
+
+static void sh7372_enter_a4s_common(int pllc0_on)
+{

arch/arm/mach-shmobile/pm-sh7372.c static void sh7372_enter_a3sm_common(int · line 354

Quoted 10 lines
arch/arm/mach-shmobile/pm-sh7372.c +10 -0
+       sh7372_intca_suspend();
+       sh7372_enter_sysc(pllc0_on, 1 << 10);
+       sh7372_intca_resume();
+}
+
+static void sh7372_pm_setup_smfram(void)
+{
+       memcpy((void *)SMFRAM, sh7372_resume_core_standby_sysc, 0x100);
+       sh7372_set_reset_vector(SMFRAM);
+}

I believe the reset vector is being setup dynamically depending on the sleep mode, so you probably want to move sh7372_set_reset_vector() into sh7372_enter_a4s_common().

Cheers,

/ magnus

#2 lore raw

PATCH 1/1 ARM: shmobile: Add A4S cpuidle state on sh7372

Hi,

Quoted 34 lines · Magnus Damm

Hi Rafael,

Thanks for your patch. Please see below for my comment.

Quoted 12 lines · Rafael J. Wysocki

Add a "C5" cpuidle state to the SH7372 SoC connected to the A4S power domain in such a way that A4S may be turned off by cpuidle if all I/O devices in that domain have been suspended (or do not have attached drivers).

This requires some reorganization of the initialization of SH7372 power management which affects the the boards based on it, Mackerel and AP4EVB.

---

[snip]

Quoted 14 lines
arch/arm/mach-shmobile/pm-sh7372.c +8 -0
@@ -339,6 +339,21 @@ static void sh7372_enter_a3sm_common(int
        sh7372_set_reset_vector(__pa(sh7372_resume_core_standby_sysc));
        sh7372_enter_sysc(pllc0_on, 1 << 12);
 }
+
+static void sh7372_enter_a4s_common(int pllc0_on)
+{
+       sh7372_intca_suspend();
+       sh7372_enter_sysc(pllc0_on, 1 << 10);
+       sh7372_intca_resume();
+}
+
Quoted 8 lines

arch/arm/mach-shmobile/pm-sh7372.c static void sh7372_enter_a3sm_common(int · line 354

Quoted 5 lines
arch/arm/mach-shmobile/pm-sh7372.c +5 -0
+static void sh7372_pm_setup_smfram(void)
+{
+       memcpy((void *)SMFRAM, sh7372_resume_core_standby_sysc, 0x100);
+       sh7372_set_reset_vector(SMFRAM);
+}

I believe the reset vector is being setup dynamically depending on the sleep mode,

Yes, it is, sorry for overlooking that!

Quoted 2 lines

so you probably want to move sh7372_set_reset_vector() into sh7372_enter_a4s_common().

Thanks for the review, updated patch follows.

Rafael

---
From: Rafael J. Wysocki <[email protected]>
Subject: ARM: shmobile: Add A4S cpuidle state on sh7372

Add a "C5" cpuidle state to the SH7372 SoC connected to the A4S power domain in such a way that A4S may be turned off by cpuidle if all I/O devices in that domain have been suspended (or do not have attached drivers).

This requires some reorganization of the initialization of SH7372 power management which affects the the boards based on it, Mackerel and AP4EVB.

---
 arch/arm/mach-shmobile/board-ap4evb.c        |    2 
 arch/arm/mach-shmobile/board-mackerel.c      |    2 
 arch/arm/mach-shmobile/include/mach/sh7372.h |    2 
 arch/arm/mach-shmobile/pm-sh7372.c           |   56 ++++++++++++++++++++++-----
 4 files changed, 50 insertions(+), 12 deletions(-)
arch/arm/mach-shmobile/board-ap4evb.c +1 -1
Index: linux/arch/arm/mach-shmobile/board-ap4evb.c
===================================================================
@@ -1486,6 +1486,6 @@ MACHINE_START(AP4EVB, "ap4evb")
 	.init_irq	= sh7372_init_irq,
 	.handle_irq	= shmobile_handle_irq_intc,
 	.init_machine	= ap4evb_init,
-	.init_late	= shmobile_init_late,
+	.init_late	= sh7372_pm_init_late,
 	.timer		= &shmobile_timer,
 MACHINE_END
arch/arm/mach-shmobile/board-mackerel.c +1 -1
Index: linux/arch/arm/mach-shmobile/board-mackerel.c
===================================================================
@@ -1654,6 +1654,6 @@ MACHINE_START(MACKEREL, "mackerel")
 	.init_irq	= sh7372_init_irq,
 	.handle_irq	= shmobile_handle_irq_intc,
 	.init_machine	= mackerel_init,
-	.init_late	= shmobile_init_late,
+	.init_late	= sh7372_pm_init_late,
 	.timer		= &shmobile_timer,
 MACHINE_END
arch/arm/mach-shmobile/include/mach/sh7372.h +2 -0
Index: linux/arch/arm/mach-shmobile/include/mach/sh7372.h
===================================================================
@@ -489,4 +489,6 @@ extern void __init sh7372_init_pm_domain
 static inline void sh7372_init_pm_domains(void) {}
 #endif
 
+extern void __init sh7372_pm_init_late(void);
+
 #endif /* __ASM_SH7372_H__ */
arch/arm/mach-shmobile/pm-sh7372.c +46 -10

90 lines not on this page · raw message