From 40d97b89bd3c902144a0757249d9d5d5cf314214 Mon Sep 17 00:00:00 2001 From: Philippe Rétornaz Date: Tue, 20 Sep 2011 10:57:43 +0200 Subject: mx31moboard: Add poweroff support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Sascha Hauer --- arch/arm/mach-imx/mach-mx31moboard.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'arch/arm/mach-imx') diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c index b358383120e..3c7d67b7771 100644 --- a/arch/arm/mach-imx/mach-mx31moboard.c +++ b/arch/arm/mach-imx/mach-mx31moboard.c @@ -28,6 +28,9 @@ #include #include #include +#include +#include +#include #include #include @@ -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; -- cgit v1.2.3-70-g09d2