From 7ca546c61b054a628dcf1e26e6dc35ef79d2f9b7 Mon Sep 17 00:00:00 2001
From: Przemyslaw Marczak
Date: Fri, 21 Mar 2014 11:48:54 +0100
Subject: [PATCH] trats2: add implementation of board_poweroff() and
CONFIG_CMD_POWEROFF
This change adds implementation of function board_poweroff() which
turns off the device off by setting PSHOLD gpio to low state which
is a power off signal for main PMIC.
Change-Id: Iae97fb81d7e7e243079ac18d03f4fd917c50b62e
Signed-off-by: Przemyslaw Marczak
---
board/samsung/trats2/trats2.c | 17 +++++++++++++++++
include/configs/trats2.h | 1 +
2 files changed, 18 insertions(+)
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index fa26e61..13f5d88 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -414,3 +414,20 @@ void exynos_lcd_misc_init(vidinfo_t *vid)
#endif
}
#endif /* LCD */
+
+#ifdef CONFIG_CMD_POWEROFF
+void board_poweroff(void)
+{
+ unsigned int val;
+ struct exynos4x12_power *power =
+ (struct exynos4x12_power *)samsung_get_base_power();
+
+ val = readl(&power->ps_hold_control);
+ val |= EXYNOS_PS_HOLD_CONTROL_EN_OUTPUT; /* set to output */
+ val &= ~EXYNOS_PS_HOLD_CONTROL_DATA_HIGH; /* set state to low */
+ writel(val, &power->ps_hold_control);
+
+ while (1);
+ /* Should not reach here */
+}
+#endif
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 349473e..f8ca576 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -198,6 +198,7 @@ int get_soft_i2c_sda_pin(void);
#define CONFIG_POWER_MUIC_MAX77693
#define CONFIG_POWER_FG_MAX77693
#define CONFIG_POWER_BATTERY_TRATS2
+#define CONFIG_CMD_POWEROFF
/* Security subsystem - enable hw_rand() */
#define CONFIG_EXYNOS_ACE_SHA
--
2.7.4