socfpga_arria5_secu1.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2017-2020 ABB
  4. *
  5. */
  6. #ifndef __CONFIG_SOCFPGA_SECU1_H__
  7. #define __CONFIG_SOCFPGA_SECU1_H__
  8. #include <asm/arch/base_addr_ac5.h>
  9. #include <linux/stringify.h>
  10. /* Call misc_init_r */
  11. #define CONFIG_MISC_INIT_R
  12. #define CONFIG_HUSH_INIT_VAR
  13. /* Eternal oscillator */
  14. #define CONFIG_SYS_TIMER_RATE 40000000
  15. /* Memory configurations */
  16. #define PHYS_SDRAM_1_SIZE 0x20000000 /* 512MiB on SECU1 */
  17. /*
  18. * We use bootcounter in i2c nvram of the RTC (0x68)
  19. * The offset fopr the bootcounter is 0x9e, which are
  20. * the last two bytes of the 128 bytes large NVRAM in the
  21. * RTC which begin at address 0x20
  22. */
  23. #define CONFIG_SYS_I2C_RTC_ADDR 0x68
  24. /* Booting Linux */
  25. #define CONFIG_BOOTDELAY 2
  26. #define CONFIG_BOOTFILE "zImage"
  27. #define CONFIG_BOOTARGS \
  28. "console=ttyS0," __stringify(CONFIG_BAUDRATE) \
  29. " ubi.fm_autoconvert=1" \
  30. " uio_pdrv_genirq.of_id=\"idq,regbank\""
  31. #define CONFIG_BOOTCOMMAND \
  32. "setenv bootcmd '" \
  33. "bridge enable; " \
  34. "if test ${bootnum} = \"b\"; " \
  35. "then run _fpga_loadsafe; " \
  36. "else if test ${bootcount} -eq 4; then echo \"Switching copy...\"; setexpr x $bootnum % 2 && setexpr bootnum $x + 1; saveenv; fi; " \
  37. "run _fpga_loaduser; " \
  38. "fi;" \
  39. "echo \"Booting bank $bootnum\" && run userload && run userboot;" \
  40. "' && " \
  41. "setenv altbootcmd 'setenv bootnum b && saveenv && boot;' && " \
  42. "saveenv && saveenv && boot;"
  43. #define CONFIG_CMDLINE_TAG
  44. #define CONFIG_SYS_BOOTM_LEN (64 << 20)
  45. /* Environment settings */
  46. #define CONFIG_ENV_OVERWRITE
  47. /*
  48. * Autoboot
  49. *
  50. * After 45s of inactivity in the prompt, the board will reset.
  51. * Set 'bootretry' in the environment to -1 to disable this behavior
  52. */
  53. #define CONFIG_BOOT_RETRY_TIME 45
  54. #define CONFIG_RESET_TO_RETRY
  55. #define CONFIG_LOADADDR 0x01000000
  56. #define CONFIG_SYS_LOAD_ADDR CONFIG_KM_KERNEL_ADDR
  57. /*
  58. * FPGA Remote Update related environment
  59. *
  60. * Note that since those commands access the FPGA, the HPS-to-FPGA
  61. * bridges MUST have been previously enabled (for example
  62. * with 'bridge enable').
  63. */
  64. #define FPGA_RMTU_ENV \
  65. "rmtu_page=0xFF29000C\0" \
  66. "rmtu_reconfig=0xFF290018\0" \
  67. "fpga_safebase=0x0\0" \
  68. "fpga_userbase=0x2000000\0" \
  69. "_fpga_loaduser=echo Loading FPGA USER image..." \
  70. " && mw ${rmtu_page} ${fpga_userbase} && mw ${rmtu_reconfig} 1\0" \
  71. "_fpga_loadsafe=echo Loading FPGA SAFE image..." \
  72. " && mw ${rmtu_page} ${fpga_safebase} && mw ${rmtu_reconfig} 1\0" \
  73. #define CONFIG_KM_NEW_ENV \
  74. "newenv=" \
  75. "nand erase 0x100000 0x40000\0"
  76. #define CONFIG_KM_DEF_ENV_BOOTTARGETS \
  77. "release=" \
  78. "run newenv; reset\0" \
  79. "develop=" \
  80. "tftp 0x200000 scripts/develop-secu.txt && env import -t 0x200000 ${filesize} && saveenv && reset\0"
  81. #define CONFIG_EXTRA_ENV_SETTINGS \
  82. FPGA_RMTU_ENV \
  83. CONFIG_KM_DEF_ENV_BOOTTARGETS \
  84. CONFIG_KM_NEW_ENV \
  85. "socfpga_legacy_reset_compat=1\0" \
  86. "altbootcmd=run bootcmd;\0" \
  87. "bootlimit=6\0" \
  88. "bootnum=1\0" \
  89. "bootretry=" __stringify(CONFIG_BOOT_RETRY_TIME) "\0" \
  90. "fdt_addr=" __stringify(CONFIG_KM_FDT_ADDR) "\0" \
  91. "load=tftpboot ${loadaddr} u-boot-with-nand-spl.sfp\0" \
  92. "loadaddr=" __stringify(CONFIG_KM_KERNEL_ADDR) "\0" \
  93. "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
  94. "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
  95. "update=nand erase 0x0 0x00100000 && nand write ${loadaddr} 0x0 ${filesize}\0" \
  96. "userload=ubi part nand.ubi &&" \
  97. "ubi check rootfs$bootnum &&" \
  98. "ubi read $fdt_addr dtb$bootnum &&" \
  99. "ubi read $loadaddr kernel$bootnum\0" \
  100. "userboot=setenv bootargs " CONFIG_BOOTARGS \
  101. " ubi.mtd=1 ubi.block=0,rootfs$bootnum root=/dev/ubiblock0_$ubivolid" \
  102. " ro rootfstype=squashfs init=sbin/preinit;" \
  103. "bootz ${loadaddr} - ${fdt_addr}\0" \
  104. "verify=y\0"
  105. /* The rest of the configuration is shared */
  106. #include <configs/socfpga_common.h>
  107. #ifdef CONFIG_SPL_NAND_SUPPORT
  108. #undef CONFIG_SYS_NAND_U_BOOT_OFFS
  109. #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000
  110. #endif
  111. #undef CONFIG_WATCHDOG_TIMEOUT_MSECS
  112. #define CONFIG_WATCHDOG_TIMEOUT_MSECS 60000
  113. #endif /* __CONFIG_SOCFPGA_SECU1_H__ */