diff options
author | Shawn Guo <shawn.guo@freescale.com> | 2014-04-18 03:55:16 -0400 |
---|---|---|
committer | Shawn Guo <shawn.guo@freescale.com> | 2014-05-12 10:58:48 -0400 |
commit | 54ee1471f82047885ec575559cb7c8466adcbef4 (patch) | |
tree | 38d9e794424934f9ca173fb03f65692d904cd2d9 /arch/arm/mach-imx/clk-gate2.c | |
parent | 1e56f8945d17a3a55b7d4c4dd9debeda8e68af8e (diff) |
ARM: imx: define struct clk_gate2 on our own
The imx clk-gate2 driver implements an i.MX specific gate clock, which
has two bits controlling the gate states. While this is a completely
separate gate driver from the common clk-gate one, it reuses the common
clk_gate structure. Such reusing makes the extending of clk_gate2
clumsy. Let's define struct clk_gate2 on our own to make the driver
independent of the common clk-gate one, and ease the clk_gate2 extending
at a later time.
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Diffstat (limited to 'arch/arm/mach-imx/clk-gate2.c')
-rw-r--r-- | arch/arm/mach-imx/clk-gate2.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c index a2ecc006b322..7e98ccb8fa91 100644 --- a/arch/arm/mach-imx/clk-gate2.c +++ b/arch/arm/mach-imx/clk-gate2.c | |||
@@ -27,11 +27,19 @@ | |||
27 | * parent - fixed parent. No clk_set_parent support | 27 | * parent - fixed parent. No clk_set_parent support |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw) | 30 | struct clk_gate2 { |
31 | struct clk_hw hw; | ||
32 | void __iomem *reg; | ||
33 | u8 bit_idx; | ||
34 | u8 flags; | ||
35 | spinlock_t *lock; | ||
36 | }; | ||
37 | |||
38 | #define to_clk_gate2(_hw) container_of(_hw, struct clk_gate2, hw) | ||
31 | 39 | ||
32 | static int clk_gate2_enable(struct clk_hw *hw) | 40 | static int clk_gate2_enable(struct clk_hw *hw) |
33 | { | 41 | { |
34 | struct clk_gate *gate = to_clk_gate(hw); | 42 | struct clk_gate2 *gate = to_clk_gate2(hw); |
35 | u32 reg; | 43 | u32 reg; |
36 | unsigned long flags = 0; | 44 | unsigned long flags = 0; |
37 | 45 | ||
@@ -50,7 +58,7 @@ static int clk_gate2_enable(struct clk_hw *hw) | |||
50 | 58 | ||
51 | static void clk_gate2_disable(struct clk_hw *hw) | 59 | static void clk_gate2_disable(struct clk_hw *hw) |
52 | { | 60 | { |
53 | struct clk_gate *gate = to_clk_gate(hw); | 61 | struct clk_gate2 *gate = to_clk_gate2(hw); |
54 | u32 reg; | 62 | u32 reg; |
55 | unsigned long flags = 0; | 63 | unsigned long flags = 0; |
56 | 64 | ||
@@ -68,7 +76,7 @@ static void clk_gate2_disable(struct clk_hw *hw) | |||
68 | static int clk_gate2_is_enabled(struct clk_hw *hw) | 76 | static int clk_gate2_is_enabled(struct clk_hw *hw) |
69 | { | 77 | { |
70 | u32 reg; | 78 | u32 reg; |
71 | struct clk_gate *gate = to_clk_gate(hw); | 79 | struct clk_gate2 *gate = to_clk_gate2(hw); |
72 | 80 | ||
73 | reg = readl(gate->reg); | 81 | reg = readl(gate->reg); |
74 | 82 | ||
@@ -89,15 +97,15 @@ struct clk *clk_register_gate2(struct device *dev, const char *name, | |||
89 | void __iomem *reg, u8 bit_idx, | 97 | void __iomem *reg, u8 bit_idx, |
90 | u8 clk_gate2_flags, spinlock_t *lock) | 98 | u8 clk_gate2_flags, spinlock_t *lock) |
91 | { | 99 | { |
92 | struct clk_gate *gate; | 100 | struct clk_gate2 *gate; |
93 | struct clk *clk; | 101 | struct clk *clk; |
94 | struct clk_init_data init; | 102 | struct clk_init_data init; |
95 | 103 | ||
96 | gate = kzalloc(sizeof(struct clk_gate), GFP_KERNEL); | 104 | gate = kzalloc(sizeof(struct clk_gate2), GFP_KERNEL); |
97 | if (!gate) | 105 | if (!gate) |
98 | return ERR_PTR(-ENOMEM); | 106 | return ERR_PTR(-ENOMEM); |
99 | 107 | ||
100 | /* struct clk_gate assignments */ | 108 | /* struct clk_gate2 assignments */ |
101 | gate->reg = reg; | 109 | gate->reg = reg; |
102 | gate->bit_idx = bit_idx; | 110 | gate->bit_idx = bit_idx; |
103 | gate->flags = clk_gate2_flags; | 111 | gate->flags = clk_gate2_flags; |