taurus.h 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. /*
  2. * Common board functions for Siemens TAURUS (AT91SAM9G20) based boards
  3. * (C) Copyright 2013 Siemens AG
  4. *
  5. * Based on:
  6. * U-Boot file: include/configs/at91sam9260ek.h
  7. *
  8. * (C) Copyright 2007-2008
  9. * Stelian Pop <stelian@popies.net>
  10. * Lead Tech Design <www.leadtechdesign.com>
  11. *
  12. * SPDX-License-Identifier: GPL-2.0+
  13. */
  14. #ifndef __CONFIG_H
  15. #define __CONFIG_H
  16. /*
  17. * SoC must be defined first, before hardware.h is included.
  18. * In this case SoC is defined in boards.cfg.
  19. */
  20. #include <asm/hardware.h>
  21. #include <linux/sizes.h>
  22. #if defined(CONFIG_SPL_BUILD)
  23. #define CONFIG_SYS_THUMB_BUILD
  24. #define CONFIG_SYS_ICACHE_OFF
  25. #define CONFIG_SYS_DCACHE_OFF
  26. #endif
  27. /*
  28. * Warning: changing CONFIG_SYS_TEXT_BASE requires
  29. * adapting the initial boot program.
  30. * Since the linker has to swallow that define, we must use a pure
  31. * hex number here!
  32. */
  33. #define CONFIG_SYS_TEXT_BASE 0x21000000
  34. /* ARM asynchronous clock */
  35. #define CONFIG_SYS_AT91_SLOW_CLOCK 32768 /* slow clock xtal */
  36. #define CONFIG_SYS_AT91_MAIN_CLOCK 18432000 /* main clock xtal */
  37. /* Misc CPU related */
  38. #define CONFIG_ARCH_CPU_INIT
  39. #define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */
  40. #define CONFIG_SETUP_MEMORY_TAGS
  41. #define CONFIG_INITRD_TAG
  42. #define CONFIG_SKIP_LOWLEVEL_INIT_ONLY
  43. #define CONFIG_BOARD_EARLY_INIT_F
  44. /* general purpose I/O */
  45. #define CONFIG_ATMEL_LEGACY /* required until (g)pio is fixed */
  46. #define CONFIG_AT91_GPIO
  47. #define CONFIG_AT91_GPIO_PULLUP 1 /* keep pullups on peripheral pins */
  48. /* serial console */
  49. #define CONFIG_ATMEL_USART
  50. #define CONFIG_USART_BASE ATMEL_BASE_DBGU
  51. #define CONFIG_USART_ID ATMEL_ID_SYS
  52. #define CONFIG_BAUDRATE 115200
  53. /*
  54. * Command line configuration.
  55. */
  56. #define CONFIG_CMD_NAND
  57. /*
  58. * SDRAM: 1 bank, min 32, max 128 MB
  59. * Initialized before u-boot gets started.
  60. */
  61. #define CONFIG_NR_DRAM_BANKS 1
  62. #define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_CS1
  63. #define CONFIG_SYS_SDRAM_SIZE (128 * SZ_1M)
  64. /*
  65. * Initial stack pointer: 4k - GENERATED_GBL_DATA_SIZE in internal SRAM,
  66. * leaving the correct space for initial global data structure above
  67. * that address while providing maximum stack area below.
  68. */
  69. #define CONFIG_SYS_INIT_SP_ADDR \
  70. (ATMEL_BASE_SRAM1 + 0x1000 - GENERATED_GBL_DATA_SIZE)
  71. /* NAND flash */
  72. #ifdef CONFIG_CMD_NAND
  73. #define CONFIG_NAND_ATMEL
  74. #define CONFIG_SYS_MAX_NAND_DEVICE 1
  75. #define CONFIG_SYS_NAND_BASE ATMEL_BASE_CS3
  76. #define CONFIG_SYS_NAND_DBW_8
  77. #define CONFIG_SYS_NAND_MASK_ALE (1 << 21)
  78. #define CONFIG_SYS_NAND_MASK_CLE (1 << 22)
  79. #define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PC14
  80. #define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PC13
  81. #endif
  82. /* NOR flash - no real flash on this board */
  83. #define CONFIG_SYS_NO_FLASH 1
  84. /* Ethernet */
  85. #define CONFIG_MACB
  86. #define CONFIG_PHYLIB
  87. #define CONFIG_RMII
  88. #define CONFIG_AT91_WANTS_COMMON_PHY
  89. #define CONFIG_AT91SAM9_WATCHDOG
  90. #define CONFIG_AT91_HW_WDT_TIMEOUT 15
  91. #if !defined(CONFIG_SPL_BUILD)
  92. /* Enable the watchdog */
  93. #define CONFIG_HW_WATCHDOG
  94. #endif
  95. /* USB */
  96. #if defined(CONFIG_BOARD_TAURUS)
  97. #define CONFIG_USB_ATMEL
  98. #define CONFIG_USB_ATMEL_CLK_SEL_PLLB
  99. #define CONFIG_USB_OHCI_NEW
  100. #define CONFIG_SYS_USB_OHCI_CPU_INIT
  101. #define CONFIG_SYS_USB_OHCI_REGS_BASE 0x00500000
  102. #define CONFIG_SYS_USB_OHCI_SLOT_NAME "at91sam9260"
  103. #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2
  104. /* USB DFU support */
  105. #define CONFIG_CMD_MTDPARTS
  106. #define CONFIG_MTD_DEVICE
  107. #define CONFIG_MTD_PARTITIONS
  108. #define CONFIG_USB_GADGET_AT91
  109. /* DFU class support */
  110. #define CONFIG_SYS_DFU_DATA_BUF_SIZE (SZ_1M)
  111. #define DFU_MANIFEST_POLL_TIMEOUT 25000
  112. #endif
  113. /* SPI EEPROM */
  114. #define CONFIG_SPI
  115. #define CONFIG_ATMEL_SPI
  116. #define TAURUS_SPI_MASK (1 << 4)
  117. #define TAURUS_SPI_CS_PIN AT91_PIN_PA3
  118. #if defined(CONFIG_SPL_BUILD)
  119. /* SPL related */
  120. #define CONFIG_SPL_SPI_LOAD
  121. #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000
  122. #define CONFIG_SF_DEFAULT_BUS 0
  123. #define CONFIG_SF_DEFAULT_SPEED 1000000
  124. #define CONFIG_SF_DEFAULT_MODE SPI_MODE_3
  125. #endif
  126. /* load address */
  127. #define CONFIG_SYS_LOAD_ADDR 0x22000000
  128. /* bootstrap in spi flash , u-boot + env + linux in nandflash */
  129. #define CONFIG_ENV_IS_IN_NAND
  130. #define CONFIG_ENV_OFFSET 0x100000
  131. #define CONFIG_ENV_OFFSET_REDUND 0x180000
  132. #define CONFIG_ENV_SIZE (SZ_128K) /* 1 sector = 128 kB */
  133. #define CONFIG_BOOTCOMMAND "nand read 0x22000000 0x200000 0x300000; bootm"
  134. #if defined(CONFIG_BOARD_TAURUS)
  135. #define CONFIG_BOOTARGS_TAURUS \
  136. "console=ttyS0,115200 earlyprintk " \
  137. "mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro," \
  138. "256k(env),256k(env_redundant),256k(spare)," \
  139. "512k(dtb),6M(kernel)ro,-(rootfs) " \
  140. "root=/dev/mtdblock7 rw rootfstype=jffs2"
  141. #endif
  142. #if defined(CONFIG_BOARD_AXM)
  143. #define CONFIG_BOOTARGS_AXM \
  144. "\0" \
  145. "addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:" \
  146. "${gatewayip}:${netmask}:${hostname}:${netdev}::off\0" \
  147. "addtest=setenv bootargs ${bootargs} loglevel=4 test\0" \
  148. "baudrate=115200\0" \
  149. "boot_file=setenv bootfile /${project_dir}/kernel/uImage\0" \
  150. "boot_retries=0\0" \
  151. "bootcmd=run flash_self\0" \
  152. "bootdelay=3\0" \
  153. "ethact=macb0\0" \
  154. "flash_nfs=run nand_kernel;run nfsargs;run addip;upgrade_available;"\
  155. "bootm ${kernel_ram};reset\0" \
  156. "flash_self=run nand_kernel;run setbootargs;upgrade_available;" \
  157. "bootm ${kernel_ram};reset\0" \
  158. "flash_self_test=run nand_kernel;run setbootargs addtest; " \
  159. "upgrade_available;bootm ${kernel_ram};reset\0" \
  160. "hostname=systemone\0" \
  161. "kernel_Off=0x00200000\0" \
  162. "kernel_Off_fallback=0x03800000\0" \
  163. "kernel_ram=0x21500000\0" \
  164. "kernel_size=0x00400000\0" \
  165. "kernel_size_fallback=0x00400000\0" \
  166. "loads_echo=1\0" \
  167. "nand_kernel=nand read.e ${kernel_ram} ${kernel_Off} " \
  168. "${kernel_size}\0" \
  169. "net_nfs=run boot_file;tftp ${kernel_ram} ${bootfile};" \
  170. "run nfsargs;run addip;upgrade_available;bootm " \
  171. "${kernel_ram};reset\0" \
  172. "netdev=eth0\0" \
  173. "nfsargs=run root_path;setenv bootargs ${bootargs} " \
  174. "root=/dev/nfs rw nfsroot=${serverip}:${rootpath} " \
  175. "at91sam9_wdt.wdt_timeout=16\0" \
  176. "partitionset_active=A\0" \
  177. "preboot=echo;echo Type 'run flash_self' to use kernel and root "\
  178. "filesystem on memory;echo Type 'run flash_nfs' to use kernel " \
  179. "from memory and root filesystem over NFS;echo Type 'run net_nfs' "\
  180. "to get Kernel over TFTP and mount root filesystem over NFS;echo\0"\
  181. "project_dir=systemone\0" \
  182. "root_path=setenv rootpath /home/projects/${project_dir}/rootfs\0"\
  183. "rootfs=/dev/mtdblock5\0" \
  184. "rootfs_fallback=/dev/mtdblock7\0" \
  185. "setbootargs=setenv bootargs ${bootargs} console=ttyMTD,mtdoops "\
  186. "root=${rootfs} rootfstype=jffs2 panic=7 " \
  187. "at91sam9_wdt.wdt_timeout=16\0" \
  188. "stderr=serial\0" \
  189. "stdin=serial\0" \
  190. "stdout=serial\0" \
  191. "upgrade_available=0\0"
  192. #endif
  193. #if defined(CONFIG_BOARD_TAURUS)
  194. #define CONFIG_BOOTARGS CONFIG_BOOTARGS_TAURUS
  195. #endif
  196. #if defined(CONFIG_BOARD_AXM)
  197. #define CONFIG_BOOTARGS CONFIG_BOOTARGS_AXM
  198. #endif
  199. #define CONFIG_SYS_CBSIZE 256
  200. #define CONFIG_SYS_MAXARGS 16
  201. #define CONFIG_SYS_PBSIZE \
  202. (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
  203. #define CONFIG_SYS_LONGHELP
  204. #define CONFIG_CMDLINE_EDITING
  205. #define CONFIG_AUTO_COMPLETE
  206. /*
  207. * Size of malloc() pool
  208. */
  209. #define CONFIG_SYS_MALLOC_LEN \
  210. ROUND(3 * CONFIG_ENV_SIZE + SZ_4M, 0x1000)
  211. /* Defines for SPL */
  212. #define CONFIG_SPL_FRAMEWORK
  213. #define CONFIG_SPL_TEXT_BASE 0x0
  214. #define CONFIG_SPL_MAX_SIZE (31 * SZ_512)
  215. #define CONFIG_SPL_STACK (ATMEL_BASE_SRAM1 + SZ_16K)
  216. #define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SYS_TEXT_BASE - \
  217. CONFIG_SYS_MALLOC_LEN)
  218. #define CONFIG_SYS_SPL_MALLOC_SIZE CONFIG_SYS_MALLOC_LEN
  219. #define CONFIG_SPL_BSS_START_ADDR CONFIG_SPL_MAX_SIZE
  220. #define CONFIG_SPL_BSS_MAX_SIZE (3 * SZ_512)
  221. #define CONFIG_SPL_BOARD_INIT
  222. #define CONFIG_SYS_NAND_ENABLE_PIN_SPL (2*32 + 14)
  223. #define CONFIG_SYS_USE_NANDFLASH 1
  224. #define CONFIG_SPL_NAND_DRIVERS
  225. #define CONFIG_SPL_NAND_BASE
  226. #define CONFIG_SPL_NAND_ECC
  227. #define CONFIG_SPL_NAND_RAW_ONLY
  228. #define CONFIG_SPL_NAND_SOFTECC
  229. #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x20000
  230. #define CONFIG_SYS_NAND_U_BOOT_SIZE SZ_512K
  231. #define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
  232. #define CONFIG_SYS_NAND_U_BOOT_DST CONFIG_SYS_TEXT_BASE
  233. #define CONFIG_SYS_NAND_5_ADDR_CYCLE
  234. #define CONFIG_SYS_NAND_SIZE (256 * SZ_1M)
  235. #define CONFIG_SYS_NAND_PAGE_SIZE SZ_2K
  236. #define CONFIG_SYS_NAND_BLOCK_SIZE (SZ_128K)
  237. #define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
  238. CONFIG_SYS_NAND_PAGE_SIZE)
  239. #define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS
  240. #define CONFIG_SYS_NAND_ECCSIZE 256
  241. #define CONFIG_SYS_NAND_ECCBYTES 3
  242. #define CONFIG_SYS_NAND_OOBSIZE 64
  243. #define CONFIG_SYS_NAND_ECCPOS { 40, 41, 42, 43, 44, 45, 46, 47, \
  244. 48, 49, 50, 51, 52, 53, 54, 55, \
  245. 56, 57, 58, 59, 60, 61, 62, 63, }
  246. #define CONFIG_SPL_ATMEL_SIZE
  247. #define CONFIG_SYS_MASTER_CLOCK 132096000
  248. #define AT91_PLL_LOCK_TIMEOUT 1000000
  249. #define CONFIG_SYS_AT91_PLLA 0x202A3F01
  250. #define CONFIG_SYS_MCKR 0x1300
  251. #define CONFIG_SYS_MCKR_CSS (0x02 | CONFIG_SYS_MCKR)
  252. #define CONFIG_SYS_AT91_PLLB 0x10193F05
  253. #endif