tegra-common-post.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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 __TEGRA_COMMON_POST_H
  24. #define __TEGRA_COMMON_POST_H
  25. #ifdef CONFIG_BOOTCOMMAND
  26. #define BOOTCMDS_COMMON ""
  27. #else
  28. #ifdef CONFIG_CMD_MMC
  29. #define BOOTCMDS_MMC \
  30. "mmc_boot=" \
  31. "setenv devtype mmc; " \
  32. "if mmc dev ${devnum}; then " \
  33. "run scan_boot; " \
  34. "fi\0" \
  35. "bootcmd_mmc0=setenv devnum 0; run mmc_boot;\0" \
  36. "bootcmd_mmc1=setenv devnum 1; run mmc_boot;\0"
  37. #define BOOT_TARGETS_MMC "mmc1 mmc0"
  38. #else
  39. #define BOOTCMDS_MMC ""
  40. #define BOOT_TARGETS_MMC ""
  41. #endif
  42. #ifdef CONFIG_CMD_USB
  43. #define BOOTCMD_INIT_USB "run usb_init; "
  44. #define BOOTCMDS_USB \
  45. "usb_init=" \
  46. "if ${usb_need_init}; then " \
  47. "set usb_need_init false; " \
  48. "usb start 0; " \
  49. "fi\0" \
  50. \
  51. "usb_boot=" \
  52. "setenv devtype usb; " \
  53. BOOTCMD_INIT_USB \
  54. "if usb dev ${devnum}; then " \
  55. "run scan_boot; " \
  56. "fi\0" \
  57. \
  58. "bootcmd_usb0=setenv devnum 0; run usb_boot;\0"
  59. #define BOOT_TARGETS_USB "usb0"
  60. #else
  61. #define BOOTCMD_INIT_USB ""
  62. #define BOOTCMDS_USB ""
  63. #define BOOT_TARGETS_USB ""
  64. #endif
  65. #ifdef CONFIG_CMD_DHCP
  66. #define BOOTCMDS_DHCP \
  67. "bootcmd_dhcp=" \
  68. BOOTCMD_INIT_USB \
  69. "if dhcp ${scriptaddr} boot.scr.uimg; then "\
  70. "source ${scriptaddr}; " \
  71. "fi\0"
  72. #define BOOT_TARGETS_DHCP "dhcp"
  73. #else
  74. #define BOOTCMDS_DHCP ""
  75. #define BOOT_TARGETS_DHCP ""
  76. #endif
  77. #define BOOTCMDS_COMMON \
  78. "rootpart=1\0" \
  79. \
  80. "script_boot=" \
  81. "if load ${devtype} ${devnum}:${rootpart} " \
  82. "${scriptaddr} ${prefix}${script}; then " \
  83. "echo ${script} found! Executing ...;" \
  84. "source ${scriptaddr};" \
  85. "fi;\0" \
  86. \
  87. "scan_boot=" \
  88. "echo Scanning ${devtype} ${devnum}...; " \
  89. "for prefix in ${boot_prefixes}; do " \
  90. "for script in ${boot_scripts}; do " \
  91. "run script_boot; " \
  92. "done; " \
  93. "done;\0" \
  94. \
  95. "boot_targets=" \
  96. BOOT_TARGETS_MMC " " \
  97. BOOT_TARGETS_USB " " \
  98. BOOT_TARGETS_DHCP " " \
  99. "\0" \
  100. \
  101. "boot_prefixes=/ /boot/\0" \
  102. \
  103. "boot_scripts=boot.scr.uimg boot.scr\0" \
  104. \
  105. BOOTCMDS_MMC \
  106. BOOTCMDS_USB \
  107. BOOTCMDS_DHCP
  108. #define CONFIG_BOOTCOMMAND \
  109. "for target in ${boot_targets}; do run bootcmd_${target}; done"
  110. #endif
  111. #ifdef CONFIG_TEGRA_KEYBOARD
  112. #define STDIN_KBD_KBC ",tegra-kbc"
  113. #else
  114. #define STDIN_KBD_KBC ""
  115. #endif
  116. #ifdef CONFIG_USB_KEYBOARD
  117. #define STDIN_KBD_USB ",usbkbd"
  118. #define CONFIG_SYS_USB_EVENT_POLL
  119. #define CONFIG_PREBOOT "usb start"
  120. #else
  121. #define STDIN_KBD_USB ""
  122. #endif
  123. #define TEGRA_DEVICE_SETTINGS \
  124. "stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB "\0" \
  125. "stdout=serial,lcd\0" \
  126. "stderr=serial,lcd\0" \
  127. #define CONFIG_EXTRA_ENV_SETTINGS \
  128. TEGRA_DEVICE_SETTINGS \
  129. MEM_LAYOUT_ENV_SETTINGS \
  130. BOOTCMDS_COMMON
  131. /* overrides for SPL build here */
  132. #ifdef CONFIG_SPL_BUILD
  133. /* remove devicetree support */
  134. #ifdef CONFIG_OF_CONTROL
  135. #undef CONFIG_OF_CONTROL
  136. #endif
  137. /* remove I2C support */
  138. #ifdef CONFIG_TEGRA_I2C
  139. #undef CONFIG_TEGRA_I2C
  140. #endif
  141. #ifdef CONFIG_CMD_I2C
  142. #undef CONFIG_CMD_I2C
  143. #endif
  144. /* remove MMC support */
  145. #ifdef CONFIG_MMC
  146. #undef CONFIG_MMC
  147. #endif
  148. #ifdef CONFIG_GENERIC_MMC
  149. #undef CONFIG_GENERIC_MMC
  150. #endif
  151. #ifdef CONFIG_TEGRA_MMC
  152. #undef CONFIG_TEGRA_MMC
  153. #endif
  154. #ifdef CONFIG_CMD_MMC
  155. #undef CONFIG_CMD_MMC
  156. #endif
  157. /* remove partitions/filesystems */
  158. #ifdef CONFIG_DOS_PARTITION
  159. #undef CONFIG_DOS_PARTITION
  160. #endif
  161. #ifdef CONFIG_EFI_PARTITION
  162. #undef CONFIG_EFI_PARTITION
  163. #endif
  164. #ifdef CONFIG_CMD_FS_GENERIC
  165. #undef CONFIG_CMD_FS_GENERIC
  166. #endif
  167. #ifdef CONFIG_CMD_EXT4
  168. #undef CONFIG_CMD_EXT4
  169. #endif
  170. #ifdef CONFIG_CMD_EXT2
  171. #undef CONFIG_CMD_EXT2
  172. #endif
  173. #ifdef CONFIG_CMD_FAT
  174. #undef CONFIG_CMD_FAT
  175. #endif
  176. #ifdef CONFIG_FS_EXT4
  177. #undef CONFIG_FS_EXT4
  178. #endif
  179. #ifdef CONFIG_FS_FAT
  180. #undef CONFIG_FS_FAT
  181. #endif
  182. /* remove USB */
  183. #ifdef CONFIG_USB_EHCI
  184. #undef CONFIG_USB_EHCI
  185. #endif
  186. #ifdef CONFIG_USB_EHCI_TEGRA
  187. #undef CONFIG_USB_EHCI_TEGRA
  188. #endif
  189. #ifdef CONFIG_USB_STORAGE
  190. #undef CONFIG_USB_STORAGE
  191. #endif
  192. #ifdef CONFIG_CMD_USB
  193. #undef CONFIG_CMD_USB
  194. #endif
  195. /* remove part command support */
  196. #ifdef CONFIG_PARTITION_UUIDS
  197. #undef CONFIG_PARTITION_UUIDS
  198. #endif
  199. #ifdef CONFIG_CMD_PART
  200. #undef CONFIG_CMD_PART
  201. #endif
  202. #endif /* CONFIG_SPL_BUILD */
  203. #endif /* __TEGRA_COMMON_POST_H */