clock-krait.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Copyright (c) 2013, The Linux Foundation. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 and
  6. * only version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef __ARCH_ARM_MACH_MSM_CLOCK_KRAIT_H
  14. #define __ARCH_ARM_MACH_MSM_CLOCK_KRAIT_H
  15. #include <mach/clk-provider.h>
  16. #include <mach/clock-generic.h>
  17. extern struct clk_mux_ops clk_mux_ops_kpss;
  18. extern struct clk_div_ops clk_div_ops_kpss_div2;
  19. #define DEFINE_KPSS_DIV2_CLK(clk_name, _parent, _offset, _lf_tree) \
  20. static struct div_clk clk_name = { \
  21. .data = { \
  22. .div = 2, \
  23. .min_div = 2, \
  24. .max_div = 2, \
  25. }, \
  26. .ops = &clk_div_ops_kpss_div2, \
  27. .offset = _offset, \
  28. .mask = 0x3, \
  29. .shift = 6, \
  30. .priv = (void *) _lf_tree, \
  31. .c = { \
  32. .parent = _parent, \
  33. .dbg_name = #clk_name, \
  34. .ops = &clk_ops_div, \
  35. .flags = CLKFLAG_NO_RATE_CACHE, \
  36. CLK_INIT(clk_name.c), \
  37. } \
  38. }
  39. struct hfpll_data {
  40. const u32 mode_offset;
  41. const u32 l_offset;
  42. const u32 m_offset;
  43. const u32 n_offset;
  44. const u32 user_offset;
  45. const u32 droop_offset;
  46. const u32 config_offset;
  47. const u32 status_offset;
  48. const u32 droop_val;
  49. u32 config_val;
  50. const u32 user_val;
  51. u32 user_vco_mask;
  52. unsigned long low_vco_max_rate;
  53. unsigned long min_rate;
  54. unsigned long max_rate;
  55. };
  56. struct hfpll_clk {
  57. void * __iomem base;
  58. struct hfpll_data const *d;
  59. unsigned long src_rate;
  60. int init_done;
  61. struct clk c;
  62. };
  63. static inline struct hfpll_clk *to_hfpll_clk(struct clk *c)
  64. {
  65. return container_of(c, struct hfpll_clk, c);
  66. }
  67. extern struct clk_ops clk_ops_hfpll;
  68. struct avs_data {
  69. unsigned long *rate;
  70. u32 *dscr;
  71. int num;
  72. };
  73. struct kpss_core_clk {
  74. int id;
  75. u32 cp15_iaddr;
  76. u32 l2_slp_delay;
  77. struct avs_data *avs_tbl;
  78. struct clk c;
  79. };
  80. static inline struct kpss_core_clk *to_kpss_core_clk(struct clk *c)
  81. {
  82. return container_of(c, struct kpss_core_clk, c);
  83. }
  84. extern struct clk_ops clk_ops_kpss_cpu;
  85. extern struct clk_ops clk_ops_kpss_l2;
  86. #endif