top9000.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. /*
  2. * (C) Copyright 2010
  3. * Reinhard Meyer, EMK Elektronik, reinhard.meyer@emk-elektronik.de
  4. *
  5. * Configuation settings for the TOP9000 CPU module with AT91SAM9XE.
  6. *
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. */
  25. /*
  26. * top9000 with at91sam9xe256 or at91sam9xe512
  27. *
  28. * Initial Bootloader is in embedded flash.
  29. * Vital Product Data, U-Boot Environment are in I2C-EEPROM.
  30. * U-Boot is in embedded flash, a backup U-Boot can be in NAND flash.
  31. * kernel and file system are either in NAND flash or on a micro SD card.
  32. * NAND flash is optional.
  33. * I2C EEPROM is never optional.
  34. * SPI FRAM is optional.
  35. * SPI ENC28J60 is optional.
  36. * 16 or 32 bit wide SDRAM.
  37. */
  38. #ifndef __CONFIG_H
  39. #define __CONFIG_H
  40. /* SoC must be defined first, before hardware.h is included */
  41. #define CONFIG_AT91SAM9XE
  42. #include <asm/hardware.h>
  43. /*
  44. * Warning: changing CONFIG_SYS_TEXT_BASE requires
  45. * adapting the initial boot program.
  46. */
  47. #define CONFIG_SYS_TEXT_BASE 0x20000000 /* start of SDRAM */
  48. /* Command line configuration */
  49. #include <config_cmd_default.h>
  50. #undef CONFIG_CMD_FPGA
  51. #undef CONFIG_CMD_SETGETDCR
  52. #undef CONFIG_CMD_XIMG
  53. #define CONFIG_CMD_ASKENV
  54. #define CONFIG_SYS_CBSIZE 256
  55. #define CONFIG_SYS_MAXARGS 16
  56. #define CONFIG_SYS_PBSIZE \
  57. (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
  58. #define CONFIG_SYS_PROMPT "TOP9000> "
  59. #define CONFIG_SYS_LONGHELP
  60. #define CONFIG_CMDLINE_EDITING
  61. #define CONFIG_CMD_BDI
  62. #define CONFIG_CMD_CACHE
  63. /* ARM asynchronous clock */
  64. #define CONFIG_SYS_AT91_SLOW_CLOCK 32768 /* slow clock xtal */
  65. #define CONFIG_SYS_AT91_MAIN_CLOCK 18432000 /* main clock xtal */
  66. #define CONFIG_SYS_HZ 1000
  67. /* Misc CPU related */
  68. #define CONFIG_ARCH_CPU_INIT
  69. #undef CONFIG_USE_IRQ /* we don't need IRQ/FIQ stuff */
  70. #define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */
  71. #define CONFIG_SETUP_MEMORY_TAGS
  72. #define CONFIG_INITRD_TAG
  73. #define CONFIG_SKIP_LOWLEVEL_INIT
  74. #define CONFIG_BOARD_EARLY_INIT_F
  75. #define CONFIG_DISPLAY_CPUINFO
  76. #define CONFIG_AT91RESET_EXTRST /* assert external reset */
  77. /* general purpose I/O */
  78. #define CONFIG_ATMEL_LEGACY /* required until (g)pio is fixed */
  79. #define CONFIG_AT91_GPIO
  80. #define CONFIG_AT91_GPIO_PULLUP 1 /* keep pullups on peripheral pins */
  81. /* serial console */
  82. #define CONFIG_ATMEL_USART
  83. #define CONFIG_USART_BASE ATMEL_BASE_DBGU
  84. #define CONFIG_USART_ID ATMEL_ID_SYS
  85. #define CONFIG_BAUDRATE 115200
  86. #define CONFIG_SYS_BAUDRATE_TABLE {115200 , 19200, 38400, 57600, 9600 }
  87. /* SD/MMC card */
  88. #define CONFIG_MMC
  89. #define CONFIG_GENERIC_MMC
  90. #define CONFIG_GENERIC_ATMEL_MCI
  91. #define CONFIG_SYS_MMC_CD_PIN AT91_PIN_PC9
  92. #define CONFIG_CMD_MMC
  93. /* Ethernet */
  94. #define CONFIG_MACB
  95. #define CONFIG_SYS_PHY_ID 1
  96. #define CONFIG_RMII
  97. #define CONFIG_NET_RETRY_COUNT 20
  98. /* real time clock */
  99. #define CONFIG_RTC_AT91SAM9_RTT
  100. #define CONFIG_CMD_DATE
  101. #if defined(CONFIG_AT91SAM9XE)
  102. /*
  103. * NOR flash - use embedded flash of SAM9XE256/512
  104. * U-Boot will not fit into 128K !
  105. * 2010.09 will not fit into 256K with all options enabled !
  106. *
  107. * Layout:
  108. * 16kB 1st Bootloader
  109. * Rest U-Boot
  110. * the first sector (16kB) of EFLASH cannot be unprotected
  111. * with u-boot commands
  112. */
  113. # define CONFIG_AT91_EFLASH
  114. # define CONFIG_SYS_FLASH_BASE ATMEL_BASE_FLASH
  115. # define CONFIG_SYS_MAX_FLASH_SECT 32
  116. # define CONFIG_SYS_MAX_FLASH_BANKS 1
  117. # define CONFIG_SYS_FLASH_PROTECTION
  118. # define CONFIG_EFLASH_PROTSECTORS 1 /* protect first sector */
  119. #endif
  120. /* SPI */
  121. #define CONFIG_ATMEL_SPI
  122. #define CONFIG_CMD_SPI
  123. /* RAMTRON FRAM */
  124. #define CONFIG_CMD_SF
  125. #define CONFIG_ATMEL_SPI0 /* SPI used for FRAM is SPI0 */
  126. #define FRAM_SPI_BUS 0
  127. #define FRAM_CS_NUM 0
  128. #define CONFIG_SPI_FLASH /* RAMTRON FRAM on SPI bus */
  129. #define CONFIG_SPI_FRAM_RAMTRON
  130. #define CONFIG_SF_DEFAULT_SPEED 1000000 /* be conservative here... */
  131. #define CONFIG_SF_DEFAULT_MODE SPI_MODE_0
  132. #define CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC "FM25H20"
  133. /* Microchip ENC28J60 (second LAN) */
  134. #if defined(CONFIG_EVAL9000)
  135. # define CONFIG_ENC28J60
  136. # define CONFIG_ATMEL_SPI1 /* SPI used for ENC28J60 is SPI1 */
  137. # define ENC_SPI_BUS 1
  138. # define ENC_CS_NUM 0
  139. # define ENC_SPI_CLOCK 1000000
  140. #endif /* CONFIG_EVAL9000 */
  141. /*
  142. * SDRAM: 1 bank, min 32, max 128 MB
  143. * Initialized before u-boot gets started.
  144. */
  145. #define CONFIG_NR_DRAM_BANKS 1
  146. #define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_CS1
  147. #define CONFIG_SYS_SDRAM_SIZE 0x08000000
  148. #define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE
  149. #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_SDRAM_BASE + 0x01e00000)
  150. #define CONFIG_SYS_LOAD_ADDR \
  151. (CONFIG_SYS_SDRAM_BASE + 0x01000000)
  152. /*
  153. * Initial stack pointer: 16k - GENERATED_GBL_DATA_SIZE in internal SRAM,
  154. * leaving the correct space for initial global data structure above
  155. * that address while providing maximum stack area below.
  156. */
  157. #define CONFIG_SYS_INIT_SP_ADDR \
  158. (ATMEL_BASE_SRAM + 0x4000 - GENERATED_GBL_DATA_SIZE)
  159. /*
  160. * NAND flash: 256 MB (optional)
  161. *
  162. * Layout:
  163. * 640kB: u-boot (includes space for spare sectors, handled by
  164. * initial loader)
  165. * 2MB: kernel
  166. * rest: file system
  167. */
  168. #define CONFIG_NAND_ATMEL
  169. #define CONFIG_SYS_MAX_NAND_DEVICE 1
  170. #define CONFIG_SYS_NAND_BASE ATMEL_BASE_CS3
  171. #define CONFIG_SYS_NAND_DBW_8
  172. #define CONFIG_SYS_NAND_MASK_ALE (1 << 21)
  173. #define CONFIG_SYS_NAND_MASK_CLE (1 << 22)
  174. #define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PC14
  175. #define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PC13
  176. #define CONFIG_CMD_NAND
  177. /* USB */
  178. #define CONFIG_USB_ATMEL
  179. #define CONFIG_USB_OHCI_NEW
  180. #define CONFIG_DOS_PARTITION
  181. #define CONFIG_SYS_USB_OHCI_CPU_INIT
  182. #define CONFIG_SYS_USB_OHCI_REGS_BASE ATMEL_UHP_BASE
  183. #define CONFIG_SYS_USB_OHCI_SLOT_NAME "top9000"
  184. #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2
  185. #define CONFIG_USB_STORAGE
  186. #define CONFIG_CMD_USB
  187. /* I2C support must always be enabled */
  188. #define CONFIG_SOFT_I2C
  189. #define CONFIG_CMD_I2C
  190. #define CONFIG_SYS_I2C_SPEED 400000
  191. #define CONFIG_SYS_I2C_SLAVE 0x7F
  192. #define CONFIG_I2C_MULTI_BUS
  193. #define I2C0_PORT AT91_PIO_PORTA
  194. #define SDA0_PIN 23
  195. #define SCL0_PIN 24
  196. #define I2C1_PORT AT91_PIO_PORTB
  197. #define SDA1_PIN 12
  198. #define SCL1_PIN 13
  199. #define I2C_SOFT_DECLARATIONS void iic_init(void);\
  200. int iic_read(void);\
  201. void iic_sda(int);\
  202. void iic_scl(int);
  203. #define I2C_ACTIVE
  204. #define I2C_TRISTATE
  205. #define I2C_INIT iic_init()
  206. #define I2C_READ iic_read()
  207. #define I2C_SDA(bit) iic_sda(bit)
  208. #define I2C_SCL(bit) iic_scl(bit)
  209. #define I2C_DELAY udelay(3)
  210. /* EEPROM configuration */
  211. #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 5
  212. #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5
  213. #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
  214. #define CONFIG_SYS_EEPROM_SIZE 0x2000
  215. #define CONFIG_SYS_I2C_EEPROM_ADDR 0x57
  216. /* later: #define CONFIG_I2C_ENV_EEPROM_BUS 0 */
  217. /* ENV is always in I2C-EEPROM */
  218. #define CONFIG_ENV_IS_IN_EEPROM
  219. #define CONFIG_ENV_OFFSET 0x1000
  220. #define CONFIG_ENV_SIZE 0x0f00
  221. /* VPD settings */
  222. #define CONFIG_SYS_I2C_FACT_ADDR 0x57
  223. #define CONFIG_SYS_FACT_OFFSET 0x1F00
  224. #define CONFIG_SYS_FACT_SIZE 0x0100
  225. /* later: #define CONFIG_MISC_INIT_R */
  226. /* define the next only if you want to allow users to enter VPD data */
  227. #define CONFIG_SYS_FACT_ENTRY
  228. #ifndef __ASSEMBLY__
  229. extern void read_factory_r(void);
  230. #endif
  231. /*
  232. * Only interrupt autoboot if <space> is pressed. Otherwise, garbage
  233. * data on the serial line may interrupt the boot sequence.
  234. */
  235. #define CONFIG_BOOTDELAY 1
  236. #define CONFIG_AUTOBOOT
  237. #define CONFIG_AUTOBOOT_KEYED
  238. #define CONFIG_AUTOBOOT_PROMPT \
  239. "Press SPACE to abort autoboot in %d seconds\n", bootdelay
  240. #define CONFIG_AUTOBOOT_DELAY_STR "d"
  241. #define CONFIG_AUTOBOOT_STOP_STR " "
  242. /*
  243. * add filesystem commands if we have at least 1 storage
  244. * media with filesystem
  245. */
  246. #if defined(CONFIG_NAND_ATMEL) \
  247. || defined(CONFIG_USB_ATMEL) \
  248. || defined(CONFIG_MMC)
  249. # define CONFIG_DOS_PARTITION
  250. # define CONFIG_CMD_FAT
  251. # define CONFIG_CMD_EXT2
  252. /* later: #define CONFIG_CMD_JFFS2 */
  253. #endif
  254. /* add NET commands if we have at least 1 LAN */
  255. #if defined(CONFIG_MACB) || defined(CONFIG_ENC28J60)
  256. # define CONFIG_CMD_PING
  257. # define CONFIG_CMD_DHCP
  258. # define CONFIG_CMD_MII
  259. /* is this really needed ? */
  260. # define CONFIG_RESET_PHY_R
  261. /* BOOTP options */
  262. # define CONFIG_BOOTP_BOOTFILESIZE
  263. # define CONFIG_BOOTP_BOOTPATH
  264. # define CONFIG_BOOTP_GATEWAY
  265. # define CONFIG_BOOTP_HOSTNAME
  266. #endif
  267. /* linux in NAND flash */
  268. #define CONFIG_BOOTCOUNT_LIMIT 1
  269. #define CONFIG_BOOTCOMMAND \
  270. "nand read 0x21000000 0xA0000 0x200000; bootm"
  271. #define CONFIG_BOOTARGS \
  272. "console=ttyS0,115200 " \
  273. "root=/dev/mtdblock2 " \
  274. "mtdparts=atmel_nand:" \
  275. "640k(uboot)ro," \
  276. "2M(linux)," \
  277. "16M(root)," \
  278. "-(rest) " \
  279. "rw "\
  280. "rootfstype=jffs2"
  281. /* Size of malloc() pool */
  282. #define CONFIG_SYS_MALLOC_LEN \
  283. ROUND(3 * CONFIG_ENV_SIZE + 128*1024, 0x1000)
  284. #define CONFIG_STACKSIZE (32*1024)
  285. #ifdef CONFIG_USE_IRQ
  286. #error CONFIG_USE_IRQ not supported
  287. #endif
  288. #endif