regmap: introduce fast_io busses, and use a spinlock for them
Some bus types have very fast IO. For these, acquiring a mutex for every IO operation is a significant overhead. Allow busses to indicate their IO is fast, and enhance regmap to use a spinlock for those busses. [Currently limited to native endian registers -- broonie] Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
committed by
Mark Brown
parent
0135bbcc7a
commit
bacdbe0773
@@ -264,7 +264,7 @@ int regcache_sync(struct regmap *map)
|
||||
|
||||
BUG_ON(!map->cache_ops || !map->cache_ops->sync);
|
||||
|
||||
mutex_lock(&map->lock);
|
||||
map->lock(map);
|
||||
/* Remember the initial bypass state */
|
||||
bypass = map->cache_bypass;
|
||||
dev_dbg(map->dev, "Syncing %s cache\n",
|
||||
@@ -296,7 +296,7 @@ out:
|
||||
trace_regcache_sync(map->dev, name, "stop");
|
||||
/* Restore the bypass state */
|
||||
map->cache_bypass = bypass;
|
||||
mutex_unlock(&map->lock);
|
||||
map->unlock(map);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -323,7 +323,7 @@ int regcache_sync_region(struct regmap *map, unsigned int min,
|
||||
|
||||
BUG_ON(!map->cache_ops || !map->cache_ops->sync);
|
||||
|
||||
mutex_lock(&map->lock);
|
||||
map->lock(map);
|
||||
|
||||
/* Remember the initial bypass state */
|
||||
bypass = map->cache_bypass;
|
||||
@@ -342,7 +342,7 @@ out:
|
||||
trace_regcache_sync(map->dev, name, "stop region");
|
||||
/* Restore the bypass state */
|
||||
map->cache_bypass = bypass;
|
||||
mutex_unlock(&map->lock);
|
||||
map->unlock(map);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -361,11 +361,11 @@ out:
|
||||
*/
|
||||
void regcache_cache_only(struct regmap *map, bool enable)
|
||||
{
|
||||
mutex_lock(&map->lock);
|
||||
map->lock(map);
|
||||
WARN_ON(map->cache_bypass && enable);
|
||||
map->cache_only = enable;
|
||||
trace_regmap_cache_only(map->dev, enable);
|
||||
mutex_unlock(&map->lock);
|
||||
map->unlock(map);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(regcache_cache_only);
|
||||
|
||||
@@ -380,9 +380,9 @@ EXPORT_SYMBOL_GPL(regcache_cache_only);
|
||||
*/
|
||||
void regcache_mark_dirty(struct regmap *map)
|
||||
{
|
||||
mutex_lock(&map->lock);
|
||||
map->lock(map);
|
||||
map->cache_dirty = true;
|
||||
mutex_unlock(&map->lock);
|
||||
map->unlock(map);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(regcache_mark_dirty);
|
||||
|
||||
@@ -399,11 +399,11 @@ EXPORT_SYMBOL_GPL(regcache_mark_dirty);
|
||||
*/
|
||||
void regcache_cache_bypass(struct regmap *map, bool enable)
|
||||
{
|
||||
mutex_lock(&map->lock);
|
||||
map->lock(map);
|
||||
WARN_ON(map->cache_only && enable);
|
||||
map->cache_bypass = enable;
|
||||
trace_regmap_cache_bypass(map->dev, enable);
|
||||
mutex_unlock(&map->lock);
|
||||
map->unlock(map);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(regcache_cache_bypass);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user