varianceDataMemoryDefinition.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /*
  2. * linux/arch/arm/mach-omap2/clock.h
  3. *
  4. * Copyright (C) 2005-2009 Texas Instruments, Inc.
  5. * Copyright (C) 2004-2011 Nokia Corporation
  6. *
  7. * Contacts:
  8. * Richard Woodruff <r-woodruff2@ti.com>
  9. * Paul Walmsley
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_H
  16. #define __ARCH_ARM_MACH_OMAP2_CLOCK_H
  17. #include <linux/kernel.h>
  18. #include <linux/list.h>
  19. #include <linux/clkdev.h>
  20. #include <linux/clk-provider.h>
  21. struct omap_clk {
  22. u16 cpu;
  23. struct clk_lookup lk;
  24. };
  25. #define CLK(dev, con, ck, cp) \
  26. { \
  27. .cpu = cp, \
  28. .lk = { \
  29. .dev_id = dev, \
  30. .con_id = con, \
  31. .clk = ck, \
  32. }, \
  33. }
  34. /* Platform flags for the clkdev-OMAP integration code */
  35. #define CK_242X (1 << 0)
  36. #define CK_243X (1 << 1) /* 243x, 253x */
  37. #define CK_3430ES1 (1 << 2) /* 34xxES1 only */
  38. #define CK_3430ES2PLUS (1 << 3) /* 34xxES2, ES3, non-Sitara 35xx only */
  39. #define CK_AM35XX (1 << 4) /* Sitara AM35xx */
  40. #define CK_36XX (1 << 5) /* 36xx/37xx-specific clocks */
  41. #define CK_443X (1 << 6)
  42. #define CK_TI816X (1 << 7)
  43. #define CK_446X (1 << 8)
  44. #define CK_AM33XX (1 << 9) /* AM33xx specific clocks */
  45. #define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS)
  46. #define CK_3XXX (CK_34XX | CK_AM35XX | CK_36XX)
  47. struct clockdomain;
  48. #define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw)
  49. #define DEFINE_STRUCT_CLK(_name, _parent_array_name, _clkops_name) \
  50. static struct clk _name = { \
  51. .name = #_name, \
  52. .hw = &_name##_hw.hw, \
  53. .parent_names = _parent_array_name, \
  54. .num_parents = ARRAY_SIZE(_parent_array_name), \
  55. .ops = &_clkops_name, \
  56. };
  57. #define DEFINE_STRUCT_CLK_HW_OMAP(_name, _clkdm_name) \
  58. static struct clk_hw_omap _name##_hw = { \
  59. .hw = { \
  60. .clk = &_name, \
  61. }, \
  62. .clkdm_name = _clkdm_name, \
  63. };
  64. #define DEFINE_CLK_OMAP_MUX(_name, _clkdm_name, _clksel, \
  65. _clksel_reg, _clksel_mask, \
  66. _parent_names, _ops) \
  67. static struct clk _name; \
  68. static struct clk_hw_omap _name##_hw = { \
  69. .hw = { \
  70. .clk = &_name, \
  71. }, \
  72. .clksel = _clksel, \
  73. .clksel_reg = _clksel_reg, \
  74. .clksel_mask = _clksel_mask, \
  75. .clkdm_name = _clkdm_name, \
  76. }; \
  77. DEFINE_STRUCT_CLK(_name, _parent_names, _ops);
  78. #define DEFINE_CLK_OMAP_MUX_GATE(_name, _clkdm_name, _clksel, \
  79. _clksel_reg, _clksel_mask, \
  80. _enable_reg, _enable_bit, \
  81. _hwops, _parent_names, _ops) \
  82. static struct clk _name; \
  83. static struct clk_hw_omap _name##_hw = { \
  84. .hw = { \
  85. .clk = &_name, \
  86. }, \
  87. .ops = _hwops, \
  88. .enable_reg = _enable_reg, \
  89. .enable_bit = _enable_bit, \
  90. .clksel = _clksel, \
  91. .clksel_reg = _clksel_reg, \
  92. .clksel_mask = _clksel_mask, \
  93. .clkdm_name = _clkdm_name, \
  94. }; \
  95. DEFINE_STRUCT_CLK(_name, _parent_names, _ops);
  96. #define DEFINE_CLK_OMAP_HSDIVIDER(_name, _parent_name, \
  97. _parent_ptr, _flags, \
  98. _clksel_reg, _clksel_mask) \
  99. static const struct clksel _name##_div[] = { \
  100. { \
  101. .parent = _parent_ptr, \
  102. .rates = div31_1to31_rates \
  103. }, \
  104. { .parent = NULL }, \
  105. }; \
  106. static struct clk _name; \
  107. static const char *_name##_parent_names[] = { \
  108. _parent_name, \
  109. }; \
  110. static struct clk_hw_omap _name##_hw = { \
  111. .hw = { \
  112. .clk = &_name, \
  113. }, \
  114. .clksel = _name##_div, \
  115. .clksel_reg = _clksel_reg, \
  116. .clksel_mask = _clksel_mask, \
  117. .ops = &clkhwops_omap4_dpllmx, \
  118. }; \
  119. DEFINE_STRUCT_CLK(_name, _name##_parent_names, omap_hsdivider_ops);
  120. /* struct clksel_rate.flags possibilities */
  121. #define RATE_IN_242X (1 << 0)
  122. #define RATE_IN_243X (1 << 1)
  123. #define RATE_IN_3430ES1 (1 << 2) /* 3430ES1 rates only */
  124. #define RATE_IN_3430ES2PLUS (1 << 3) /* 3430 ES >= 2 rates only */
  125. #define RATE_IN_36XX (1 << 4)
  126. #define RATE_IN_4430 (1 << 5)
  127. #define RATE_IN_TI816X (1 << 6)
  128. #define RATE_IN_4460 (1 << 7)
  129. #define RATE_IN_AM33XX (1 << 8)
  130. #define RATE_IN_TI814X (1 << 9)
  131. #define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X)
  132. #define RATE_IN_34XX (RATE_IN_3430ES1 | RATE_IN_3430ES2PLUS)
  133. #define RATE_IN_3XXX (RATE_IN_34XX | RATE_IN_36XX)
  134. #define RATE_IN_44XX (RATE_IN_4430 | RATE_IN_4460)
  135. /* RATE_IN_3430ES2PLUS_36XX includes 34xx/35xx with ES >=2, and all 36xx/37xx */
  136. #define RATE_IN_3430ES2PLUS_36XX (RATE_IN_3430ES2PLUS | RATE_IN_36XX)
  137. /**
  138. * struct clksel_rate - register bitfield values corresponding to clk divisors
  139. * @val: register bitfield value (shifted to bit 0)
  140. * @div: clock divisor corresponding to @val
  141. * @flags: (see "struct clksel_rate.flags possibilities" above)
  142. *
  143. * @val should match the value of a read from struct clk.clksel_reg
  144. * AND'ed with struct clk.clksel_mask, shifted right to bit 0.
  145. *
  146. * @div is the divisor that should be applied to the parent clock's rate
  147. * to produce the current clock's rate.
  148. */
  149. struct clksel_rate {
  150. u32 val;
  151. u8 div;
  152. u16 flags;
  153. };
  154. /**
  155. * struct clksel - available parent clocks, and a pointer to their divisors
  156. * @parent: struct clk * to a possible parent clock
  157. * @rates: available divisors for this parent clock
  158. *
  159. * A struct clksel is always associated with one or more struct clks
  160. * and one or more struct clksel_rates.
  161. */
  162. struct clksel {