ethernut5.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. /*
  2. * (C) Copyright 2011
  3. * egnite GmbH <info@egnite.de>
  4. *
  5. * Configuation settings for Ethernut 5 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. #ifndef __CONFIG_H
  26. #define __CONFIG_H
  27. #include <asm/hardware.h>
  28. /* The first stage boot loader expects u-boot running at this address. */
  29. #define CONFIG_SYS_TEXT_BASE 0x27000000 /* 16MB available */
  30. /* The first stage boot loader takes care of low level initialization. */
  31. #define CONFIG_SKIP_LOWLEVEL_INIT
  32. /* Set our official architecture number. */
  33. #define MACH_TYPE_ETHERNUT5 1971
  34. #define CONFIG_MACH_TYPE MACH_TYPE_ETHERNUT5
  35. /* CPU information */
  36. #define CONFIG_ARM926EJS
  37. #define CONFIG_AT91FAMILY
  38. #define CONFIG_DISPLAY_CPUINFO /* Display at console. */
  39. #define CONFIG_ARCH_CPU_INIT
  40. /* ARM asynchronous clock */
  41. #define CONFIG_SYS_AT91_SLOW_CLOCK 32768 /* slow clock xtal */
  42. #define CONFIG_SYS_AT91_MAIN_CLOCK 18432000 /* 18.432 MHz crystal */
  43. #define CONFIG_SYS_HZ 1000
  44. #undef CONFIG_USE_IRQ /* Running w/o interrupts */
  45. /* 32kB internal SRAM */
  46. #define CONFIG_SRAM_BASE 0x00300000 /*AT91SAM9XE_SRAM_BASE */
  47. #define CONFIG_SRAM_SIZE (32 << 10)
  48. #define CONFIG_STACKSIZE (CONFIG_SRAM_SIZE - GENERATED_GBL_DATA_SIZE)
  49. #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SRAM_BASE + CONFIG_STACKSIZE)
  50. /* 128MB SDRAM in 1 bank */
  51. #define CONFIG_NR_DRAM_BANKS 1
  52. #define CONFIG_SYS_SDRAM_BASE 0x20000000
  53. #define CONFIG_SYS_SDRAM_SIZE (128 << 20)
  54. #define CONFIG_SYS_LOAD_ADDR CONFIG_SYS_SDRAM_BASE
  55. #define CONFIG_LOADADDR CONFIG_SYS_LOAD_ADDR
  56. #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (1 << 20))
  57. #define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE
  58. #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_TEXT_BASE \
  59. - CONFIG_SYS_MALLOC_LEN)
  60. /* 512kB on-chip NOR flash */
  61. # define CONFIG_SYS_MAX_FLASH_BANKS 1
  62. # define CONFIG_SYS_FLASH_BASE 0x00200000 /* AT91SAM9XE_FLASH_BASE */
  63. # define CONFIG_AT91_EFLASH
  64. # define CONFIG_SYS_MAX_FLASH_SECT 32
  65. # define CONFIG_SYS_FLASH_PROTECTION /* First stage loader in sector 0 */
  66. # define CONFIG_EFLASH_PROTSECTORS 1
  67. /* 512kB DataFlash at NPCS0 */
  68. #define CONFIG_SYS_MAX_DATAFLASH_BANKS 1
  69. #define CONFIG_HAS_DATAFLASH
  70. #define CONFIG_SPI_FLASH
  71. #define CONFIG_SPI_FLASH_ATMEL
  72. #define CONFIG_ATMEL_DATAFLASH_SPI
  73. #define CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 0xC0000000
  74. #define DATAFLASH_TCSS (0x1a << 16)
  75. #define DATAFLASH_TCHS (0x1 << 24)
  76. #define CONFIG_ENV_IS_IN_SPI_FLASH
  77. #define CONFIG_ENV_OFFSET 0x3DE000
  78. #define CONFIG_ENV_SECT_SIZE (132 << 10)
  79. #define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE
  80. #define CONFIG_ENV_ADDR (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 \
  81. + CONFIG_ENV_OFFSET)
  82. #define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 \
  83. + 0x042000)
  84. /* SPI */
  85. #define CONFIG_ATMEL_SPI
  86. #define CONFIG_SYS_SPI_WRITE_TOUT (5 * CONFIG_SYS_HZ)
  87. #define AT91_SPI_CLK 15000000
  88. /* Serial port */
  89. #define CONFIG_ATMEL_USART
  90. #define CONFIG_USART3 /* USART 3 is DBGU */
  91. #define CONFIG_BAUDRATE 115200
  92. #define CONFIG_SYS_BAUDRATE_TABLE {115200 , 19200, 38400, 57600, 9600 }
  93. #define CONFIG_USART_BASE ATMEL_BASE_DBGU
  94. #define CONFIG_USART_ID ATMEL_ID_SYS
  95. /* Misc. hardware drivers */
  96. #define CONFIG_AT91_GPIO
  97. /* Command line configuration */
  98. #include <config_cmd_default.h>
  99. #undef CONFIG_CMD_BDI
  100. #undef CONFIG_CMD_FPGA
  101. #undef CONFIG_CMD_LOADS
  102. #define CONFIG_CMD_JFFS2
  103. #define CONFIG_CMD_MII
  104. #define CONFIG_CMD_MTDPARTS
  105. #define CONFIG_CMD_NAND
  106. #define CONFIG_CMD_SPI
  107. #ifdef MINIMAL_LOADER
  108. #undef CONFIG_CMD_CONSOLE
  109. #undef CONFIG_CMD_EDITENV
  110. #undef CONFIG_CMD_IMI
  111. #undef CONFIG_CMD_ITEST
  112. #undef CONFIG_CMD_IMLS
  113. #undef CONFIG_CMD_LOADB
  114. #undef CONFIG_CMD_LOADS
  115. #undef CONFIG_CMD_NFS
  116. #undef CONFIG_CMD_SETGETDCR
  117. #undef CONFIG_CMD_XIMG
  118. #else
  119. #define CONFIG_CMD_ASKENV
  120. #define CONFIG_CMD_BSP
  121. #define CONFIG_CMD_CACHE
  122. #define CONFIG_CMD_CDP
  123. #define CONFIG_CMD_DATE
  124. #define CONFIG_CMD_DHCP
  125. #define CONFIG_CMD_DNS
  126. #define CONFIG_CMD_EXT2
  127. #define CONFIG_CMD_FAT
  128. #define CONFIG_CMD_I2C
  129. #define CONFIG_CMD_MMC
  130. #define CONFIG_CMD_PING
  131. #define CONFIG_CMD_RARP
  132. #define CONFIG_CMD_REISER
  133. #define CONFIG_CMD_SAVES
  134. #define CONFIG_CMD_SETEXPR
  135. #define CONFIG_CMD_SF
  136. #define CONFIG_CMD_SNTP
  137. #define CONFIG_CMD_UBI
  138. #define CONFIG_CMD_UBIFS
  139. #define CONFIG_CMD_UNZIP
  140. #define CONFIG_CMD_USB
  141. #endif
  142. /* NAND flash */
  143. #ifdef CONFIG_CMD_NAND
  144. #define CONFIG_SYS_MAX_NAND_DEVICE 1
  145. #define CONFIG_SYS_NAND_BASE 0x40000000
  146. #define CONFIG_SYS_NAND_DBW_8
  147. #define CONFIG_NAND_ATMEL
  148. /* our ALE is AD21 */
  149. #define CONFIG_SYS_NAND_MASK_ALE (1 << 21)
  150. /* our CLE is AD22 */
  151. #define CONFIG_SYS_NAND_MASK_CLE (1 << 22)
  152. #define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIO_PORTC, 14
  153. #endif
  154. /* JFFS2 */
  155. #ifdef CONFIG_CMD_JFFS2
  156. #define CONFIG_MTD_NAND_ECC_JFFS2
  157. #define CONFIG_JFFS2_CMDLINE
  158. #define CONFIG_JFFS2_NAND
  159. #endif
  160. /* Ethernet */
  161. #define CONFIG_NET_RETRY_COUNT 20
  162. #define CONFIG_MACB
  163. #define CONFIG_RMII
  164. #define CONFIG_PHY_ID 0
  165. #define CONFIG_MACB_SEARCH_PHY
  166. /* MMC */
  167. #ifdef CONFIG_CMD_MMC
  168. #define CONFIG_MMC
  169. #define CONFIG_GENERIC_MMC
  170. #define CONFIG_GENERIC_ATMEL_MCI
  171. #define CONFIG_SYS_MMC_CD_PIN AT91_PIO_PORTC, 8
  172. #endif
  173. /* USB */
  174. #ifdef CONFIG_CMD_USB
  175. #define CONFIG_USB_ATMEL
  176. #define CONFIG_USB_OHCI_NEW
  177. #define CONFIG_SYS_USB_OHCI_CPU_INIT
  178. #define CONFIG_SYS_USB_OHCI_REGS_BASE 0x00500000
  179. #define CONFIG_SYS_USB_OHCI_SLOT_NAME "host"
  180. #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2
  181. #define CONFIG_USB_STORAGE
  182. #endif
  183. /* RTC */
  184. #if defined(CONFIG_CMD_DATE) || defined(CONFIG_CMD_SNTP)
  185. #define CONFIG_RTC_PCF8563
  186. #define CONFIG_SYS_I2C_RTC_ADDR 0x51
  187. #endif
  188. /* I2C */
  189. #define CONFIG_SYS_MAX_I2C_BUS 1
  190. #define CONFIG_SYS_I2C_SLAVE 0
  191. #define CONFIG_SYS_I2C_SPEED 100000
  192. #define CONFIG_SOFT_I2C
  193. #define I2C_SOFT_DECLARATIONS
  194. #define GPIO_I2C_SCL AT91_PIO_PORTA, 24
  195. #define GPIO_I2C_SDA AT91_PIO_PORTA, 23
  196. #define I2C_INIT { \
  197. at91_set_pio_periph(AT91_PIO_PORTA, 23, 0); \
  198. at91_set_pio_multi_drive(AT91_PIO_PORTA, 23, 1); \
  199. at91_set_pio_periph(AT91_PIO_PORTA, 24, 0); \
  200. at91_set_pio_output(AT91_PIO_PORTA, 24, 0); \
  201. at91_set_pio_multi_drive(AT91_PIO_PORTA, 24, 1); \
  202. }
  203. #define I2C_ACTIVE at91_set_pio_output(AT91_PIO_PORTA, 23, 0)
  204. #define I2C_TRISTATE at91_set_pio_input(AT91_PIO_PORTA, 23, 0)
  205. #define I2C_SCL(bit) at91_set_pio_value(AT91_PIO_PORTA, 24, bit)
  206. #define I2C_SDA(bit) at91_set_pio_value(AT91_PIO_PORTA, 23, bit)
  207. #define I2C_DELAY udelay(100)
  208. #define I2C_READ at91_get_pio_value(AT91_PIO_PORTA, 23)
  209. /* DHCP/BOOTP options */
  210. #ifdef CONFIG_CMD_DHCP
  211. #define CONFIG_BOOTP_BOOTFILESIZE
  212. #define CONFIG_BOOTP_BOOTPATH
  213. #define CONFIG_BOOTP_GATEWAY
  214. #define CONFIG_BOOTP_HOSTNAME
  215. #define CONFIG_SYS_AUTOLOAD "n"
  216. #endif
  217. /* File systems */
  218. #define CONFIG_MTD_DEVICE
  219. #define CONFIG_MTD_PARTITIONS
  220. #if defined(CONFIG_CMD_MTDPARTS) || defined(CONFIG_CMD_NAND)
  221. #define MTDIDS_DEFAULT "nand0=atmel_nand"
  222. #define MTDPARTS_DEFAULT "mtdparts=atmel_nand:-(root)"
  223. #endif
  224. #if defined(CONFIG_CMD_REISER) || defined(CONFIG_CMD_EXT2) || \
  225. defined(CONFIG_CMD_USB) || defined(CONFIG_MMC)
  226. #define CONFIG_DOS_PARTITION
  227. #endif
  228. #define CONFIG_LZO
  229. #define CONFIG_RBTREE
  230. /* Boot command */
  231. #define CONFIG_BOOTDELAY 3
  232. #define CONFIG_CMDLINE_TAG
  233. #define CONFIG_SETUP_MEMORY_TAGS
  234. #define CONFIG_INITRD_TAG
  235. #define CONFIG_BOOTCOMMAND "cp.b 0xC00C6000 ${loadaddr} 0x294000; bootm"
  236. #if defined(CONFIG_CMD_NAND)
  237. #define CONFIG_BOOTARGS "console=ttyS0,115200 " \
  238. "root=/dev/mtdblock0 " \
  239. MTDPARTS_DEFAULT \
  240. " rw rootfstype=jffs2"
  241. #endif
  242. /* Misc. u-boot settings */
  243. #define CONFIG_SYS_PROMPT "U-Boot> "
  244. #define CONFIG_SYS_HUSH_PARSER
  245. #define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
  246. #define CONFIG_SYS_CBSIZE 256
  247. #define CONFIG_SYS_MAXARGS 16
  248. #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + 16 \
  249. + sizeof(CONFIG_SYS_PROMPT))
  250. #define CONFIG_SYS_LONGHELP
  251. #define CONFIG_CMDLINE_EDITING
  252. #endif