clearfog.h 4.8 KB

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