[PATCH v3 2/2] mfd: syscon: Give each syscon its own lockdep class

Arun Iyengar via B4 Relay devnull+aiyengar1990.gmail.com at kernel.org
Sat Nov 28 11:06:25 PST 2026


From: Arun Iyengar <aiyengar1990 at gmail.com>

All syscon regmaps share the lockdep class of the regmap_init_mmio() call
site. On RK3588 the VO1 GRF calls clk_enable() under its regmap lock, while
the CRU's GRF gates take the SYS GRF regmap lock under enable_lock. Lockdep
reports a circular dependency and turns itself off.

Give each syscon its own class.

Signed-off-by: Arun Iyengar <aiyengar1990 at gmail.com>
---
 drivers/mfd/syscon.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 21a7fcdd2737..e0d5558b3382 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -13,6 +13,7 @@
 #include <linux/err.h>
 #include <linux/hwspinlock.h>
 #include <linux/list.h>
+#include <linux/lockdep.h>
 #include <linux/mutex.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
@@ -29,6 +30,7 @@ struct syscon {
 	struct regmap *regmap;
 	struct reset_control *reset;
 	struct list_head list;
+	struct lock_class_key lock_key;
 };
 
 static const struct regmap_config syscon_regmap_config = {
@@ -62,6 +64,9 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res)
 	if (!base)
 		return ERR_PTR(-ENOMEM);
 
+	lockdep_register_key(&syscon->lock_key);
+	syscon_config.lock_key = &syscon->lock_key;
+
 	/* Parse the device's DT node for an endianness specification */
 	if (of_property_read_bool(np, "big-endian"))
 		syscon_config.val_format_endian = REGMAP_ENDIAN_BIG;
@@ -162,6 +167,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res)
 	regmap_exit(regmap);
 err_regmap:
 	iounmap(base);
+	lockdep_unregister_key(&syscon->lock_key);
 	return ERR_PTR(ret);
 }
 

-- 
2.55.0





More information about the Linux-rockchip mailing list