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