socfpga_soc64_common.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. /*
  46. * QSPI support
  47. */
  48. #ifdef CONFIG_CADENCE_QSPI
  49. /* Enable it if you want to use dual-stacked mode */
  50. /*#define CONFIG_QSPI_RBF_ADDR 0x720000*/
  51. /* Flash device info */
  52. /*#define CONFIG_ENV_IS_IN_SPI_FLASH*/
  53. #ifndef CONFIG_SPL_BUILD
  54. #define CONFIG_MTD_PARTITIONS
  55. #define MTDIDS_DEFAULT "nor0=ff705000.spi.0"
  56. #endif /* CONFIG_SPL_BUILD */
  57. #ifndef __ASSEMBLY__
  58. unsigned int cm_get_qspi_controller_clk_hz(void);
  59. #define CONFIG_CQSPI_REF_CLK cm_get_qspi_controller_clk_hz()
  60. #endif
  61. #endif /* CONFIG_CADENCE_QSPI */
  62. /*
  63. * Boot arguments passed to the boot command. The value of
  64. * CONFIG_BOOTARGS goes into the environment value "bootargs".
  65. * Do note the value will override also the chosen node in FDT blob.
  66. */
  67. #define CONFIG_BOOTCOMMAND "run fatscript; run mmcload;run linux_qspi_enable;" \
  68. "run mmcboot"
  69. #define CONFIG_EXTRA_ENV_SETTINGS \
  70. "loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
  71. "bootfile=Image\0" \
  72. "fdt_addr=8000000\0" \
  73. "fdtimage=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
  74. "mmcroot=/dev/mmcblk0p2\0" \
  75. "mmcboot=setenv bootargs " CONFIG_BOOTARGS \
  76. " root=${mmcroot} rw rootwait;" \
  77. "booti ${loadaddr} - ${fdt_addr}\0" \
  78. "mmcload=mmc rescan;" \
  79. "load mmc 0:1 ${loadaddr} ${bootfile};" \
  80. "load mmc 0:1 ${fdt_addr} ${fdtimage}\0" \
  81. "linux_qspi_enable=if sf probe; then " \
  82. "echo Enabling QSPI at Linux DTB...;" \
  83. "fdt addr ${fdt_addr}; fdt resize;" \
  84. "fdt set /soc/spi@ff8d2000 status okay;" \
  85. "fdt set /soc/clkmgr/clocks/qspi_clk clock-frequency " \
  86. " ${qspi_clock}; fi; \0" \
  87. "scriptaddr=0x02100000\0" \
  88. "scriptfile=u-boot.scr\0" \
  89. "fatscript=if fatload mmc 0:1 ${scriptaddr} ${scriptfile};" \
  90. "then source ${scriptaddr}; fi\0" \
  91. "socfpga_legacy_reset_compat=1\0"
  92. /*
  93. * Generic Interrupt Controller Definitions
  94. */
  95. #define CONFIG_GICV2
  96. /*
  97. * External memory configurations
  98. */
  99. #define PHYS_SDRAM_1 0x0
  100. #define PHYS_SDRAM_1_SIZE (1 * 1024 * 1024 * 1024)
  101. #define CONFIG_SYS_SDRAM_BASE 0
  102. /*
  103. * Serial / UART configurations
  104. */
  105. #define CONFIG_SYS_NS16550_CLK 100000000
  106. #define CONFIG_SYS_NS16550_MEM32
  107. /*
  108. * Timer & watchdog configurations
  109. */
  110. #define COUNTER_FREQUENCY 400000000
  111. /*
  112. * SDMMC configurations
  113. */
  114. #ifdef CONFIG_CMD_MMC
  115. #define CONFIG_SYS_MMC_MAX_BLK_COUNT 256
  116. #endif
  117. /*
  118. * Flash configurations
  119. */
  120. #define CONFIG_SYS_MAX_FLASH_BANKS 1
  121. /* Ethernet on SoC (EMAC) */
  122. #if defined(CONFIG_CMD_NET)
  123. #define CONFIG_DW_ALTDESCRIPTOR
  124. #endif /* CONFIG_CMD_NET */
  125. /*
  126. * L4 Watchdog
  127. */
  128. #ifndef CONFIG_SPL_BUILD
  129. #undef CONFIG_HW_WATCHDOG
  130. #undef CONFIG_DESIGNWARE_WATCHDOG
  131. #endif
  132. #define CONFIG_DW_WDT_BASE SOCFPGA_L4WD0_ADDRESS
  133. #ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
  134. #ifndef __ASSEMBLY__
  135. unsigned int cm_get_l4_sys_free_clk_hz(void);
  136. #define CONFIG_DW_WDT_CLOCK_KHZ (cm_get_l4_sys_free_clk_hz() / 1000)
  137. #endif
  138. #else
  139. #define CONFIG_DW_WDT_CLOCK_KHZ 100000
  140. #endif
  141. /*
  142. * SPL memory layout
  143. *
  144. * On chip RAM
  145. * 0xFFE0_0000 ...... Start of OCRAM
  146. * SPL code, rwdata
  147. * empty space
  148. * 0xFFEx_xxxx ...... Top of stack (grows down)
  149. * 0xFFEy_yyyy ...... Global Data
  150. * 0xFFEz_zzzz ...... Malloc prior relocation (size CONFIG_SYS_MALLOC_F_LEN)
  151. * 0xFFE3_F000 ...... Hardware handdoff blob (size 4KB)
  152. * 0xFFE3_FFFF ...... End of OCRAM
  153. *
  154. * SDRAM
  155. * 0x0000_0000 ...... Start of SDRAM_1
  156. * unused / empty space for image loading
  157. * Size 64MB ...... MALLOC (size CONFIG_SYS_SPL_MALLOC_SIZE)
  158. * Size 1MB ...... BSS (size CONFIG_SPL_BSS_MAX_SIZE)
  159. * 0x8000_0000 ...... End of SDRAM_1 (assume 2GB)
  160. *
  161. */
  162. #define CONFIG_SPL_TARGET "spl/u-boot-spl.hex"
  163. #define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZE
  164. #define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR
  165. #define CONFIG_SPL_BSS_MAX_SIZE 0x100000 /* 1 MB */
  166. #define CONFIG_SPL_BSS_START_ADDR (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE \
  167. - CONFIG_SPL_BSS_MAX_SIZE)
  168. #define CONFIG_SYS_SPL_MALLOC_SIZE (CONFIG_SYS_MALLOC_LEN)
  169. #define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SPL_BSS_START_ADDR \
  170. - CONFIG_SYS_SPL_MALLOC_SIZE)
  171. /* SPL SDMMC boot support */
  172. #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img"
  173. #endif /* __CONFIG_SOCFPGA_SOC64_COMMON_H__ */