sysreset: implement MAX9807 sysreset functions

MAX8907 PMIC has embedded poweroff function used by some device to initiane
device power off. Implement it as optional sysreset driver guarded by
kconfig option and system-power-controller device tree property.

Tested-by: Ion Agorria <ion@agorria.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
diff --git a/drivers/power/pmic/max8907.c b/drivers/power/pmic/max8907.c
index 5d35957..a7ef701 100644
--- a/drivers/power/pmic/max8907.c
+++ b/drivers/power/pmic/max8907.c
@@ -45,7 +45,19 @@
 static int max8907_bind(struct udevice *dev)
 {
 	ofnode regulators_node;
-	int children;
+	int children, ret;
+
+	if (IS_ENABLED(CONFIG_SYSRESET_MAX8907) &&
+	    dev_read_bool(dev, "maxim,system-power-controller")) {
+		ret = device_bind_driver_to_node(dev, MAX8907_RST_DRIVER,
+						 "sysreset", dev_ofnode(dev),
+						 NULL);
+		if (ret) {
+			log_debug("%s: cannot bind SYSRESET (ret = %d)\n",
+				  __func__, ret);
+			return ret;
+		}
+	}
 
 	regulators_node = dev_read_subnode(dev, "regulators");
 	if (!ofnode_valid(regulators_node)) {