board_init.c 3.1 KB

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