Commit ad8d7b80 authored by Andrew Davis's avatar Andrew Davis Committed by Sebastian Reichel

power: reset: axxia-reset: Use devm_register_sys_off_handler(RESTART)

Use device life-cycle managed register function to simplify probe.
Signed-off-by: default avatarAndrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-9-afd@ti.comSigned-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent 45079f20
...@@ -26,11 +26,10 @@ ...@@ -26,11 +26,10 @@
#define SC_EFUSE_INT_STATUS 0x180c #define SC_EFUSE_INT_STATUS 0x180c
#define EFUSE_READ_DONE (1<<31) #define EFUSE_READ_DONE (1<<31)
static struct regmap *syscon; static int axxia_restart_handler(struct sys_off_data *data)
static int axxia_restart_handler(struct notifier_block *this,
unsigned long mode, void *cmd)
{ {
struct regmap *syscon = data->cb_data;
/* Access Key (0xab) */ /* Access Key (0xab) */
regmap_write(syscon, SC_CRIT_WRITE_KEY, 0xab); regmap_write(syscon, SC_CRIT_WRITE_KEY, 0xab);
/* Select internal boot from 0xffff0000 */ /* Select internal boot from 0xffff0000 */
...@@ -44,14 +43,10 @@ static int axxia_restart_handler(struct notifier_block *this, ...@@ -44,14 +43,10 @@ static int axxia_restart_handler(struct notifier_block *this,
return NOTIFY_DONE; return NOTIFY_DONE;
} }
static struct notifier_block axxia_restart_nb = {
.notifier_call = axxia_restart_handler,
.priority = 128,
};
static int axxia_reset_probe(struct platform_device *pdev) static int axxia_reset_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct regmap *syscon;
int err; int err;
syscon = syscon_regmap_lookup_by_phandle(dev->of_node, "syscon"); syscon = syscon_regmap_lookup_by_phandle(dev->of_node, "syscon");
...@@ -60,7 +55,8 @@ static int axxia_reset_probe(struct platform_device *pdev) ...@@ -60,7 +55,8 @@ static int axxia_reset_probe(struct platform_device *pdev)
return PTR_ERR(syscon); return PTR_ERR(syscon);
} }
err = register_restart_handler(&axxia_restart_nb); err = devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_RESTART,
128, axxia_restart_handler, syscon);
if (err) if (err)
dev_err(dev, "cannot register restart handler (err=%d)\n", err); dev_err(dev, "cannot register restart handler (err=%d)\n", err);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment