summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2016-03-18 19:24:48 -0700
committerStefan Agner <stefan.agner@toradex.com>2016-03-18 19:59:09 -0700
commite1121f9a970a2d0e770532a5849eb749d8bbe8a3 (patch)
treee7dc99068507a6f80aa78dff2d40da613548135b
parentb5e0328c10eafd9c74ddc7b73fbebf13a6405b34 (diff)
rn5t567: register ARM reset callback
Use the PMIC repower capabilities to reboot the module. Register arm_pm_restart to trigger a cold reboot using the PMIC. Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
-rw-r--r--drivers/mfd/rn5t567.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/drivers/mfd/rn5t567.c b/drivers/mfd/rn5t567.c
index f0a47ab52239..4209f1a51545 100644
--- a/drivers/mfd/rn5t567.c
+++ b/drivers/mfd/rn5t567.c
@@ -19,6 +19,8 @@
#include <linux/module.h>
#include <linux/regmap.h>
+#include <asm/system_misc.h>
+
static const struct mfd_cell rn5t618_cells[] = {
{ .name = "rn5t618-regulator" },
{ .name = "rn5t618-wdt" },
@@ -53,16 +55,28 @@ static const struct regmap_config rn5t618_regmap_config = {
static struct rn5t618 *rn5t618_pm_power_off;
-static void rn5t618_power_off(void)
+static void rn5t618_trigger_poweroff_sequence(bool repower)
{
/* disable automatic repower-on */
regmap_update_bits(rn5t618_pm_power_off->regmap, RN5T618_REPCNT,
- RN5T618_REPCNT_REPWRON, 0);
+ RN5T618_REPCNT_REPWRON, repower);
/* start power-off sequence */
regmap_update_bits(rn5t618_pm_power_off->regmap, RN5T618_SLPCNT,
RN5T618_SLPCNT_SWPWROFF, RN5T618_SLPCNT_SWPWROFF);
}
+static void rn5t618_power_off(void)
+{
+ rn5t618_trigger_poweroff_sequence(false);
+}
+
+static void rn5t618_restart(enum reboot_mode reboot_mode, const char *cmd)
+{
+ rn5t618_trigger_poweroff_sequence(true);
+
+ pr_info("Unable to restart system\n");
+}
+
static int rn5t618_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
@@ -90,10 +104,12 @@ static int rn5t618_i2c_probe(struct i2c_client *i2c,
return ret;
}
- if (!pm_power_off && of_device_is_compatible(np, "ricoh,rn5t618")) {
- rn5t618_pm_power_off = priv;
+ rn5t618_pm_power_off = priv;
+ if (!pm_power_off && of_device_is_compatible(np, "ricoh,rn5t618"))
pm_power_off = rn5t618_power_off;
- }
+
+ if (of_device_is_compatible(np, "ricoh,rn5t567"))
+ arm_pm_restart = rn5t618_restart;
dev_err(&i2c->dev, "probe finished ok: %d\n", ret);