@@ -25,6 +25,8 @@
#include <linux/mfd/syscon.h>
#include <linux/slab.h>
+#define SYSCON_HWSPINLOCK_TIMEOUT (~0U)
+
static struct platform_driver syscon_driver;
static DEFINE_SPINLOCK(syscon_list_slock);
@@ -87,6 +89,13 @@ static struct syscon *of_syscon_register(struct device_node *np)
if (ret)
reg_io_width = 4;
+ ret = of_hwspin_lock_get_id(np, 0);
+ if (ret > 0) {
+ syscon_config.hwlock_id = ret;
+ syscon_config.hwlock_mode = HWLOCK_IRQSTATE;
+ syscon_config.hwlock_timeout = SYSCON_HWSPINLOCK_TIMEOUT;
+ }
+
syscon_config.reg_stride = reg_io_width;
syscon_config.val_bits = reg_io_width * 8;
syscon_config.max_register = resource_size(&res) - reg_io_width;
Some system control registers need hardware spinlock to synchronize between the multiple subsystems, so we should add hardware spinlock support for syscon. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> --- drivers/mfd/syscon.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 1.7.9.5