[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <af057a852faf8859266409303e4043edbfe0d356.1509425993.git.baolin.wang@linaro.org>
Date: Tue, 31 Oct 2017 14:35:56 +0800
From: Baolin Wang <baolin.wang@...aro.org>
To: broonie@...nel.org, gregkh@...uxfoundation.org,
lee.jones@...aro.org, arnd@...db.de
Cc: linux-kernel@...r.kernel.org, baolin.wang@...aro.org
Subject: [PATCH 2/2] mfd: syscon: Add hardware spinlock support
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@...aro.org>
---
drivers/mfd/syscon.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index b93fe4c..adc1c9c 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -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;
--
1.7.9.5
Powered by blists - more mailing lists