boards.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 <mach/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_ch0_base = 0x80000000,
  14. .dram_ch0_size = 0x20000000,
  15. .dram_ch0_width = 32,
  16. .dram_ch1_base = 0xc0000000,
  17. .dram_ch1_size = 0x20000000,
  18. .dram_ch1_width = 16,
  19. .dram_ch2_base = 0xc0000000,
  20. .dram_ch2_size = 0x10000000,
  21. .dram_ch2_width = 16,
  22. .dram_freq = 1600,
  23. };
  24. #endif
  25. #if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4)
  26. static const struct uniphier_board_data ph1_ld4_data = {
  27. .dram_ch0_base = 0x80000000,
  28. .dram_ch0_size = 0x10000000,
  29. .dram_ch0_width = 16,
  30. .dram_ch1_base = 0x90000000,
  31. .dram_ch1_size = 0x10000000,
  32. .dram_ch1_width = 16,
  33. .dram_freq = 1600,
  34. };
  35. #endif
  36. #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4)
  37. static const struct uniphier_board_data ph1_pro4_data = {
  38. .dram_ch0_base = 0x80000000,
  39. .dram_ch0_size = 0x20000000,
  40. .dram_ch0_width = 32,
  41. .dram_ch1_base = 0xa0000000,
  42. .dram_ch1_size = 0x20000000,
  43. .dram_ch1_width = 32,
  44. .dram_freq = 1600,
  45. };
  46. #endif
  47. #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8)
  48. static const struct uniphier_board_data ph1_sld8_data = {
  49. .dram_ch0_base = 0x80000000,
  50. .dram_ch0_size = 0x10000000,
  51. .dram_ch0_width = 16,
  52. .dram_ch1_base = 0x90000000,
  53. .dram_ch1_size = 0x10000000,
  54. .dram_ch1_width = 16,
  55. .dram_freq = 1333,
  56. };
  57. #endif
  58. #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO5)
  59. static const struct uniphier_board_data ph1_pro5_data = {
  60. .dram_ch0_base = 0x80000000,
  61. .dram_ch0_size = 0x20000000,
  62. .dram_ch0_width = 32,
  63. .dram_ch1_base = 0xa0000000,
  64. .dram_ch1_size = 0x20000000,
  65. .dram_ch1_width = 32,
  66. .dram_freq = 1866,
  67. };
  68. #endif
  69. #if defined(CONFIG_ARCH_UNIPHIER_PROXSTREAM2) || \
  70. defined(CONFIG_ARCH_UNIPHIER_PH1_LD6B)
  71. static const struct uniphier_board_data proxstream2_data = {
  72. .dram_ch0_base = 0x80000000,
  73. .dram_ch0_size = 0x40000000,
  74. .dram_ch0_width = 32,
  75. .dram_ch1_base = 0xc0000000,
  76. .dram_ch1_size = 0x20000000,
  77. .dram_ch1_width = 32,
  78. .dram_ch2_base = 0xe0000000,
  79. .dram_ch2_size = 0x20000000,
  80. .dram_ch2_width = 16,
  81. .dram_freq = 1866,
  82. };
  83. #endif
  84. struct uniphier_board_id {
  85. const char *compatible;
  86. const struct uniphier_board_data *param;
  87. };
  88. static const struct uniphier_board_id uniphier_boards[] = {
  89. #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD3)
  90. { "socionext,ph1-sld3", &ph1_sld3_data, },
  91. #endif
  92. #if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4)
  93. { "socionext,ph1-ld4", &ph1_ld4_data, },
  94. #endif
  95. #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4)
  96. { "socionext,ph1-pro4", &ph1_pro4_data, },
  97. #endif
  98. #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8)
  99. { "socionext,ph1-sld8", &ph1_sld8_data, },
  100. #endif
  101. #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO5)
  102. { "socionext,ph1-pro5", &ph1_pro5_data, },
  103. #endif
  104. #if defined(CONFIG_ARCH_UNIPHIER_PROXSTREAM2)
  105. { "socionext,proxstream2", &proxstream2_data, },
  106. #endif
  107. #if defined(CONFIG_ARCH_UNIPHIER_PH1_LD6B)
  108. { "socionext,ph1-ld6b", &proxstream2_data, },
  109. #endif
  110. };
  111. const struct uniphier_board_data *uniphier_get_board_param(void)
  112. {
  113. int i;
  114. for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) {
  115. if (!fdt_node_check_compatible(gd->fdt_blob, 0,
  116. uniphier_boards[i].compatible))
  117. return uniphier_boards[i].param;
  118. }
  119. return NULL;
  120. }