summaryrefslogtreecommitdiff
path: root/arch/arm/mach-imx/mach-mx31moboard.c
diff options
context:
space:
mode:
authorPhilippe Rétornaz <philippe.retornaz@epfl.ch>2011-09-20 10:57:43 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2011-09-20 14:53:00 +0200
commit40d97b89bd3c902144a0757249d9d5d5cf314214 (patch)
treeb3ee3e1faea1225b4bcd65c2c1df1695aa46b288 /arch/arm/mach-imx/mach-mx31moboard.c
parentbbb433639c8e7b0ab68b7ed05871272880db4094 (diff)
mx31moboard: Add poweroff support
This patch add poweroff support on mx31moboard platform. A watchdog timeout is generated while enabling the watchdog reset IO to trigger a PMIC poweroff. Signed-off-by: Philippe Rétornaz <philippe.retornaz@epfl.ch> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-imx/mach-mx31moboard.c')
-rw-r--r--arch/arm/mach-imx/mach-mx31moboard.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index b358383120e7..3c7d67b77716 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -28,6 +28,9 @@
#include <linux/spi/spi.h>
#include <linux/types.h>
#include <linux/memblock.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+#include <linux/err.h>
#include <linux/usb/otg.h>
#include <linux/usb/ulpi.h>
@@ -490,6 +493,18 @@ err:
}
+static void mx31moboard_poweroff(void)
+{
+ struct clk *clk = clk_get_sys("imx2-wdt.0", NULL);
+
+ if (!IS_ERR(clk))
+ clk_enable(clk);
+
+ mxc_iomux_mode(MX31_PIN_WATCHDOG_RST__WATCHDOG_RST);
+
+ __raw_writew(1 << 6 | 1 << 2, MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR));
+}
+
static int mx31moboard_baseboard;
core_param(mx31moboard_baseboard, mx31moboard_baseboard, int, 0444);
@@ -528,6 +543,8 @@ static void __init mx31moboard_init(void)
moboard_usbh2_init();
+ pm_power_off = mx31moboard_poweroff;
+
switch (mx31moboard_baseboard) {
case MX31NOBOARD:
break;