clock_init.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * Clock initialization routines
  3. *
  4. * Copyright (c) 2011 The Chromium OS Authors.
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. */
  24. #ifndef __EXYNOS_CLOCK_INIT_H
  25. #define __EXYNOS_CLOCK_INIT_H
  26. enum {
  27. MEM_TIMINGS_MSR_COUNT = 4,
  28. };
  29. /* These are the ratio's for configuring ARM clock */
  30. struct arm_clk_ratios {
  31. unsigned arm_freq_mhz; /* Frequency of ARM core in MHz */
  32. unsigned apll_mdiv;
  33. unsigned apll_pdiv;
  34. unsigned apll_sdiv;
  35. unsigned arm2_ratio;
  36. unsigned apll_ratio;
  37. unsigned pclk_dbg_ratio;
  38. unsigned atb_ratio;
  39. unsigned periph_ratio;
  40. unsigned acp_ratio;
  41. unsigned cpud_ratio;
  42. unsigned arm_ratio;
  43. };
  44. /* These are the memory timings for a particular memory type and speed */
  45. struct mem_timings {
  46. enum mem_manuf mem_manuf; /* Memory manufacturer */
  47. enum ddr_mode mem_type; /* Memory type */
  48. unsigned frequency_mhz; /* Frequency of memory in MHz */
  49. /* Here follow the timing parameters for the selected memory */
  50. unsigned apll_mdiv;
  51. unsigned apll_pdiv;
  52. unsigned apll_sdiv;
  53. unsigned mpll_mdiv;
  54. unsigned mpll_pdiv;
  55. unsigned mpll_sdiv;
  56. unsigned cpll_mdiv;
  57. unsigned cpll_pdiv;
  58. unsigned cpll_sdiv;
  59. unsigned gpll_mdiv;
  60. unsigned gpll_pdiv;
  61. unsigned gpll_sdiv;
  62. unsigned epll_mdiv;
  63. unsigned epll_pdiv;
  64. unsigned epll_sdiv;
  65. unsigned vpll_mdiv;
  66. unsigned vpll_pdiv;
  67. unsigned vpll_sdiv;
  68. unsigned bpll_mdiv;
  69. unsigned bpll_pdiv;
  70. unsigned bpll_sdiv;
  71. unsigned pclk_cdrex_ratio;
  72. unsigned direct_cmd_msr[MEM_TIMINGS_MSR_COUNT];
  73. unsigned timing_ref;
  74. unsigned timing_row;
  75. unsigned timing_data;
  76. unsigned timing_power;
  77. /* DQS, DQ, DEBUG offsets */
  78. unsigned phy0_dqs;
  79. unsigned phy1_dqs;
  80. unsigned phy0_dq;
  81. unsigned phy1_dq;
  82. unsigned phy0_tFS;
  83. unsigned phy1_tFS;
  84. unsigned phy0_pulld_dqs;
  85. unsigned phy1_pulld_dqs;
  86. unsigned lpddr3_ctrl_phy_reset;
  87. unsigned ctrl_start_point;
  88. unsigned ctrl_inc;
  89. unsigned ctrl_start;
  90. unsigned ctrl_dll_on;
  91. unsigned ctrl_ref;
  92. unsigned ctrl_force;
  93. unsigned ctrl_rdlat;
  94. unsigned ctrl_bstlen;
  95. unsigned fp_resync;
  96. unsigned iv_size;
  97. unsigned dfi_init_start;
  98. unsigned aref_en;
  99. unsigned rd_fetch;
  100. unsigned zq_mode_dds;
  101. unsigned zq_mode_term;
  102. unsigned zq_mode_noterm; /* 1 to allow termination disable */
  103. unsigned memcontrol;
  104. unsigned memconfig;
  105. unsigned membaseconfig0;
  106. unsigned membaseconfig1;
  107. unsigned prechconfig_tp_cnt;
  108. unsigned dpwrdn_cyc;
  109. unsigned dsref_cyc;
  110. unsigned concontrol;
  111. /* Channel and Chip Selection */
  112. uint8_t dmc_channels; /* number of memory channels */
  113. uint8_t chips_per_channel; /* number of chips per channel */
  114. uint8_t chips_to_configure; /* number of chips to configure */
  115. uint8_t send_zq_init; /* 1 to send this command */
  116. unsigned impedance; /* drive strength impedeance */
  117. uint8_t gate_leveling_enable; /* check gate leveling is enabled */
  118. };
  119. /**
  120. * Get the correct memory timings for our selected memory type and speed.
  121. *
  122. * This function can be called from SPL or the main U-Boot.
  123. *
  124. * @return pointer to the memory timings that we should use
  125. */
  126. struct mem_timings *clock_get_mem_timings(void);
  127. /*
  128. * Initialize clock for the device
  129. */
  130. void system_clock_init(void);
  131. /*
  132. * Set clock divisor value for booting from EMMC.
  133. */
  134. void emmc_boot_clk_div_set(void);
  135. #endif