fsl_ifc.c 5.9 KB

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