فهرست منبع

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>
Philippe Rétornaz 13 سال پیش
والد
کامیت
40d97b89bd
2فایلهای تغییر یافته به همراه18 افزوده شده و 0 حذف شده
  1. 17 0
      arch/arm/mach-imx/mach-mx31moboard.c
  2. 1 0
      arch/arm/plat-mxc/include/mach/iomux-mx3.h

+ 17 - 0
arch/arm/mach-imx/mach-mx31moboard.c

@@ -28,6 +28,9 @@
 #include <linux/spi/spi.h>
 #include <linux/spi/spi.h>
 #include <linux/types.h>
 #include <linux/types.h>
 #include <linux/memblock.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/otg.h>
 #include <linux/usb/ulpi.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;
 static int mx31moboard_baseboard;
 core_param(mx31moboard_baseboard, mx31moboard_baseboard, int, 0444);
 core_param(mx31moboard_baseboard, mx31moboard_baseboard, int, 0444);
 
 
@@ -528,6 +543,8 @@ static void __init mx31moboard_init(void)
 
 
 	moboard_usbh2_init();
 	moboard_usbh2_init();
 
 
+	pm_power_off = mx31moboard_poweroff;
+
 	switch (mx31moboard_baseboard) {
 	switch (mx31moboard_baseboard) {
 	case MX31NOBOARD:
 	case MX31NOBOARD:
 		break;
 		break;

+ 1 - 0
arch/arm/plat-mxc/include/mach/iomux-mx3.h

@@ -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_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_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_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)
 
 
 
 
 /*
 /*