fsl_ifc.c 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /*
  2. * Copyright 2010-2011 Freescale Semiconductor, Inc.
  3. * Author: Dipen Dudhat <dipen.dudhat@freescale.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <fsl_ifc.h>
  9. void print_ifc_regs(void)
  10. {
  11. int i, j;
  12. printf("IFC Controller Registers\n");
  13. for (i = 0; i < CONFIG_SYS_FSL_IFC_BANK_COUNT; i++) {
  14. printf("CSPR%d:0x%08X\tAMASK%d:0x%08X\tCSOR%d:0x%08X\n",
  15. i, get_ifc_cspr(i), i, get_ifc_amask(i),
  16. i, get_ifc_csor(i));
  17. for (j = 0; j < 4; j++)
  18. printf("IFC_FTIM%d:0x%08X\n", j, get_ifc_ftim(i, j));
  19. }
  20. }
  21. void init_early_memctl_regs(void)
  22. {
  23. #if defined(CONFIG_SYS_CSPR0) && defined(CONFIG_SYS_CSOR0)
  24. set_ifc_ftim(IFC_CS0, IFC_FTIM0, CONFIG_SYS_CS0_FTIM0);
  25. set_ifc_ftim(IFC_CS0, IFC_FTIM1, CONFIG_SYS_CS0_FTIM1);
  26. set_ifc_ftim(IFC_CS0, IFC_FTIM2, CONFIG_SYS_CS0_FTIM2);
  27. set_ifc_ftim(IFC_CS0, IFC_FTIM3, CONFIG_SYS_CS0_FTIM3);
  28. #ifndef CONFIG_A003399_NOR_WORKAROUND
  29. #ifdef CONFIG_SYS_CSPR0_EXT
  30. set_ifc_cspr_ext(IFC_CS0, CONFIG_SYS_CSPR0_EXT);
  31. #endif
  32. #ifdef CONFIG_SYS_CSOR0_EXT
  33. set_ifc_csor_ext(IFC_CS0, CONFIG_SYS_CSOR0_EXT);
  34. #endif
  35. set_ifc_cspr(IFC_CS0, CONFIG_SYS_CSPR0);
  36. set_ifc_amask(IFC_CS0, CONFIG_SYS_AMASK0);
  37. set_ifc_csor(IFC_CS0, CONFIG_SYS_CSOR0);
  38. #endif
  39. #endif
  40. #ifdef CONFIG_SYS_CSPR1_EXT
  41. set_ifc_cspr_ext(IFC_CS1, CONFIG_SYS_CSPR1_EXT);
  42. #endif
  43. #ifdef CONFIG_SYS_CSOR1_EXT
  44. set_ifc_csor_ext(IFC_CS1, CONFIG_SYS_CSOR1_EXT);
  45. #endif
  46. #if defined(CONFIG_SYS_CSPR1) && defined(CONFIG_SYS_CSOR1)
  47. set_ifc_ftim(IFC_CS1, IFC_FTIM0, CONFIG_SYS_CS1_FTIM0);
  48. set_ifc_ftim(IFC_CS1, IFC_FTIM1, CONFIG_SYS_CS1_FTIM1);
  49. set_ifc_ftim(IFC_CS1, IFC_FTIM2, CONFIG_SYS_CS1_FTIM2);
  50. set_ifc_ftim(IFC_CS1, IFC_FTIM3, CONFIG_SYS_CS1_FTIM3);
  51. set_ifc_csor(IFC_CS1, CONFIG_SYS_CSOR1);
  52. set_ifc_amask(IFC_CS1, CONFIG_SYS_AMASK1);
  53. set_ifc_cspr(IFC_CS1, CONFIG_SYS_CSPR1);
  54. #endif
  55. #ifdef CONFIG_SYS_CSPR2_EXT
  56. set_ifc_cspr_ext(IFC_CS2, CONFIG_SYS_CSPR2_EXT);
  57. #endif
  58. #ifdef CONFIG_SYS_CSOR2_EXT
  59. set_ifc_csor_ext(IFC_CS2, CONFIG_SYS_CSOR2_EXT);
  60. #endif
  61. #if defined(CONFIG_SYS_CSPR2) && defined(CONFIG_SYS_CSOR2)
  62. set_ifc_ftim(IFC_CS2, IFC_FTIM0, CONFIG_SYS_CS2_FTIM0);
  63. set_ifc_ftim(IFC_CS2, IFC_FTIM1, CONFIG_SYS_CS2_FTIM1);
  64. set_ifc_ftim(IFC_CS2, IFC_FTIM2, CONFIG_SYS_CS2_FTIM2);
  65. set_ifc_ftim(IFC_CS2, IFC_FTIM3, CONFIG_SYS_CS2_FTIM3);
  66. set_ifc_csor(IFC_CS2, CONFIG_SYS_CSOR2);
  67. set_ifc_amask(IFC_CS2, CONFIG_SYS_AMASK2);
  68. set_ifc_cspr(IFC_CS2, CONFIG_SYS_CSPR2);
  69. #endif
  70. #ifdef CONFIG_SYS_CSPR3_EXT
  71. set_ifc_cspr_ext(IFC_CS3, CONFIG_SYS_CSPR3_EXT);
  72. #endif
  73. #ifdef CONFIG_SYS_CSOR3_EXT
  74. set_ifc_csor_ext(IFC_CS3, CONFIG_SYS_CSOR3_EXT);
  75. #endif
  76. #if defined(CONFIG_SYS_CSPR3) && defined(CONFIG_SYS_CSOR3)
  77. set_ifc_ftim(IFC_CS3, IFC_FTIM0, CONFIG_SYS_CS3_FTIM0);
  78. set_ifc_ftim(IFC_CS3, IFC_FTIM1, CONFIG_SYS_CS3_FTIM1);
  79. set_ifc_ftim(IFC_CS3, IFC_FTIM2, CONFIG_SYS_CS3_FTIM2);
  80. set_ifc_ftim(IFC_CS3, IFC_FTIM3, CONFIG_SYS_CS3_FTIM3);
  81. set_ifc_cspr(IFC_CS3, CONFIG_SYS_CSPR3);
  82. set_ifc_amask(IFC_CS3, CONFIG_SYS_AMASK3);
  83. set_ifc_csor(IFC_CS3, CONFIG_SYS_CSOR3);
  84. #endif
  85. #ifdef CONFIG_SYS_CSPR4_EXT
  86. set_ifc_cspr_ext(IFC_CS4, CONFIG_SYS_CSPR4_EXT);
  87. #endif
  88. #ifdef CONFIG_SYS_CSOR4_EXT
  89. set_ifc_csor_ext(IFC_CS4, CONFIG_SYS_CSOR4_EXT);
  90. #endif
  91. #if defined(CONFIG_SYS_CSPR4) && defined(CONFIG_SYS_CSOR4)
  92. set_ifc_ftim(IFC_CS4, IFC_FTIM0, CONFIG_SYS_CS4_FTIM0);
  93. set_ifc_ftim(IFC_CS4, IFC_FTIM1, CONFIG_SYS_CS4_FTIM1);
  94. set_ifc_ftim(IFC_CS4, IFC_FTIM2, CONFIG_SYS_CS4_FTIM2);
  95. set_ifc_ftim(IFC_CS4, IFC_FTIM3, CONFIG_SYS_CS4_FTIM3);
  96. set_ifc_cspr(IFC_CS4, CONFIG_SYS_CSPR4);
  97. set_ifc_amask(IFC_CS4, CONFIG_SYS_AMASK4);
  98. set_ifc_csor(IFC_CS4, CONFIG_SYS_CSOR4);
  99. #endif
  100. #ifdef CONFIG_SYS_CSPR5_EXT
  101. set_ifc_cspr_ext(IFC_CS5, CONFIG_SYS_CSPR5_EXT);
  102. #endif
  103. #ifdef CONFIG_SYS_CSOR5_EXT
  104. set_ifc_csor_ext(IFC_CS5, CONFIG_SYS_CSOR5_EXT);
  105. #endif
  106. #if defined(CONFIG_SYS_CSPR5) && defined(CONFIG_SYS_CSOR5)
  107. set_ifc_ftim(IFC_CS5, IFC_FTIM0, CONFIG_SYS_CS5_FTIM0);
  108. set_ifc_ftim(IFC_CS5, IFC_FTIM1, CONFIG_SYS_CS5_FTIM1);
  109. set_ifc_ftim(IFC_CS5, IFC_FTIM2, CONFIG_SYS_CS5_FTIM2);
  110. set_ifc_ftim(IFC_CS5, IFC_FTIM3, CONFIG_SYS_CS5_FTIM3);
  111. set_ifc_cspr(IFC_CS5, CONFIG_SYS_CSPR5);
  112. set_ifc_amask(IFC_CS5, CONFIG_SYS_AMASK5);
  113. set_ifc_csor(IFC_CS5, CONFIG_SYS_CSOR5);
  114. #endif
  115. #ifdef CONFIG_SYS_CSPR6_EXT
  116. set_ifc_cspr_ext(IFC_CS6, CONFIG_SYS_CSPR6_EXT);
  117. #endif
  118. #ifdef CONFIG_SYS_CSOR6_EXT
  119. set_ifc_csor_ext(IFC_CS6, CONFIG_SYS_CSOR6_EXT);
  120. #endif
  121. #if defined(CONFIG_SYS_CSPR6) && defined(CONFIG_SYS_CSOR6)
  122. set_ifc_ftim(IFC_CS6, IFC_FTIM0, CONFIG_SYS_CS6_FTIM0);
  123. set_ifc_ftim(IFC_CS6, IFC_FTIM1, CONFIG_SYS_CS6_FTIM1);
  124. set_ifc_ftim(IFC_CS6, IFC_FTIM2, CONFIG_SYS_CS6_FTIM2);
  125. set_ifc_ftim(IFC_CS6, IFC_FTIM3, CONFIG_SYS_CS6_FTIM3);
  126. set_ifc_cspr(IFC_CS6, CONFIG_SYS_CSPR6);
  127. set_ifc_amask(IFC_CS6, CONFIG_SYS_AMASK6);
  128. set_ifc_csor(IFC_CS6, CONFIG_SYS_CSOR6);
  129. #endif
  130. #ifdef CONFIG_SYS_CSPR7_EXT
  131. set_ifc_cspr_ext(IFC_CS7, CONFIG_SYS_CSPR7_EXT);
  132. #endif
  133. #ifdef CONFIG_SYS_CSOR7_EXT
  134. set_ifc_csor_ext(IFC_CS7, CONFIG_SYS_CSOR7_EXT);
  135. #endif
  136. #if defined(CONFIG_SYS_CSPR7) && defined(CONFIG_SYS_CSOR7)
  137. set_ifc_ftim(IFC_CS7, IFC_FTIM0, CONFIG_SYS_CS7_FTIM0);
  138. set_ifc_ftim(IFC_CS7, IFC_FTIM1, CONFIG_SYS_CS7_FTIM1);
  139. set_ifc_ftim(IFC_CS7, IFC_FTIM2, CONFIG_SYS_CS7_FTIM2);
  140. set_ifc_ftim(IFC_CS7, IFC_FTIM3, CONFIG_SYS_CS7_FTIM3);
  141. set_ifc_cspr(IFC_CS7, CONFIG_SYS_CSPR7);
  142. set_ifc_amask(IFC_CS7, CONFIG_SYS_AMASK7);
  143. set_ifc_csor(IFC_CS7, CONFIG_SYS_CSOR7);
  144. #endif
  145. }
  146. void init_final_memctl_regs(void)
  147. {
  148. #ifdef CONFIG_SYS_CSPR0_FINAL
  149. set_ifc_cspr(IFC_CS0, CONFIG_SYS_CSPR0_FINAL);
  150. #endif
  151. #ifdef CONFIG_SYS_AMASK0_FINAL
  152. set_ifc_amask(IFC_CS0, CONFIG_SYS_AMASK0);
  153. #endif
  154. #ifdef CONFIG_SYS_CSPR1_FINAL
  155. set_ifc_cspr(IFC_CS1, CONFIG_SYS_CSPR1_FINAL);
  156. #endif
  157. #ifdef CONFIG_SYS_AMASK1_FINAL
  158. set_ifc_amask(IFC_CS1, CONFIG_SYS_AMASK1_FINAL);
  159. #endif
  160. #ifdef CONFIG_SYS_CSPR2_FINAL
  161. set_ifc_cspr(IFC_CS2, CONFIG_SYS_CSPR2_FINAL);
  162. #endif
  163. #ifdef CONFIG_SYS_AMASK2_FINAL
  164. set_ifc_amask(IFC_CS2, CONFIG_SYS_AMASK2);
  165. #endif
  166. #ifdef CONFIG_SYS_CSPR3_FINAL
  167. set_ifc_cspr(IFC_CS3, CONFIG_SYS_CSPR3_FINAL);
  168. #endif
  169. #ifdef CONFIG_SYS_AMASK3_FINAL
  170. set_ifc_amask(IFC_CS3, CONFIG_SYS_AMASK3);
  171. #endif
  172. }