aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sh_clk.h
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2012-05-25 02:21:43 -0400
committerPaul Mundt <lethal@linux-sh.org>2012-05-25 02:21:43 -0400
commit1111cc1e8080b5ff46f5b945acb2f99d6176b2d1 (patch)
tree0a8333a7f46236e53ce3f520ceb35b7dd8cfe76f /include/linux/sh_clk.h
parenta60977a51333a8108f0574aa26094d66b7fedf34 (diff)
sh: clkfwk: Introduce a div_mask for variable div types.
This plugs in a div_mask for the clock and sets it up for the existing div6/4 cases. This will make it possible to support other div types, as well as share more div6/4 infrastructure. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include/linux/sh_clk.h')
-rw-r--r--include/linux/sh_clk.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 706b803df7b7..d540b8153178 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -30,6 +30,10 @@ struct sh_clk_ops {
30 long (*round_rate)(struct clk *clk, unsigned long rate); 30 long (*round_rate)(struct clk *clk, unsigned long rate);
31}; 31};
32 32
33#define SH_CLK_DIV_MSK(div) ((1 << (div)) - 1)
34#define SH_CLK_DIV4_MSK SH_CLK_DIV_MSK(4)
35#define SH_CLK_DIV6_MSK SH_CLK_DIV_MSK(6)
36
33struct clk { 37struct clk {
34 struct list_head node; 38 struct list_head node;
35 struct clk *parent; 39 struct clk *parent;
@@ -51,6 +55,7 @@ struct clk {
51 unsigned int enable_bit; 55 unsigned int enable_bit;
52 void __iomem *mapped_reg; 56 void __iomem *mapped_reg;
53 57
58 unsigned int div_mask;
54 unsigned long arch_flags; 59 unsigned long arch_flags;
55 void *priv; 60 void *priv;
56 struct clk_mapping *mapping; 61 struct clk_mapping *mapping;
@@ -145,6 +150,7 @@ static inline int __deprecated sh_clk_mstp32_register(struct clk *clks, int nr)
145 .enable_reg = (void __iomem *)_reg, \ 150 .enable_reg = (void __iomem *)_reg, \
146 .enable_bit = _shift, \ 151 .enable_bit = _shift, \
147 .arch_flags = _div_bitmap, \ 152 .arch_flags = _div_bitmap, \
153 .div_mask = SH_CLK_DIV4_MSK, \
148 .flags = _flags, \ 154 .flags = _flags, \
149} 155}
150 156
@@ -167,6 +173,7 @@ int sh_clk_div4_reparent_register(struct clk *clks, int nr,
167{ \ 173{ \
168 .enable_reg = (void __iomem *)_reg, \ 174 .enable_reg = (void __iomem *)_reg, \
169 .flags = _flags, \ 175 .flags = _flags, \
176 .div_mask = SH_CLK_DIV6_MSK, \
170 .parent_table = _parents, \ 177 .parent_table = _parents, \
171 .parent_num = _num_parents, \ 178 .parent_num = _num_parents, \
172 .src_shift = _src_shift, \ 179 .src_shift = _src_shift, \
@@ -177,6 +184,7 @@ int sh_clk_div4_reparent_register(struct clk *clks, int nr,
177{ \ 184{ \
178 .parent = _parent, \ 185 .parent = _parent, \
179 .enable_reg = (void __iomem *)_reg, \ 186 .enable_reg = (void __iomem *)_reg, \
187 .div_mask = SH_CLK_DIV6_MSK, \
180 .flags = _flags, \ 188 .flags = _flags, \
181} 189}
182 190