Reinhard Meyer | 82a0979 | 2010-10-30 23:09:58 +0000 | [diff] [blame] | 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 | |
| 41 | /* |
| 42 | * Warning: changing CONFIG_SYS_TEXT_BASE requires |
Reinhard Meyer | 9d9f00e | 2010-12-09 10:07:31 +0100 | [diff] [blame] | 43 | * adapting the initial boot program. |
Reinhard Meyer | 82a0979 | 2010-10-30 23:09:58 +0000 | [diff] [blame] | 44 | */ |
Reinhard Meyer | 9d9f00e | 2010-12-09 10:07:31 +0100 | [diff] [blame] | 45 | #define CONFIG_SYS_TEXT_BASE 0x20000000 /* start of SDRAM */ |
Reinhard Meyer | 82a0979 | 2010-10-30 23:09:58 +0000 | [diff] [blame] | 46 | |
| 47 | /* Command line configuration */ |
| 48 | #include <config_cmd_default.h> |
| 49 | #undef CONFIG_CMD_FPGA |
| 50 | #undef CONFIG_CMD_SETGETDCR |
| 51 | #undef CONFIG_CMD_XIMG |
| 52 | #define CONFIG_CMD_ASKENV |
| 53 | #define CONFIG_SYS_CBSIZE 256 |
| 54 | #define CONFIG_SYS_MAXARGS 16 |
| 55 | #define CONFIG_SYS_PBSIZE \ |
| 56 | (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) |
| 57 | #define CONFIG_SYS_PROMPT "TOP9000> " |
| 58 | #define CONFIG_SYS_LONGHELP |
| 59 | #define CONFIG_CMDLINE_EDITING |
| 60 | #define CONFIG_CMD_BDI |
| 61 | #define CONFIG_CMD_CACHE |
| 62 | |
| 63 | /* ARM asynchronous clock */ |
| 64 | #define CONFIG_SYS_AT91_MAIN_CLOCK 18432000 /* 18.432 MHz xtal */ |
| 65 | #define CONFIG_SYS_HZ 1000 |
| 66 | |
| 67 | /* SoC */ |
| 68 | #define CONFIG_ARM926EJS /* ARM926EJS Core */ |
| 69 | #define CONFIG_AT91FAMILY /* it's a member of AT91 */ |
| 70 | #define CONFIG_AT91SAM9260 /* Atmel AT91SAM9260 based SoC */ |
| 71 | #define CONFIG_AT91SAM9XE |
| 72 | |
| 73 | /* Misc CPU related */ |
| 74 | #define CONFIG_AT91_LEGACY |
| 75 | #define CONFIG_ARCH_CPU_INIT |
| 76 | #undef CONFIG_USE_IRQ /* we don't need IRQ/FIQ stuff */ |
| 77 | #define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ |
| 78 | #define CONFIG_SETUP_MEMORY_TAGS |
| 79 | #define CONFIG_INITRD_TAG |
| 80 | #define CONFIG_SKIP_LOWLEVEL_INIT |
| 81 | #define CONFIG_BOARD_EARLY_INIT_F |
| 82 | #define CONFIG_DISPLAY_CPUINFO |
| 83 | #define CONFIG_AT91RESET_EXTRST /* assert external reset */ |
| 84 | |
| 85 | /* general purpose I/O */ |
| 86 | #define CONFIG_AT91_GPIO |
| 87 | #define CONFIG_AT91_GPIO_PULLUP 1 /* keep pullups on peripheral pins */ |
| 88 | |
| 89 | /* serial console */ |
| 90 | #define CONFIG_ATMEL_USART |
| 91 | #define CONFIG_USART3 /* USART 3 is DBGU !!! */ |
| 92 | #define CONFIG_BAUDRATE 115200 |
| 93 | #define CONFIG_SYS_BAUDRATE_TABLE {115200 , 19200, 38400, 57600, 9600 } |
| 94 | |
| 95 | /* SD/MMC card */ |
| 96 | #define CONFIG_MMC |
| 97 | #define CONFIG_GENERIC_MMC |
| 98 | #define CONFIG_GENERIC_ATMEL_MCI |
| 99 | #define CONFIG_SYS_MMC_CD_PIN AT91_PIN_PC9 |
| 100 | #define CONFIG_CMD_MMC |
| 101 | |
| 102 | /* Ethernet */ |
| 103 | #define CONFIG_MACB |
| 104 | #define CONFIG_SYS_PHY_ID 1 |
| 105 | #define CONFIG_RMII |
| 106 | #define CONFIG_NET_MULTI |
| 107 | #define CONFIG_NET_RETRY_COUNT 20 |
| 108 | |
| 109 | /* real time clock */ |
| 110 | #define CONFIG_RTC_AT91SAM9_RTT |
| 111 | #define CONFIG_CMD_DATE |
| 112 | |
| 113 | #if defined(CONFIG_AT91SAM9XE) |
| 114 | /* |
| 115 | * NOR flash - use embedded flash of SAM9XE256/512 |
| 116 | * U-Boot will not fit into 128K ! |
| 117 | * 2010.09 will not fit into 256K with all options enabled ! |
| 118 | * |
| 119 | * Layout: |
| 120 | * 16kB 1st Bootloader |
| 121 | * Rest U-Boot |
| 122 | * the first sector (16kB) of EFLASH cannot be unprotected |
| 123 | * with u-boot commands |
| 124 | */ |
| 125 | # define CONFIG_AT91_EFLASH |
| 126 | # define CONFIG_SYS_FLASH_BASE 0x200000 |
| 127 | # define CONFIG_SYS_MAX_FLASH_SECT 32 |
| 128 | # define CONFIG_SYS_MAX_FLASH_BANKS 1 |
| 129 | # define CONFIG_SYS_FLASH_PROTECTION |
| 130 | # define CONFIG_EFLASH_PROTSECTORS 1 /* protect first sector */ |
| 131 | #endif |
| 132 | |
| 133 | /* SPI */ |
| 134 | #define CONFIG_ATMEL_SPI |
| 135 | #define CONFIG_CMD_SPI |
| 136 | |
| 137 | /* RAMTRON FRAM */ |
| 138 | #define CONFIG_CMD_SF |
| 139 | #define CONFIG_ATMEL_SPI0 /* SPI used for FRAM is SPI0 */ |
| 140 | #define FRAM_SPI_BUS 0 |
| 141 | #define FRAM_CS_NUM 0 |
| 142 | #define CONFIG_SPI_FLASH /* RAMTRON FRAM on SPI bus */ |
| 143 | #define CONFIG_SPI_FRAM_RAMTRON |
| 144 | #define CONFIG_SF_DEFAULT_SPEED 1000000 /* be conservative here... */ |
| 145 | #define CONFIG_SF_DEFAULT_MODE SPI_MODE_0 |
| 146 | #define CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC "FM25H20" |
| 147 | |
| 148 | /* Microchip ENC28J60 (second LAN) */ |
| 149 | #if defined(CONFIG_EVAL9000) |
| 150 | # define CONFIG_ENC28J60 |
| 151 | # define CONFIG_ATMEL_SPI1 /* SPI used for ENC28J60 is SPI1 */ |
| 152 | # define ENC_SPI_BUS 1 |
| 153 | # define ENC_CS_NUM 0 |
| 154 | # define ENC_SPI_CLOCK 1000000 |
| 155 | #endif /* CONFIG_EVAL9000 */ |
| 156 | |
| 157 | /* |
| 158 | * SDRAM: 1 bank, min 32, max 128 MB |
| 159 | * Initialized before u-boot gets started. |
| 160 | */ |
| 161 | #define CONFIG_NR_DRAM_BANKS 1 |
| 162 | #define CONFIG_SYS_SDRAM_BASE 0x20000000 |
| 163 | #define CONFIG_SYS_SDRAM_SIZE 0x08000000 |
| 164 | #define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE |
| 165 | #define CONFIG_SYS_MEMTEST_END 0x21e00000 |
| 166 | #define CONFIG_SYS_LOAD_ADDR \ |
| 167 | (CONFIG_SYS_SDRAM_BASE + 0x01000000) |
| 168 | /* |
| 169 | * Initial stack pointer: 16k - GENERATED_GBL_DATA_SIZE in internal SRAM, |
| 170 | * leaving the correct space for initial global data structure above |
| 171 | * that address while providing maximum stack area below. |
| 172 | */ |
| 173 | #define CONFIG_SYS_INIT_SP_ADDR \ |
| 174 | (0x00300000 + 0x4000 - GENERATED_GBL_DATA_SIZE) |
| 175 | |
| 176 | /* |
| 177 | * NAND flash: 256 MB (optional) |
| 178 | * |
| 179 | * Layout: |
| 180 | * 640kB: u-boot (includes space for spare sectors, handled by |
| 181 | * initial loader) |
| 182 | * 2MB: kernel |
| 183 | * rest: file system |
| 184 | */ |
| 185 | #define CONFIG_NAND_ATMEL |
| 186 | #define CONFIG_SYS_MAX_NAND_DEVICE 1 |
| 187 | #define CONFIG_SYS_NAND_BASE 0x40000000 |
| 188 | #define CONFIG_SYS_NAND_DBW_8 |
| 189 | #define CONFIG_SYS_NAND_MASK_ALE (1 << 21) |
| 190 | #define CONFIG_SYS_NAND_MASK_CLE (1 << 22) |
| 191 | #define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PC14 |
| 192 | #define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PC13 |
| 193 | #define CONFIG_CMD_NAND |
| 194 | |
| 195 | /* USB */ |
| 196 | #define CONFIG_USB_ATMEL |
| 197 | #define CONFIG_USB_OHCI_NEW |
| 198 | #define CONFIG_DOS_PARTITION |
| 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 "top9000" |
| 202 | #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2 |
| 203 | #define CONFIG_USB_STORAGE |
| 204 | #define CONFIG_CMD_USB |
| 205 | |
| 206 | /* I2C support must always be enabled */ |
| 207 | #define CONFIG_SOFT_I2C |
| 208 | #define CONFIG_CMD_I2C |
| 209 | #define CONFIG_SYS_I2C_SPEED 400000 |
| 210 | #define CONFIG_SYS_I2C_SLAVE 0x7F |
| 211 | #define CONFIG_I2C_MULTI_BUS |
| 212 | #define I2C0_PORT AT91_PIO_PORTA |
| 213 | #define SDA0_PIN 23 |
| 214 | #define SCL0_PIN 24 |
| 215 | #define I2C1_PORT AT91_PIO_PORTB |
| 216 | #define SDA1_PIN 12 |
| 217 | #define SCL1_PIN 13 |
| 218 | #define I2C_SOFT_DECLARATIONS void iic_init(void);\ |
| 219 | int iic_read(void);\ |
| 220 | void iic_sda(int);\ |
| 221 | void iic_scl(int); |
| 222 | #define I2C_ACTIVE |
| 223 | #define I2C_TRISTATE |
| 224 | #define I2C_INIT iic_init() |
| 225 | #define I2C_READ iic_read() |
| 226 | #define I2C_SDA(bit) iic_sda(bit) |
| 227 | #define I2C_SCL(bit) iic_scl(bit) |
| 228 | #define I2C_DELAY udelay(3) |
| 229 | /* EEPROM configuration */ |
| 230 | #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 5 |
| 231 | #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5 |
| 232 | #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 |
| 233 | #define CONFIG_SYS_EEPROM_SIZE 0x2000 |
| 234 | #define CONFIG_SYS_I2C_EEPROM_ADDR 0x57 |
| 235 | /* later: #define CONFIG_I2C_ENV_EEPROM_BUS 0 */ |
| 236 | /* ENV is always in I2C-EEPROM */ |
| 237 | #define CONFIG_ENV_IS_IN_EEPROM |
| 238 | #define CONFIG_ENV_OFFSET 0x1000 |
| 239 | #define CONFIG_ENV_SIZE 0x0f00 |
| 240 | /* VPD settings */ |
| 241 | #define CONFIG_SYS_I2C_FACT_ADDR 0x57 |
| 242 | #define CONFIG_SYS_FACT_OFFSET 0x1F00 |
| 243 | #define CONFIG_SYS_FACT_SIZE 0x0100 |
| 244 | /* later: #define CONFIG_MISC_INIT_R */ |
| 245 | /* define the next only if you want to allow users to enter VPD data */ |
| 246 | #define CONFIG_SYS_FACT_ENTRY |
| 247 | #ifndef __ASSEMBLY__ |
| 248 | extern void read_factory_r(void); |
| 249 | #endif |
| 250 | |
| 251 | /* |
| 252 | * Only interrupt autoboot if <space> is pressed. Otherwise, garbage |
| 253 | * data on the serial line may interrupt the boot sequence. |
| 254 | */ |
| 255 | #define CONFIG_BOOTDELAY 1 |
| 256 | #define CONFIG_AUTOBOOT |
| 257 | #define CONFIG_AUTOBOOT_KEYED |
| 258 | #define CONFIG_AUTOBOOT_PROMPT \ |
| 259 | "Press SPACE to abort autoboot in %d seconds\n", bootdelay |
| 260 | #define CONFIG_AUTOBOOT_DELAY_STR "d" |
| 261 | #define CONFIG_AUTOBOOT_STOP_STR " " |
| 262 | |
| 263 | /* |
| 264 | * add filesystem commands if we have at least 1 storage |
| 265 | * media with filesystem |
| 266 | */ |
| 267 | #if defined(CONFIG_NAND_ATMEL) \ |
| 268 | || defined(CONFIG_USB_ATMEL) \ |
| 269 | || defined(CONFIG_MMC) |
| 270 | # define CONFIG_DOS_PARTITION |
| 271 | # define CONFIG_CMD_FAT |
| 272 | # define CONFIG_CMD_EXT2 |
| 273 | /* later: #define CONFIG_CMD_JFFS2 */ |
| 274 | #endif |
| 275 | |
| 276 | /* add NET commands if we have at least 1 LAN */ |
| 277 | #if defined(CONFIG_MACB) || defined(CONFIG_ENC28J60) |
| 278 | # define CONFIG_CMD_PING |
| 279 | # define CONFIG_CMD_DHCP |
| 280 | # define CONFIG_CMD_MII |
| 281 | /* is this really needed ? */ |
| 282 | # define CONFIG_RESET_PHY_R |
| 283 | /* BOOTP options */ |
| 284 | # define CONFIG_BOOTP_BOOTFILESIZE |
| 285 | # define CONFIG_BOOTP_BOOTPATH |
| 286 | # define CONFIG_BOOTP_GATEWAY |
| 287 | # define CONFIG_BOOTP_HOSTNAME |
| 288 | #endif |
| 289 | |
| 290 | /* linux in NAND flash */ |
| 291 | #define CONFIG_BOOTCOUNT_LIMIT 1 |
| 292 | #define CONFIG_BOOTCOMMAND \ |
| 293 | "nand read 0x21000000 0xA0000 0x200000; bootm" |
| 294 | #define CONFIG_BOOTARGS \ |
| 295 | "console=ttyS0,115200 " \ |
| 296 | "root=/dev/mtdblock2 " \ |
| 297 | "mtdparts=atmel_nand:" \ |
| 298 | "640k(uboot)ro," \ |
| 299 | "2M(linux)," \ |
| 300 | "16M(root)," \ |
| 301 | "-(rest) " \ |
| 302 | "rw "\ |
| 303 | "rootfstype=jffs2" |
| 304 | |
| 305 | /* Size of malloc() pool */ |
| 306 | #define CONFIG_SYS_MALLOC_LEN \ |
| 307 | ROUND(3 * CONFIG_ENV_SIZE + 128*1024, 0x1000) |
| 308 | #define CONFIG_STACKSIZE (32*1024) |
| 309 | #ifdef CONFIG_USE_IRQ |
| 310 | #error CONFIG_USE_IRQ not supported |
| 311 | #endif |
| 312 | |
| 313 | #endif |