Skip to contentSkip to conversation

sysreset: syscon: Get regmap from parent node

PATCH In review Sam Protsenko 2 participants 2 messages Oct 15 – Oct 28

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sysreset: syscon: Get regmap from parent node

Follow Linux kernel example (see [1,2,3,4]) and deprecate 'regmap' field in "syscon-reboot" and "syscon-poweroff" drivers. Instead take regmap from the parent's node, which normally should be a syscon node.

The fact that 'regmap' field is deprecated is already documented in the corresponding upstream bindings here:

dts/upstream/Bindings/power/reset/syscon-poweroff.yaml dts/upstream/Bindings/power/reset/syscon-reboot.yaml

This also fixes 'unable to find regmap' error message when running 'reset' command on the E850-96 board, as the recently added 'poweroff' node doesn't declare the deprecated 'regmap' property.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2140d68d69d45e4a74ec09ca381d2c8879165d2d
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c3d80522237b71480109fc397975fe4146ed2550
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=716293381a0f9a400d0010628a9ba4354c2bea40
[4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=92bbb93aaaefe14c01eac18df46f8260ee4c2825

---
 drivers/sysreset/sysreset_syscon.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/sysreset/sysreset_syscon.c +7 -2
index 57144fa1e3bb..d853830d5ae4 100644
@@ -47,8 +47,13 @@ static int syscon_reboot_probe(struct udevice *dev)
 
 	priv->regmap = syscon_regmap_lookup_by_phandle(dev, "regmap");
 	if (IS_ERR(priv->regmap)) {
-		pr_err("unable to find regmap\n");
-		return -ENODEV;
+		ofnode syscon_node = dev_ofnode(dev_get_parent(dev));
+
+		priv->regmap = syscon_node_to_regmap(syscon_node);
+		if (IS_ERR(priv->regmap)) {
+			pr_err("unable to find regmap\n");
+			return -ENODEV;
+		}
 	}
 
 	err = dev_read_u32(dev, "offset", &priv->offset);

base-commit: 65a7532545336e4b73e049a69436e255da7df961
prerequisite-patch-id: 7f17e13b8b63210378a74f089ee8fee9cb8dd587

Signature · 1 line
2.47.3
#1 lore raw
Quoted 8 lines · Sam Protsenko

Follow Linux kernel example (see [1,2,3,4]) and deprecate 'regmap' field in "syscon-reboot" and "syscon-poweroff" drivers. Instead take regmap from the parent's node, which normally should be a syscon node.

The fact that 'regmap' field is deprecated is already documented in the corresponding upstream bindings here:

[...]

Applied to u-boot/main, thanks!

[1/1] sysreset: syscon: Get regmap from parent node

      commit: ea87a239da37a5aca11b70b52ae60e1aed0214fd
Signature · 1 line
Tom