Skip to contentSkip to conversation

powerpc: mpc5200 low power mode

PATCH New Sylvain Munaut 3 participants 3 messages Jul 17, 2007 – Jul 20, 2007

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

PATCH 1/1 powerpc: mpc5200 low power mode

From: Domen Puncer <[email protected]>

Low-power mode implementation for Lite5200b.
Some I/O registers are also saved here.

A recent U-Boot that supports this (lite5200b_PM_config) is needed.

---
Hi Paulus,

Could you push this with you next merge ? It's the support for lite5200 low power mode, posted on -embedded a few days ago.

Sylvain

---
 arch/powerpc/platforms/52xx/Makefile         |    3 +
 arch/powerpc/platforms/52xx/lite5200.c       |   14 +-
 arch/powerpc/platforms/52xx/lite5200_pm.c    |  213 +++++++++++++
 arch/powerpc/platforms/52xx/lite5200_sleep.S |  413 ++++++++++++++++++++++++++
 include/asm-powerpc/mpc52xx.h                |   10 +
 5 files changed, 648 insertions(+), 5 deletions(-)
 create mode 100644 arch/powerpc/platforms/52xx/lite5200_pm.c
 create mode 100644 arch/powerpc/platforms/52xx/lite5200_sleep.S
arch/powerpc/platforms/52xx/Makefile +3 -0
index b91e39c..307dbc1 100644
@@ -10,3 +10,6 @@ obj-$(CONFIG_PPC_EFIKA)		+= efika.o
 obj-$(CONFIG_PPC_LITE5200)	+= lite5200.o
 
 obj-$(CONFIG_PM)		+= mpc52xx_sleep.o mpc52xx_pm.o
+ifeq ($(CONFIG_PPC_LITE5200),y)
+	obj-$(CONFIG_PM)	+= lite5200_sleep.o lite5200_pm.o
+endif
arch/powerpc/platforms/52xx/lite5200.c +9 -5
index 5c46e89..16eb5ad 100644
@@ -86,7 +86,6 @@ error:
 }
 
 #ifdef CONFIG_PM
-static u32 descr_a;
 static void lite5200_suspend_prepare(void __iomem *mbar)
 {
 	u8 pin = 1;	/* GPIO_WKUP_1 (GPIO_PSC2_4) */
@@ -97,13 +96,18 @@ static void lite5200_suspend_prepare(void __iomem *mbar)
 	 * power down usb port
 	 * this needs to be called before of-ohci suspend code
 	 */
-	descr_a = in_be32(mbar + 0x1048);
-	out_be32(mbar + 0x1048, (descr_a & ~0x200) | 0x100);
+
+	/* set ports to "power switched" and "powered at the same time"
+	 * USB Rh descriptor A: NPS = 0, PSM = 0 */
+	out_be32(mbar + 0x1048, in_be32(mbar + 0x1048) & ~0x300);
+	/* USB Rh status: LPS = 1 - turn off power */
+	out_be32(mbar + 0x1050, 0x00000001);
 }
 
 static void lite5200_resume_finish(void __iomem *mbar)
 {
-	out_be32(mbar + 0x1048, descr_a);
+	/* USB Rh status: LPSC = 1 - turn on power */
+	out_be32(mbar + 0x1050, 0x00010000);
 }
 #endif
 
@@ -132,7 +136,7 @@ static void __init lite5200_setup_arch(void)
 #ifdef CONFIG_PM
 	mpc52xx_suspend.board_suspend_prepare = lite5200_suspend_prepare;
 	mpc52xx_suspend.board_resume_finish = lite5200_resume_finish;
-	mpc52xx_pm_init();
+ 	lite5200_pm_init();
 #endif
 
 #ifdef CONFIG_PCI
arch/powerpc/platforms/52xx/lite5200_pm.c new file +213 -0

213 lines not on this page · raw message

arch/powerpc/platforms/52xx/lite5200_sleep.S new file +413 -0

413 lines not on this page · raw message

include/asm-powerpc/mpc52xx.h +10 -0
index c4631f6..1a3dbb7 100644
@@ -262,6 +262,16 @@ struct mpc52xx_suspend {
 extern struct mpc52xx_suspend mpc52xx_suspend;
 extern int __init mpc52xx_pm_init(void);
 extern int mpc52xx_set_wakeup_gpio(u8 pin, u8 level);
+
+#ifdef CONFIG_PPC_LITE5200
+extern int __init lite5200_pm_init(void);
+
+/* lite5200 calls mpc5200 suspend functions, so here they are */
+extern int mpc52xx_pm_prepare(suspend_state_t);
+extern int mpc52xx_pm_enter(suspend_state_t);
+extern int mpc52xx_pm_finish(suspend_state_t);
+extern char saved_sram[0x4000]; /* reuse buffer from mpc52xx suspend */
+#endif
 #endif /* CONFIG_PM */
 
 #endif /* __ASM_POWERPC_MPC52xx_H__ */
Signature · 1 line
1.5.0.1
#1 lore raw

PATCH 1/1 powerpc: mpc5200 low power mode, .globl fix

flush_data_cache doesn't need to be global, and can cause problems. Thanks to Milton Miller for noticing this.

---
 arch/powerpc/platforms/52xx/lite5200_sleep.S |    1 -
 1 file changed, 1 deletion(-)
arch/powerpc/platforms/52xx/lite5200_sleep.S +0 -1
Index: work-powerpc.git/arch/powerpc/platforms/52xx/lite5200_sleep.S
===================================================================
@@ -400,7 +400,6 @@ restore_regs:
  * Flush data cache
  * Do this by just reading lots of stuff into the cache.
  */
-        .globl flush_data_cache
 flush_data_cache:
 	lis	r3,CONFIG_KERNEL_START@h
 	ori	r3,r3,CONFIG_KERNEL_START@l
#2 lore raw

Re: [PATCH] powerpc: mpc5200 low power mode, .globl fix

Quoted 5 lines · Domen Puncer

flush_data_cache doesn't need to be global, and can cause problems. Thanks to Milton Miller for noticing this.

Paulus, can you pick this up please?

Quoted 21 lines
---
 arch/powerpc/platforms/52xx/lite5200_sleep.S |    1 -
 1 file changed, 1 deletion(-)

Index: work-powerpc.git/arch/powerpc/platforms/52xx/lite5200_sleep.S
===================================================================

arch/powerpc/platforms/52xx/lite5200_sleep.S +0 -1
@@ -400,7 +400,6 @@ restore_regs:
  * Flush data cache
  * Do this by just reading lots of stuff into the cache.
  */
-        .globl flush_data_cache
 flush_data_cache:
        lis     r3,CONFIG_KERNEL_START@h
        ori     r3,r3,CONFIG_KERNEL_START@l

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Signature · 4 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195