Skip to contentSkip to conversation

powerpc/mpc85xx: add support for suspend mode

RFC In review Sebastian Andrzej Siewior 2 participants 3 messages Jun 3, 2009 – Jun 4, 2009

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

RFC 1/1 powerpc/mpc85xx: add support for suspend mode

This patch adds support for the MPC85xx boards to enter the SLEEP mode. The wake up is done via an external interrupt. mpc85xx_enter_sleep() does not clear HID0_SLEEP in resume but it may be okay since it gets cleared on next NAP/DOZE. mpc85xx_enter_sleep() is mostly copied from NAP/DOZE. It does not look like it is worth to merge into e500_idle(). I removed the feature check for NAP/DOZE because it does not look required. It is just there to work around the BDI. If it is required it could be moved to mpc85xx_init_suspend().
The suspend.c file contains a sample implementation. I need additionally to add hooks prio and after mpc85xx_enter_sleep() to toggle a few bits in my FPGA. Since the suspend.c is really short I'm not sure if it is worth to keep it here and add couple function prototypes or add the required bits directly into the board code.

---
 arch/powerpc/Kconfig                  |    2 +-
 arch/powerpc/kernel/idle_e500.S       |   43 +++++++++++++++++++++++++++++++++
 arch/powerpc/platforms/85xx/Makefile  |    1 +
 arch/powerpc/platforms/85xx/suspend.c |   27 ++++++++++++++++++++
 4 files changed, 72 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/platforms/85xx/suspend.c
arch/powerpc/Kconfig +1 -1
index ff75539..80e3f6e 100644
@@ -215,7 +215,7 @@ config ARCH_HIBERNATION_POSSIBLE
 
 config ARCH_SUSPEND_POSSIBLE
 	def_bool y
-	depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx
+	depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx || PPC_85xx
 
 config PPC_DCR_NATIVE
 	bool
arch/powerpc/kernel/idle_e500.S +43 -0

46 lines not on this page · raw message

arch/powerpc/platforms/85xx/Makefile +1 -0
index a857b35..e2ae7d1 100644
@@ -15,3 +15,4 @@ obj-$(CONFIG_SBC8560)     += sbc8560.o
 obj-$(CONFIG_SBC8548)     += sbc8548.o
 obj-$(CONFIG_SOCRATES)    += socrates.o socrates_fpga_pic.o
 obj-$(CONFIG_KSI8560)	  += ksi8560.o
+obj-$(CONFIG_SUSPEND)	  += suspend.o
arch/powerpc/platforms/85xx/suspend.c new file +27 -0
new file mode 100644
index 0000000..b6507d0
@@ -0,0 +1,27 @@
+#include <linux/suspend.h>
+
+void mpc85xx_enter_sleep(void);
+static int mpc85xx_suspend_valid(suspend_state_t state)
+{
+	switch (state) {
+		case PM_SUSPEND_STANDBY:
+			return 1;
+	}
+	return 0;
+}
+
+static int mpc85xx_suspend_enter(suspend_state_t state)
+{
+	mpc85xx_enter_sleep();
+}
+
+static struct platform_suspend_ops mpc85xx_pm_ops = {
+	.valid = mpc85xx_suspend_valid,
+	.enter = mpc85xx_suspend_enter,
+};
+
+int mpc85xx_init_suspend(void)
+{
+	suspend_set_ops(&mpc85xx_pm_ops);
+	return 0;
+}
Signature · 1 line
1.6.0.6
#1 lore raw
Quoted 16 lines · Sebastian Andrzej Siewior

This patch adds support for the MPC85xx boards to enter the SLEEP mode. The wake up is done via an external interrupt. mpc85xx_enter_sleep() does not clear HID0_SLEEP in resume but it may be okay since it gets cleared on next NAP/DOZE. mpc85xx_enter_sleep() is mostly copied from NAP/DOZE. It does not look like it is worth to merge into e500_idle(). I removed the feature check for NAP/DOZE because it does not look required. It is just there to work around the BDI. If it is required it could be moved to mpc85xx_init_suspend().
The suspend.c file contains a sample implementation. I need additionally to add hooks prio and after mpc85xx_enter_sleep() to toggle a few bits in my FPGA. Since the suspend.c is really short I'm not sure if it is worth to keep it here and add couple function prototypes or add the required bits directly into the board code.

Quoted 8 lines

---
arch/powerpc/Kconfig | 2 +-
arch/powerpc/kernel/idle_e500.S | 43 ++++++++++++++++++++++++
+++++++++
arch/powerpc/platforms/85xx/Makefile | 1 +
arch/powerpc/platforms/85xx/suspend.c | 27 ++++++++++++++++++++

4 files changed, 72 insertions(+), 1 deletions(-)

create mode 100644 arch/powerpc/platforms/85xx/suspend.c

On what system did you test / develop this on?

- k

#2 lore raw
Quoted 32 lines · * Kumar Gala | 2009-06-03 16:31:42 [-0500]:
Quoted 21 lines · Sebastian Andrzej Siewior

This patch adds support for the MPC85xx boards to enter the SLEEP mode.
The wake up is done via an external interrupt. mpc85xx_enter_sleep() does not clear HID0_SLEEP in resume but it may be
okay since it gets cleared on next NAP/DOZE. mpc85xx_enter_sleep() is mostly copied from NAP/DOZE. It does not look like it is worth to merge into e500_idle(). I removed the feature check
for NAP/DOZE because it does not look required. It is just there to work
around the BDI. If it is required it could be moved to mpc85xx_init_suspend().
The suspend.c file contains a sample implementation. I need additionally
to add hooks prio and after mpc85xx_enter_sleep() to toggle a few bits in my FPGA. Since the suspend.c is really short I'm not sure if it is worth to keep it here and add couple function prototypes or add the required bits directly into the board code.

Quoted 8 lines

---
arch/powerpc/Kconfig | 2 +-
arch/powerpc/kernel/idle_e500.S | 43 ++++++++++++++++++++++++
+++++++++
arch/powerpc/platforms/85xx/Makefile | 1 +
arch/powerpc/platforms/85xx/suspend.c | 27 ++++++++++++++++++++

4 files changed, 72 insertions(+), 1 deletions(-)

create mode 100644 arch/powerpc/platforms/85xx/suspend.c

Quoted 1 line

On what system did you test / develop this on?

An mpc8544ds based custom board. Non-SMP machine. The only negative thing I've noticed is that the clock stops in SLEEP. The spec says that all clocks will halt so I thing it is okay :) I have no RTC directly on my board so I'm not sure if I have to call something to sync with a RTC or the suspend code is doing this on its own.

Quoted 2 lines

- k

Sebastian