diff options
author | Heiko Stuebner <heiko@sntech.de> | 2014-05-23 09:02:15 -0400 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2014-05-23 16:45:47 -0400 |
commit | 79c6ab509558f9871175c7e4411f857de12cf33b (patch) | |
tree | dd67f6534ab3be884ec541f710605af688e87c9a | |
parent | 1923ca92a618b6107d3a44b5c9f9360b104dcddb (diff) |
clk: divider: add CLK_DIVIDER_READ_ONLY flag
From: Heiko Stuebner <heiko@sntech.de>
Similar to muxes which already have a read-only flag there sometimes
exist dividers which should not be changed by the clock framework
but whose value still should be readable.
Therefore add a READ_ONLY flag similar to the mux-one to clk-divider
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
[changed flag bit to BIT(5) as suggested by Tomasz Figa]
Signed-off-by: Thomas Abraham <thomas.ab@samsung.com>
Acked-by: Tomasz Figa <t.figa@samsung.com>
Acked-by: Max Schwarz <max.schwarz@online.de>
Tested-by: Max Schwarz <max.schwarz@online.de>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
-rw-r--r-- | drivers/clk/clk-divider.c | 10 | ||||
-rw-r--r-- | include/linux/clk-provider.h | 4 |
2 files changed, 13 insertions, 1 deletions
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index b3c83966be18..c9343f5d9918 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c | |||
@@ -361,6 +361,11 @@ const struct clk_ops clk_divider_ops = { | |||
361 | }; | 361 | }; |
362 | EXPORT_SYMBOL_GPL(clk_divider_ops); | 362 | EXPORT_SYMBOL_GPL(clk_divider_ops); |
363 | 363 | ||
364 | const struct clk_ops clk_divider_ro_ops = { | ||
365 | .recalc_rate = clk_divider_recalc_rate, | ||
366 | }; | ||
367 | EXPORT_SYMBOL_GPL(clk_divider_ro_ops); | ||
368 | |||
364 | static struct clk *_register_divider(struct device *dev, const char *name, | 369 | static struct clk *_register_divider(struct device *dev, const char *name, |
365 | const char *parent_name, unsigned long flags, | 370 | const char *parent_name, unsigned long flags, |
366 | void __iomem *reg, u8 shift, u8 width, | 371 | void __iomem *reg, u8 shift, u8 width, |
@@ -386,7 +391,10 @@ static struct clk *_register_divider(struct device *dev, const char *name, | |||
386 | } | 391 | } |
387 | 392 | ||
388 | init.name = name; | 393 | init.name = name; |
389 | init.ops = &clk_divider_ops; | 394 | if (clk_divider_flags & CLK_DIVIDER_READ_ONLY) |
395 | init.ops = &clk_divider_ro_ops; | ||
396 | else | ||
397 | init.ops = &clk_divider_ops; | ||
390 | init.flags = flags | CLK_IS_BASIC; | 398 | init.flags = flags | CLK_IS_BASIC; |
391 | init.parent_names = (parent_name ? &parent_name: NULL); | 399 | init.parent_names = (parent_name ? &parent_name: NULL); |
392 | init.num_parents = (parent_name ? 1 : 0); | 400 | init.num_parents = (parent_name ? 1 : 0); |
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 40809431641e..c7135dbbcd65 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
@@ -320,6 +320,8 @@ struct clk_div_table { | |||
320 | * updated to indicate changing divider bits. | 320 | * updated to indicate changing divider bits. |
321 | * CLK_DIVIDER_ROUND_CLOSEST - Makes the best calculated divider to be rounded | 321 | * CLK_DIVIDER_ROUND_CLOSEST - Makes the best calculated divider to be rounded |
322 | * to the closest integer instead of the up one. | 322 | * to the closest integer instead of the up one. |
323 | * CLK_DIVIDER_READ_ONLY - The divider settings are preconfigured and should | ||
324 | * not be changed by the clock framework. | ||
323 | */ | 325 | */ |
324 | struct clk_divider { | 326 | struct clk_divider { |
325 | struct clk_hw hw; | 327 | struct clk_hw hw; |
@@ -336,8 +338,10 @@ struct clk_divider { | |||
336 | #define CLK_DIVIDER_ALLOW_ZERO BIT(2) | 338 | #define CLK_DIVIDER_ALLOW_ZERO BIT(2) |
337 | #define CLK_DIVIDER_HIWORD_MASK BIT(3) | 339 | #define CLK_DIVIDER_HIWORD_MASK BIT(3) |
338 | #define CLK_DIVIDER_ROUND_CLOSEST BIT(4) | 340 | #define CLK_DIVIDER_ROUND_CLOSEST BIT(4) |
341 | #define CLK_DIVIDER_READ_ONLY BIT(5) | ||
339 | 342 | ||
340 | extern const struct clk_ops clk_divider_ops; | 343 | extern const struct clk_ops clk_divider_ops; |
344 | extern const struct clk_ops clk_divider_ro_ops; | ||
341 | struct clk *clk_register_divider(struct device *dev, const char *name, | 345 | struct clk *clk_register_divider(struct device *dev, const char *name, |
342 | const char *parent_name, unsigned long flags, | 346 | const char *parent_name, unsigned long flags, |
343 | void __iomem *reg, u8 shift, u8 width, | 347 | void __iomem *reg, u8 shift, u8 width, |