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