clock.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /* arch/arm/mach-msm/clock.h
  2. *
  3. * Copyright (C) 2007 Google, Inc.
  4. * Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved.
  5. *
  6. * This software is licensed under the terms of the GNU General Public
  7. * License version 2, as published by the Free Software Foundation, and
  8. * may be copied, distributed, and modified under those terms.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. */
  16. #ifndef __ARCH_ARM_MACH_MSM_CLOCK_H
  17. #define __ARCH_ARM_MACH_MSM_CLOCK_H
  18. #include <linux/list.h>
  19. #include <mach/clk.h>
  20. #include "clock-pcom.h"
  21. #include "clock-7x30.h"
  22. #define CLKFLAG_INVERT 0x00000001
  23. #define CLKFLAG_NOINVERT 0x00000002
  24. #define CLKFLAG_NONEST 0x00000004
  25. #define CLKFLAG_NORESET 0x00000008
  26. #define CLK_FIRST_AVAILABLE_FLAG 0x00000100
  27. #define CLKFLAG_AUTO_OFF 0x00000200
  28. #define CLKFLAG_MIN 0x00000400
  29. #define CLKFLAG_MAX 0x00000800
  30. struct clk_ops {
  31. int (*enable)(unsigned id);
  32. void (*disable)(unsigned id);
  33. void (*auto_off)(unsigned id);
  34. int (*reset)(unsigned id, enum clk_reset_action action);
  35. int (*set_rate)(unsigned id, unsigned rate);
  36. int (*set_min_rate)(unsigned id, unsigned rate);
  37. int (*set_max_rate)(unsigned id, unsigned rate);
  38. int (*set_flags)(unsigned id, unsigned flags);
  39. unsigned (*get_rate)(unsigned id);
  40. unsigned (*is_enabled)(unsigned id);
  41. long (*round_rate)(unsigned id, unsigned rate);
  42. };
  43. struct clk {
  44. uint32_t id;
  45. uint32_t remote_id;
  46. uint32_t count;
  47. uint32_t flags;
  48. const char *name;
  49. struct clk_ops *ops;
  50. const char *dbg_name;
  51. struct list_head list;
  52. struct device *dev;
  53. };
  54. #define A11S_CLK_CNTL_ADDR (MSM_CSR_BASE + 0x100)
  55. #define A11S_CLK_SEL_ADDR (MSM_CSR_BASE + 0x104)
  56. #define A11S_VDD_SVS_PLEVEL_ADDR (MSM_CSR_BASE + 0x124)
  57. #ifdef CONFIG_DEBUG_FS
  58. #define CLOCK_DBG_NAME(x) .dbg_name = x,
  59. #else
  60. #define CLOCK_DBG_NAME(x)
  61. #endif
  62. #define CLOCK(clk_name, clk_id, clk_dev, clk_flags) { \
  63. .name = clk_name, \
  64. .id = clk_id, \
  65. .flags = clk_flags, \
  66. .dev = clk_dev, \
  67. CLOCK_DBG_NAME(#clk_id) \
  68. }
  69. #define OFF CLKFLAG_AUTO_OFF
  70. #define CLK_MIN CLKFLAG_MIN
  71. #define CLK_MAX CLKFLAG_MAX
  72. #define CLK_MINMAX (CLK_MIN | CLK_MAX)
  73. #define NR_CLKS P_NR_CLKS
  74. enum {
  75. PLL_0 = 0,
  76. PLL_1,
  77. PLL_2,
  78. PLL_3,
  79. PLL_4,
  80. PLL_5,
  81. PLL_6,
  82. NUM_PLL
  83. };
  84. enum clkvote_client {
  85. CLKVOTE_ACPUCLK = 0,
  86. CLKVOTE_PMQOS,
  87. CLKVOTE_MAX,
  88. };
  89. int msm_clock_require_tcxo(unsigned long *reason, int nbits);
  90. int msm_clock_get_name(uint32_t id, char *name, uint32_t size);
  91. int ebi1_clk_set_min_rate(enum clkvote_client client, unsigned long rate);
  92. unsigned long clk_get_max_axi_khz(void);
  93. #endif