1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */ 2b841b6e9Srick /* 3b841b6e9Srick * Copyright (C) 2011 Andes Technology Corporation 4b841b6e9Srick * Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com> 5b841b6e9Srick * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com> 6b841b6e9Srick */ 7b841b6e9Srick 8b841b6e9Srick #ifndef __CONFIG_H 9b841b6e9Srick #define __CONFIG_H 10b841b6e9Srick 11b841b6e9Srick #include <asm/arch-ae3xx/ae3xx.h> 12b841b6e9Srick 13b841b6e9Srick /* 14b841b6e9Srick * CPU and Board Configuration Options 15b841b6e9Srick */ 16b841b6e9Srick #define CONFIG_USE_INTERRUPT 17b841b6e9Srick 18b841b6e9Srick #define CONFIG_SKIP_LOWLEVEL_INIT 19b841b6e9Srick 20b841b6e9Srick #define CONFIG_SKIP_TRUNOFF_WATCHDOG 21b841b6e9Srick 22e336b73dSrick #define CONFIG_ARCH_MAP_SYSMEM 23b841b6e9Srick 24b841b6e9Srick #define CONFIG_BOOTP_SEND_HOSTNAME 25b841b6e9Srick #define CONFIG_BOOTP_SERVERIP 26b841b6e9Srick 27b841b6e9Srick #ifdef CONFIG_SKIP_LOWLEVEL_INIT 28b841b6e9Srick #ifdef CONFIG_OF_CONTROL 29b841b6e9Srick #undef CONFIG_OF_SEPARATE 30b841b6e9Srick #define CONFIG_OF_EMBED 31b841b6e9Srick #endif 32b841b6e9Srick #endif 33b841b6e9Srick 34b841b6e9Srick /* 35b841b6e9Srick * Timer 36b841b6e9Srick */ 37b841b6e9Srick #define CONFIG_SYS_CLK_FREQ 39062500 38b841b6e9Srick #define VERSION_CLOCK CONFIG_SYS_CLK_FREQ 39b841b6e9Srick 40b841b6e9Srick /* 41b841b6e9Srick * Use Externel CLOCK or PCLK 42b841b6e9Srick */ 43b841b6e9Srick #undef CONFIG_FTRTC010_EXTCLK 44b841b6e9Srick 45b841b6e9Srick #ifndef CONFIG_FTRTC010_EXTCLK 46b841b6e9Srick #define CONFIG_FTRTC010_PCLK 47b841b6e9Srick #endif 48b841b6e9Srick 49b841b6e9Srick #ifdef CONFIG_FTRTC010_EXTCLK 50b841b6e9Srick #define TIMER_CLOCK 32768 /* CONFIG_FTRTC010_EXTCLK */ 51b841b6e9Srick #else 52b841b6e9Srick #define TIMER_CLOCK CONFIG_SYS_HZ /* CONFIG_FTRTC010_PCLK */ 53b841b6e9Srick #endif 54b841b6e9Srick 55b841b6e9Srick #define TIMER_LOAD_VAL 0xffffffff 56b841b6e9Srick 57b841b6e9Srick /* 58b841b6e9Srick * Real Time Clock 59b841b6e9Srick */ 60b841b6e9Srick #define CONFIG_RTC_FTRTC010 61b841b6e9Srick 62b841b6e9Srick /* 63b841b6e9Srick * Real Time Clock Divider 64b841b6e9Srick * RTC_DIV_COUNT (OSC_CLK/OSC_5MHZ) 65b841b6e9Srick */ 66b841b6e9Srick #define OSC_5MHZ (5*1000000) 67b841b6e9Srick #define OSC_CLK (4*OSC_5MHZ) 68b841b6e9Srick #define RTC_DIV_COUNT (0.5) /* Why?? */ 69b841b6e9Srick 70b841b6e9Srick /* 71b841b6e9Srick * Serial console configuration 72b841b6e9Srick */ 73b841b6e9Srick 74b841b6e9Srick /* FTUART is a high speed NS 16C550A compatible UART, addr: 0x99600000 */ 75b841b6e9Srick #define CONFIG_SYS_NS16550_SERIAL 76b841b6e9Srick #define CONFIG_SYS_NS16550_COM1 CONFIG_FTUART010_02_BASE 77b841b6e9Srick #ifndef CONFIG_DM_SERIAL 78b841b6e9Srick #define CONFIG_SYS_NS16550_REG_SIZE -4 79b841b6e9Srick #endif 80b841b6e9Srick #define CONFIG_SYS_NS16550_CLK ((18432000 * 20) / 25) /* AG101P */ 81b841b6e9Srick 82b841b6e9Srick /* 83b841b6e9Srick * Miscellaneous configurable options 84b841b6e9Srick */ 85b841b6e9Srick 86b841b6e9Srick /* 87b841b6e9Srick * Size of malloc() pool 88b841b6e9Srick */ 89b841b6e9Srick /* 512kB is suggested, (CONFIG_ENV_SIZE + 128 * 1024) was not enough */ 90b841b6e9Srick #define CONFIG_SYS_MALLOC_LEN (512 << 10) 91b841b6e9Srick 92b841b6e9Srick /* 93b841b6e9Srick * Physical Memory Map 94b841b6e9Srick */ 95b841b6e9Srick #define PHYS_SDRAM_0 0x00000000 /* SDRAM Bank #1 */ 96b841b6e9Srick 97b841b6e9Srick #define PHYS_SDRAM_1 \ 98b841b6e9Srick (PHYS_SDRAM_0 + PHYS_SDRAM_0_SIZE) /* SDRAM Bank #2 */ 99b841b6e9Srick 100b841b6e9Srick #define PHYS_SDRAM_0_SIZE 0x20000000 /* 512 MB */ 101b841b6e9Srick #define PHYS_SDRAM_1_SIZE 0x20000000 /* 512 MB */ 102b841b6e9Srick 103b841b6e9Srick #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_0 104b841b6e9Srick 105b841b6e9Srick #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0xA0000 - \ 106b841b6e9Srick GENERATED_GBL_DATA_SIZE) 107b841b6e9Srick 108b841b6e9Srick /* 109b841b6e9Srick * Load address and memory test area should agree with 110b841b6e9Srick * arch/nds32/config.mk. Be careful not to overwrite U-Boot itself. 111b841b6e9Srick */ 112b841b6e9Srick #define CONFIG_SYS_LOAD_ADDR 0x300000 113b841b6e9Srick 114b841b6e9Srick /* memtest works on 63 MB in DRAM */ 115b841b6e9Srick #define CONFIG_SYS_MEMTEST_START PHYS_SDRAM_0 116b841b6e9Srick #define CONFIG_SYS_MEMTEST_END (PHYS_SDRAM_0 + 0x03F00000) 117b841b6e9Srick 118b841b6e9Srick /* 119b841b6e9Srick * Static memory controller configuration 120b841b6e9Srick */ 121b841b6e9Srick #define CONFIG_FTSMC020 122b841b6e9Srick 123b841b6e9Srick #ifdef CONFIG_FTSMC020 124b841b6e9Srick #include <faraday/ftsmc020.h> 125b841b6e9Srick 126b841b6e9Srick #define CONFIG_SYS_FTSMC020_CONFIGS { \ 127b841b6e9Srick { FTSMC020_BANK0_CONFIG, FTSMC020_BANK0_TIMING, }, \ 128b841b6e9Srick { FTSMC020_BANK1_CONFIG, FTSMC020_BANK1_TIMING, }, \ 129b841b6e9Srick } 130b841b6e9Srick 131b841b6e9Srick #ifndef CONFIG_SKIP_LOWLEVEL_INIT /* FLASH is on BANK 0 */ 132b841b6e9Srick #define FTSMC020_BANK0_LOWLV_CONFIG (FTSMC020_BANK_ENABLE | \ 133b841b6e9Srick FTSMC020_BANK_SIZE_32M | \ 134b841b6e9Srick FTSMC020_BANK_MBW_32) 135b841b6e9Srick 136b841b6e9Srick #define FTSMC020_BANK0_LOWLV_TIMING (FTSMC020_TPR_RBE | \ 137b841b6e9Srick FTSMC020_TPR_AST(1) | \ 138b841b6e9Srick FTSMC020_TPR_CTW(1) | \ 139b841b6e9Srick FTSMC020_TPR_ATI(1) | \ 140b841b6e9Srick FTSMC020_TPR_AT2(1) | \ 141b841b6e9Srick FTSMC020_TPR_WTC(1) | \ 142b841b6e9Srick FTSMC020_TPR_AHT(1) | \ 143b841b6e9Srick FTSMC020_TPR_TRNA(1)) 144b841b6e9Srick #endif 145b841b6e9Srick 146b841b6e9Srick /* 147b841b6e9Srick * FLASH on ADP_AG101P is connected to BANK0 148b841b6e9Srick * Just disalbe the other BANK to avoid detection error. 149b841b6e9Srick */ 150b841b6e9Srick #define FTSMC020_BANK0_CONFIG (FTSMC020_BANK_ENABLE | \ 151b841b6e9Srick FTSMC020_BANK_BASE(PHYS_FLASH_1) | \ 152b841b6e9Srick FTSMC020_BANK_SIZE_32M | \ 153b841b6e9Srick FTSMC020_BANK_MBW_32) 154b841b6e9Srick 155b841b6e9Srick #define FTSMC020_BANK0_TIMING (FTSMC020_TPR_AST(3) | \ 156b841b6e9Srick FTSMC020_TPR_CTW(3) | \ 157b841b6e9Srick FTSMC020_TPR_ATI(0xf) | \ 158b841b6e9Srick FTSMC020_TPR_AT2(3) | \ 159b841b6e9Srick FTSMC020_TPR_WTC(3) | \ 160b841b6e9Srick FTSMC020_TPR_AHT(3) | \ 161b841b6e9Srick FTSMC020_TPR_TRNA(0xf)) 162b841b6e9Srick 163b841b6e9Srick #define FTSMC020_BANK1_CONFIG (0x00) 164b841b6e9Srick #define FTSMC020_BANK1_TIMING (0x00) 165b841b6e9Srick #endif /* CONFIG_FTSMC020 */ 166b841b6e9Srick 167b841b6e9Srick /* 168b841b6e9Srick * FLASH and environment organization 169b841b6e9Srick */ 170b841b6e9Srick /* use CFI framework */ 171b841b6e9Srick 172b841b6e9Srick #define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT 173b841b6e9Srick #define CONFIG_SYS_CFI_FLASH_STATUS_POLL 174b841b6e9Srick 175b841b6e9Srick /* support JEDEC */ 176b841b6e9Srick #ifdef CONFIG_CFI_FLASH 177b841b6e9Srick #define CONFIG_SYS_MAX_FLASH_BANKS_DETECT 1 178b841b6e9Srick #endif 179b841b6e9Srick 180b841b6e9Srick /* Do not use CONFIG_FLASH_CFI_LEGACY to detect on board flash */ 181b841b6e9Srick #define PHYS_FLASH_1 0x88000000 /* BANK 0 */ 182b841b6e9Srick #define CONFIG_SYS_FLASH_BASE PHYS_FLASH_1 183b841b6e9Srick #define CONFIG_SYS_FLASH_BANKS_LIST { PHYS_FLASH_1, } 184b841b6e9Srick #define CONFIG_SYS_MONITOR_BASE PHYS_FLASH_1 185b841b6e9Srick 186b841b6e9Srick #define CONFIG_SYS_FLASH_ERASE_TOUT 120000 /* TO for Flash Erase (ms) */ 187b841b6e9Srick #define CONFIG_SYS_FLASH_WRITE_TOUT 500 /* TO for Flash Write (ms) */ 188b841b6e9Srick 189b841b6e9Srick /* max number of memory banks */ 190b841b6e9Srick /* 191b841b6e9Srick * There are 4 banks supported for this Controller, 192b841b6e9Srick * but we have only 1 bank connected to flash on board 193b841b6e9Srick */ 194b841b6e9Srick #ifndef CONFIG_SYS_MAX_FLASH_BANKS_DETECT 195b841b6e9Srick #define CONFIG_SYS_MAX_FLASH_BANKS 1 196b841b6e9Srick #endif 197b841b6e9Srick #define CONFIG_SYS_FLASH_BANKS_SIZES {0x4000000} 198b841b6e9Srick 199b841b6e9Srick /* max number of sectors on one chip */ 200b841b6e9Srick #define CONFIG_FLASH_SECTOR_SIZE (0x10000*2) 201b841b6e9Srick #define CONFIG_SYS_MAX_FLASH_SECT 512 202b841b6e9Srick 203b841b6e9Srick /* environments */ 2047b1a50b7Srick #define CONFIG_ENV_SECT_SIZE 0x1000 2057b1a50b7Srick #define CONFIG_ENV_OFFSET 0x140000 206b841b6e9Srick #define CONFIG_ENV_SIZE 8192 207b841b6e9Srick #define CONFIG_ENV_OVERWRITE 208b841b6e9Srick 2097b1a50b7Srick 2107b1a50b7Srick /* SPI FLASH */ 2117b1a50b7Srick 212b841b6e9Srick /* 213b841b6e9Srick * For booting Linux, the board info and command line data 214b841b6e9Srick * have to be in the first 16 MB of memory, since this is 215b841b6e9Srick * the maximum mapped by the Linux kernel during initialization. 216b841b6e9Srick */ 217b841b6e9Srick 218b841b6e9Srick /* Initial Memory map for Linux*/ 219b841b6e9Srick #define CONFIG_SYS_BOOTMAPSZ (64 << 20) 220b841b6e9Srick /* Increase max gunzip size */ 221b841b6e9Srick #define CONFIG_SYS_BOOTM_LEN (64 << 20) 222b841b6e9Srick 223b841b6e9Srick #endif /* __CONFIG_H */ 224