boards.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. /*
  2. * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <libfdt.h>
  8. #include <linux/kernel.h>
  9. #include "init.h"
  10. DECLARE_GLOBAL_DATA_PTR;
  11. #if defined(CONFIG_ARCH_UNIPHIER_SLD3)
  12. static const struct uniphier_board_data uniphier_sld3_data = {
  13. .dram_freq = 1600,
  14. .dram_nr_ch = 3,
  15. .dram_ch[0] = {
  16. .base = 0x80000000,
  17. .size = 0x20000000,
  18. .width = 32,
  19. },
  20. .dram_ch[1] = {
  21. .base = 0xc0000000,
  22. .size = 0x20000000,
  23. .width = 16,
  24. },
  25. .dram_ch[2] = {
  26. .base = 0xc0000000,
  27. .size = 0x10000000,
  28. .width = 16,
  29. },
  30. };
  31. #endif
  32. #if defined(CONFIG_ARCH_UNIPHIER_LD4)
  33. static const struct uniphier_board_data uniphier_ld4_data = {
  34. .dram_freq = 1600,
  35. .dram_nr_ch = 2,
  36. .dram_ddr3plus = true,
  37. .dram_ch[0] = {
  38. .base = 0x80000000,
  39. .size = 0x10000000,
  40. .width = 16,
  41. },
  42. .dram_ch[1] = {
  43. .base = 0x90000000,
  44. .size = 0x10000000,
  45. .width = 16,
  46. },
  47. };
  48. #endif
  49. #if defined(CONFIG_ARCH_UNIPHIER_PRO4)
  50. /* 1GB RAM board */
  51. static const struct uniphier_board_data uniphier_pro4_data = {
  52. .dram_freq = 1600,
  53. .dram_nr_ch = 2,
  54. .dram_ch[0] = {
  55. .base = 0x80000000,
  56. .size = 0x20000000,
  57. .width = 32,
  58. },
  59. .dram_ch[1] = {
  60. .base = 0xa0000000,
  61. .size = 0x20000000,
  62. .width = 32,
  63. },
  64. };
  65. /* 2GB RAM board */
  66. static const struct uniphier_board_data uniphier_pro4_2g_data = {
  67. .dram_freq = 1600,
  68. .dram_nr_ch = 2,
  69. .dram_ch[0] = {
  70. .base = 0x80000000,
  71. .size = 0x40000000,
  72. .width = 32,
  73. },
  74. .dram_ch[1] = {
  75. .base = 0xc0000000,
  76. .size = 0x40000000,
  77. .width = 32,
  78. },
  79. };
  80. #endif
  81. #if defined(CONFIG_ARCH_UNIPHIER_SLD8)
  82. static const struct uniphier_board_data uniphier_sld8_data = {
  83. .dram_freq = 1333,
  84. .dram_nr_ch = 2,
  85. .dram_ddr3plus = true,
  86. .dram_ch[0] = {
  87. .base = 0x80000000,
  88. .size = 0x10000000,
  89. .width = 16,
  90. },
  91. .dram_ch[1] = {
  92. .base = 0x90000000,
  93. .size = 0x10000000,
  94. .width = 16,
  95. },
  96. };
  97. #endif
  98. #if defined(CONFIG_ARCH_UNIPHIER_PRO5)
  99. static const struct uniphier_board_data uniphier_pro5_data = {
  100. .dram_freq = 1866,
  101. .dram_nr_ch = 2,
  102. .dram_ch[0] = {
  103. .base = 0x80000000,
  104. .size = 0x20000000,
  105. .width = 32,
  106. },
  107. .dram_ch[1] = {
  108. .base = 0xa0000000,
  109. .size = 0x20000000,
  110. .width = 32,
  111. },
  112. };
  113. #endif
  114. #if defined(CONFIG_ARCH_UNIPHIER_PXS2)
  115. static const struct uniphier_board_data uniphier_pxs2_data = {
  116. .dram_freq = 2133,
  117. .dram_nr_ch = 3,
  118. .dram_ch[0] = {
  119. .base = 0x80000000,
  120. .size = 0x40000000,
  121. .width = 32,
  122. },
  123. .dram_ch[1] = {
  124. .base = 0xc0000000,
  125. .size = 0x20000000,
  126. .width = 32,
  127. },
  128. .dram_ch[2] = {
  129. .base = 0xe0000000,
  130. .size = 0x20000000,
  131. .width = 16,
  132. },
  133. };
  134. #endif
  135. #if defined(CONFIG_ARCH_UNIPHIER_LD6B)
  136. static const struct uniphier_board_data uniphier_ld6b_data = {
  137. .dram_freq = 1866,
  138. .dram_nr_ch = 3,
  139. .dram_ch[0] = {
  140. .base = 0x80000000,
  141. .size = 0x40000000,
  142. .width = 32,
  143. },
  144. .dram_ch[1] = {
  145. .base = 0xc0000000,
  146. .size = 0x20000000,
  147. .width = 32,
  148. },
  149. .dram_ch[2] = {
  150. .base = 0xe0000000,
  151. .size = 0x20000000,
  152. .width = 16,
  153. },
  154. };
  155. #endif
  156. #if defined(CONFIG_ARCH_UNIPHIER_LD11)
  157. static const struct uniphier_board_data uniphier_ld11_data = {
  158. .dram_freq = 1600,
  159. .dram_nr_ch = 2,
  160. .dram_ch[0] = {
  161. .base = 0x80000000,
  162. .size = 0x20000000,
  163. .width = 16,
  164. },
  165. .dram_ch[1] = {
  166. .base = 0xa0000000,
  167. .size = 0x20000000,
  168. .width = 16,
  169. },
  170. };
  171. #endif
  172. #if defined(CONFIG_ARCH_UNIPHIER_LD20)
  173. static const struct uniphier_board_data uniphier_ld20_data = {
  174. .dram_freq = 1866,
  175. .dram_nr_ch = 3,
  176. .dram_ch[0] = {
  177. .base = 0x80000000,
  178. .size = 0x40000000,
  179. .width = 32,
  180. },
  181. .dram_ch[1] = {
  182. .base = 0xc0000000,
  183. .size = 0x40000000,
  184. .width = 32,
  185. },
  186. .dram_ch[2] = {
  187. .base = 0x100000000UL,
  188. .size = 0x40000000,
  189. .width = 32,
  190. },
  191. };
  192. #endif
  193. struct uniphier_board_id {
  194. const char *compatible;
  195. const struct uniphier_board_data *param;
  196. };
  197. static const struct uniphier_board_id uniphier_boards[] = {
  198. #if defined(CONFIG_ARCH_UNIPHIER_SLD3)
  199. { "socionext,ph1-sld3", &uniphier_sld3_data, },
  200. #endif
  201. #if defined(CONFIG_ARCH_UNIPHIER_LD4)
  202. { "socionext,ph1-ld4", &uniphier_ld4_data, },
  203. #endif
  204. #if defined(CONFIG_ARCH_UNIPHIER_PRO4)
  205. { "socionext,ph1-pro4-ace", &uniphier_pro4_2g_data, },
  206. { "socionext,ph1-pro4-sanji", &uniphier_pro4_2g_data, },
  207. { "socionext,ph1-pro4", &uniphier_pro4_data, },
  208. #endif
  209. #if defined(CONFIG_ARCH_UNIPHIER_SLD8)
  210. { "socionext,ph1-sld8", &uniphier_sld8_data, },
  211. #endif
  212. #if defined(CONFIG_ARCH_UNIPHIER_PRO5)
  213. { "socionext,ph1-pro5", &uniphier_pro5_data, },
  214. #endif
  215. #if defined(CONFIG_ARCH_UNIPHIER_PXS2)
  216. { "socionext,proxstream2", &uniphier_pxs2_data, },
  217. #endif
  218. #if defined(CONFIG_ARCH_UNIPHIER_LD6B)
  219. { "socionext,ph1-ld6b", &uniphier_ld6b_data, },
  220. #endif
  221. #if defined(CONFIG_ARCH_UNIPHIER_LD11)
  222. { "socionext,ph1-ld11", &uniphier_ld11_data, },
  223. #endif
  224. #if defined(CONFIG_ARCH_UNIPHIER_LD20)
  225. { "socionext,ph1-ld20", &uniphier_ld20_data, },
  226. #endif
  227. };
  228. const struct uniphier_board_data *uniphier_get_board_param(void)
  229. {
  230. int i;
  231. for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) {
  232. if (!fdt_node_check_compatible(gd->fdt_blob, 0,
  233. uniphier_boards[i].compatible))
  234. return uniphier_boards[i].param;
  235. }
  236. return NULL;
  237. }