stm32mp1.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
  2. /*
  3. * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
  4. *
  5. * Configuration settings for the STM32MP15x CPU
  6. */
  7. #ifndef __CONFIG_H
  8. #define __CONFIG_H
  9. #include <linux/sizes.h>
  10. #include <asm/arch/stm32.h>
  11. #ifndef CONFIG_TFABOOT
  12. /* PSCI support */
  13. #define CONFIG_ARMV7_SECURE_BASE STM32_SYSRAM_BASE
  14. #define CONFIG_ARMV7_SECURE_MAX_SIZE STM32_SYSRAM_SIZE
  15. #endif
  16. /*
  17. * Configuration of the external SRAM memory used by U-Boot
  18. */
  19. #define CONFIG_SYS_SDRAM_BASE STM32_DDR_BASE
  20. #define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_TEXT_BASE
  21. /*
  22. * Console I/O buffer size
  23. */
  24. #define CONFIG_SYS_CBSIZE SZ_1K
  25. /*
  26. * default load address used for command tftp, bootm , loadb, ...
  27. */
  28. #define CONFIG_LOADADDR 0xc2000000
  29. #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
  30. /* ATAGs */
  31. #define CONFIG_CMDLINE_TAG
  32. #define CONFIG_SETUP_MEMORY_TAGS
  33. #define CONFIG_INITRD_TAG
  34. /*
  35. * For booting Linux, use the first 256 MB of memory, since this is
  36. * the maximum mapped by the Linux kernel during initialization.
  37. */
  38. #define CONFIG_SYS_BOOTMAPSZ SZ_256M
  39. /* Extend size of kernel image for uncompression */
  40. #define CONFIG_SYS_BOOTM_LEN SZ_32M
  41. /* SPL support */
  42. #ifdef CONFIG_SPL
  43. /* SPL use DDR */
  44. #define CONFIG_SYS_SPL_MALLOC_START 0xC0300000
  45. #define CONFIG_SYS_SPL_MALLOC_SIZE 0x01D00000
  46. /* Restrict SPL to fit within SYSRAM */
  47. #define STM32_SYSRAM_END (STM32_SYSRAM_BASE + STM32_SYSRAM_SIZE)
  48. #define CONFIG_SPL_MAX_FOOTPRINT (STM32_SYSRAM_END - CONFIG_SPL_TEXT_BASE)
  49. #define CONFIG_SPL_STACK (STM32_SYSRAM_BASE + \
  50. STM32_SYSRAM_SIZE)
  51. #endif /* #ifdef CONFIG_SPL */
  52. /*MMC SD*/
  53. #define CONFIG_SYS_MMC_MAX_DEVICE 3
  54. /* NAND support */
  55. #define CONFIG_SYS_NAND_ONFI_DETECTION
  56. #define CONFIG_SYS_MAX_NAND_DEVICE 1
  57. /* Ethernet need */
  58. #ifdef CONFIG_DWC_ETH_QOS
  59. #define CONFIG_SERVERIP 192.168.1.1
  60. #define CONFIG_BOOTP_SERVERIP
  61. #define CONFIG_SYS_AUTOLOAD "no"
  62. #endif
  63. /*****************************************************************************/
  64. #ifdef CONFIG_DISTRO_DEFAULTS
  65. /*****************************************************************************/
  66. #if !defined(CONFIG_SPL_BUILD)
  67. #ifdef CONFIG_CMD_MMC
  68. #define BOOT_TARGET_MMC0(func) func(MMC, mmc, 0)
  69. #define BOOT_TARGET_MMC1(func) func(MMC, mmc, 1)
  70. #define BOOT_TARGET_MMC2(func) func(MMC, mmc, 2)
  71. #else
  72. #define BOOT_TARGET_MMC0(func)
  73. #define BOOT_TARGET_MMC1(func)
  74. #define BOOT_TARGET_MMC2(func)
  75. #endif
  76. #ifdef CONFIG_NET
  77. #define BOOT_TARGET_PXE(func) func(PXE, pxe, na)
  78. #else
  79. #define BOOT_TARGET_PXE(func)
  80. #endif
  81. #ifdef CONFIG_CMD_UBIFS
  82. #define BOOT_TARGET_UBIFS(func) func(UBIFS, ubifs, 0)
  83. #else
  84. #define BOOT_TARGET_UBIFS(func)
  85. #endif
  86. #ifdef CONFIG_CMD_USB
  87. #define BOOT_TARGET_USB(func) func(USB, usb, 0)
  88. #else
  89. #define BOOT_TARGET_USB(func)
  90. #endif
  91. #define BOOT_TARGET_DEVICES(func) \
  92. BOOT_TARGET_MMC1(func) \
  93. BOOT_TARGET_UBIFS(func) \
  94. BOOT_TARGET_MMC0(func) \
  95. BOOT_TARGET_MMC2(func) \
  96. BOOT_TARGET_USB(func) \
  97. BOOT_TARGET_PXE(func)
  98. /*
  99. * bootcmd for stm32mp1:
  100. * for serial/usb: execute the stm32prog command
  101. * for mmc boot (eMMC, SD card), boot only on the same device
  102. * for nand or spi-nand boot, boot with on ubifs partition on UBI partition
  103. * for nor boot, use SD card = mmc0
  104. */
  105. #define STM32MP_BOOTCMD "bootcmd_stm32mp=" \
  106. "echo \"Boot over ${boot_device}${boot_instance}!\";" \
  107. "if test ${boot_device} = serial || test ${boot_device} = usb;" \
  108. "then stm32prog ${boot_device} ${boot_instance}; " \
  109. "else " \
  110. "run env_check;" \
  111. "if test ${boot_device} = mmc;" \
  112. "then env set boot_targets \"mmc${boot_instance}\"; fi;" \
  113. "if test ${boot_device} = nand ||" \
  114. " test ${boot_device} = spi-nand ;" \
  115. "then env set boot_targets ubifs0; fi;" \
  116. "if test ${boot_device} = nor;" \
  117. "then env set boot_targets mmc0; fi;" \
  118. "run distro_bootcmd;" \
  119. "fi;\0"
  120. #ifdef CONFIG_FASTBOOT_CMD_OEM_FORMAT
  121. /* eMMC default partitions for fastboot command: oem format */
  122. #define PARTS_DEFAULT \
  123. "partitions=" \
  124. "name=ssbl,size=2M;" \
  125. "name=bootfs,size=64MB,bootable;" \
  126. "name=vendorfs,size=16M;" \
  127. "name=rootfs,size=746M;" \
  128. "name=userfs,size=-\0"
  129. #else
  130. #define PARTS_DEFAULT
  131. #endif
  132. #include <config_distro_bootcmd.h>
  133. /*
  134. * memory layout for 32M uncompressed/compressed kernel,
  135. * 1M fdt, 1M script, 1M pxe and 1M for overlay
  136. * and the ramdisk at the end.
  137. */
  138. #define CONFIG_EXTRA_ENV_SETTINGS \
  139. "kernel_addr_r=0xc2000000\0" \
  140. "fdt_addr_r=0xc4000000\0" \
  141. "scriptaddr=0xc4100000\0" \
  142. "pxefile_addr_r=0xc4200000\0" \
  143. "fdtoverlay_addr_r=0xc4300000\0" \
  144. "ramdisk_addr_r=0xc4400000\0" \
  145. "altbootcmd=run bootcmd\0" \
  146. "env_check=if env info -p -d -q; then env save; fi\0" \
  147. STM32MP_BOOTCMD \
  148. PARTS_DEFAULT \
  149. BOOTENV \
  150. "boot_net_usb_start=true\0"
  151. #endif /* ifndef CONFIG_SPL_BUILD */
  152. #endif /* ifdef CONFIG_DISTRO_DEFAULTS*/
  153. #endif /* __CONFIG_H */