clk.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Clock framework definitions for SPEAr platform
  3. *
  4. * Copyright (C) 2012 ST Microelectronics
  5. * Viresh Kumar <viresh.kumar@st.com>
  6. *
  7. * This file is licensed under the terms of the GNU General Public
  8. * License version 2. This program is licensed "as is" without any
  9. * warranty of any kind, whether express or implied.
  10. */
  11. #ifndef __SPEAR_CLK_H
  12. #define __SPEAR_CLK_H
  13. #include <linux/clk-provider.h>
  14. #include <linux/spinlock_types.h>
  15. #include <linux/types.h>
  16. /* VCO-PLL clk */
  17. struct pll_rate_tbl {
  18. u8 mode;
  19. u16 m;
  20. u8 n;
  21. u8 p;
  22. };
  23. struct clk_vco {
  24. struct clk_hw hw;
  25. void __iomem *mode_reg;
  26. void __iomem *cfg_reg;
  27. struct pll_rate_tbl *rtbl;
  28. u8 rtbl_cnt;
  29. spinlock_t *lock;
  30. };
  31. struct clk_pll {
  32. struct clk_hw hw;
  33. struct clk_vco *vco;
  34. const char *parent[1];
  35. spinlock_t *lock;
  36. };
  37. typedef unsigned long (*clk_calc_rate)(struct clk_hw *hw, unsigned long prate,
  38. int index);
  39. /* clk register routines */
  40. struct clk *clk_register_vco_pll(const char *vco_name, const char *pll_name,
  41. const char *vco_gate_name, const char *parent_name,
  42. unsigned long flags, void __iomem *mode_reg, void __iomem
  43. *cfg_reg, struct pll_rate_tbl *rtbl, u8 rtbl_cnt,
  44. spinlock_t *lock, struct clk **pll_clk,
  45. struct clk **vco_gate_clk);
  46. long clk_round_rate_index(struct clk_hw *hw, unsigned long drate,
  47. unsigned long parent_rate, clk_calc_rate calc_rate, u8 rtbl_cnt,
  48. int *index);
  49. #endif /* __SPEAR_CLK_H */