tegra-common-post.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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. #ifdef CONFIG_VIDEO_TEGRA
  124. #define STDOUT_LCD ",lcd"
  125. #else
  126. #define STDOUT_LCD ""
  127. #endif
  128. #define TEGRA_DEVICE_SETTINGS \
  129. "stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB "\0" \
  130. "stdout=serial" STDOUT_LCD "\0" \
  131. "stderr=serial" STDOUT_LCD "\0" \
  132. ""
  133. #define CONFIG_EXTRA_ENV_SETTINGS \
  134. TEGRA_DEVICE_SETTINGS \
  135. MEM_LAYOUT_ENV_SETTINGS \
  136. BOOTCMDS_COMMON
  137. #if defined(CONFIG_TEGRA20_SFLASH) || defined(CONFIG_TEGRA20_SLINK) || defined(CONFIG_TEGRA114_SPI)
  138. #define CONFIG_FDT_SPI
  139. #endif
  140. /* overrides for SPL build here */
  141. #ifdef CONFIG_SPL_BUILD
  142. /* remove devicetree support */
  143. #ifdef CONFIG_OF_CONTROL
  144. #undef CONFIG_OF_CONTROL
  145. #endif
  146. /* remove I2C support */
  147. #ifdef CONFIG_TEGRA_I2C
  148. #undef CONFIG_TEGRA_I2C
  149. #endif
  150. #ifdef CONFIG_CMD_I2C
  151. #undef CONFIG_CMD_I2C
  152. #endif
  153. /* remove MMC support */
  154. #ifdef CONFIG_MMC
  155. #undef CONFIG_MMC
  156. #endif
  157. #ifdef CONFIG_GENERIC_MMC
  158. #undef CONFIG_GENERIC_MMC
  159. #endif
  160. #ifdef CONFIG_TEGRA_MMC
  161. #undef CONFIG_TEGRA_MMC
  162. #endif
  163. #ifdef CONFIG_CMD_MMC
  164. #undef CONFIG_CMD_MMC
  165. #endif
  166. /* remove partitions/filesystems */
  167. #ifdef CONFIG_DOS_PARTITION
  168. #undef CONFIG_DOS_PARTITION
  169. #endif
  170. #ifdef CONFIG_EFI_PARTITION
  171. #undef CONFIG_EFI_PARTITION
  172. #endif
  173. #ifdef CONFIG_CMD_FS_GENERIC
  174. #undef CONFIG_CMD_FS_GENERIC
  175. #endif
  176. #ifdef CONFIG_CMD_EXT4
  177. #undef CONFIG_CMD_EXT4
  178. #endif
  179. #ifdef CONFIG_CMD_EXT2
  180. #undef CONFIG_CMD_EXT2
  181. #endif
  182. #ifdef CONFIG_CMD_FAT
  183. #undef CONFIG_CMD_FAT
  184. #endif
  185. #ifdef CONFIG_FS_EXT4
  186. #undef CONFIG_FS_EXT4
  187. #endif
  188. #ifdef CONFIG_FS_FAT
  189. #undef CONFIG_FS_FAT
  190. #endif
  191. /* remove USB */
  192. #ifdef CONFIG_USB_EHCI
  193. #undef CONFIG_USB_EHCI
  194. #endif
  195. #ifdef CONFIG_USB_EHCI_TEGRA
  196. #undef CONFIG_USB_EHCI_TEGRA
  197. #endif
  198. #ifdef CONFIG_USB_STORAGE
  199. #undef CONFIG_USB_STORAGE
  200. #endif
  201. #ifdef CONFIG_CMD_USB
  202. #undef CONFIG_CMD_USB
  203. #endif
  204. /* remove part command support */
  205. #ifdef CONFIG_PARTITION_UUIDS
  206. #undef CONFIG_PARTITION_UUIDS
  207. #endif
  208. #ifdef CONFIG_CMD_PART
  209. #undef CONFIG_CMD_PART
  210. #endif
  211. #endif /* CONFIG_SPL_BUILD */
  212. #endif /* __TEGRA_COMMON_POST_H */