#include <linux/notifier.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/reboot.h>
#include <linux/vexpress.h>
static void vexpress_reset_do(struct device *dev, const char *what)
struct regmap *reg = dev_get_drvdata(dev);
err = regmap_write(reg, 0, 0);
dev_emerg(dev, "Unable to %s (%d)\n", what, err);
static struct device *vexpress_power_off_device;
static atomic_t vexpress_restart_nb_refcnt = ATOMIC_INIT(0);
static void vexpress_power_off(void)
vexpress_reset_do(vexpress_power_off_device, "power off");
static struct device *vexpress_restart_device;
static int vexpress_restart(struct notifier_block *this, unsigned long mode,
vexpress_reset_do(vexpress_restart_device, "restart");
static struct notifier_block vexpress_restart_nb = {
.notifier_call = vexpress_restart,
static ssize_t vexpress_reset_active_show(struct device *dev,
struct device_attribute *attr, char *buf)
return sprintf(buf, "%d\n", vexpress_restart_device == dev);