board_init.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * Copyright (C) 2012-2015 Panasonic Corporation
  3. * Copyright (C) 2015-2016 Socionext Inc.
  4. * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. #include <linux/errno.h>
  9. #include <linux/io.h>
  10. #include <linux/printk.h>
  11. #include "init.h"
  12. #include "micro-support-card.h"
  13. #include "soc-info.h"
  14. #ifdef CONFIG_ARCH_UNIPHIER_LD20
  15. static void uniphier_ld20_misc_init(void)
  16. {
  17. /* ES1 errata: increase VDD09 supply to suppress VBO noise */
  18. if (uniphier_get_soc_revision() == 1) {
  19. writel(0x00000003, 0x6184e004);
  20. writel(0x00000100, 0x6184e040);
  21. writel(0x0000b500, 0x6184e024);
  22. writel(0x00000001, 0x6184e000);
  23. }
  24. }
  25. #endif
  26. struct uniphier_initdata {
  27. unsigned int soc_id;
  28. void (*sbc_init)(void);
  29. void (*pll_init)(void);
  30. void (*clk_init)(void);
  31. void (*misc_init)(void);
  32. };
  33. static const struct uniphier_initdata uniphier_initdata[] = {
  34. #if defined(CONFIG_ARCH_UNIPHIER_LD4)
  35. {
  36. .soc_id = UNIPHIER_LD4_ID,
  37. .sbc_init = uniphier_ld4_sbc_init,
  38. .pll_init = uniphier_ld4_pll_init,
  39. .clk_init = uniphier_ld4_clk_init,
  40. },
  41. #endif
  42. #if defined(CONFIG_ARCH_UNIPHIER_PRO4)
  43. {
  44. .soc_id = UNIPHIER_PRO4_ID,
  45. .sbc_init = uniphier_sbc_init_savepin,
  46. .pll_init = uniphier_pro4_pll_init,
  47. .clk_init = uniphier_pro4_clk_init,
  48. },
  49. #endif
  50. #if defined(CONFIG_ARCH_UNIPHIER_SLD8)
  51. {
  52. .soc_id = UNIPHIER_SLD8_ID,
  53. .sbc_init = uniphier_ld4_sbc_init,
  54. .pll_init = uniphier_ld4_pll_init,
  55. .clk_init = uniphier_ld4_clk_init,
  56. },
  57. #endif
  58. #if defined(CONFIG_ARCH_UNIPHIER_PRO5)
  59. {
  60. .soc_id = UNIPHIER_PRO5_ID,
  61. .sbc_init = uniphier_sbc_init_savepin,
  62. .clk_init = uniphier_pro5_clk_init,
  63. },
  64. #endif
  65. #if defined(CONFIG_ARCH_UNIPHIER_PXS2)
  66. {
  67. .soc_id = UNIPHIER_PXS2_ID,
  68. .sbc_init = uniphier_pxs2_sbc_init,
  69. .clk_init = uniphier_pxs2_clk_init,
  70. },
  71. #endif
  72. #if defined(CONFIG_ARCH_UNIPHIER_LD6B)
  73. {
  74. .soc_id = UNIPHIER_LD6B_ID,
  75. .sbc_init = uniphier_pxs2_sbc_init,
  76. .clk_init = uniphier_pxs2_clk_init,
  77. },
  78. #endif
  79. #if defined(CONFIG_ARCH_UNIPHIER_LD11)
  80. {
  81. .soc_id = UNIPHIER_LD11_ID,
  82. .sbc_init = uniphier_ld11_sbc_init,
  83. .pll_init = uniphier_ld11_pll_init,
  84. .clk_init = uniphier_ld11_clk_init,
  85. },
  86. #endif
  87. #if defined(CONFIG_ARCH_UNIPHIER_LD20)
  88. {
  89. .soc_id = UNIPHIER_LD20_ID,
  90. .sbc_init = uniphier_ld11_sbc_init,
  91. .pll_init = uniphier_ld20_pll_init,
  92. .clk_init = uniphier_ld20_clk_init,
  93. .misc_init = uniphier_ld20_misc_init,
  94. },
  95. #endif
  96. #if defined(CONFIG_ARCH_UNIPHIER_PXS3)
  97. {
  98. .soc_id = UNIPHIER_PXS3_ID,
  99. .sbc_init = uniphier_pxs2_sbc_init,
  100. .pll_init = uniphier_pxs3_pll_init,
  101. .clk_init = uniphier_pxs3_clk_init,
  102. },
  103. #endif
  104. };
  105. UNIPHIER_DEFINE_SOCDATA_FUNC(uniphier_get_initdata, uniphier_initdata)
  106. int board_init(void)
  107. {
  108. const struct uniphier_initdata *initdata;
  109. led_puts("U0");
  110. initdata = uniphier_get_initdata();
  111. if (!initdata) {
  112. pr_err("unsupported SoC\n");
  113. return -EINVAL;
  114. }
  115. initdata->sbc_init();
  116. support_card_init();
  117. led_puts("U0");
  118. if (initdata->pll_init)
  119. initdata->pll_init();
  120. led_puts("U1");
  121. if (initdata->clk_init)
  122. initdata->clk_init();
  123. led_puts("U2");
  124. if (initdata->misc_init)
  125. initdata->misc_init();
  126. led_puts("U3");
  127. support_card_late_init();
  128. led_puts("Uboo");
  129. return 0;
  130. }