blob: d2fd05183cb9a63d9cbaf075f52e034fbbd01fe2 [file] [log] [blame]
Duy Truong790f06d2013-02-13 16:38:12 -08001/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#include <linux/module.h>
15#include <linux/moduleparam.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/reboot.h>
19#include <linux/io.h>
20#include <linux/delay.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070021#include <linux/gpio.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070022
23#define FEMTO_GPIO_PS_HOLD 161
24
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -070025void fsm_restart(char mode, const char *cmd)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070026{
27 pr_notice("Going down for restart now\n");
28 msleep(3000);
29
30 /* Configure FEMTO_GPIO_PS_HOLD as a general purpose output */
31 if (gpio_tlmm_config(GPIO_CFG(FEMTO_GPIO_PS_HOLD, 0,
32 GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
33 GPIO_CFG_2MA), GPIO_CFG_ENABLE))
34 pr_err("%s: gpio_tlmm_config (gpio=%d) failed\n",
35 __func__, FEMTO_GPIO_PS_HOLD);
36
37 /* Now set it low to power cycle the entire board */
38 gpio_set_value(FEMTO_GPIO_PS_HOLD, 0);
39
40 msleep(10000);
41 pr_err("Restarting has failed\n");
42}