stm32mp1.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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_SPL_BSS_START_ADDR 0xC0200000
  45. #define CONFIG_SPL_BSS_MAX_SIZE 0x00100000
  46. #define CONFIG_SYS_SPL_MALLOC_START 0xC0300000
  47. #define CONFIG_SYS_SPL_MALLOC_SIZE 0x00100000
  48. /* limit SYSRAM usage to first 128 KB */
  49. #define CONFIG_SPL_MAX_SIZE 0x00020000
  50. #define CONFIG_SPL_STACK (STM32_SYSRAM_BASE + \
  51. STM32_SYSRAM_SIZE)
  52. #endif /* #ifdef CONFIG_SPL */
  53. /*MMC SD*/
  54. #define CONFIG_SYS_MMC_MAX_DEVICE 3
  55. /* NAND support */
  56. #define CONFIG_SYS_NAND_ONFI_DETECTION
  57. #define CONFIG_SYS_MAX_NAND_DEVICE 1
  58. /* Ethernet need */
  59. #ifdef CONFIG_DWC_ETH_QOS
  60. #define CONFIG_SYS_NONCACHED_MEMORY (1 * SZ_1M) /* 1M */
  61. #define CONFIG_SERVERIP 192.168.1.1
  62. #define CONFIG_BOOTP_SERVERIP
  63. #define CONFIG_SYS_AUTOLOAD "no"
  64. #endif
  65. /*****************************************************************************/
  66. #ifdef CONFIG_DISTRO_DEFAULTS
  67. /*****************************************************************************/
  68. #if !defined(CONFIG_SPL_BUILD)
  69. #ifdef CONFIG_CMD_MMC
  70. #define BOOT_TARGET_MMC0(func) func(MMC, mmc, 0)
  71. #define BOOT_TARGET_MMC1(func) func(MMC, mmc, 1)
  72. #define BOOT_TARGET_MMC2(func) func(MMC, mmc, 2)
  73. #else
  74. #define BOOT_TARGET_MMC0(func)
  75. #define BOOT_TARGET_MMC1(func)
  76. #define BOOT_TARGET_MMC2(func)
  77. #endif
  78. #ifdef CONFIG_NET
  79. #define BOOT_TARGET_PXE(func) func(PXE, pxe, na)
  80. #else
  81. #define BOOT_TARGET_PXE(func)
  82. #endif
  83. #ifdef CONFIG_CMD_UBIFS
  84. #define BOOT_TARGET_UBIFS(func) func(UBIFS, ubifs, 0)
  85. #else
  86. #define BOOT_TARGET_UBIFS(func)
  87. #endif
  88. #define BOOT_TARGET_DEVICES(func) \
  89. BOOT_TARGET_MMC1(func) \
  90. BOOT_TARGET_UBIFS(func) \
  91. BOOT_TARGET_MMC0(func) \
  92. BOOT_TARGET_MMC2(func) \
  93. BOOT_TARGET_PXE(func)
  94. /*
  95. * bootcmd for stm32mp1:
  96. * for serial/usb: execute the stm32prog command
  97. * for mmc boot (eMMC, SD card), boot only on the same device
  98. * for nand or spi-nand boot, boot with on ubifs partition on UBI partition
  99. * for nor boot, use SD card = mmc0
  100. */
  101. #define STM32MP_BOOTCMD "bootcmd_stm32mp=" \
  102. "echo \"Boot over ${boot_device}${boot_instance}!\";" \
  103. "if test ${boot_device} = serial || test ${boot_device} = usb;" \
  104. "then stm32prog ${boot_device} ${boot_instance}; " \
  105. "else " \
  106. "run env_check;" \
  107. "if test ${boot_device} = mmc;" \
  108. "then env set boot_targets \"mmc${boot_instance}\"; fi;" \
  109. "if test ${boot_device} = nand ||" \
  110. " test ${boot_device} = spi-nand ;" \
  111. "then env set boot_targets ubifs0; fi;" \
  112. "if test ${boot_device} = nor;" \
  113. "then env set boot_targets mmc0; fi;" \
  114. "run distro_bootcmd;" \
  115. "fi;\0"
  116. #include <config_distro_bootcmd.h>
  117. /*
  118. * memory layout for 32M uncompressed/compressed kernel,
  119. * 1M fdt, 1M script, 1M pxe and 1M for splashimage
  120. * and the ramdisk at the end.
  121. */
  122. #define CONFIG_EXTRA_ENV_SETTINGS \
  123. "bootdelay=1\0" \
  124. "kernel_addr_r=0xc2000000\0" \
  125. "fdt_addr_r=0xc4000000\0" \
  126. "scriptaddr=0xc4100000\0" \
  127. "pxefile_addr_r=0xc4200000\0" \
  128. "splashimage=0xc4300000\0" \
  129. "ramdisk_addr_r=0xc4400000\0" \
  130. "altbootcmd=run bootcmd\0" \
  131. "env_check=if env info -p -d -q; then env save; fi\0" \
  132. STM32MP_BOOTCMD \
  133. BOOTENV \
  134. "boot_net_usb_start=true\0"
  135. #endif /* ifndef CONFIG_SPL_BUILD */
  136. #endif /* ifdef CONFIG_DISTRO_DEFAULTS*/
  137. #endif /* __CONFIG_H */