uniphier.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. /*
  2. * Copyright (C) 2012-2015 Panasonic Corporation
  3. * Copyright (C) 2015-2016 Socionext Inc.
  4. * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. /* U-Boot - Common settings for UniPhier Family */
  9. #ifndef __CONFIG_UNIPHIER_COMMON_H__
  10. #define __CONFIG_UNIPHIER_COMMON_H__
  11. #define CONFIG_ARMV7_PSCI_1_0
  12. /*-----------------------------------------------------------------------
  13. * MMU and Cache Setting
  14. *----------------------------------------------------------------------*/
  15. /* Comment out the following to enable L1 cache */
  16. /* #define CONFIG_SYS_ICACHE_OFF */
  17. /* #define CONFIG_SYS_DCACHE_OFF */
  18. #define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024)
  19. #define CONFIG_TIMESTAMP
  20. /* FLASH related */
  21. #define CONFIG_MTD_DEVICE
  22. #define CONFIG_FLASH_CFI_DRIVER
  23. #define CONFIG_SYS_FLASH_CFI
  24. #define CONFIG_SYS_MAX_FLASH_SECT 256
  25. #define CONFIG_SYS_MONITOR_BASE 0
  26. #define CONFIG_SYS_MONITOR_LEN 0x00080000 /* 512KB */
  27. #define CONFIG_SYS_FLASH_BASE 0
  28. /*
  29. * flash_toggle does not work for our support card.
  30. * We need to use flash_status_poll.
  31. */
  32. #define CONFIG_SYS_CFI_FLASH_STATUS_POLL
  33. #define CONFIG_FLASH_SHOW_PROGRESS 45 /* count down from 45/5: 9..1 */
  34. #define CONFIG_SYS_MAX_FLASH_BANKS_DETECT 1
  35. /* serial console configuration */
  36. #define CONFIG_SYS_LONGHELP /* undef to save memory */
  37. #define CONFIG_CMDLINE_EDITING /* add command line history */
  38. #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
  39. /* Boot Argument Buffer Size */
  40. #define CONFIG_SYS_BARGSIZE (CONFIG_SYS_CBSIZE)
  41. #define CONFIG_CONS_INDEX 1
  42. #define CONFIG_ENV_OFFSET 0x100000
  43. #define CONFIG_ENV_SIZE 0x2000
  44. /* #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) */
  45. #define CONFIG_SYS_MMC_ENV_DEV 0
  46. #define CONFIG_SYS_MMC_ENV_PART 1
  47. #if !defined(CONFIG_ARM64)
  48. /* Time clock 1MHz */
  49. #define CONFIG_SYS_TIMER_RATE 1000000
  50. #endif
  51. #define CONFIG_SYS_MAX_NAND_DEVICE 1
  52. #define CONFIG_SYS_NAND_ONFI_DETECTION
  53. #define CONFIG_NAND_DENALI_ECC_SIZE 1024
  54. #define CONFIG_SYS_NAND_REGS_BASE 0x68100000
  55. #define CONFIG_SYS_NAND_DATA_BASE 0x68000000
  56. #define CONFIG_SYS_NAND_USE_FLASH_BBT
  57. #define CONFIG_SYS_NAND_BAD_BLOCK_POS 0
  58. /* SD/MMC */
  59. #define CONFIG_SUPPORT_EMMC_BOOT
  60. /* memtest works on */
  61. #define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE
  62. #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_SDRAM_BASE + 0x01000000)
  63. /*
  64. * Network Configuration
  65. */
  66. #define CONFIG_SERVERIP 192.168.11.1
  67. #define CONFIG_IPADDR 192.168.11.10
  68. #define CONFIG_GATEWAYIP 192.168.11.1
  69. #define CONFIG_NETMASK 255.255.255.0
  70. #define CONFIG_LOADADDR 0x84000000
  71. #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
  72. #define CONFIG_SYS_BOOTM_LEN (32 << 20)
  73. #define CONFIG_CMDLINE_EDITING /* add command line history */
  74. #if defined(CONFIG_ARM64)
  75. /* ARM Trusted Firmware */
  76. #define BOOT_IMAGES \
  77. "second_image=unph_bl.bin\0" \
  78. "third_image=fip.bin\0"
  79. #else
  80. #define BOOT_IMAGES \
  81. "second_image=u-boot-spl.bin\0" \
  82. "third_image=u-boot.bin\0"
  83. #endif
  84. #define CONFIG_BOOTCOMMAND "run $bootmode"
  85. #define CONFIG_ROOTPATH "/nfs/root/path"
  86. #define CONFIG_NFSBOOTCOMMAND \
  87. "setenv bootargs $bootargs root=/dev/nfs rw " \
  88. "nfsroot=$serverip:$rootpath " \
  89. "ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off;" \
  90. "run __nfsboot"
  91. #ifdef CONFIG_FIT
  92. #define CONFIG_BOOTFILE "fitImage"
  93. #define LINUXBOOT_ENV_SETTINGS \
  94. "fit_addr=0x00100000\0" \
  95. "fit_addr_r=0x84100000\0" \
  96. "fit_size=0x00f00000\0" \
  97. "norboot=setexpr fit_addr $nor_base + $fit_addr &&" \
  98. "bootm $fit_addr\0" \
  99. "nandboot=nand read $fit_addr_r $fit_addr $fit_size &&" \
  100. "bootm $fit_addr_r\0" \
  101. "tftpboot=tftpboot $fit_addr_r $bootfile &&" \
  102. "bootm $fit_addr_r\0" \
  103. "__nfsboot=run tftpboot\0"
  104. #else
  105. #ifdef CONFIG_ARM64
  106. #define CONFIG_BOOTFILE "Image.gz"
  107. #define LINUXBOOT_CMD "booti"
  108. #define KERNEL_ADDR_LOAD "kernel_addr_load=0x84200000\0"
  109. #define KERNEL_ADDR_R "kernel_addr_r=0x82080000\0"
  110. #else
  111. #define CONFIG_BOOTFILE "zImage"
  112. #define LINUXBOOT_CMD "bootz"
  113. #define KERNEL_ADDR_LOAD "kernel_addr_load=0x80208000\0"
  114. #define KERNEL_ADDR_R "kernel_addr_r=0x80208000\0"
  115. #endif
  116. #define LINUXBOOT_ENV_SETTINGS \
  117. "fdt_addr=0x00100000\0" \
  118. "fdt_addr_r=0x84100000\0" \
  119. "fdt_size=0x00008000\0" \
  120. "kernel_addr=0x00200000\0" \
  121. KERNEL_ADDR_LOAD \
  122. KERNEL_ADDR_R \
  123. "kernel_size=0x00800000\0" \
  124. "ramdisk_addr=0x00a00000\0" \
  125. "ramdisk_addr_r=0x84a00000\0" \
  126. "ramdisk_size=0x00600000\0" \
  127. "ramdisk_file=rootfs.cpio.uboot\0" \
  128. "boot_common=setexpr bootm_low $kernel_addr_r '&' fe000000 && " \
  129. "if test $kernel_addr_load = $kernel_addr_r; then " \
  130. "true; " \
  131. "else " \
  132. "unzip $kernel_addr_load $kernel_addr_r; " \
  133. "fi && " \
  134. LINUXBOOT_CMD " $kernel_addr_r $ramdisk_addr_r $fdt_addr_r\0" \
  135. "norboot=setexpr kernel_addr_nor $nor_base + $kernel_addr && " \
  136. "setexpr kernel_size_div4 $kernel_size / 4 && " \
  137. "cp $kernel_addr_nor $kernel_addr_load $kernel_size_div4 && " \
  138. "setexpr ramdisk_addr_nor $nor_base + $ramdisk_addr && " \
  139. "setexpr ramdisk_size_div4 $ramdisk_size / 4 && " \
  140. "cp $ramdisk_addr_nor $ramdisk_addr_r $ramdisk_size_div4 && " \
  141. "setexpr fdt_addr_nor $nor_base + $fdt_addr && " \
  142. "setexpr fdt_size_div4 $fdt_size / 4 && " \
  143. "cp $fdt_addr_nor $fdt_addr_r $fdt_size_div4 && " \
  144. "run boot_common\0" \
  145. "nandboot=nand read $kernel_addr_load $kernel_addr $kernel_size && " \
  146. "nand read $ramdisk_addr_r $ramdisk_addr $ramdisk_size &&" \
  147. "nand read $fdt_addr_r $fdt_addr $fdt_size &&" \
  148. "run boot_common\0" \
  149. "tftpboot=tftpboot $kernel_addr_load $bootfile && " \
  150. "tftpboot $ramdisk_addr_r $ramdisk_file &&" \
  151. "tftpboot $fdt_addr_r $fdt_file &&" \
  152. "run boot_common\0" \
  153. "__nfsboot=tftpboot $kernel_addr_load $bootfile && " \
  154. "tftpboot $fdt_addr_r $fdt_file &&" \
  155. "setenv ramdisk_addr_r - &&" \
  156. "run boot_common\0"
  157. #endif
  158. #define CONFIG_EXTRA_ENV_SETTINGS \
  159. "netdev=eth0\0" \
  160. "initrd_high=0xffffffffffffffff\0" \
  161. "nor_base=0x42000000\0" \
  162. "sramupdate=setexpr tmp_addr $nor_base + 0x50000 &&" \
  163. "tftpboot $tmp_addr $second_image && " \
  164. "setexpr tmp_addr $nor_base + 0x70000 && " \
  165. "tftpboot $tmp_addr $third_image\0" \
  166. "emmcupdate=mmcsetn &&" \
  167. "mmc partconf $mmc_first_dev 0 1 1 &&" \
  168. "tftpboot $second_image && " \
  169. "mmc write $loadaddr 0 100 && " \
  170. "tftpboot $third_image && " \
  171. "mmc write $loadaddr 100 700\0" \
  172. "nandupdate=nand erase 0 0x00100000 &&" \
  173. "tftpboot $second_image && " \
  174. "nand write $loadaddr 0 0x00020000 && " \
  175. "tftpboot $third_image && " \
  176. "nand write $loadaddr 0x00020000 0x000e0000\0" \
  177. "usbupdate=usb start &&" \
  178. "tftpboot $second_image && " \
  179. "usb write $loadaddr 0 100 && " \
  180. "tftpboot $third_image && " \
  181. "usb write $loadaddr 100 700\0" \
  182. BOOT_IMAGES \
  183. LINUXBOOT_ENV_SETTINGS
  184. #define CONFIG_SYS_BOOTMAPSZ 0x20000000
  185. #define CONFIG_SYS_SDRAM_BASE 0x80000000
  186. #define CONFIG_NR_DRAM_BANKS 3
  187. /* for LD20; the last 64 byte is used for dynamic DDR PHY training */
  188. #define CONFIG_SYS_MEM_TOP_HIDE 64
  189. #define CONFIG_PANIC_HANG
  190. #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE)
  191. /* only for SPL */
  192. #if defined(CONFIG_ARCH_UNIPHIER_LD4) || \
  193. defined(CONFIG_ARCH_UNIPHIER_SLD8)
  194. #define CONFIG_SPL_TEXT_BASE 0x00040000
  195. #else
  196. #define CONFIG_SPL_TEXT_BASE 0x00100000
  197. #endif
  198. #define CONFIG_SPL_STACK (0x00100000)
  199. #define CONFIG_SPL_FRAMEWORK
  200. #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x20000
  201. /* subtract sizeof(struct image_header) */
  202. #define CONFIG_SYS_UBOOT_BASE (0x70000 - 0x40)
  203. #define CONFIG_SPL_TARGET "u-boot-with-spl.bin"
  204. #define CONFIG_SPL_MAX_FOOTPRINT 0x10000
  205. #define CONFIG_SPL_MAX_SIZE 0x10000
  206. #define CONFIG_SPL_BSS_MAX_SIZE 0x2000
  207. #define CONFIG_SPL_PAD_TO 0x20000
  208. #endif /* __CONFIG_UNIPHIER_COMMON_H__ */