boards.c 5.0 KB

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