clearfog.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2015 Stefan Roese <sr@denx.de>
  4. */
  5. #ifndef _CONFIG_CLEARFOG_H
  6. #define _CONFIG_CLEARFOG_H
  7. #include <linux/stringify.h>
  8. /*
  9. * High Level Configuration Options (easy to change)
  10. */
  11. /*
  12. * TEXT_BASE needs to be below 16MiB, since this area is scrubbed
  13. * for DDR ECC byte filling in the SPL before loading the main
  14. * U-Boot into it.
  15. */
  16. #define CONFIG_SYS_TCLK 250000000 /* 250MHz */
  17. /*
  18. * Commands configuration
  19. */
  20. /*
  21. * SDIO/MMC Card Configuration
  22. */
  23. #define CONFIG_SYS_MMC_BASE MVEBU_SDIO_BASE
  24. /* USB/EHCI configuration */
  25. #define CONFIG_EHCI_IS_TDI
  26. #define CONFIG_ENV_MIN_ENTRIES 128
  27. /* Environment in MMC */
  28. #define CONFIG_SYS_MMC_ENV_DEV 0
  29. /*
  30. * For SD - reserve 1 LBA for MBR + 1M for u-boot image. The MMC/eMMC
  31. * boot image starts @ LBA-0.
  32. * As result in MMC/eMMC case it will be a 1 sector gap between u-boot
  33. * image and environment
  34. */
  35. #define PHY_ANEG_TIMEOUT 8000 /* PHY needs a longer aneg time */
  36. /* PCIe support */
  37. #ifndef CONFIG_SPL_BUILD
  38. #define CONFIG_PCI_SCAN_SHOW
  39. #endif
  40. /* SATA support */
  41. #ifdef CONFIG_SCSI
  42. #define CONFIG_SCSI_AHCI_PLAT
  43. #define CONFIG_SYS_SCSI_MAX_SCSI_ID 1
  44. #define CONFIG_SYS_SCSI_MAX_LUN 1
  45. #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \
  46. CONFIG_SYS_SCSI_MAX_LUN)
  47. #endif
  48. /* Keep device tree and initrd in lower memory so the kernel can access them */
  49. #define RELOCATION_LIMITS_ENV_SETTINGS \
  50. "fdt_high=0x10000000\0" \
  51. "initrd_high=0x10000000\0"
  52. /* SPL */
  53. /* Defines for SPL */
  54. #define CONFIG_SPL_SIZE (140 << 10)
  55. #define CONFIG_SPL_MAX_SIZE (CONFIG_SPL_SIZE - 0x0030)
  56. #define CONFIG_SPL_BSS_START_ADDR (0x40000000 + CONFIG_SPL_SIZE)
  57. #define CONFIG_SPL_BSS_MAX_SIZE (16 << 10)
  58. #ifdef CONFIG_SPL_BUILD
  59. #define CONFIG_SYS_MALLOC_SIMPLE
  60. #endif
  61. #define CONFIG_SPL_STACK (0x40000000 + ((192 - 16) << 10))
  62. #define CONFIG_SPL_BOOTROM_SAVE (CONFIG_SPL_STACK + 4)
  63. #if defined(CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI)
  64. /* SPL related SPI defines */
  65. #define CONFIG_SYS_U_BOOT_OFFS CONFIG_SYS_SPI_U_BOOT_OFFS
  66. #elif defined(CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC) || defined(CONFIG_MVEBU_SPL_BOOT_DEVICE_SATA)
  67. /* SPL related MMC defines */
  68. #define CONFIG_SYS_MMC_U_BOOT_OFFS (160 << 10)
  69. #define CONFIG_SYS_U_BOOT_OFFS CONFIG_SYS_MMC_U_BOOT_OFFS
  70. #ifdef CONFIG_SPL_BUILD
  71. #define CONFIG_FIXED_SDHCI_ALIGNED_BUFFER 0x00180000 /* in SDRAM */
  72. #endif
  73. #endif
  74. /*
  75. * mv-common.h should be defined after CMD configs since it used them
  76. * to enable certain macros
  77. */
  78. #include "mv-common.h"
  79. /* Include the common distro boot environment */
  80. #ifndef CONFIG_SPL_BUILD
  81. #ifdef CONFIG_MMC
  82. #define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
  83. #else
  84. #define BOOT_TARGET_DEVICES_MMC(func)
  85. #endif
  86. #ifdef CONFIG_USB_STORAGE
  87. #define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0)
  88. #else
  89. #define BOOT_TARGET_DEVICES_USB(func)
  90. #endif
  91. #ifndef CONFIG_SCSI
  92. #define BOOT_TARGET_DEVICES_SCSI_BUS0(func)
  93. #define BOOT_TARGET_DEVICES_SCSI_BUS1(func)
  94. #define BOOT_TARGET_DEVICES_SCSI_BUS2(func)
  95. #else
  96. /*
  97. * With SCSI enabled, M.2 SATA is always located on bus 0
  98. */
  99. #define BOOT_TARGET_DEVICES_SCSI_BUS0(func) func(SCSI, scsi, 0)
  100. /*
  101. * Either one or both mPCIe slots may be configured as mSATA interfaces. The
  102. * SCSI bus ids are assigned based on sequence of hardware present, not always
  103. * tied to hardware slot ids. As such, use second SCSI bus if either slot is
  104. * set for SATA, and only use third SCSI bus if both slots are SATA enabled.
  105. */
  106. #if defined (CONFIG_CLEARFOG_CON2_SATA) || defined (CONFIG_CLEARFOG_CON3_SATA)
  107. #define BOOT_TARGET_DEVICES_SCSI_BUS1(func) func(SCSI, scsi, 1)
  108. #else
  109. #define BOOT_TARGET_DEVICES_SCSI_BUS1(func)
  110. #endif
  111. #if defined (CONFIG_CLEARFOG_CON2_SATA) && defined (CONFIG_CLEARFOG_CON3_SATA)
  112. #define BOOT_TARGET_DEVICES_SCSI_BUS2(func) func(SCSI, scsi, 2)
  113. #else
  114. #define BOOT_TARGET_DEVICES_SCSI_BUS2(func)
  115. #endif
  116. #endif /* CONFIG_SCSI */
  117. /*
  118. * The SCSI buses are attempted in increasing bus order, there is no current
  119. * mechanism to alter the default bus priority order for booting.
  120. */
  121. #define BOOT_TARGET_DEVICES(func) \
  122. BOOT_TARGET_DEVICES_MMC(func) \
  123. BOOT_TARGET_DEVICES_USB(func) \
  124. BOOT_TARGET_DEVICES_SCSI_BUS0(func) \
  125. BOOT_TARGET_DEVICES_SCSI_BUS1(func) \
  126. BOOT_TARGET_DEVICES_SCSI_BUS2(func) \
  127. func(PXE, pxe, na) \
  128. func(DHCP, dhcp, na)
  129. #define KERNEL_ADDR_R __stringify(0x800000)
  130. #define FDT_ADDR_R __stringify(0x100000)
  131. #define RAMDISK_ADDR_R __stringify(0x1800000)
  132. #define SCRIPT_ADDR_R __stringify(0x200000)
  133. #define PXEFILE_ADDR_R __stringify(0x300000)
  134. #define LOAD_ADDRESS_ENV_SETTINGS \
  135. "kernel_addr_r=" KERNEL_ADDR_R "\0" \
  136. "fdt_addr_r=" FDT_ADDR_R "\0" \
  137. "ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \
  138. "scriptaddr=" SCRIPT_ADDR_R "\0" \
  139. "pxefile_addr_r=" PXEFILE_ADDR_R "\0"
  140. #include <config_distro_bootcmd.h>
  141. #define CONFIG_EXTRA_ENV_SETTINGS \
  142. RELOCATION_LIMITS_ENV_SETTINGS \
  143. LOAD_ADDRESS_ENV_SETTINGS \
  144. "console=ttyS0,115200\0" \
  145. BOOTENV
  146. #endif /* CONFIG_SPL_BUILD */
  147. #endif /* _CONFIG_CLEARFOG_H */