tegra2-common-post.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. * (C) Copyright 2010-2012
  3. * NVIDIA Corporation <www.nvidia.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. #ifndef __TEGRA2_COMMON_POST_H
  24. #define __TEGRA2_COMMON_POST_H
  25. #ifdef CONFIG_BOOTCOMMAND
  26. #define BOOTCMDS_COMMON ""
  27. #else
  28. #ifdef CONFIG_CMD_EXT2
  29. #define BOOT_FSTYPE_EXT2 "ext2 "
  30. #else
  31. #define BOOT_FSTYPE_EXT2 ""
  32. #endif
  33. #ifdef CONFIG_CMD_FAT
  34. #define BOOT_FSTYPE_FAT "fat"
  35. #else
  36. #define BOOT_FSTYPE_FAT ""
  37. #endif
  38. #ifdef CONFIG_CMD_MMC
  39. #define BOOTCMDS_MMC \
  40. "mmc_boot=" \
  41. "setenv devtype mmc; " \
  42. "if mmc dev ${devnum}; then " \
  43. "run scan_boot; " \
  44. "fi\0" \
  45. "bootcmd_mmc0=setenv devnum 0; run mmc_boot;\0" \
  46. "bootcmd_mmc1=setenv devnum 1; run mmc_boot;\0"
  47. #define BOOT_TARGETS_MMC "mmc1 mmc0"
  48. #else
  49. #define BOOTCMDS_MMC ""
  50. #define BOOT_TARGETS_MMC ""
  51. #endif
  52. #ifdef CONFIG_CMD_USB
  53. #define BOOTCMD_INIT_USB "run usb_init; "
  54. #define BOOTCMDS_USB \
  55. "usb_init=" \
  56. "if ${usb_need_init}; then " \
  57. "set usb_need_init false; " \
  58. "usb start 0; " \
  59. "fi\0" \
  60. \
  61. "usb_boot=" \
  62. "setenv devtype usb; " \
  63. BOOTCMD_INIT_USB \
  64. "if usb dev ${devnum}; then " \
  65. "run scan_boot; " \
  66. "fi\0" \
  67. \
  68. "bootcmd_usb0=setenv devnum 0; run usb_boot;\0"
  69. #define BOOT_TARGETS_USB "usb0"
  70. #else
  71. #define BOOTCMD_INIT_USB ""
  72. #define BOOTCMDS_USB ""
  73. #define BOOT_TARGETS_USB ""
  74. #endif
  75. #ifdef CONFIG_CMD_DHCP
  76. #define BOOTCMDS_DHCP \
  77. "bootcmd_dhcp=" \
  78. BOOTCMD_INIT_USB \
  79. "if dhcp ${scriptaddr} boot.scr.uimg; then "\
  80. "source ${scriptaddr}; " \
  81. "fi\0"
  82. #define BOOT_TARGETS_DHCP "dhcp"
  83. #else
  84. #define BOOTCMDS_DHCP ""
  85. #define BOOT_TARGETS_DHCP ""
  86. #endif
  87. #define BOOTCMDS_COMMON \
  88. "scriptaddr=0x400000\0" \
  89. \
  90. "rootpart=1\0" \
  91. \
  92. "script_boot=" \
  93. "if ${fs}load ${devtype} ${devnum}:${rootpart} " \
  94. "${scriptaddr} ${prefix}${script}; then " \
  95. "echo ${script} found! Executing ...;" \
  96. "source ${scriptaddr};" \
  97. "fi;\0" \
  98. \
  99. "scan_boot=" \
  100. "echo Scanning ${devtype} ${devnum}...; " \
  101. "for fs in ${boot_fstypes}; do " \
  102. "for prefix in ${boot_prefixes}; do " \
  103. "for script in ${boot_scripts}; do " \
  104. "run script_boot; " \
  105. "done; " \
  106. "done; " \
  107. "done;\0" \
  108. \
  109. "boot_targets=" \
  110. BOOT_TARGETS_MMC " " \
  111. BOOT_TARGETS_USB " " \
  112. BOOT_TARGETS_DHCP " " \
  113. "\0" \
  114. \
  115. "boot_fstypes=" \
  116. BOOT_FSTYPE_EXT2 " " \
  117. BOOT_FSTYPE_FAT " " \
  118. "\0" \
  119. \
  120. "boot_prefixes=/ /boot/\0" \
  121. \
  122. "boot_scripts=boot.scr.uimg boot.scr\0" \
  123. \
  124. BOOTCMDS_MMC \
  125. BOOTCMDS_USB \
  126. BOOTCMDS_DHCP
  127. #define CONFIG_BOOTCOMMAND \
  128. "for target in ${boot_targets}; do run bootcmd_${target}; done"
  129. #endif
  130. #define CONFIG_EXTRA_ENV_SETTINGS \
  131. TEGRA2_DEVICE_SETTINGS \
  132. "fdt_load=0x01000000\0" \
  133. "fdt_high=01100000\0" \
  134. BOOTCMDS_COMMON
  135. #endif /* __TEGRA2_COMMON_POST_H */