aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/clk-provider.h50
-rw-r--r--include/linux/clk/at91_pmc.h22
2 files changed, 62 insertions, 10 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
504struct clk_fractional_divider { 503struct 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 */
543struct 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
555extern 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);
606void devm_clk_unregister(struct device *dev, struct clk *clk); 642void devm_clk_unregister(struct device *dev, struct clk *clk);
607 643
608/* helper functions */ 644/* helper functions */
609const char *__clk_get_name(struct clk *clk); 645const char *__clk_get_name(const struct clk *clk);
610const char *clk_hw_get_name(const struct clk_hw *hw); 646const char *clk_hw_get_name(const struct clk_hw *hw);
611struct clk_hw *__clk_get_hw(struct clk *clk); 647struct clk_hw *__clk_get_hw(struct clk *clk);
612unsigned int clk_hw_get_num_parents(const struct clk_hw *hw); 648unsigned 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);
618unsigned long __clk_get_flags(struct clk *clk); 654unsigned long __clk_get_flags(struct clk *clk);
619unsigned long clk_hw_get_flags(const struct clk_hw *hw); 655unsigned long clk_hw_get_flags(const struct clk_hw *hw);
620bool clk_hw_is_prepared(const struct clk_hw *hw); 656bool clk_hw_is_prepared(const struct clk_hw *hw);
657bool clk_hw_is_enabled(const struct clk_hw *hw);
621bool __clk_is_enabled(struct clk *clk); 658bool __clk_is_enabled(struct clk *clk);
622struct clk *__clk_lookup(const char *name); 659struct clk *__clk_lookup(const char *name);
623int __clk_mux_determine_rate(struct clk_hw *hw, 660int __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}
730static inline int of_clk_get_parent_count(struct device_node *np)
731{
732 return 0;
733}
734static inline int of_clk_parent_fill(struct device_node *np,
735 const char **parents, unsigned int size)
736{
737 return 0;
738}
693static inline const char *of_clk_get_parent_name(struct device_node *np, 739static inline const char *of_clk_get_parent_name(struct device_node *np,
694 int index) 740 int index)
695{ 741{
diff --git a/include/linux/clk/at91_pmc.h b/include/linux/clk/at91_pmc.h
index 7669f7618f39..1e6932222e11 100644
--- a/include/linux/clk/at91_pmc.h
+++ b/include/linux/clk/at91_pmc.h
@@ -164,6 +164,7 @@ extern void __iomem *at91_pmc_base;
164#define AT91_PMC_MOSCSELS (1 << 16) /* Main Oscillator Selection [some SAM9] */ 164#define AT91_PMC_MOSCSELS (1 << 16) /* Main Oscillator Selection [some SAM9] */
165#define AT91_PMC_MOSCRCS (1 << 17) /* Main On-Chip RC [some SAM9] */ 165#define AT91_PMC_MOSCRCS (1 << 17) /* Main On-Chip RC [some SAM9] */
166#define AT91_PMC_CFDEV (1 << 18) /* Clock Failure Detector Event [some SAM9] */ 166#define AT91_PMC_CFDEV (1 << 18) /* Clock Failure Detector Event [some SAM9] */
167#define AT91_PMC_GCKRDY (1 << 24) /* Generated Clocks */
167#define AT91_PMC_IMR 0x6c /* Interrupt Mask Register */ 168#define AT91_PMC_IMR 0x6c /* Interrupt Mask Register */
168 169
169#define AT91_PMC_PLLICPR 0x80 /* PLL Charge Pump Current Register */ 170#define AT91_PMC_PLLICPR 0x80 /* PLL Charge Pump Current Register */
@@ -182,13 +183,18 @@ extern void __iomem *at91_pmc_base;
182#define AT91_PMC_PCSR1 0x108 /* Peripheral Clock Enable Register 1 */ 183#define AT91_PMC_PCSR1 0x108 /* Peripheral Clock Enable Register 1 */
183 184
184#define AT91_PMC_PCR 0x10c /* Peripheral Control Register [some SAM9 and SAMA5] */ 185#define AT91_PMC_PCR 0x10c /* Peripheral Control Register [some SAM9 and SAMA5] */
185#define AT91_PMC_PCR_PID (0x3f << 0) /* Peripheral ID */ 186#define AT91_PMC_PCR_PID_MASK 0x3f
186#define AT91_PMC_PCR_CMD (0x1 << 12) /* Command (read=0, write=1) */ 187#define AT91_PMC_PCR_GCKCSS_OFFSET 8
187#define AT91_PMC_PCR_DIV(n) ((n) << 16) /* Divisor Value */ 188#define AT91_PMC_PCR_GCKCSS_MASK (0x7 << AT91_PMC_PCR_GCKCSS_OFFSET)
188#define AT91_PMC_PCR_DIV0 0x0 /* Peripheral clock is MCK */ 189#define AT91_PMC_PCR_GCKCSS(n) ((n) << AT91_PMC_PCR_GCKCSS_OFFSET) /* GCK Clock Source Selection */
189#define AT91_PMC_PCR_DIV2 0x1 /* Peripheral clock is MCK/2 */ 190#define AT91_PMC_PCR_CMD (0x1 << 12) /* Command (read=0, write=1) */
190#define AT91_PMC_PCR_DIV4 0x2 /* Peripheral clock is MCK/4 */ 191#define AT91_PMC_PCR_DIV_OFFSET 16
191#define AT91_PMC_PCR_DIV8 0x3 /* Peripheral clock is MCK/8 */ 192#define AT91_PMC_PCR_DIV_MASK (0x3 << AT91_PMC_PCR_DIV_OFFSET)
192#define AT91_PMC_PCR_EN (0x1 << 28) /* Enable */ 193#define AT91_PMC_PCR_DIV(n) ((n) << AT91_PMC_PCR_DIV_OFFSET) /* Divisor Value */
194#define AT91_PMC_PCR_GCKDIV_OFFSET 20
195#define AT91_PMC_PCR_GCKDIV_MASK (0xff << AT91_PMC_PCR_GCKDIV_OFFSET)
196#define AT91_PMC_PCR_GCKDIV(n) ((n) << AT91_PMC_PCR_GCKDIV_OFFSET) /* Generated Clock Divisor Value */
197#define AT91_PMC_PCR_EN (0x1 << 28) /* Enable */
198#define AT91_PMC_PCR_GCKEN (0x1 << 29) /* GCK Enable */
193 199
194#endif 200#endif