boards.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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_PH1_SLD3)
  12. static const struct uniphier_board_data ph1_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_PH1_LD4)
  33. static const struct uniphier_board_data ph1_ld4_data = {
  34. .dram_freq = 1600,
  35. .dram_nr_ch = 2,
  36. .dram_ch[0] = {
  37. .base = 0x80000000,
  38. .size = 0x10000000,
  39. .width = 16,
  40. },
  41. .dram_ch[1] = {
  42. .base = 0x90000000,
  43. .size = 0x10000000,
  44. .width = 16,
  45. },
  46. };
  47. #endif
  48. #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4)
  49. /* 1GB RAM board */
  50. static const struct uniphier_board_data ph1_pro4_data = {
  51. .dram_freq = 1600,
  52. .dram_nr_ch = 2,
  53. .dram_ch[0] = {
  54. .base = 0x80000000,
  55. .size = 0x20000000,
  56. .width = 32,
  57. },
  58. .dram_ch[1] = {
  59. .base = 0xa0000000,
  60. .size = 0x20000000,
  61. .width = 32,
  62. },
  63. };
  64. /* 2GB RAM board */
  65. static const struct uniphier_board_data ph1_pro4_2g_data = {
  66. .dram_freq = 1600,
  67. .dram_nr_ch = 2,
  68. .dram_ch[0] = {
  69. .base = 0x80000000,
  70. .size = 0x40000000,
  71. .width = 32,
  72. },
  73. .dram_ch[1] = {
  74. .base = 0xc0000000,
  75. .size = 0x40000000,
  76. .width = 32,
  77. },
  78. };
  79. #endif
  80. #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8)
  81. static const struct uniphier_board_data ph1_sld8_data = {
  82. .dram_freq = 1333,
  83. .dram_nr_ch = 2,
  84. .dram_ch[0] = {
  85. .base = 0x80000000,
  86. .size = 0x10000000,
  87. .width = 16,
  88. },
  89. .dram_ch[1] = {
  90. .base = 0x90000000,
  91. .size = 0x10000000,
  92. .width = 16,
  93. },
  94. };
  95. #endif
  96. #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO5)
  97. static const struct uniphier_board_data ph1_pro5_data = {
  98. .dram_freq = 1866,
  99. .dram_nr_ch = 2,
  100. .dram_ch[0] = {
  101. .base = 0x80000000,
  102. .size = 0x20000000,
  103. .width = 32,
  104. },
  105. .dram_ch[1] = {
  106. .base = 0xa0000000,
  107. .size = 0x20000000,
  108. .width = 32,
  109. },
  110. };
  111. #endif
  112. #if defined(CONFIG_ARCH_UNIPHIER_PROXSTREAM2)
  113. static const struct uniphier_board_data proxstream2_data = {
  114. .dram_freq = 2133,
  115. .dram_nr_ch = 3,
  116. .dram_ch[0] = {
  117. .base = 0x80000000,
  118. .size = 0x40000000,
  119. .width = 32,
  120. },
  121. .dram_ch[1] = {
  122. .base = 0xc0000000,
  123. .size = 0x20000000,
  124. .width = 32,
  125. },
  126. .dram_ch[2] = {
  127. .base = 0xe0000000,
  128. .size = 0x20000000,
  129. .width = 16,
  130. },
  131. };
  132. #endif
  133. #if defined(CONFIG_ARCH_UNIPHIER_PH1_LD6B)
  134. static const struct uniphier_board_data ph1_ld6b_data = {
  135. .dram_freq = 1866,
  136. .dram_nr_ch = 3,
  137. .dram_ch[0] = {
  138. .base = 0x80000000,
  139. .size = 0x40000000,
  140. .width = 32,
  141. },
  142. .dram_ch[1] = {
  143. .base = 0xc0000000,
  144. .size = 0x20000000,
  145. .width = 32,
  146. },
  147. .dram_ch[2] = {
  148. .base = 0xe0000000,
  149. .size = 0x20000000,
  150. .width = 16,
  151. },
  152. };
  153. #endif
  154. struct uniphier_board_id {
  155. const char *compatible;
  156. const struct uniphier_board_data *param;
  157. };
  158. static const struct uniphier_board_id uniphier_boards[] = {
  159. #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD3)
  160. { "socionext,ph1-sld3", &ph1_sld3_data, },
  161. #endif
  162. #if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4)
  163. { "socionext,ph1-ld4", &ph1_ld4_data, },
  164. #endif
  165. #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4)
  166. { "socionext,ph1-pro4-ace", &ph1_pro4_2g_data, },
  167. { "socionext,ph1-pro4-sanji", &ph1_pro4_2g_data, },
  168. { "socionext,ph1-pro4", &ph1_pro4_data, },
  169. #endif
  170. #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8)
  171. { "socionext,ph1-sld8", &ph1_sld8_data, },
  172. #endif
  173. #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO5)
  174. { "socionext,ph1-pro5", &ph1_pro5_data, },
  175. #endif
  176. #if defined(CONFIG_ARCH_UNIPHIER_PROXSTREAM2)
  177. { "socionext,proxstream2", &proxstream2_data, },
  178. #endif
  179. #if defined(CONFIG_ARCH_UNIPHIER_PH1_LD6B)
  180. { "socionext,ph1-ld6b", &ph1_ld6b_data, },
  181. #endif
  182. };
  183. const struct uniphier_board_data *uniphier_get_board_param(void)
  184. {
  185. int i;
  186. for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) {
  187. if (!fdt_node_check_compatible(gd->fdt_blob, 0,
  188. uniphier_boards[i].compatible))
  189. return uniphier_boards[i].param;
  190. }
  191. return NULL;
  192. }