Duy Truong | 790f06d | 2013-02-13 16:38:12 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011, The Linux Foundation. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2 | * |
| 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 Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 21 | #include <linux/gpio.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 22 | |
| 23 | #define FEMTO_GPIO_PS_HOLD 161 |
| 24 | |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 25 | void fsm_restart(char mode, const char *cmd) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 26 | { |
| 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 | } |