@@ -4,7 +4,7 @@ config OLPC_EC
config OLPC_XO175_EC
tristate "OLPC XO 1.75 Embedded Controller"
- depends on ARCH_MMP || COMPILE_TEST
+ depends on ARM && (ARCH_MMP || COMPILE_TEST)
select SPI_SLAVE
select OLPC_EC
help
@@ -23,6 +23,7 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/spi/spi.h>
+#include <asm/system_misc.h>
struct ec_cmd_t {
u8 cmd;
@@ -580,6 +581,14 @@ static int olpc_xo175_ec_set_event_mask(unsigned int mask)
return olpc_ec_cmd(CMD_WRITE_EXT_SCI_MASK, args, 2, NULL, 0);
}
+static void olpc_xo175_ec_restart(enum reboot_mode mode, const char *cmd)
+{
+ while (1) {
+ olpc_ec_cmd(CMD_POWER_CYCLE, NULL, 0, NULL, 0);
+ mdelay(1000);
+ }
+}
+
static void olpc_xo175_ec_power_off(void)
{
while (1) {
@@ -651,6 +660,8 @@ static int olpc_xo175_ec_remove(struct spi_device *spi)
{
if (pm_power_off == olpc_xo175_ec_power_off)
pm_power_off = NULL;
+ if (arm_pm_restart == olpc_xo175_ec_restart)
+ arm_pm_restart = NULL;
spi_slave_abort(spi);
@@ -718,6 +729,8 @@ static int olpc_xo175_ec_probe(struct spi_device *spi)
if (pm_power_off == NULL)
pm_power_off = olpc_xo175_ec_power_off;
+ if (arm_pm_restart == NULL)
+ arm_pm_restart = olpc_xo175_ec_restart;
dev_info(&spi->dev, "OLPC XO-1.75 Embedded Controller driver\n");
This hooks to arm_pm_restart instead od utilizing a restart handler notifier, because the reboot dance on XO 1.75 needs to sleep (it pokes a GPIO and waits for the EC to initiate the command transaction) and the restart handler is called in atomic context. Sad. Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> --- Changes since v4: - Split off from the driver. drivers/platform/olpc/Kconfig | 2 +- drivers/platform/olpc/olpc-xo175-ec.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)