init_wrappers.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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 <serial.h>
  26. #include <kgdb.h>
  27. #include <scsi.h>
  28. #include <post.h>
  29. #include <miiphy.h>
  30. #include <asm/init_wrappers.h>
  31. int serial_initialize_r(void)
  32. {
  33. serial_initialize();
  34. return 0;
  35. }
  36. /*
  37. * Tell if it's OK to load the environment early in boot.
  38. *
  39. * If CONFIG_OF_CONFIG is defined, we'll check with the FDT to see
  40. * if this is OK (defaulting to saying it's not OK).
  41. *
  42. * NOTE: Loading the environment early can be a bad idea if security is
  43. * important, since no verification is done on the environment.
  44. *
  45. * @return 0 if environment should not be loaded, !=0 if it is ok to load
  46. */
  47. static int should_load_env(void)
  48. {
  49. #ifdef CONFIG_OF_CONTROL
  50. return fdtdec_get_config_int(gd->fdt_blob, "load-environment", 0);
  51. #elif defined CONFIG_DELAY_ENVIRONMENT
  52. return 0;
  53. #else
  54. return 1;
  55. #endif
  56. }
  57. int env_relocate_r(void)
  58. {
  59. /* initialize environment */
  60. if (should_load_env())
  61. env_relocate();
  62. else
  63. set_default_env(NULL);
  64. return 0;
  65. }
  66. int pci_init_r(void)
  67. {
  68. /* Do pci configuration */
  69. pci_init();
  70. return 0;
  71. }
  72. int jumptable_init_r(void)
  73. {
  74. jumptable_init();
  75. return 0;
  76. }
  77. int pcmcia_init_r(void)
  78. {
  79. puts("PCMCIA:");
  80. pcmcia_init();
  81. return 0;
  82. }
  83. int kgdb_init_r(void)
  84. {
  85. puts("KGDB: ");
  86. kgdb_init();
  87. return 0;
  88. }
  89. int enable_interrupts_r(void)
  90. {
  91. /* enable exceptions */
  92. enable_interrupts();
  93. return 0;
  94. }
  95. int eth_initialize_r(void)
  96. {
  97. puts("Net: ");
  98. eth_initialize(gd->bd);
  99. return 0;
  100. }
  101. int reset_phy_r(void)
  102. {
  103. #ifdef DEBUG
  104. puts("Reset Ethernet PHY\n");
  105. #endif
  106. reset_phy();
  107. return 0;
  108. }
  109. int ide_init_r(void)
  110. {
  111. puts("IDE: ");
  112. ide_init();
  113. return 0;
  114. }
  115. int scsi_init_r(void)
  116. {
  117. puts("SCSI: ");
  118. scsi_init();
  119. return 0;
  120. }
  121. #ifdef CONFIG_BITBANGMII
  122. int bb_miiphy_init_r(void)
  123. {
  124. bb_miiphy_init();
  125. return 0;
  126. }
  127. #endif
  128. #ifdef CONFIG_POST
  129. int post_run_r(void)
  130. {
  131. post_run(NULL, POST_RAM | post_bootmode_get(0));
  132. return 0;
  133. }
  134. #endif