power: reset: read priority from device tree
authorStefan Agner <stefan@agner.ch>
Mon, 1 Dec 2014 10:22:17 +0000 (11:22 +0100)
committerStefan Agner <stefan@agner.ch>
Mon, 1 Dec 2014 16:57:07 +0000 (17:57 +0100)
This patch adds an optional property which allows to specify the
reset source priority. This priority is used by the kernel restart
handler call chain to sort out the proper reset/restart method.
Depending on the power design of a board or other machine/board
specific peculiarity, it is not possible to pick a generic priority.

Documentation/devicetree/bindings/power/reset/syscon-reboot.txt
drivers/power/reset/syscon-reboot.c

index 11906316b43d0860133efce69c70f5a3e5a52157..ee41d9c783722686fe5ba86bf0d88da7545fba83 100644 (file)
@@ -11,6 +11,9 @@ Required properties:
 - offset: offset in the register map for the reboot register (in bytes)
 - mask: the reset value written to the reboot register (32 bit access)
 
+Optional properties:
+- priority: define the priority of the reset (0-255, defaults to 128)
+
 Default will be little endian mode, 32 bit access only.
 
 Examples:
index 815b901822cf9299b6210982e370e2aaa3a503a7..3060d6b2ee8a570fc067fc74373fc0eff9a22081 100644 (file)
@@ -67,8 +67,11 @@ static int syscon_reboot_probe(struct platform_device *pdev)
        if (of_property_read_u32(pdev->dev.of_node, "mask", &ctx->mask))
                return -EINVAL;
 
-       ctx->restart_handler.notifier_call = syscon_restart_handle;
        ctx->restart_handler.priority = 128;
+       of_property_read_u32(pdev->dev.of_node, "priority",
+                            &ctx->restart_handler.priority);
+
+       ctx->restart_handler.notifier_call = syscon_restart_handle;
        err = register_restart_handler(&ctx->restart_handler);
        if (err)
                dev_err(dev, "can't register restart notifier (err=%d)\n", err);