init_wrappers.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. * (C) Copyright 2011
  3. * Graeme Russ, <graeme.russ@gmail.com>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <environment.h>
  25. #include <fdtdec.h>
  26. #include <serial.h>
  27. #include <kgdb.h>
  28. #include <scsi.h>
  29. #include <post.h>
  30. #include <miiphy.h>
  31. #include <asm/init_wrappers.h>
  32. int serial_initialize_r(void)
  33. {
  34. serial_initialize();
  35. return 0;
  36. }
  37. /*
  38. * Tell if it's OK to load the environment early in boot.
  39. *
  40. * If CONFIG_OF_CONFIG is defined, we'll check with the FDT to see
  41. * if this is OK (defaulting to saying it's not OK).
  42. *
  43. * NOTE: Loading the environment early can be a bad idea if security is
  44. * important, since no verification is done on the environment.
  45. *
  46. * @return 0 if environment should not be loaded, !=0 if it is ok to load
  47. */
  48. static int should_load_env(void)
  49. {
  50. #ifdef CONFIG_OF_CONTROL
  51. return fdtdec_get_config_int(gd->fdt_blob, "load-environment", 0);
  52. #elif defined CONFIG_DELAY_ENVIRONMENT
  53. return 0;
  54. #else
  55. return 1;
  56. #endif
  57. }
  58. int env_relocate_r(void)
  59. {
  60. /* initialize environment */
  61. if (should_load_env())
  62. env_relocate();
  63. else
  64. set_default_env(NULL);
  65. return 0;
  66. }
  67. int pci_init_r(void)
  68. {
  69. /* Do pci configuration */
  70. pci_init();
  71. return 0;
  72. }
  73. int jumptable_init_r(void)
  74. {
  75. jumptable_init();
  76. return 0;
  77. }
  78. int pcmcia_init_r(void)
  79. {
  80. puts("PCMCIA:");
  81. pcmcia_init();
  82. return 0;
  83. }
  84. int kgdb_init_r(void)
  85. {
  86. puts("KGDB: ");
  87. kgdb_init();
  88. return 0;
  89. }
  90. int enable_interrupts_r(void)
  91. {
  92. /* enable exceptions */
  93. enable_interrupts();
  94. return 0;
  95. }
  96. int eth_initialize_r(void)
  97. {
  98. puts("Net: ");
  99. eth_initialize(gd->bd);
  100. return 0;
  101. }
  102. int reset_phy_r(void)
  103. {
  104. #ifdef DEBUG
  105. puts("Reset Ethernet PHY\n");
  106. #endif
  107. reset_phy();
  108. return 0;
  109. }
  110. int ide_init_r(void)
  111. {
  112. puts("IDE: ");
  113. ide_init();
  114. return 0;
  115. }
  116. int scsi_init_r(void)
  117. {
  118. puts("SCSI: ");
  119. scsi_init();
  120. return 0;
  121. }
  122. #ifdef CONFIG_BITBANGMII
  123. int bb_miiphy_init_r(void)
  124. {
  125. bb_miiphy_init();
  126. return 0;
  127. }
  128. #endif
  129. #ifdef CONFIG_POST
  130. int post_run_r(void)
  131. {
  132. post_run(NULL, POST_RAM | post_bootmode_get(0));
  133. return 0;
  134. }
  135. #endif