clock.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. * arch/arm/mach-meson/include/mach/clock.h
  3. *
  4. * Copyright (C) 2010 AMLOGIC, INC.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #ifndef __ARCH_ARM_MESON3_CLOCK_H
  21. #define __ARCH_ARM_MESON3_CLOCK_H
  22. // -----------------------------------------
  23. // clk_util_clk_msr
  24. // -----------------------------------------
  25. // from twister_core.v
  26. // .clk_to_msr_in ( { 18'h0, // [63:46]
  27. // cts_pwm_A_clk, // [45]
  28. // cts_pwm_B_clk, // [44]
  29. // cts_pwm_C_clk, // [43]
  30. // cts_pwm_D_clk, // [42]
  31. // cts_eth_rx_tx, // [41]
  32. // cts_pcm_mclk, // [40]
  33. // cts_pcm_sclk, // [39]
  34. // cts_vdin_meas_clk, // [38]
  35. // cts_vdac_clk[1], // [37]
  36. // cts_hdmi_tx_pixel_clk, // [36]
  37. // cts_mali_clk, // [35]
  38. // cts_sdhc_clk1, // [34]
  39. // cts_sdhc_clk0, // [33]
  40. // cts_audac_clkpi, // [32]
  41. // cts_a9_clk, // [31]
  42. // cts_ddr_clk, // [30]
  43. // cts_vdac_clk[0], // [29]
  44. // cts_sar_adc_clk, // [28]
  45. // cts_enci_clk, // [27]
  46. // sc_clk_int, // [26]
  47. // usb_clk_12mhz, // [25]
  48. // lvds_fifo_clk, // [24]
  49. // HDMI_CH3_TMDSCLK, // [23]
  50. // mod_eth_clk50_i, // [22]
  51. // mod_audin_amclk_i, // [21]
  52. // cts_btclk27, // [20]
  53. // cts_hdmi_sys_clk, // [19]
  54. // cts_led_pll_clk, // [18]
  55. // cts_vghl_pll_clk, // [17]
  56. // cts_FEC_CLK_2, // [16]
  57. // cts_FEC_CLK_1, // [15]
  58. // cts_FEC_CLK_0, // [14]
  59. // cts_amclk, // [13]
  60. // vid2_pll_clk, // [12]
  61. // cts_eth_rmii, // [11]
  62. // cts_enct_clk, // [10]
  63. // cts_encl_clk, // [9]
  64. // cts_encp_clk, // [8]
  65. // clk81, // [7]
  66. // vid_pll_clk, // [6]
  67. // aud_pll_clk, // [5]
  68. // misc_pll_clk, // [4]
  69. // ddr_pll_clk, // [3]
  70. // sys_pll_clk, // [2]
  71. // am_ring_osc_clk_out[1], // [1]
  72. // am_ring_osc_clk_out[0]} ), // [0]
  73. //
  74. #define CTS_PWM_A_CLK (45)
  75. #define CTS_PWM_B_CLK (44)
  76. #define CTS_PWM_C_CLK (43)
  77. #define CTS_PWM_D_CLK (42)
  78. #define CTS_ETH_RX_TX (41)
  79. #define CTS_PCM_MCLK (40)
  80. #define CTS_PCM_SCLK (39)
  81. #define CTS_VDIN_MEAS_CLK (38)
  82. #define CTS_VDAC_CLK1 (37)
  83. #define CTS_HDMI_TX_PIXEL_CLK (36)
  84. #define CTS_MALI_CLK (35)
  85. #define CTS_SDHC_CLK1 (34)
  86. #define CTS_SDHC_CLK0 (33)
  87. #define CTS_AUDAC_CLKPI (32)
  88. #define CTS_A9_CLK (31)
  89. #define CTS_DDR_CLK (30)
  90. #define CTS_VDAC_CLK0 (29)
  91. #define CTS_SAR_ADC_CLK (28)
  92. #define CTS_ENCI_CLK (27)
  93. #define SC_CLK_INT (26)
  94. #define USB_CLK_12MHZ (25)
  95. #define LVDS_FIFO_CLK (24)
  96. #define HDMI_CH3_TMDSCLK (23)
  97. #define MOD_ETH_CLK50_I (22)
  98. #define MOD_AUDIN_AMCLK_I (21)
  99. #define CTS_BTCLK27 (20)
  100. #define CTS_HDMI_SYS_CLK (19)
  101. #define CTS_LED_PLL_CLK (18)
  102. #define CTS_VGHL_PLL_CLK (17)
  103. #define CTS_FEC_CLK_2 (16)
  104. #define CTS_FEC_CLK_1 (15)
  105. #define CTS_FEC_CLK_0 (14)
  106. #define CTS_AMCLK (13)
  107. #define VID2_PLL_CLK (12)
  108. #define CTS_ETH_RMII (11)
  109. #define CTS_ENCT_CLK (10)
  110. #define CTS_ENCL_CLK (9)
  111. #define CTS_ENCP_CLK (8)
  112. #define CLK81 (7)
  113. #define VID_PLL_CLK (6)
  114. #define AUD_PLL_CLK (5)
  115. #define MISC_PLL_CLK (4)
  116. #define DDR_PLL_CLK (3)
  117. #define SYS_PLL_CLK (2)
  118. #define AM_RING_OSC_CLK_OUT1 (1)
  119. #define AM_RING_OSC_CLK_OUT0 (0)
  120. struct clk {
  121. const char *name;
  122. unsigned long rate;
  123. unsigned long min;
  124. unsigned long max;
  125. int source_clk;
  126. /* for clock gate */
  127. unsigned char clock_index;
  128. unsigned clock_gate_reg_adr;
  129. unsigned clock_gate_reg_mask;
  130. /**/
  131. unsigned long(*get_rate)(struct clk *);
  132. int (*set_rate)(struct clk *, unsigned long);
  133. };
  134. unsigned int clk_util_clk_msr(unsigned int clk_mux);
  135. unsigned int get_mpeg_clk(void );
  136. unsigned int get_system_clk(void );
  137. unsigned int get_misc_pll_clk(void );
  138. unsigned int get_ddr_pll_clk(void );
  139. int clk_measure(char index );
  140. #endif //__ARCH_ARM_MESON3_CLOCK_H