aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/mvebu
diff options
context:
space:
mode:
authorMike Turquette <mturquette@linaro.org>2014-08-27 18:36:37 -0400
committerMike Turquette <mturquette@linaro.org>2014-09-01 20:43:52 -0400
commit87e392164ab6c0f3f055f8483dc7dc3f1afa19ad (patch)
treecf29e87ab8c5243a4771e782106259ca4ab50ed2 /drivers/clk/mvebu
parent69e273c0b0a3c337a521d083374c918dc52c666f (diff)
clk: mvebu: share locks between gate clocks
Refactor mvebu_clk_gating_setup() to use a common spinlock instead of a unique lock for every instance of a struct clk_gating_ctrl object. This will be used later for a separate mux clock type that shares a register with gate clock types and needs to use the same lock to protect access to the register. Cc: Andrew Lunn <andrew@lunn.ch> Tested-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk/mvebu')
-rw-r--r--drivers/clk/mvebu/common.c9
-rw-r--r--drivers/clk/mvebu/common.h2
2 files changed, 8 insertions, 3 deletions
diff --git a/drivers/clk/mvebu/common.c b/drivers/clk/mvebu/common.c
index 25ceccf939ad..8145c4efc381 100644
--- a/drivers/clk/mvebu/common.c
+++ b/drivers/clk/mvebu/common.c
@@ -89,8 +89,10 @@ void __init mvebu_coreclk_setup(struct device_node *np,
89 * Clock Gating Control 89 * Clock Gating Control
90 */ 90 */
91 91
92DEFINE_SPINLOCK(ctrl_gating_lock);
93
92struct clk_gating_ctrl { 94struct clk_gating_ctrl {
93 spinlock_t lock; 95 spinlock_t *lock;
94 struct clk **gates; 96 struct clk **gates;
95 int num_gates; 97 int num_gates;
96}; 98};
@@ -138,7 +140,8 @@ void __init mvebu_clk_gating_setup(struct device_node *np,
138 if (WARN_ON(!ctrl)) 140 if (WARN_ON(!ctrl))
139 goto ctrl_out; 141 goto ctrl_out;
140 142
141 spin_lock_init(&ctrl->lock); 143 /* lock must already be initialized */
144 ctrl->lock = &ctrl_gating_lock;
142 145
143 /* Count, allocate, and register clock gates */ 146 /* Count, allocate, and register clock gates */
144 for (n = 0; desc[n].name;) 147 for (n = 0; desc[n].name;)
@@ -155,7 +158,7 @@ void __init mvebu_clk_gating_setup(struct device_node *np,
155 (desc[n].parent) ? desc[n].parent : default_parent; 158 (desc[n].parent) ? desc[n].parent : default_parent;
156 ctrl->gates[n] = clk_register_gate(NULL, desc[n].name, parent, 159 ctrl->gates[n] = clk_register_gate(NULL, desc[n].name, parent,
157 desc[n].flags, base, desc[n].bit_idx, 160 desc[n].flags, base, desc[n].bit_idx,
158 0, &ctrl->lock); 161 0, ctrl->lock);
159 WARN_ON(IS_ERR(ctrl->gates[n])); 162 WARN_ON(IS_ERR(ctrl->gates[n]));
160 } 163 }
161 164
diff --git a/drivers/clk/mvebu/common.h b/drivers/clk/mvebu/common.h
index f968b4d9df92..8cd28e47471c 100644
--- a/drivers/clk/mvebu/common.h
+++ b/drivers/clk/mvebu/common.h
@@ -17,6 +17,8 @@
17 17
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19 19
20extern spinlock_t ctrl_gating_lock;
21
20struct device_node; 22struct device_node;
21 23
22struct coreclk_ratio { 24struct coreclk_ratio {