diff options
Diffstat (limited to 'include/linux/clk-provider.h')
-rw-r--r-- | include/linux/clk-provider.h | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 3ecc07d0da77..c56988ac63f7 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
@@ -500,13 +500,14 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name, | |||
500 | * | 500 | * |
501 | * Clock with adjustable fractional divider affecting its output frequency. | 501 | * Clock with adjustable fractional divider affecting its output frequency. |
502 | */ | 502 | */ |
503 | |||
504 | struct clk_fractional_divider { | 503 | struct clk_fractional_divider { |
505 | struct clk_hw hw; | 504 | struct clk_hw hw; |
506 | void __iomem *reg; | 505 | void __iomem *reg; |
507 | u8 mshift; | 506 | u8 mshift; |
507 | u8 mwidth; | ||
508 | u32 mmask; | 508 | u32 mmask; |
509 | u8 nshift; | 509 | u8 nshift; |
510 | u8 nwidth; | ||
510 | u32 nmask; | 511 | u32 nmask; |
511 | u8 flags; | 512 | u8 flags; |
512 | spinlock_t *lock; | 513 | spinlock_t *lock; |
@@ -518,6 +519,41 @@ struct clk *clk_register_fractional_divider(struct device *dev, | |||
518 | void __iomem *reg, u8 mshift, u8 mwidth, u8 nshift, u8 nwidth, | 519 | void __iomem *reg, u8 mshift, u8 mwidth, u8 nshift, u8 nwidth, |
519 | u8 clk_divider_flags, spinlock_t *lock); | 520 | u8 clk_divider_flags, spinlock_t *lock); |
520 | 521 | ||
522 | /** | ||
523 | * struct clk_multiplier - adjustable multiplier clock | ||
524 | * | ||
525 | * @hw: handle between common and hardware-specific interfaces | ||
526 | * @reg: register containing the multiplier | ||
527 | * @shift: shift to the multiplier bit field | ||
528 | * @width: width of the multiplier bit field | ||
529 | * @lock: register lock | ||
530 | * | ||
531 | * Clock with an adjustable multiplier affecting its output frequency. | ||
532 | * Implements .recalc_rate, .set_rate and .round_rate | ||
533 | * | ||
534 | * Flags: | ||
535 | * CLK_MULTIPLIER_ZERO_BYPASS - By default, the multiplier is the value read | ||
536 | * from the register, with 0 being a valid value effectively | ||
537 | * zeroing the output clock rate. If CLK_MULTIPLIER_ZERO_BYPASS is | ||
538 | * set, then a null multiplier will be considered as a bypass, | ||
539 | * leaving the parent rate unmodified. | ||
540 | * CLK_MULTIPLIER_ROUND_CLOSEST - Makes the best calculated divider to be | ||
541 | * rounded to the closest integer instead of the down one. | ||
542 | */ | ||
543 | struct clk_multiplier { | ||
544 | struct clk_hw hw; | ||
545 | void __iomem *reg; | ||
546 | u8 shift; | ||
547 | u8 width; | ||
548 | u8 flags; | ||
549 | spinlock_t *lock; | ||
550 | }; | ||
551 | |||
552 | #define CLK_MULTIPLIER_ZERO_BYPASS BIT(0) | ||
553 | #define CLK_MULTIPLIER_ROUND_CLOSEST BIT(1) | ||
554 | |||
555 | extern const struct clk_ops clk_multiplier_ops; | ||
556 | |||
521 | /*** | 557 | /*** |
522 | * struct clk_composite - aggregate clock of mux, divider and gate clocks | 558 | * struct clk_composite - aggregate clock of mux, divider and gate clocks |
523 | * | 559 | * |
@@ -606,7 +642,7 @@ void clk_unregister(struct clk *clk); | |||
606 | void devm_clk_unregister(struct device *dev, struct clk *clk); | 642 | void devm_clk_unregister(struct device *dev, struct clk *clk); |
607 | 643 | ||
608 | /* helper functions */ | 644 | /* helper functions */ |
609 | const char *__clk_get_name(struct clk *clk); | 645 | const char *__clk_get_name(const struct clk *clk); |
610 | const char *clk_hw_get_name(const struct clk_hw *hw); | 646 | const char *clk_hw_get_name(const struct clk_hw *hw); |
611 | struct clk_hw *__clk_get_hw(struct clk *clk); | 647 | struct clk_hw *__clk_get_hw(struct clk *clk); |
612 | unsigned int clk_hw_get_num_parents(const struct clk_hw *hw); | 648 | unsigned int clk_hw_get_num_parents(const struct clk_hw *hw); |
@@ -618,6 +654,7 @@ unsigned long clk_hw_get_rate(const struct clk_hw *hw); | |||
618 | unsigned long __clk_get_flags(struct clk *clk); | 654 | unsigned long __clk_get_flags(struct clk *clk); |
619 | unsigned long clk_hw_get_flags(const struct clk_hw *hw); | 655 | unsigned long clk_hw_get_flags(const struct clk_hw *hw); |
620 | bool clk_hw_is_prepared(const struct clk_hw *hw); | 656 | bool clk_hw_is_prepared(const struct clk_hw *hw); |
657 | bool clk_hw_is_enabled(const struct clk_hw *hw); | ||
621 | bool __clk_is_enabled(struct clk *clk); | 658 | bool __clk_is_enabled(struct clk *clk); |
622 | struct clk *__clk_lookup(const char *name); | 659 | struct clk *__clk_lookup(const char *name); |
623 | int __clk_mux_determine_rate(struct clk_hw *hw, | 660 | int __clk_mux_determine_rate(struct clk_hw *hw, |
@@ -690,6 +727,15 @@ static inline struct clk *of_clk_src_onecell_get( | |||
690 | { | 727 | { |
691 | return ERR_PTR(-ENOENT); | 728 | return ERR_PTR(-ENOENT); |
692 | } | 729 | } |
730 | static inline int of_clk_get_parent_count(struct device_node *np) | ||
731 | { | ||
732 | return 0; | ||
733 | } | ||
734 | static inline int of_clk_parent_fill(struct device_node *np, | ||
735 | const char **parents, unsigned int size) | ||
736 | { | ||
737 | return 0; | ||
738 | } | ||
693 | static inline const char *of_clk_get_parent_name(struct device_node *np, | 739 | static inline const char *of_clk_get_parent_name(struct device_node *np, |
694 | int index) | 740 | int index) |
695 | { | 741 | { |