socfpga_soc64_common.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /* SPDX-License-Identifier: GPL-2.0
  2. *
  3. * Copyright (C) 2017-2019 Intel Corporation <www.intel.com>
  4. *
  5. */
  6. #ifndef __CONFIG_SOCFPGA_SOC64_COMMON_H__
  7. #define __CONFIG_SOCFPGA_SOC64_COMMON_H__
  8. #include <asm/arch/base_addr_s10.h>
  9. #include <asm/arch/handoff_s10.h>
  10. #include <linux/stringify.h>
  11. /*
  12. * U-Boot general configurations
  13. */
  14. #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE
  15. #define CONFIG_LOADADDR 0x2000000
  16. #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
  17. #define CONFIG_REMAKE_ELF
  18. /* sysmgr.boot_scratch_cold4 & 5 (64bit) will be used for PSCI_CPU_ON call */
  19. #define CPU_RELEASE_ADDR 0xFFD12210
  20. #define CONFIG_SYS_CACHELINE_SIZE 64
  21. #define CONFIG_SYS_MEM_RESERVE_SECURE 0 /* using OCRAM, not DDR */
  22. /*
  23. * U-Boot console configurations
  24. */
  25. #define CONFIG_SYS_MAXARGS 64
  26. #define CONFIG_SYS_CBSIZE 2048
  27. #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
  28. sizeof(CONFIG_SYS_PROMPT) + 16)
  29. #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
  30. /* Extend size of kernel image for uncompression */
  31. #define CONFIG_SYS_BOOTM_LEN (32 * 1024 * 1024)
  32. /*
  33. * U-Boot run time memory configurations
  34. */
  35. #define CONFIG_SYS_INIT_RAM_ADDR 0xFFE00000
  36. #define CONFIG_SYS_INIT_RAM_SIZE 0x40000
  37. #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR \
  38. + CONFIG_SYS_INIT_RAM_SIZE \
  39. - S10_HANDOFF_SIZE)
  40. #define CONFIG_SYS_INIT_SP_OFFSET (CONFIG_SYS_INIT_SP_ADDR)
  41. #define CONFIG_SYS_MALLOC_LEN (5 * 1024 * 1024)
  42. /*
  43. * U-Boot environment configurations
  44. */
  45. #define CONFIG_SYS_MMC_ENV_DEV 0 /* device 0 */
  46. /*
  47. * QSPI support
  48. */
  49. #ifdef CONFIG_CADENCE_QSPI
  50. /* Enable it if you want to use dual-stacked mode */
  51. /*#define CONFIG_QSPI_RBF_ADDR 0x720000*/
  52. /* Flash device info */
  53. /*#define CONFIG_ENV_IS_IN_SPI_FLASH*/
  54. #ifndef CONFIG_SPL_BUILD
  55. #define CONFIG_MTD_PARTITIONS
  56. #define MTDIDS_DEFAULT "nor0=ff705000.spi.0"
  57. #endif /* CONFIG_SPL_BUILD */
  58. #ifndef __ASSEMBLY__
  59. unsigned int cm_get_qspi_controller_clk_hz(void);
  60. #define CONFIG_CQSPI_REF_CLK cm_get_qspi_controller_clk_hz()
  61. #endif
  62. #endif /* CONFIG_CADENCE_QSPI */
  63. /*
  64. * Boot arguments passed to the boot command. The value of
  65. * CONFIG_BOOTARGS goes into the environment value "bootargs".
  66. * Do note the value will override also the chosen node in FDT blob.
  67. */
  68. #define CONFIG_BOOTCOMMAND "run fatscript; run mmcload;run linux_qspi_enable;" \
  69. "run mmcboot"
  70. #define CONFIG_EXTRA_ENV_SETTINGS \
  71. "loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
  72. "bootfile=Image\0" \
  73. "fdt_addr=8000000\0" \
  74. "fdtimage=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
  75. "mmcroot=/dev/mmcblk0p2\0" \
  76. "mmcboot=setenv bootargs " CONFIG_BOOTARGS \
  77. " root=${mmcroot} rw rootwait;" \
  78. "booti ${loadaddr} - ${fdt_addr}\0" \
  79. "mmcload=mmc rescan;" \
  80. "load mmc 0:1 ${loadaddr} ${bootfile};" \
  81. "load mmc 0:1 ${fdt_addr} ${fdtimage}\0" \
  82. "linux_qspi_enable=if sf probe; then " \
  83. "echo Enabling QSPI at Linux DTB...;" \
  84. "fdt addr ${fdt_addr}; fdt resize;" \
  85. "fdt set /soc/spi@ff8d2000 status okay;" \
  86. "fdt set /soc/clkmgr/clocks/qspi_clk clock-frequency " \
  87. " ${qspi_clock}; fi; \0" \
  88. "scriptaddr=0x02100000\0" \
  89. "scriptfile=u-boot.scr\0" \
  90. "fatscript=if fatload mmc 0:1 ${scriptaddr} ${scriptfile};" \
  91. "then source ${scriptaddr}; fi\0" \
  92. "socfpga_legacy_reset_compat=1\0"
  93. /*
  94. * Generic Interrupt Controller Definitions
  95. */
  96. #define CONFIG_GICV2
  97. /*
  98. * External memory configurations
  99. */
  100. #define PHYS_SDRAM_1 0x0
  101. #define PHYS_SDRAM_1_SIZE (1 * 1024 * 1024 * 1024)
  102. #define CONFIG_SYS_SDRAM_BASE 0
  103. /*
  104. * Serial / UART configurations
  105. */
  106. #define CONFIG_SYS_NS16550_CLK 100000000
  107. #define CONFIG_SYS_NS16550_MEM32
  108. /*
  109. * Timer & watchdog configurations
  110. */
  111. #define COUNTER_FREQUENCY 400000000
  112. /*
  113. * SDMMC configurations
  114. */
  115. #ifdef CONFIG_CMD_MMC
  116. #define CONFIG_SYS_MMC_MAX_BLK_COUNT 256
  117. #endif
  118. /*
  119. * Flash configurations
  120. */
  121. #define CONFIG_SYS_MAX_FLASH_BANKS 1
  122. /* Ethernet on SoC (EMAC) */
  123. #if defined(CONFIG_CMD_NET)
  124. #define CONFIG_DW_ALTDESCRIPTOR
  125. #endif /* CONFIG_CMD_NET */
  126. /*
  127. * L4 Watchdog
  128. */
  129. #ifndef CONFIG_SPL_BUILD
  130. #undef CONFIG_HW_WATCHDOG
  131. #undef CONFIG_DESIGNWARE_WATCHDOG
  132. #endif
  133. #define CONFIG_DW_WDT_BASE SOCFPGA_L4WD0_ADDRESS
  134. #ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
  135. #ifndef __ASSEMBLY__
  136. unsigned int cm_get_l4_sys_free_clk_hz(void);
  137. #define CONFIG_DW_WDT_CLOCK_KHZ (cm_get_l4_sys_free_clk_hz() / 1000)
  138. #endif
  139. #else
  140. #define CONFIG_DW_WDT_CLOCK_KHZ 100000
  141. #endif
  142. /*
  143. * SPL memory layout
  144. *
  145. * On chip RAM
  146. * 0xFFE0_0000 ...... Start of OCRAM
  147. * SPL code, rwdata
  148. * empty space
  149. * 0xFFEx_xxxx ...... Top of stack (grows down)
  150. * 0xFFEy_yyyy ...... Global Data
  151. * 0xFFEz_zzzz ...... Malloc prior relocation (size CONFIG_SYS_MALLOC_F_LEN)
  152. * 0xFFE3_F000 ...... Hardware handdoff blob (size 4KB)
  153. * 0xFFE3_FFFF ...... End of OCRAM
  154. *
  155. * SDRAM
  156. * 0x0000_0000 ...... Start of SDRAM_1
  157. * unused / empty space for image loading
  158. * Size 64MB ...... MALLOC (size CONFIG_SYS_SPL_MALLOC_SIZE)
  159. * Size 1MB ...... BSS (size CONFIG_SPL_BSS_MAX_SIZE)
  160. * 0x8000_0000 ...... End of SDRAM_1 (assume 2GB)
  161. *
  162. */
  163. #define CONFIG_SPL_TARGET "spl/u-boot-spl.hex"
  164. #define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZE
  165. #define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR
  166. #define CONFIG_SPL_BSS_MAX_SIZE 0x100000 /* 1 MB */
  167. #define CONFIG_SPL_BSS_START_ADDR (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE \
  168. - CONFIG_SPL_BSS_MAX_SIZE)
  169. #define CONFIG_SYS_SPL_MALLOC_SIZE (CONFIG_SYS_MALLOC_LEN)
  170. #define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SPL_BSS_START_ADDR \
  171. - CONFIG_SYS_SPL_MALLOC_SIZE)
  172. /* SPL SDMMC boot support */
  173. #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1
  174. #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img"
  175. #endif /* __CONFIG_SOCFPGA_SOC64_COMMON_H__ */