blob: 254c2308faf03c11ac1cf54ed5d1ca437ae42209 [file] [log] [blame]
Matt Waddelb80e41a2010-10-07 15:48:45 -06001/*
Ryan Harkin168d8202011-10-18 11:06:25 +01002 * (C) Copyright 2011 ARM Limited
Matt Waddelb80e41a2010-10-07 15:48:45 -06003 * (C) Copyright 2010 Linaro
4 * Matt Waddel, <matt.waddel@linaro.org>
5 *
6 * Configuration for Versatile Express. Parts were derived from other ARM
7 * configurations.
8 *
9 * See file CREDITS for list of people who contributed to this
10 * project.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 * MA 02111-1307 USA
26 */
27
Ryan Harkin168d8202011-10-18 11:06:25 +010028#ifndef __VEXPRESS_COMMON_H
29#define __VEXPRESS_COMMON_H
30
31/* Definitions copied from linux kernel: arch/arm/mach-vexpress/include/mach/motherboard.h */
32#ifdef CONFIG_VEXPRESS_ORIGINAL_MEMORY_MAP
33/* CS register bases for the original memory map. */
34#define V2M_PA_CS0 0x40000000
35#define V2M_PA_CS1 0x44000000
36#define V2M_PA_CS2 0x48000000
37#define V2M_PA_CS3 0x4c000000
38#define V2M_PA_CS7 0x10000000
39
40#define V2M_PERIPH_OFFSET(x) (x << 12)
41#define V2M_SYSREGS (V2M_PA_CS7 + V2M_PERIPH_OFFSET(0))
42#define V2M_SYSCTL (V2M_PA_CS7 + V2M_PERIPH_OFFSET(1))
43#define V2M_SERIAL_BUS_PCI (V2M_PA_CS7 + V2M_PERIPH_OFFSET(2))
44
45#define V2M_BASE 0x60000000
46#define CONFIG_SYS_TEXT_BASE 0x60800000
47#elif defined(CONFIG_VEXPRESS_EXTENDED_MEMORY_MAP)
48/* CS register bases for the extended memory map. */
49#define V2M_PA_CS0 0x08000000
50#define V2M_PA_CS1 0x0c000000
51#define V2M_PA_CS2 0x14000000
52#define V2M_PA_CS3 0x18000000
53#define V2M_PA_CS7 0x1c000000
54
55#define V2M_PERIPH_OFFSET(x) (x << 16)
56#define V2M_SYSREGS (V2M_PA_CS7 + V2M_PERIPH_OFFSET(1))
57#define V2M_SYSCTL (V2M_PA_CS7 + V2M_PERIPH_OFFSET(2))
58#define V2M_SERIAL_BUS_PCI (V2M_PA_CS7 + V2M_PERIPH_OFFSET(3))
59
60#define V2M_BASE 0x80000000
61#define CONFIG_SYS_TEXT_BASE 0x80800000
62#endif
63
64/*
65 * Physical addresses, offset from V2M_PA_CS0-3
66 */
67#define V2M_NOR0 (V2M_PA_CS0)
68#define V2M_NOR1 (V2M_PA_CS1)
69#define V2M_SRAM (V2M_PA_CS2)
70#define V2M_VIDEO_SRAM (V2M_PA_CS3 + 0x00000000)
71#define V2M_LAN9118 (V2M_PA_CS3 + 0x02000000)
72#define V2M_ISP1761 (V2M_PA_CS3 + 0x03000000)
73
74/* Common peripherals relative to CS7. */
75#define V2M_AACI (V2M_PA_CS7 + V2M_PERIPH_OFFSET(4))
76#define V2M_MMCI (V2M_PA_CS7 + V2M_PERIPH_OFFSET(5))
77#define V2M_KMI0 (V2M_PA_CS7 + V2M_PERIPH_OFFSET(6))
78#define V2M_KMI1 (V2M_PA_CS7 + V2M_PERIPH_OFFSET(7))
79
80#define V2M_UART0 (V2M_PA_CS7 + V2M_PERIPH_OFFSET(9))
81#define V2M_UART1 (V2M_PA_CS7 + V2M_PERIPH_OFFSET(10))
82#define V2M_UART2 (V2M_PA_CS7 + V2M_PERIPH_OFFSET(11))
83#define V2M_UART3 (V2M_PA_CS7 + V2M_PERIPH_OFFSET(12))
84
85#define V2M_WDT (V2M_PA_CS7 + V2M_PERIPH_OFFSET(15))
86
87#define V2M_TIMER01 (V2M_PA_CS7 + V2M_PERIPH_OFFSET(17))
88#define V2M_TIMER23 (V2M_PA_CS7 + V2M_PERIPH_OFFSET(18))
89
90#define V2M_SERIAL_BUS_DVI (V2M_PA_CS7 + V2M_PERIPH_OFFSET(22))
91#define V2M_RTC (V2M_PA_CS7 + V2M_PERIPH_OFFSET(23))
92
93#define V2M_CF (V2M_PA_CS7 + V2M_PERIPH_OFFSET(26))
94
95#define V2M_CLCD (V2M_PA_CS7 + V2M_PERIPH_OFFSET(31))
96#define V2M_SIZE_CS7 V2M_PERIPH_OFFSET(32)
97
98/* System register offsets. */
99#define V2M_SYS_CFGDATA (V2M_SYSREGS + 0x0a0)
100#define V2M_SYS_CFGCTRL (V2M_SYSREGS + 0x0a4)
101#define V2M_SYS_CFGSTAT (V2M_SYSREGS + 0x0a8)
102
103/*
104 * Configuration
105 */
106#define SYS_CFG_START (1 << 31)
107#define SYS_CFG_WRITE (1 << 30)
108#define SYS_CFG_OSC (1 << 20)
109#define SYS_CFG_VOLT (2 << 20)
110#define SYS_CFG_AMP (3 << 20)
111#define SYS_CFG_TEMP (4 << 20)
112#define SYS_CFG_RESET (5 << 20)
113#define SYS_CFG_SCC (6 << 20)
114#define SYS_CFG_MUXFPGA (7 << 20)
115#define SYS_CFG_SHUTDOWN (8 << 20)
116#define SYS_CFG_REBOOT (9 << 20)
117#define SYS_CFG_DVIMODE (11 << 20)
118#define SYS_CFG_POWER (12 << 20)
119#define SYS_CFG_SITE_MB (0 << 16)
120#define SYS_CFG_SITE_DB1 (1 << 16)
121#define SYS_CFG_SITE_DB2 (2 << 16)
122#define SYS_CFG_STACK(n) ((n) << 12)
123
124#define SYS_CFG_ERR (1 << 1)
125#define SYS_CFG_COMPLETE (1 << 0)
Matt Waddelb80e41a2010-10-07 15:48:45 -0600126
127/* Board info register */
Ryan Harkin168d8202011-10-18 11:06:25 +0100128#define SYS_ID V2M_SYSREGS
Matt Waddelb80e41a2010-10-07 15:48:45 -0600129#define CONFIG_REVISION_TAG 1
130
Ryan Harkin168d8202011-10-18 11:06:25 +0100131#define CONFIG_SYS_MEMTEST_START V2M_BASE
Matt Waddelb80e41a2010-10-07 15:48:45 -0600132#define CONFIG_SYS_MEMTEST_END 0x20000000
133#define CONFIG_SYS_HZ 1000
134
135#define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */
136#define CONFIG_SETUP_MEMORY_TAGS 1
Aneesh Ve47f2db2011-06-16 23:30:48 +0000137#define CONFIG_SYS_L2CACHE_OFF 1
Matt Waddelb80e41a2010-10-07 15:48:45 -0600138#define CONFIG_INITRD_TAG 1
139
Grant Likely2fa8ca92011-03-28 09:59:07 +0000140#define CONFIG_OF_LIBFDT 1
141
Matt Waddelb80e41a2010-10-07 15:48:45 -0600142/* Size of malloc() pool */
143#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128 * 1024)
Matt Waddelb80e41a2010-10-07 15:48:45 -0600144
Ryan Harkin168d8202011-10-18 11:06:25 +0100145#define SCTL_BASE V2M_SYSCTL
Matt Waddelb80e41a2010-10-07 15:48:45 -0600146#define VEXPRESS_FLASHPROG_FLVPPEN (1 << 0)
147
148/* SMSC9115 Ethernet from SMSC9118 family */
Matt Waddelb80e41a2010-10-07 15:48:45 -0600149#define CONFIG_SMC911X 1
150#define CONFIG_SMC911X_32_BIT 1
Ryan Harkin168d8202011-10-18 11:06:25 +0100151#define CONFIG_SMC911X_BASE V2M_LAN9118
Matt Waddelb80e41a2010-10-07 15:48:45 -0600152
153/* PL011 Serial Configuration */
154#define CONFIG_PL011_SERIAL
155#define CONFIG_PL011_CLOCK 24000000
156#define CONFIG_PL01x_PORTS {(void *)CONFIG_SYS_SERIAL0, \
157 (void *)CONFIG_SYS_SERIAL1}
158#define CONFIG_CONS_INDEX 0
159
160#define CONFIG_BAUDRATE 38400
161#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
Ryan Harkin168d8202011-10-18 11:06:25 +0100162#define CONFIG_SYS_SERIAL0 V2M_UART0
163#define CONFIG_SYS_SERIAL1 V2M_UART1
Matt Waddelb80e41a2010-10-07 15:48:45 -0600164
165/* Command line configuration */
166#define CONFIG_CMD_BDI
167#define CONFIG_CMD_DHCP
Jason Hobbse21669f2011-08-23 11:07:00 +0000168#define CONFIG_CMD_PXE
169#define CONFIG_MENU
Matt Waddelb80e41a2010-10-07 15:48:45 -0600170#define CONFIG_CMD_ELF
171#define CONFIG_CMD_ENV
172#define CONFIG_CMD_FLASH
173#define CONFIG_CMD_IMI
174#define CONFIG_CMD_MEMORY
175#define CONFIG_CMD_NET
176#define CONFIG_CMD_PING
177#define CONFIG_CMD_SAVEENV
Matt Waddelb80e41a2010-10-07 15:48:45 -0600178#define CONFIG_CMD_RUN
Jon Medhurstd73e3012011-11-23 11:09:34 +0000179#define CONFIG_CMD_BOOTD
180#define CONFIG_CMD_ECHO
Matt Waddelb80e41a2010-10-07 15:48:45 -0600181
182#define CONFIG_CMD_FAT
183#define CONFIG_DOS_PARTITION 1
184#define CONFIG_MMC 1
185#define CONFIG_CMD_MMC
186#define CONFIG_GENERIC_MMC
Matt Waddelf0c64522011-04-16 11:54:08 +0000187#define CONFIG_ARM_PL180_MMCI
John Rigby9c143062012-03-07 18:24:05 -0700188#define CONFIG_ARM_PL180_MMCI_BASE V2M_MMCI
Matt Waddelf0c64522011-04-16 11:54:08 +0000189#define CONFIG_SYS_MMC_MAX_BLK_COUNT 127
190#define CONFIG_ARM_PL180_MMCI_CLOCK_FREQ 6250000
Matt Waddelb80e41a2010-10-07 15:48:45 -0600191
192/* BOOTP options */
193#define CONFIG_BOOTP_BOOTFILESIZE
194#define CONFIG_BOOTP_BOOTPATH
195#define CONFIG_BOOTP_GATEWAY
196#define CONFIG_BOOTP_HOSTNAME
Jason Hobbse72f0b12011-08-23 11:07:01 +0000197#define CONFIG_BOOTP_PXE
198#define CONFIG_BOOTP_PXE_CLIENTARCH 0x100
Justin L Wernerdc80e002012-08-09 14:20:30 -0600199#define CONFIG_BOOTP_VENDOREX
200#define CONFIG_BOOTP_VENDOREX_PXE_SHARED
Matt Waddelb80e41a2010-10-07 15:48:45 -0600201
202/* Miscellaneous configurable options */
203#undef CONFIG_SYS_CLKS_IN_HZ
Ryan Harkin168d8202011-10-18 11:06:25 +0100204#define CONFIG_SYS_LOAD_ADDR (V2M_BASE + 0x8000) /* load address */
205#define LINUX_BOOT_PARAM_ADDR (V2M_BASE + 0x2000)
Matt Waddelb80e41a2010-10-07 15:48:45 -0600206#define CONFIG_BOOTDELAY 2
207
208/* Stack sizes are set up in start.S using the settings below */
209#define CONFIG_STACKSIZE (128 * 1024) /* regular stack */
210#ifdef CONFIG_USE_IRQ
211#define CONFIG_STACKSIZE_IRQ (4 * 1024) /* IRQ stack */
212#define CONFIG_STACKSIZE_FIQ (4 * 1024) /* FIQ stack */
213#endif
214
215/* Physical Memory Map */
216#define CONFIG_NR_DRAM_BANKS 2
Ryan Harkin168d8202011-10-18 11:06:25 +0100217#define PHYS_SDRAM_1 (V2M_BASE) /* SDRAM Bank #1 */
218#define PHYS_SDRAM_2 (((unsigned int)V2M_BASE) + ((unsigned int)0x20000000)) /* SDRAM Bank #2 */
Matt Waddelb80e41a2010-10-07 15:48:45 -0600219#define PHYS_SDRAM_1_SIZE 0x20000000 /* 512 MB */
220#define PHYS_SDRAM_2_SIZE 0x20000000 /* 512 MB */
221
222/* additions for new relocation code */
223#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
Wolfgang Denk553f0982010-10-26 13:32:32 +0200224#define CONFIG_SYS_INIT_RAM_SIZE 0x1000
Matt Waddelb80e41a2010-10-07 15:48:45 -0600225#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_SDRAM_BASE + \
Wolfgang Denk553f0982010-10-26 13:32:32 +0200226 CONFIG_SYS_INIT_RAM_SIZE - \
Wolfgang Denk25ddd1f2010-10-26 14:34:52 +0200227 GENERATED_GBL_DATA_SIZE)
Matt Waddelb80e41a2010-10-07 15:48:45 -0600228#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_GBL_DATA_OFFSET
229
230/* Basic environment settings */
Jon Medhurstd73e3012011-11-23 11:09:34 +0000231#define CONFIG_BOOTCOMMAND \
232 "if mmc rescan ${mmcdev}; then " \
233 "if run loadbootscript; then " \
234 "run bootscript; " \
235 "fi; " \
236 "fi; " \
237 "run bootflash;"
238
Ryan Harkin168d8202011-10-18 11:06:25 +0100239#ifdef CONFIG_VEXPRESS_ORIGINAL_MEMORY_MAP
240#define CONFIG_PLATFORM_ENV_SETTINGS \
Matt Waddelb80e41a2010-10-07 15:48:45 -0600241 "loadaddr=0x80008000\0" \
Jason Hobbs75e7f3f2011-08-23 11:06:59 +0000242 "ramdisk_addr_r=0x61000000\0" \
243 "kernel_addr=0x44100000\0" \
244 "ramdisk_addr=0x44800000\0" \
245 "maxramdisk=0x1800000\0" \
Jason Hobbse21669f2011-08-23 11:07:00 +0000246 "pxefile_addr_r=0x88000000\0" \
Ryan Harkin168d8202011-10-18 11:06:25 +0100247 "kernel_addr_r=0x80008000\0"
248#elif defined(CONFIG_VEXPRESS_EXTENDED_MEMORY_MAP)
249#define CONFIG_PLATFORM_ENV_SETTINGS \
250 "loadaddr=0xa0008000\0" \
251 "ramdisk_addr_r=0x81000000\0" \
252 "kernel_addr=0x0c100000\0" \
253 "ramdisk_addr=0x0c800000\0" \
254 "maxramdisk=0x1800000\0" \
255 "pxefile_addr_r=0xa8000000\0" \
256 "kernel_addr_r=0xa0008000\0"
257#endif
258#define CONFIG_EXTRA_ENV_SETTINGS \
259 CONFIG_PLATFORM_ENV_SETTINGS \
Matt Waddelb80e41a2010-10-07 15:48:45 -0600260 "console=ttyAMA0,38400n8\0" \
261 "dram=1024M\0" \
262 "root=/dev/sda1 rw\0" \
263 "mtd=armflash:1M@0x800000(uboot),7M@0x1000000(kernel)," \
264 "24M@0x2000000(initrd)\0" \
265 "flashargs=setenv bootargs root=${root} console=${console} " \
266 "mem=${dram} mtdparts=${mtd} mmci.fmax=190000 " \
267 "devtmpfs.mount=0 vmalloc=256M\0" \
268 "bootflash=run flashargs; " \
Jason Hobbs75e7f3f2011-08-23 11:06:59 +0000269 "cp ${ramdisk_addr} ${ramdisk_addr_r} ${maxramdisk}; " \
Jon Medhurstd73e3012011-11-23 11:09:34 +0000270 "bootm ${kernel_addr} ${ramdisk_addr_r}\0" \
271 "mmcdev=0\0" \
272 "bootscr=boot.scr\0" \
273 "loadbootscript=fatload mmc ${mmcdev} ${loadaddr} ${bootscr}\0" \
274 "bootscript=echo Running bootscript from mmc ...; " \
275 "source ${loadaddr}\0"
Matt Waddelb80e41a2010-10-07 15:48:45 -0600276
277/* FLASH and environment organization */
278#define PHYS_FLASH_SIZE 0x04000000 /* 64MB */
279#define CONFIG_SYS_FLASH_CFI 1
280#define CONFIG_FLASH_CFI_DRIVER 1
281#define CONFIG_SYS_FLASH_SIZE 0x04000000
282#define CONFIG_SYS_MAX_FLASH_BANKS 2
Ryan Harkin168d8202011-10-18 11:06:25 +0100283#define CONFIG_SYS_FLASH_BASE0 V2M_NOR0
284#define CONFIG_SYS_FLASH_BASE1 V2M_NOR1
Matt Waddelb80e41a2010-10-07 15:48:45 -0600285#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE0
286
287/* Timeout values in ticks */
288#define CONFIG_SYS_FLASH_ERASE_TOUT (2 * CONFIG_SYS_HZ) /* Erase Timeout */
289#define CONFIG_SYS_FLASH_WRITE_TOUT (2 * CONFIG_SYS_HZ) /* Write Timeout */
290
291/* 255 0x40000 sectors + first or last sector may have 4 erase regions = 259 */
292#define CONFIG_SYS_MAX_FLASH_SECT 259 /* Max sectors */
293#define FLASH_MAX_SECTOR_SIZE 0x00040000 /* 256 KB sectors */
294
295/* Room required on the stack for the environment data */
296#define CONFIG_ENV_SIZE FLASH_MAX_SECTOR_SIZE
297
298/*
299 * Amount of flash used for environment:
300 * We don't know which end has the small erase blocks so we use the penultimate
301 * sector location for the environment
302 */
303#define CONFIG_ENV_SECT_SIZE FLASH_MAX_SECTOR_SIZE
304#define CONFIG_ENV_OVERWRITE 1
305
306/* Store environment at top of flash */
307#define CONFIG_ENV_IS_IN_FLASH 1
308#define CONFIG_ENV_OFFSET (PHYS_FLASH_SIZE - \
309 (2 * CONFIG_ENV_SECT_SIZE))
310#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE1 + \
311 CONFIG_ENV_OFFSET)
312#define CONFIG_SYS_FLASH_PROTECTION /* The devices have real protection */
313#define CONFIG_SYS_FLASH_EMPTY_INFO /* flinfo indicates empty blocks */
314#define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE0, \
315 CONFIG_SYS_FLASH_BASE1 }
316
317/* Monitor Command Prompt */
318#define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */
319#define CONFIG_SYS_PROMPT "VExpress# "
320#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
321 sizeof(CONFIG_SYS_PROMPT) + 16)
Jon Medhurstd73e3012011-11-23 11:09:34 +0000322#define CONFIG_SYS_HUSH_PARSER
323#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
Matt Waddelb80e41a2010-10-07 15:48:45 -0600324#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot args buffer */
325#define CONFIG_CMD_SOURCE
326#define CONFIG_SYS_LONGHELP
327#define CONFIG_CMDLINE_EDITING 1
328#define CONFIG_SYS_MAXARGS 16 /* max command args */
329
Ryan Harkin168d8202011-10-18 11:06:25 +0100330#endif // VEXPRESS_COMMON_H