uniphier.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2012-2015 Panasonic Corporation
  4. * Copyright (C) 2015-2016 Socionext Inc.
  5. * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
  6. */
  7. /* U-Boot - Common settings for UniPhier Family */
  8. #ifndef __CONFIG_UNIPHIER_COMMON_H__
  9. #define __CONFIG_UNIPHIER_COMMON_H__
  10. #ifndef CONFIG_SPL_BUILD
  11. #include <config_distro_bootcmd.h>
  12. #ifdef CONFIG_CMD_MMC
  13. #define BOOT_TARGET_DEVICE_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1)
  14. #else
  15. #define BOOT_TARGET_DEVICE_MMC(func)
  16. #endif
  17. #ifdef CONFIG_CMD_UBIFS
  18. #define BOOT_TARGET_DEVICE_UBIFS(func) func(UBIFS, ubifs, 0)
  19. #else
  20. #define BOOT_TARGET_DEVICE_UBIFS(func)
  21. #endif
  22. #ifdef CONFIG_CMD_USB
  23. #define BOOT_TARGET_DEVICE_USB(func) func(USB, usb, 0)
  24. #else
  25. #define BOOT_TARGET_DEVICE_USB(func)
  26. #endif
  27. #define BOOT_TARGET_DEVICES(func) \
  28. BOOT_TARGET_DEVICE_MMC(func) \
  29. BOOT_TARGET_DEVICE_UBIFS(func) \
  30. BOOT_TARGET_DEVICE_USB(func)
  31. #else
  32. #define BOOTENV
  33. #endif
  34. #define CONFIG_ARMV7_PSCI_1_0
  35. /*-----------------------------------------------------------------------
  36. * MMU and Cache Setting
  37. *----------------------------------------------------------------------*/
  38. #define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024)
  39. #define CONFIG_TIMESTAMP
  40. /* FLASH related */
  41. #define CONFIG_SYS_MAX_FLASH_SECT 256
  42. #define CONFIG_SYS_MONITOR_BASE 0
  43. #define CONFIG_SYS_MONITOR_LEN 0x000d0000 /* 832KB */
  44. #define CONFIG_SYS_FLASH_BASE 0
  45. /*
  46. * flash_toggle does not work for our support card.
  47. * We need to use flash_status_poll.
  48. */
  49. #define CONFIG_SYS_CFI_FLASH_STATUS_POLL
  50. #define CONFIG_FLASH_SHOW_PROGRESS 45 /* count down from 45/5: 9..1 */
  51. #define CONFIG_SYS_MAX_FLASH_BANKS_DETECT 1
  52. /* serial console configuration */
  53. #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
  54. /* Boot Argument Buffer Size */
  55. #define CONFIG_SYS_BARGSIZE (CONFIG_SYS_CBSIZE)
  56. #define CONFIG_SYS_MMC_ENV_DEV 0
  57. #define CONFIG_SYS_MMC_ENV_PART 1
  58. #if !defined(CONFIG_ARM64)
  59. /* Time clock 1MHz */
  60. #define CONFIG_SYS_TIMER_RATE 1000000
  61. #endif
  62. #define CONFIG_SYS_MAX_NAND_DEVICE 1
  63. #define CONFIG_SYS_NAND_ONFI_DETECTION
  64. #define CONFIG_SYS_NAND_REGS_BASE 0x68100000
  65. #define CONFIG_SYS_NAND_DATA_BASE 0x68000000
  66. #define CONFIG_SYS_NAND_BAD_BLOCK_POS 0
  67. /*
  68. * Network Configuration
  69. */
  70. #define CONFIG_SERVERIP 192.168.11.1
  71. #define CONFIG_IPADDR 192.168.11.10
  72. #define CONFIG_GATEWAYIP 192.168.11.1
  73. #define CONFIG_NETMASK 255.255.255.0
  74. #define CONFIG_SYS_LOAD_ADDR 0x85000000
  75. #define CONFIG_SYS_BOOTM_LEN (32 << 20)
  76. #if defined(CONFIG_ARM64)
  77. /* ARM Trusted Firmware */
  78. #define BOOT_IMAGES \
  79. "second_image=unph_bl.bin\0" \
  80. "third_image=fip.bin\0"
  81. #else
  82. #define BOOT_IMAGES \
  83. "second_image=u-boot-spl.bin\0" \
  84. "third_image=u-boot.bin\0"
  85. #endif
  86. #define CONFIG_ROOTPATH "/nfs/root/path"
  87. #define CONFIG_NFSBOOTCOMMAND \
  88. "setenv bootargs $bootargs root=/dev/nfs rw " \
  89. "nfsroot=$serverip:$rootpath " \
  90. "ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off;" \
  91. "run __nfsboot"
  92. #ifdef CONFIG_FIT
  93. #define CONFIG_BOOTFILE "fitImage"
  94. #define KERNEL_ADDR_R_OFFSET "0x05100000"
  95. #define LINUXBOOT_ENV_SETTINGS \
  96. "tftpboot=tftpboot $kernel_addr_r $bootfile &&" \
  97. "bootm $kernel_addr_r\0" \
  98. "__nfsboot=run tftpboot\0"
  99. #else
  100. #ifdef CONFIG_ARM64
  101. #define CONFIG_BOOTFILE "Image"
  102. #define LINUXBOOT_CMD "booti"
  103. #define KERNEL_ADDR_R_OFFSET "0x02080000"
  104. #else
  105. #define CONFIG_BOOTFILE "zImage"
  106. #define LINUXBOOT_CMD "bootz"
  107. #define KERNEL_ADDR_R_OFFSET "0x00208000"
  108. #endif
  109. #define LINUXBOOT_ENV_SETTINGS \
  110. "boot_common=setexpr bootm_low $kernel_addr_r '&' fe000000 && " \
  111. LINUXBOOT_CMD " $kernel_addr_r $ramdisk_addr_r $fdt_addr_r\0" \
  112. "tftpboot=tftpboot $kernel_addr_r $bootfile && " \
  113. "tftpboot $fdt_addr_r $fdtfile &&" \
  114. "tftpboot $ramdisk_addr_r $ramdisk_file &&" \
  115. "setenv ramdisk_addr_r $ramdisk_addr_r:$filesize &&" \
  116. "run boot_common\0" \
  117. "__nfsboot=tftpboot $kernel_addr_load $bootfile && " \
  118. "tftpboot $fdt_addr_r $fdtfile &&" \
  119. "setenv ramdisk_addr_r - &&" \
  120. "run boot_common\0"
  121. #endif
  122. #define CONFIG_EXTRA_ENV_SETTINGS \
  123. "fdt_addr_r_offset=0x05100000\0" \
  124. "kernel_addr_r_offset=" KERNEL_ADDR_R_OFFSET "\0" \
  125. "ramdisk_addr_r_offset=0x06000000\0" \
  126. "ramdisk_file=rootfs.cpio.gz\0" \
  127. "netdev=eth0\0" \
  128. "initrd_high=0xffffffffffffffff\0" \
  129. "loadaddr_offset=0x05000000\0" \
  130. "script=boot.scr\0" \
  131. "scriptaddr=0x85000000\0" \
  132. "nor_base=0x42000000\0" \
  133. "emmcboot=mmcsetn && run bootcmd_mmc${mmc_first_dev}\0" \
  134. "nandboot=run bootcmd_ubifs0\0" \
  135. "norboot=run tftpboot\0" \
  136. "usbboot=run bootcmd_usb0\0" \
  137. "emmcscript=setenv devtype mmc && " \
  138. "mmcsetn && " \
  139. "setenv devnum ${mmc_first_dev} && " \
  140. "run loadscript_fat\0" \
  141. "nandscript=echo Running ${script} from ubi ... && " \
  142. "ubi part UBI && " \
  143. "ubifsmount ubi0:boot && " \
  144. "ubifsload ${loadaddr} ${script} && " \
  145. "source\0" \
  146. "norscript=echo Running ${script} from tftp ... && " \
  147. "tftpboot ${script} &&" \
  148. "source\0" \
  149. "usbscript=usb start && " \
  150. "setenv devtype usb && " \
  151. "setenv devnum 0 && " \
  152. "run loadscript_fat\0" \
  153. "loadscript_fat=echo Running ${script} from ${devtype}${devnum} ... && " \
  154. "load ${devtype} ${devnum}:1 ${loadaddr} ${script} && " \
  155. "source\0" \
  156. "sramupdate=setexpr tmp_addr $nor_base + 0x50000 &&" \
  157. "tftpboot $tmp_addr $second_image && " \
  158. "setexpr tmp_addr $nor_base + 0x70000 && " \
  159. "tftpboot $tmp_addr $third_image\0" \
  160. "emmcupdate=mmcsetn &&" \
  161. "mmc dev $mmc_first_dev &&" \
  162. "mmc partconf $mmc_first_dev 0 1 1 &&" \
  163. "tftpboot $second_image && " \
  164. "mmc write $loadaddr 0 100 && " \
  165. "tftpboot $third_image && " \
  166. "mmc write $loadaddr 100 f00\0" \
  167. "nandupdate=nand erase 0 0x00100000 &&" \
  168. "tftpboot $second_image && " \
  169. "nand write $loadaddr 0 0x00020000 && " \
  170. "tftpboot $third_image && " \
  171. "nand write $loadaddr 0x00020000 0x001e0000\0" \
  172. "usbupdate=usb start &&" \
  173. "tftpboot $second_image && " \
  174. "usb write $loadaddr 0 100 && " \
  175. "tftpboot $third_image && " \
  176. "usb write $loadaddr 100 f00\0" \
  177. BOOT_IMAGES \
  178. LINUXBOOT_ENV_SETTINGS \
  179. BOOTENV
  180. #define CONFIG_SYS_BOOTMAPSZ 0x20000000
  181. #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE)
  182. /* only for SPL */
  183. #define CONFIG_SPL_STACK (0x00200000)
  184. #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x20000
  185. /* subtract sizeof(struct image_header) */
  186. #define CONFIG_SYS_UBOOT_BASE (0x130000 - 0x40)
  187. #define CONFIG_SPL_TARGET "u-boot-with-spl.bin"
  188. #define CONFIG_SPL_MAX_FOOTPRINT 0x10000
  189. #define CONFIG_SPL_MAX_SIZE 0x10000
  190. #define CONFIG_SPL_BSS_MAX_SIZE 0x2000
  191. #define CONFIG_SPL_PAD_TO 0x20000
  192. #endif /* __CONFIG_UNIPHIER_COMMON_H__ */