Commit 8f816321 authored by Samuel Holland's avatar Samuel Holland Committed by Maxime Ripard

clk: sunxi-ng: Use a separate lock for each CCU instance

Some platforms have more than one CCU driver loaded: the main CCU, the
PRCM, the display engine, and possibly others. All of these hardware
blocks have separate MMIO spaces, so there is no need to synchronize
between them.
Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20210901050526.45673-4-samuel@sholland.org
parent 66028ddb
...@@ -17,11 +17,10 @@ ...@@ -17,11 +17,10 @@
struct sunxi_ccu { struct sunxi_ccu {
const struct sunxi_ccu_desc *desc; const struct sunxi_ccu_desc *desc;
spinlock_t lock;
struct ccu_reset reset; struct ccu_reset reset;
}; };
static DEFINE_SPINLOCK(ccu_lock);
void ccu_helper_wait_for_lock(struct ccu_common *common, u32 lock) void ccu_helper_wait_for_lock(struct ccu_common *common, u32 lock)
{ {
void __iomem *addr; void __iomem *addr;
...@@ -94,6 +93,8 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev, ...@@ -94,6 +93,8 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev,
ccu->desc = desc; ccu->desc = desc;
spin_lock_init(&ccu->lock);
for (i = 0; i < desc->num_ccu_clks; i++) { for (i = 0; i < desc->num_ccu_clks; i++) {
struct ccu_common *cclk = desc->ccu_clks[i]; struct ccu_common *cclk = desc->ccu_clks[i];
...@@ -101,7 +102,7 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev, ...@@ -101,7 +102,7 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev,
continue; continue;
cclk->base = reg; cclk->base = reg;
cclk->lock = &ccu_lock; cclk->lock = &ccu->lock;
} }
for (i = 0; i < desc->hw_clks->num ; i++) { for (i = 0; i < desc->hw_clks->num ; i++) {
...@@ -133,7 +134,7 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev, ...@@ -133,7 +134,7 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev,
reset->rcdev.owner = dev ? dev->driver->owner : THIS_MODULE; reset->rcdev.owner = dev ? dev->driver->owner : THIS_MODULE;
reset->rcdev.nr_resets = desc->num_resets; reset->rcdev.nr_resets = desc->num_resets;
reset->base = reg; reset->base = reg;
reset->lock = &ccu_lock; reset->lock = &ccu->lock;
reset->reset_map = desc->resets; reset->reset_map = desc->resets;
ret = reset_controller_register(&reset->rcdev); ret = reset_controller_register(&reset->rcdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment