Lines Matching +full:int +full:- +full:map +full:- +full:mask

1 // SPDX-License-Identifier: GPL-2.0-or-later
18 struct regmap *map; member
21 u32 mask; member
25 static int syscon_restart_handle(struct notifier_block *this, in syscon_restart_handle()
33 regmap_update_bits(ctx->map, ctx->offset, ctx->mask, ctx->value); in syscon_restart_handle()
41 static int syscon_reboot_probe(struct platform_device *pdev) in syscon_reboot_probe()
44 struct device *dev = &pdev->dev; in syscon_reboot_probe()
45 int mask_err, value_err; in syscon_reboot_probe()
46 int priority; in syscon_reboot_probe()
47 int err; 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()
69 dev_err(dev, "unable to read 'value' and '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()
78 /* support value without mask*/ 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",