Lines Matching +full:syscon +full:- +full:reboot
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Generic Syscon Reboot Driver
11 #include <linux/mfd/syscon.h>
14 #include <linux/reboot.h>
32 /* Issue the reboot */ in syscon_restart_handle()
33 regmap_update_bits(ctx->map, ctx->offset, ctx->mask, ctx->value); in syscon_restart_handle()
44 struct device *dev = &pdev->dev; in syscon_reboot_probe()
49 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); in syscon_reboot_probe()
51 return -ENOMEM; in syscon_reboot_probe()
53 ctx->map = syscon_regmap_lookup_by_phandle(dev->of_node, "regmap"); in syscon_reboot_probe()
54 if (IS_ERR(ctx->map)) { in syscon_reboot_probe()
55 ctx->map = syscon_node_to_regmap(dev->parent->of_node); in syscon_reboot_probe()
56 if (IS_ERR(ctx->map)) in syscon_reboot_probe()
57 return PTR_ERR(ctx->map); in syscon_reboot_probe()
60 if (of_property_read_s32(pdev->dev.of_node, "priority", &priority)) in syscon_reboot_probe()
63 if (of_property_read_u32(pdev->dev.of_node, "offset", &ctx->offset)) in syscon_reboot_probe()
64 return -EINVAL; in syscon_reboot_probe()
66 value_err = of_property_read_u32(pdev->dev.of_node, "value", &ctx->value); in syscon_reboot_probe()
67 mask_err = of_property_read_u32(pdev->dev.of_node, "mask", &ctx->mask); in syscon_reboot_probe()
70 return -EINVAL; in syscon_reboot_probe()
75 ctx->value = ctx->mask; in syscon_reboot_probe()
76 ctx->mask = 0xFFFFFFFF; in syscon_reboot_probe()
79 ctx->mask = 0xFFFFFFFF; in syscon_reboot_probe()
82 ctx->restart_handler.notifier_call = syscon_restart_handle; in syscon_reboot_probe()
83 ctx->restart_handler.priority = priority; in syscon_reboot_probe()
84 err = register_restart_handler(&ctx->restart_handler); in syscon_reboot_probe()
92 { .compatible = "syscon-reboot" },
99 .name = "syscon-reboot",