adp-ag102.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. /*
  2. * Copyright (C) 2011 Andes Technology Corporation
  3. * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. */
  22. #ifndef __CONFIG_H
  23. #define __CONFIG_H
  24. #include <asm/arch/ag102.h>
  25. /*
  26. * CPU and Board Configuration Options
  27. */
  28. #define CONFIG_ADP_AG102
  29. #define CONFIG_USE_INTERRUPT
  30. #define CONFIG_SKIP_LOWLEVEL_INIT
  31. #ifndef CONFIG_SKIP_LOWLEVEL_INIT
  32. #define CONFIG_MEM_REMAP
  33. #endif
  34. #ifdef CONFIG_SKIP_LOWLEVEL_INIT
  35. #define CONFIG_SYS_TEXT_BASE 0x04200000
  36. #else
  37. #define CONFIG_SYS_TEXT_BASE 0x00000000
  38. #endif
  39. /*
  40. * Timer
  41. */
  42. /*
  43. * According to the discussion in u-boot mailing list before,
  44. * CONFIG_SYS_HZ at 1000 is mandatory.
  45. */
  46. #define CONFIG_SYS_HZ 1000
  47. #define CONFIG_SYS_CLK_FREQ (66000000 * 2)
  48. #define VERSION_CLOCK CONFIG_SYS_CLK_FREQ
  49. /*
  50. * Use Externel CLOCK or PCLK
  51. */
  52. #undef CONFIG_FTRTC010_EXTCLK
  53. #ifndef CONFIG_FTRTC010_EXTCLK
  54. #define CONFIG_FTRTC010_PCLK
  55. #endif
  56. #ifdef CONFIG_FTRTC010_EXTCLK
  57. #define TIMER_CLOCK 32768 /* CONFIG_FTRTC010_EXTCLK */
  58. #else
  59. #define TIMER_CLOCK CONFIG_SYS_HZ /* CONFIG_FTRTC010_PCLK */
  60. #endif
  61. #define TIMER_LOAD_VAL 0xffffffff
  62. /*
  63. * Real Time Clock
  64. */
  65. #define CONFIG_RTC_FTRTC010
  66. /*
  67. * Real Time Clock Divider
  68. * RTC_DIV_COUNT (OSC_CLK/OSC_5MHZ)
  69. */
  70. #define OSC_5MHZ (5*1000000)
  71. #define OSC_CLK (2*OSC_5MHZ)
  72. #define RTC_DIV_COUNT (OSC_CLK/OSC_5MHZ)
  73. /*
  74. * Serial console configuration
  75. */
  76. /* FTUART is a high speed NS 16C550A compatible UART */
  77. #define CONFIG_BAUDRATE 38400
  78. #define CONFIG_CONS_INDEX 1
  79. #define CONFIG_SYS_NS16550
  80. #define CONFIG_SYS_NS16550_SERIAL
  81. #define CONFIG_SYS_NS16550_COM1 CONFIG_FTUART010_01_BASE
  82. #define CONFIG_SYS_NS16550_REG_SIZE -4
  83. #define CONFIG_SYS_NS16550_CLK 33000000 /* AG102 */
  84. /* valid baudrates */
  85. #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
  86. /*
  87. * Ethernet
  88. */
  89. #define CONFIG_NET_MULTI
  90. #define CONFIG_PHY_MAX_ADDR 32 /* this comes from <linux/phy.h> */
  91. #define CONFIG_SYS_DISCOVER_PHY
  92. #define CONFIG_FTGMAC100
  93. #define CONFIG_FTGMAC100_EGIGA
  94. #define CONFIG_BOOTDELAY 3
  95. /*
  96. * SD (MMC) controller
  97. */
  98. #define CONFIG_MMC
  99. #define CONFIG_CMD_MMC
  100. #define CONFIG_GENERIC_MMC
  101. #define CONFIG_DOS_PARTITION
  102. #define CONFIG_FTSDC010
  103. #define CONFIG_FTSDC010_NUMBER 1
  104. #define CONFIG_FTSDC010_SDIO
  105. #define CONFIG_CMD_FAT
  106. #define CONFIG_CMD_EXT2
  107. /*
  108. * Command line configuration.
  109. */
  110. #include <config_cmd_default.h>
  111. #define CONFIG_CMD_CACHE
  112. #define CONFIG_CMD_DATE
  113. #define CONFIG_CMD_PING
  114. #define CONFIG_CMD_IDE
  115. #define CONFIG_CMD_FAT
  116. #define CONFIG_CMD_ELF
  117. #undef CONFIG_CMD_FLASH
  118. #undef CONFIG_CMD_IMLS
  119. /*
  120. * PCI
  121. */
  122. #define CONFIG_PCI
  123. #define CONFIG_FTPCI100
  124. #define CONFIG_FTPCI100_MEM_BASE 0xa0000000
  125. #define CONFIG_FTPCI100_IO_SIZE FTPCI100_BASE_IO_SIZE(256) /* 256M */
  126. #define CONFIG_FTPCI100_MEM_SIZE FTPCI100_MEM_SIZE(128) /* 128M */
  127. #define CONFIG_FTPCI100_MEM_BASE_SIZE1 0x50
  128. #define CONFIG_PCI_MEM_BUS 0xa0000000
  129. #define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS
  130. #define CONFIG_PCI_MEM_SIZE 0x01000000 /* 256M */
  131. #define CONFIG_PCI_IO_BUS 0x90000000
  132. #define CONFIG_PCI_IO_PHYS CONFIG_PCI_IO_BUS
  133. #define CONFIG_PCI_IO_SIZE 0x00100000 /* 1M */
  134. /*
  135. * USB
  136. */
  137. #if defined(CONFIG_CMD_PCI) || defined(CONFIG_PCI)
  138. #if defined(CONFIG_FTPCI100)
  139. #define __io /* enable outl & inl */
  140. #define CONFIG_CMD_USB
  141. #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 5
  142. #define CONFIG_USB_STORAGE
  143. #define CONFIG_USB_EHCI
  144. #define CONFIG_PCI_EHCI_DEVICE 0
  145. #define CONFIG_USB_EHCI_PCI
  146. #define CONFIG_PREBOOT "usb start;"
  147. #endif /* #if defiend(CONFIG_FTPCI100) */
  148. #endif /* #if defined(CONFIG_CMD_PCI) || defined(CONFIG_PCI) */
  149. /*
  150. * IDE/ATA stuff
  151. */
  152. #define __io
  153. #define CONFIG_IDE_AHB
  154. #define CONFIG_IDE_FTIDE020
  155. #undef CONFIG_IDE_8xx_DIRECT /* no pcmcia interface required */
  156. #undef CONFIG_IDE_LED /* no led for ide supported */
  157. #define CONFIG_IDE_RESET 1 /* reset for ide supported */
  158. #define CONFIG_IDE_PREINIT 1 /* preinit for ide */
  159. /* max: 2 IDE busses */
  160. #define CONFIG_SYS_IDE_MAXBUS 1 /* origin: 2 */
  161. /* max: 2 drives per IDE bus */
  162. #define CONFIG_SYS_IDE_MAXDEVICE 1 /* origin: (MAXBUS * 2) */
  163. #define CONFIG_SYS_ATA_BASE_ADDR CONFIG_FTIDE020S_BASE
  164. #define CONFIG_SYS_ATA_IDE0_OFFSET 0x0000
  165. #define CONFIG_SYS_ATA_IDE1_OFFSET 0x0000
  166. #define CONFIG_SYS_ATA_DATA_OFFSET 0x0000 /* for data I/O */
  167. #define CONFIG_SYS_ATA_REG_OFFSET 0x0000 /* for normal regs access */
  168. #define CONFIG_SYS_ATA_ALT_OFFSET 0x0000 /* for alternate regs */
  169. #define CONFIG_MAC_PARTITION
  170. #define CONFIG_DOS_PARTITION
  171. #define CONFIG_SUPPORT_VFAT
  172. /*
  173. * Miscellaneous configurable options
  174. */
  175. #define CONFIG_SYS_LONGHELP /* undef to save memory */
  176. #define CONFIG_SYS_PROMPT "NDS32 # " /* Monitor Command Prompt */
  177. #define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */
  178. /* Print Buffer Size */
  179. #define CONFIG_SYS_PBSIZE \
  180. (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
  181. /* max number of command args */
  182. #define CONFIG_SYS_MAXARGS 16
  183. /* Boot Argument Buffer Size */
  184. #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
  185. /*
  186. * Stack sizes
  187. *
  188. * The stack sizes are set up in start.S using the settings below
  189. */
  190. #define CONFIG_STACKSIZE (128 * 1024) /* regular stack */
  191. /*
  192. * Size of malloc() pool
  193. */
  194. #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128 * 1024)
  195. /*
  196. * size in bytes reserved for initial data
  197. */
  198. #define CONFIG_SYS_GBL_DATA_SIZE 128
  199. /*
  200. * AHB Controller configuration
  201. */
  202. #define CONFIG_FTAHBC020S
  203. #ifdef CONFIG_FTAHBC020S
  204. #include <faraday/ftahbc020s.h>
  205. /* Address of PHYS_SDRAM_0 before memory remap is at 0x(100)00000 */
  206. #define CONFIG_SYS_FTAHBC020S_SLAVE_BSR_BASE 0x100
  207. /*
  208. * CONFIG_SYS_FTAHBC020S_SLAVE_BSR_6: this define is used in lowlevel_init.S,
  209. * hence we cannot use FTAHBC020S_BSR_SIZE(2048) since it will use ffs() wrote
  210. * in C language.
  211. */
  212. #define CONFIG_SYS_FTAHBC020S_SLAVE_BSR_6 \
  213. (FTAHBC020S_SLAVE_BSR_BASE(CONFIG_SYS_FTAHBC020S_SLAVE_BSR_BASE) | \
  214. FTAHBC020S_SLAVE_BSR_SIZE(0xb))
  215. #endif
  216. /*
  217. * Watchdog
  218. */
  219. #define CONFIG_FTWDT010_WATCHDOG
  220. /*
  221. * PCU Power Control Unit configuration
  222. */
  223. #define CONFIG_ANDES_PCU
  224. #ifdef CONFIG_ANDES_PCU
  225. #include <andestech/andes_pcu.h>
  226. #endif
  227. /*
  228. * DDR DRAM controller configuration
  229. */
  230. #define CONFIG_DWCDDR21MCTL
  231. #ifdef CONFIG_DWCDDR21MCTL
  232. #include <synopsys/dwcddr21mctl.h>
  233. /* DCR:
  234. * 2GB: 0x000025d2, 2GB (1Gb x8 2 ranks) Micron/innoDisk/Transcend
  235. * 1GB: 0x000021d2, 1GB (1Gb x8 1 rank) Micron/Transcend/innoDisk
  236. * 512MB: 0x000025cc, Micron 512MB (512Mb x16 2 ranks)
  237. * 512MB: 0x000021ca, Trenscend/innoDisk 512MB (512Mb x8 1 rank)
  238. * 256MB: 0x000020d4, Micron 256MB (1Gb x16 1 ranks)
  239. */
  240. #define CONFIG_SYS_DWCDDR21MCTL_CCR 0x00020004
  241. #define CONFIG_SYS_DWCDDR21MCTL_CCR2 (DWCDDR21MCTL_CCR_DTT(0x1) | \
  242. DWCDDR21MCTL_CCR_DFTLM(0x4) | \
  243. DWCDDR21MCTL_CCR_HOSTEN(0x1))
  244. /* 0x04: 0x000020d4 */
  245. #define CONFIG_SYS_DWCDDR21MCTL_DCR 0x000020ca
  246. /* 0x08: 0x0000000f */
  247. #define CONFIG_SYS_DWCDDR21MCTL_IOCR 0x0000000f
  248. /* 0x10: 0x00034812 */
  249. #define CONFIG_SYS_DWCDDR21MCTL_DRR (DWCDDR21MCTL_DRR_TRFC(0x12) | \
  250. DWCDDR21MCTL_DRR_TRFPRD(0x0348))
  251. /* 0x24 */
  252. #define CONFIG_SYS_DWCDDR21MCTL_DLLCR0 DWCDDR21MCTL_DLLCR_PHASE(0x0)
  253. /* 0x4c: 0x00000040 */
  254. #define CONFIG_SYS_DWCDDR21MCTL_RSLR0 0x00000040
  255. /* 0x5c: 0x000055CF */
  256. #define CONFIG_SYS_DWCDDR21MCTL_RDGR0 0x000055cf
  257. /* 0xa4: 0x00100000 */
  258. #define CONFIG_SYS_DWCDDR21MCTL_DTAR (DWCDDR21MCTL_DTAR_DTBANK(0x0) | \
  259. DWCDDR21MCTL_DTAR_DTROW(0x0100) | \
  260. DWCDDR21MCTL_DTAR_DTCOL(0x0))
  261. /* 0x1f0: 0x00000852 */
  262. #define CONFIG_SYS_DWCDDR21MCTL_MR (DWCDDR21MCTL_MR_WR(0x4) | \
  263. DWCDDR21MCTL_MR_CL(0x5) | \
  264. DWCDDR21MCTL_MR_BL(0x2))
  265. #endif
  266. /*
  267. * Physical Memory Map
  268. */
  269. #if defined(CONFIG_MEM_REMAP) || defined(CONFIG_SKIP_LOWLEVEL_INIT)
  270. #define PHYS_SDRAM_0 0x00000000 /* SDRAM Bank #1 */
  271. #if defined(CONFIG_MEM_REMAP)
  272. #define PHYS_SDRAM_0_AT_INIT 0x80000000 /* SDRAM Bank #1 before remap*/
  273. #endif
  274. #else /* !CONFIG_SKIP_LOWLEVEL_INIT && !CONFIG_MEM_REMAP */
  275. #define PHYS_SDRAM_0 0x80000000 /* SDRAM Bank #1 */
  276. #endif
  277. #define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */
  278. #define PHYS_SDRAM_0_SIZE 0x10000000 /* 256 MB */
  279. #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_0
  280. #ifdef CONFIG_MEM_REMAP
  281. #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0xA0000 - \
  282. GENERATED_GBL_DATA_SIZE)
  283. #else
  284. #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x1000 - \
  285. GENERATED_GBL_DATA_SIZE)
  286. #endif /* CONFIG_MEM_REMAP */
  287. /*
  288. * Load address and memory test area should agree with
  289. * board/faraday/a320/config.mk
  290. * Be careful not to overwrite U-boot itself.
  291. */
  292. #define CONFIG_SYS_LOAD_ADDR 0x0CF00000
  293. /* memtest works on 63 MB in DRAM */
  294. #define CONFIG_SYS_MEMTEST_START PHYS_SDRAM_0
  295. #define CONFIG_SYS_MEMTEST_END (PHYS_SDRAM_0 + 0x03F00000)
  296. /*
  297. * Static memory controller configuration
  298. */
  299. /*
  300. * FLASH and environment organization
  301. */
  302. #define CONFIG_SYS_NO_FLASH
  303. /*
  304. * Env Storage Settings
  305. */
  306. #define CONFIG_ENV_IS_NOWHERE
  307. #define CONFIG_ENV_SIZE 4096
  308. #endif /* __CONFIG_H */