History

clk: fixed-rate: Add clk flags for parent accuracy

Some clk providers want to use the accuracy of the parent clk and use the fixed rate basic type clk to do that. This requires getting the parent clk and extracting the accuracy before registering the fixed rate clk. Let's add a flag for this and update the clk_ops to support this.

Stephen Boyd committed 7 years ago

Commit 58f0c4b1 parent 2d34f092 files · +12 −1Browse files

Unified · Split

2 files
  1. drivers/clk/clk-fixed-rate.c +6 −1
  2. include/linux/clk-provider.h +6 −0
drivers/clk/clk-fixed-rate.c+6−1
@@ -35,7 +35,12 @@ static unsigned long clk_fixed_rate_recalc_rate(struct clk_hw *hw, · 34 unmodified lines
35static unsigned long clk_fixed_rate_recalc_accuracy(struct clk_hw *hw,35static unsigned long clk_fixed_rate_recalc_accuracy(struct clk_hw *hw,
36 unsigned long parent_accuracy)36 unsigned long parent_accuracy)
37{37{
38 return to_clk_fixed_rate(hw)->fixed_accuracy;38 struct clk_fixed_rate *fixed = to_clk_fixed_rate(hw);
39
40 if (fixed->flags & CLK_FIXED_RATE_PARENT_ACCURACY)
41 return parent_accuracy;
42
43 return fixed->fixed_accuracy;
39}44}
40 45
41const struct clk_ops clk_fixed_rate_ops = {46const struct clk_ops clk_fixed_rate_ops = {
include/linux/clk-provider.h+6−0
@@ -323,6 +323,10 @@ struct clk_hw { · 322 unmodified lines
323 * @fixed_rate: constant frequency of clock323 * @fixed_rate: constant frequency of clock
324 * @fixed_accuracy: constant accuracy of clock in ppb (parts per billion)324 * @fixed_accuracy: constant accuracy of clock in ppb (parts per billion)
325 * @flags: hardware specific flags325 * @flags: hardware specific flags
326 *
327 * Flags:
328 * * CLK_FIXED_RATE_PARENT_ACCURACY - Use the accuracy of the parent clk
329 * instead of what's set in @fixed_accuracy.
326 */330 */
327struct clk_fixed_rate {331struct clk_fixed_rate {
328 struct clk_hw hw;332 struct clk_hw hw;
@@ -331,6 +335,8 @@ struct clk_fixed_rate { · 2 unmodified lines
331 unsigned long flags;335 unsigned long flags;
332};336};
333 337
338#define CLK_FIXED_RATE_PARENT_ACCURACY BIT(0)
339
334extern const struct clk_ops clk_fixed_rate_ops;340extern const struct clk_ops clk_fixed_rate_ops;
335struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev,341struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev,
336 struct device_node *np, const char *name,342 struct device_node *np, const char *name,