Skip to content

Commit

Permalink
mx31moboard: Add poweroff support
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Philippe Rétornaz authored and Sascha Hauer committed Sep 20, 2011
1 parent bbb4336 commit 40d97b8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions arch/arm/mach-imx/mach-mx31moboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -490,6 +493,18 @@ static int __init mx31moboard_init_cam(void)

}

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);

Expand Down Expand Up @@ -528,6 +543,8 @@ static void __init mx31moboard_init(void)

moboard_usbh2_init();

pm_power_off = mx31moboard_poweroff;

switch (mx31moboard_baseboard) {
case MX31NOBOARD:
break;
Expand Down
1 change: 1 addition & 0 deletions arch/arm/plat-mxc/include/mach/iomux-mx3.h
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ enum iomux_pins {
#define MX31_PIN_KEY_COL5_KEY_COL5 IOMUX_MODE(MX31_PIN_KEY_COL5, IOMUX_CONFIG_FUNC)
#define MX31_PIN_KEY_COL6_KEY_COL6 IOMUX_MODE(MX31_PIN_KEY_COL6, IOMUX_CONFIG_FUNC)
#define MX31_PIN_KEY_COL7_KEY_COL7 IOMUX_MODE(MX31_PIN_KEY_COL7, IOMUX_CONFIG_FUNC)
#define MX31_PIN_WATCHDOG_RST__WATCHDOG_RST IOMUX_MODE(MX31_PIN_WATCHDOG_RST, IOMUX_CONFIG_FUNC)


/*
Expand Down

0 comments on commit 40d97b8

Please sign in to comment.