clock_init.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*
  2. * Clock initialization routines
  3. *
  4. * Copyright (c) 2011 The Chromium OS Authors.
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. #ifndef __EXYNOS_CLOCK_INIT_H
  9. #define __EXYNOS_CLOCK_INIT_H
  10. enum {
  11. #ifdef CONFIG_EXYNOS5420
  12. MEM_TIMINGS_MSR_COUNT = 5,
  13. #else
  14. MEM_TIMINGS_MSR_COUNT = 4,
  15. #endif
  16. };
  17. /* These are the ratio's for configuring ARM clock */
  18. struct arm_clk_ratios {
  19. unsigned arm_freq_mhz; /* Frequency of ARM core in MHz */
  20. unsigned apll_mdiv;
  21. unsigned apll_pdiv;
  22. unsigned apll_sdiv;
  23. unsigned arm2_ratio;
  24. unsigned apll_ratio;
  25. unsigned pclk_dbg_ratio;
  26. unsigned atb_ratio;
  27. unsigned periph_ratio;
  28. unsigned acp_ratio;
  29. unsigned cpud_ratio;
  30. unsigned arm_ratio;
  31. };
  32. /* These are the memory timings for a particular memory type and speed */
  33. struct mem_timings {
  34. enum mem_manuf mem_manuf; /* Memory manufacturer */
  35. enum ddr_mode mem_type; /* Memory type */
  36. unsigned frequency_mhz; /* Frequency of memory in MHz */
  37. /* Here follow the timing parameters for the selected memory */
  38. unsigned apll_mdiv;
  39. unsigned apll_pdiv;
  40. unsigned apll_sdiv;
  41. unsigned mpll_mdiv;
  42. unsigned mpll_pdiv;
  43. unsigned mpll_sdiv;
  44. unsigned cpll_mdiv;
  45. unsigned cpll_pdiv;
  46. unsigned cpll_sdiv;
  47. unsigned gpll_mdiv;
  48. unsigned gpll_pdiv;
  49. unsigned gpll_sdiv;
  50. unsigned epll_mdiv;
  51. unsigned epll_pdiv;
  52. unsigned epll_sdiv;
  53. unsigned vpll_mdiv;
  54. unsigned vpll_pdiv;
  55. unsigned vpll_sdiv;
  56. unsigned bpll_mdiv;
  57. unsigned bpll_pdiv;
  58. unsigned bpll_sdiv;
  59. unsigned kpll_mdiv;
  60. unsigned kpll_pdiv;
  61. unsigned kpll_sdiv;
  62. unsigned dpll_mdiv;
  63. unsigned dpll_pdiv;
  64. unsigned dpll_sdiv;
  65. unsigned ipll_mdiv;
  66. unsigned ipll_pdiv;
  67. unsigned ipll_sdiv;
  68. unsigned spll_mdiv;
  69. unsigned spll_pdiv;
  70. unsigned spll_sdiv;
  71. unsigned rpll_mdiv;
  72. unsigned rpll_pdiv;
  73. unsigned rpll_sdiv;
  74. unsigned pclk_cdrex_ratio;
  75. unsigned direct_cmd_msr[MEM_TIMINGS_MSR_COUNT];
  76. unsigned timing_ref;
  77. unsigned timing_row;
  78. unsigned timing_data;
  79. unsigned timing_power;
  80. /* DQS, DQ, DEBUG offsets */
  81. unsigned phy0_dqs;
  82. unsigned phy1_dqs;
  83. unsigned phy0_dq;
  84. unsigned phy1_dq;
  85. unsigned phy0_tFS;
  86. unsigned phy1_tFS;
  87. unsigned phy0_pulld_dqs;
  88. unsigned phy1_pulld_dqs;
  89. unsigned lpddr3_ctrl_phy_reset;
  90. unsigned ctrl_start_point;
  91. unsigned ctrl_inc;
  92. unsigned ctrl_start;
  93. unsigned ctrl_dll_on;
  94. unsigned ctrl_ref;
  95. unsigned ctrl_force;
  96. unsigned ctrl_rdlat;
  97. unsigned ctrl_bstlen;
  98. unsigned fp_resync;
  99. unsigned iv_size;
  100. unsigned dfi_init_start;
  101. unsigned aref_en;
  102. unsigned rd_fetch;
  103. unsigned zq_mode_dds;
  104. unsigned zq_mode_term;
  105. unsigned zq_mode_noterm; /* 1 to allow termination disable */
  106. unsigned memcontrol;
  107. unsigned memconfig;
  108. unsigned membaseconfig0;
  109. unsigned membaseconfig1;
  110. unsigned prechconfig_tp_cnt;
  111. unsigned dpwrdn_cyc;
  112. unsigned dsref_cyc;
  113. unsigned concontrol;
  114. /* Channel and Chip Selection */
  115. uint8_t dmc_channels; /* number of memory channels */
  116. uint8_t chips_per_channel; /* number of chips per channel */
  117. uint8_t chips_to_configure; /* number of chips to configure */
  118. uint8_t send_zq_init; /* 1 to send this command */
  119. unsigned impedance; /* drive strength impedeance */
  120. uint8_t gate_leveling_enable; /* check gate leveling is enabled */
  121. uint8_t read_leveling_enable; /* check h/w read leveling is enabled */
  122. };
  123. /**
  124. * Get the correct memory timings for our selected memory type and speed.
  125. *
  126. * This function can be called from SPL or the main U-Boot.
  127. *
  128. * @return pointer to the memory timings that we should use
  129. */
  130. struct mem_timings *clock_get_mem_timings(void);
  131. /*
  132. * Initialize clock for the device
  133. */
  134. void system_clock_init(void);
  135. /*
  136. * Set clock divisor value for booting from EMMC.
  137. */
  138. void emmc_boot_clk_div_set(void);
  139. #endif