summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDomen Puncer <domen.puncer@telargo.com>2007-04-16 14:00:13 +0200
committerStefan Roese <sr@denx.de>2007-04-16 14:00:13 +0200
commitd3832e8fe1b214ec62424eac36cfda9fc56d21b3 (patch)
tree09f5fe519eb1f26502dd3be4882d41010041f903
parent7882751c78b7ecabfd49b0eff8de27661c71f16c (diff)
downloadu-boot-imx-d3832e8fe1b214ec62424eac36cfda9fc56d21b3.zip
u-boot-imx-d3832e8fe1b214ec62424eac36cfda9fc56d21b3.tar.gz
u-boot-imx-d3832e8fe1b214ec62424eac36cfda9fc56d21b3.tar.bz2
[PATCH] icecube/lite5200b: wakeup from low-power support
U-Boot part of Lite5200b low power mode support. Puts SDRAM out of self-refresh and transfers control to address saved at physical 0x0. Signed-off-by: Domen Puncer <domen.puncer@telargo.com> Acked-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r--Makefile5
-rw-r--r--board/icecube/icecube.c49
2 files changed, 54 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 84b49fe..8e551eb 100644
--- a/Makefile
+++ b/Makefile
@@ -430,6 +430,7 @@ inka4x0_config: unconfig
@$(MKCONFIG) inka4x0 ppc mpc5xxx inka4x0
lite5200b_config \
+lite5200b_PM_config \
lite5200b_LOWBOOT_config: unconfig
@mkdir -p $(obj)include
@mkdir -p $(obj)board/icecube
@@ -438,6 +439,10 @@ lite5200b_LOWBOOT_config: unconfig
@ echo "... DDR memory revision"
@ echo "#define CONFIG_MPC5200" >>$(obj)include/config.h
@ echo "#define CONFIG_LITE5200B" >>$(obj)include/config.h
+ @[ -z "$(findstring _PM_,$@)" ] || \
+ { echo "#define CONFIG_LITE5200B_PM" >>$(obj)include/config.h ; \
+ echo "... with power management (low-power mode) support" ; \
+ }
@[ -z "$(findstring LOWBOOT_,$@)" ] || \
{ echo "TEXT_BASE = 0xFF000000" >$(obj)board/icecube/config.tmp ; \
echo "... with LOWBOOT configuration" ; \
diff --git a/board/icecube/icecube.c b/board/icecube/icecube.c
index 700c9d9..2960998 100644
--- a/board/icecube/icecube.c
+++ b/board/icecube/icecube.c
@@ -42,6 +42,53 @@
#include "mt48lc16m16a2-75.h"
# endif
#endif
+
+#ifdef CONFIG_LITE5200B_PM
+/* u-boot part of low-power mode implementation */
+#define SAVED_ADDR (*(void **)0x00000000)
+#define PSC2_4 0x02
+
+void lite5200b_wakeup(void)
+{
+ unsigned char wakeup_pin;
+ void (*linux_wakeup)(void);
+
+ /* check PSC2_4, if it's down "QT" is signaling we have a wakeup
+ * from low power mode */
+ *(vu_char *)MPC5XXX_WU_GPIO_ENABLE = PSC2_4;
+ __asm__ volatile ("sync");
+
+ wakeup_pin = *(vu_char *)MPC5XXX_WU_GPIO_DATA_I;
+ if (wakeup_pin & PSC2_4)
+ return;
+
+ /* acknowledge to "QT"
+ * by holding pin at 1 for 10 uS */
+ *(vu_char *)MPC5XXX_WU_GPIO_DIR = PSC2_4;
+ __asm__ volatile ("sync");
+ *(vu_char *)MPC5XXX_WU_GPIO_DATA_O = PSC2_4;
+ __asm__ volatile ("sync");
+ udelay(10);
+
+ /* put ram out of self-refresh */
+ *(vu_long *)MPC5XXX_SDRAM_CTRL |= 0x80000000; /* mode_en */
+ __asm__ volatile ("sync");
+ *(vu_long *)MPC5XXX_SDRAM_CTRL |= 0x50000000; /* cke ref_en */
+ __asm__ volatile ("sync");
+ *(vu_long *)MPC5XXX_SDRAM_CTRL &= ~0x80000000; /* !mode_en */
+ __asm__ volatile ("sync");
+ udelay(10); /* wait a bit */
+
+ /* jump back to linux kernel code */
+ linux_wakeup = SAVED_ADDR;
+ printf("\n\nLooks like we just woke, transferring control to 0x%08lx\n",
+ linux_wakeup);
+ linux_wakeup();
+}
+#else
+#define lite5200b_wakeup()
+#endif
+
#ifndef CFG_RAMBOOT
static void sdram_start (int hi_addr)
{
@@ -208,6 +255,8 @@ long int initdram (int board_type)
__asm__ volatile ("sync");
}
+ lite5200b_wakeup();
+
return dramsize + dramsize2;
}