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