Note that the reboot code depends on an EC implementation for power_cycle.
---
 arch/arm/mach-mmp/olpc-xo-1-75.c |   19 +++++++++++++++++++
 include/linux/olpc-ec-1-75.h     |    3 +++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-mmp/olpc-xo-1-75.c b/arch/arm/mach-mmp/olpc-xo-1-75.c
index 431a7fd..7a8f518 100644
--- a/arch/arm/mach-mmp/olpc-xo-1-75.c
+++ b/arch/arm/mach-mmp/olpc-xo-1-75.c
@@ -181,8 +181,27 @@ static struct i2c_board_info olpc_xo_1_75_twsi4_info[] = {
        },
 };
 
+void olpc_xo_1_75_poweroff(void)
+{
+       u8 ec_cmd[8] = {0};
+       ec_cmd[0] = OLPC_EC_1_75_CMD_POWER_OFF;
+
+       olpc_xo_1_75_ec_cmd(ec_cmd, NULL, 0);
+}
+
+void olpc_xo_1_75_restart(char mode, const char *cmd)
+{
+       u8 ec_cmd[8] = {0};
+       ec_cmd[0] = OLPC_EC_1_75_CMD_POWER_CYCLE;
+
+       olpc_xo_1_75_ec_cmd(ec_cmd, NULL, 0);
+}
+
 static void __init olpc_xo_1_75_init(void)
 {
+       pm_power_off = olpc_xo_1_75_poweroff;
+       arm_pm_restart = olpc_xo_1_75_restart;
+
        /* on-chip devices */
        mmp2_add_uart(1);
        mmp2_add_uart(3);
diff --git a/include/linux/olpc-ec-1-75.h b/include/linux/olpc-ec-1-75.h
index c7926de..527f60b 100644
--- a/include/linux/olpc-ec-1-75.h
+++ b/include/linux/olpc-ec-1-75.h
@@ -9,6 +9,9 @@
 #ifndef __OLPC_EC_1_75_H
 #define __OLPC_EC_1_75_H
 
+#define OLPC_EC_1_75_CMD_POWER_CYCLE   0x4b
+#define OLPC_EC_1_75_CMD_POWER_OFF     0x4c
+
 struct olpc_ec_1_75_platform_data {
        int     gpio_ack;
        int     gpio_cmd;
-- 
1.7.0.1

_______________________________________________
Devel mailing list
[email protected]
http://lists.laptop.org/listinfo/devel

Reply via email to