boards.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <libfdt.h>
  7. #include <linux/kernel.h>
  8. #include <mach/init.h>
  9. #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD3)
  10. static const struct uniphier_board_data ph1_sld3_data = {
  11. .dram_ch0_base = 0x80000000,
  12. .dram_ch0_size = 0x20000000,
  13. .dram_ch0_width = 32,
  14. .dram_ch1_base = 0xc0000000,
  15. .dram_ch1_size = 0x20000000,
  16. .dram_ch1_width = 16,
  17. .dram_ch2_base = 0xc0000000,
  18. .dram_ch2_size = 0x10000000,
  19. .dram_ch2_width = 16,
  20. .dram_freq = 1600,
  21. };
  22. #endif
  23. #if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4)
  24. static const struct uniphier_board_data ph1_ld4_data = {
  25. .dram_ch0_base = 0x80000000,
  26. .dram_ch0_size = 0x10000000,
  27. .dram_ch0_width = 16,
  28. .dram_ch1_base = 0x90000000,
  29. .dram_ch1_size = 0x10000000,
  30. .dram_ch1_width = 16,
  31. .dram_freq = 1600,
  32. };
  33. #endif
  34. #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4)
  35. static const struct uniphier_board_data ph1_pro4_data = {
  36. .dram_ch0_base = 0x80000000,
  37. .dram_ch0_size = 0x20000000,
  38. .dram_ch0_width = 32,
  39. .dram_ch1_base = 0xa0000000,
  40. .dram_ch1_size = 0x20000000,
  41. .dram_ch1_width = 32,
  42. .dram_freq = 1600,
  43. };
  44. #endif
  45. #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8)
  46. static const struct uniphier_board_data ph1_sld8_data = {
  47. .dram_ch0_base = 0x80000000,
  48. .dram_ch0_size = 0x10000000,
  49. .dram_ch0_width = 16,
  50. .dram_ch1_base = 0x90000000,
  51. .dram_ch1_size = 0x10000000,
  52. .dram_ch1_width = 16,
  53. .dram_freq = 1333,
  54. };
  55. #endif
  56. #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO5)
  57. static const struct uniphier_board_data ph1_pro5_data = {
  58. .dram_ch0_base = 0x80000000,
  59. .dram_ch0_size = 0x20000000,
  60. .dram_ch0_width = 32,
  61. .dram_ch1_base = 0xa0000000,
  62. .dram_ch1_size = 0x20000000,
  63. .dram_ch1_width = 32,
  64. .dram_freq = 1866,
  65. };
  66. #endif
  67. struct uniphier_board_id {
  68. const char *compatible;
  69. const struct uniphier_board_data *param;
  70. };
  71. static const struct uniphier_board_id uniphier_boards[] = {
  72. #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD3)
  73. { "socionext,ph1-sld3", &ph1_sld3_data, },
  74. #endif
  75. #if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4)
  76. { "socionext,ph1-ld4", &ph1_ld4_data, },
  77. #endif
  78. #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4)
  79. { "socionext,ph1-pro4", &ph1_pro4_data, },
  80. #endif
  81. #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8)
  82. { "socionext,ph1-sld8", &ph1_sld8_data, },
  83. #endif
  84. #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO5)
  85. { "socionext,ph1-pro5", &ph1_pro5_data, },
  86. #endif
  87. };
  88. const struct uniphier_board_data *uniphier_get_board_param(const void *fdt)
  89. {
  90. int i;
  91. for (i = 0; i < ARRAY_SIZE(uniphier_boards); i++) {
  92. if (!fdt_node_check_compatible(fdt, 0,
  93. uniphier_boards[i].compatible))
  94. return uniphier_boards[i].param;
  95. }
  96. return NULL;
  97. }