aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaolin Wang <baolin.wang@linaro.org>2017-12-25 01:37:09 -0500
committerMark Brown <broonie@kernel.org>2017-12-27 05:37:03 -0500
commita4887813c3a9481ab87c8a71ab1de50b975cc823 (patch)
tree73640dff96d261e0af789f0f09e42e0e13cef47f
parenta1a68fcaf165a6ed202d8e29a692c559e10106c4 (diff)
regmap: Add one flag to indicate if a hwlock should be used
Since the hwlock id 0 is valid for hardware spinlock core, but now id 0 is treated as one invalid value for regmap. Thus we should add one extra flag for regmap config to indicate if a hardware spinlock should be used, then id 0 can be valid for regmap to request. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/base/regmap/regmap.c2
-rw-r--r--include/linux/regmap.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index f25ab18ca057..d23a5c99b639 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -671,7 +671,7 @@ struct regmap *__regmap_init(struct device *dev,
671 map->lock = config->lock; 671 map->lock = config->lock;
672 map->unlock = config->unlock; 672 map->unlock = config->unlock;
673 map->lock_arg = config->lock_arg; 673 map->lock_arg = config->lock_arg;
674 } else if (config->hwlock_id) { 674 } else if (config->use_hwlock) {
675 map->hwlock = hwspin_lock_request_specific(config->hwlock_id); 675 map->hwlock = hwspin_lock_request_specific(config->hwlock_id);
676 if (!map->hwlock) { 676 if (!map->hwlock) {
677 ret = -ENXIO; 677 ret = -ENXIO;
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 15eddc1353ba..c78e0057df66 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -317,6 +317,7 @@ typedef void (*regmap_unlock)(void *);
317 * 317 *
318 * @ranges: Array of configuration entries for virtual address ranges. 318 * @ranges: Array of configuration entries for virtual address ranges.
319 * @num_ranges: Number of range configuration entries. 319 * @num_ranges: Number of range configuration entries.
320 * @use_hwlock: Indicate if a hardware spinlock should be used.
320 * @hwlock_id: Specify the hardware spinlock id. 321 * @hwlock_id: Specify the hardware spinlock id.
321 * @hwlock_mode: The hardware spinlock mode, should be HWLOCK_IRQSTATE, 322 * @hwlock_mode: The hardware spinlock mode, should be HWLOCK_IRQSTATE,
322 * HWLOCK_IRQ or 0. 323 * HWLOCK_IRQ or 0.
@@ -365,6 +366,7 @@ struct regmap_config {
365 const struct regmap_range_cfg *ranges; 366 const struct regmap_range_cfg *ranges;
366 unsigned int num_ranges; 367 unsigned int num_ranges;
367 368
369 bool use_hwlock;
368 unsigned int hwlock_id; 370 unsigned int hwlock_id;
369 unsigned int hwlock_mode; 371 unsigned int hwlock_mode;
370}; 372};