stm3220g-eval.h 8.06 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * (C) Copyright 2011
 *
 * Yuri Tikhonov, Emcraft Systems, yur@emcraft.com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 */

/*
 * Configuration settings for the STMicroelectronic STM3220G-EVAL board.
 */

#ifndef __CONFIG_H
#define __CONFIG_H

/*
 * Disable debug messages
 */
#undef DEBUG

/*
 * This is an ARM Cortex-M3 CPU core
 */
#define CONFIG_SYS_ARMCORTEXM3

/*
 * This is the STM32-F2 device
 */
42
#define CONFIG_SYS_STM32
43

44
45
46
47
48
/*
 * Enable GPIO driver
 */
#define CONFIG_STM32F2_GPIO

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * Display CPU and Board information
 */
#define CONFIG_DISPLAY_CPUINFO		1
#define CONFIG_DISPLAY_BOARDINFO	1

#define CONFIG_SYS_BOARD_REV_STR	"1"

/*
 * Monitor prompt
 */
#define CONFIG_SYS_PROMPT		"STM3220G-EVAL> "

/*
 * We want to call the CPU specific initialization
 */
#define CONFIG_ARCH_CPU_INIT

67
/*
68
69
70
71
 * Clock configuration (see stm32f2/clock.c for details):
 * - use PLL as the system clock;
 * - use HSE as the PLL source;
 * - configure PLL to get 120MHz system clock.
72
 */
73
74
75
76
77
78
79
#define CONFIG_STM32_SYS_CLK_PLL
#define CONFIG_STM32_PLL_SRC_HSE
#define CONFIG_STM32_HSE_HZ		25000000	/* 25 MHz */
#define CONFIG_STM32_PLL_M		25
#define CONFIG_STM32_PLL_N		240
#define CONFIG_STM32_PLL_P		2
#define CONFIG_STM32_PLL_Q		5
80

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
 * Number of clock ticks in 1 sec
 */
#define CONFIG_SYS_HZ			1000

/*
 * Enable/disable h/w watchdog
 */
#undef CONFIG_HW_WATCHDOG

/*
 * No interrupts
 */
#undef CONFIG_USE_IRQ

96
97
98
/*
 * Memory layout configuration
 */
99
#define CONFIG_MEM_NVM_BASE		0x00000000
100
#define CONFIG_MEM_NVM_LEN		(1024 * 1024)
101
102

#define CONFIG_MEM_RAM_BASE		0x20000000
103
104
105
#define CONFIG_MEM_RAM_LEN		(20 * 1024)
#define CONFIG_MEM_RAM_BUF_LEN		(88 * 1024)
#define CONFIG_MEM_MALLOC_LEN		(16 * 1024)
106
#define CONFIG_MEM_STACK_LEN		(4 * 1024)
107
108
109
110
111
112

/*
 * malloc() pool size
 */
#define CONFIG_SYS_MALLOC_LEN		CONFIG_MEM_MALLOC_LEN

113
114
115
#define FSMC_NOR_PSRAM_CS_ADDR(n) \
	(0x60000000 + ((n) - 1) * 0x4000000)

116
/*
117
 * Configuration of the external PSRAM memory
118
119
 */
#define CONFIG_NR_DRAM_BANKS		1
120
#define CONFIG_SYS_RAM_SIZE		(32 * 1024 * 1024)
121
#define CONFIG_SYS_RAM_CS		2
122

123
#define CONFIG_SYS_RAM_BURST
124
#define CONFIG_SYS_FSMC_PSRAM_BCR	0x00005059
125
#define CONFIG_SYS_FSMC_PSRAM_BTR	0x10000702
126
#define CONFIG_SYS_FSMC_PSRAM_BWTR	0x10000602
127
#define CONFIG_FSMC_NOR_PSRAM_CS2_ENABLE
128

129
130
#define CONFIG_SYS_RAM_BASE		FSMC_NOR_PSRAM_CS_ADDR(CONFIG_SYS_RAM_CS)

131
#undef CONFIG_LCD
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#ifdef CONFIG_LCD
#define LCD_BPP				LCD_COLOR16
#define CONFIG_BMP_16BPP		1
#define CONFIG_SPLASH_SCREEN		1
#define CONFIG_CMD_BMP
#define CONFIG_FB_ADDR				\
	(CONFIG_SYS_RAM_BASE + CONFIG_SYS_RAM_SIZE - \
		roundup(calc_fbsize(), PAGE_SIZE))
#define CONFIG_LCD_CS			3
#define CONFIG_LCD_FSMC_BCR			\
	STM32_FSMC_BCR_MBKEN |			\
	STM32_FSMC_BCR_WREN |			\
	(STM32_FSMC_BCR_MWID_16 << STM32_FSMC_BCR_MWID_BIT)
#define CONFIG_LCD_FSMC_BTR			\
	(1 << STM32_FSMC_BTR_ADDRST_BIT) |	\
	(0 << STM32_FSMC_BTR_ADDHOLD_BIT) |	\
	(9 << STM32_FSMC_BTR_DATAST_BIT) |	\
	(0 << STM32_FSMC_BTR_BUSTURN_BIT) |	\
	(0 << STM32_FSMC_BTR_CLKDIV_BIT) |	\
	(0 << STM32_FSMC_BTR_DATLAT_BIT) |	\
	STM32_FSMC_BWTR_ACCMOD_A
#define CONFIG_LCD_FSMC_BWTR			\
	(1 << STM32_FSMC_BWTR_ADDRST_BIT) |	\
	(0 << STM32_FSMC_BWTR_ADDHOLD_BIT) |	\
	(9 << STM32_FSMC_BWTR_DATAST_BIT) |	\
	(0 << STM32_FSMC_BWTR_CLKDIV_BIT) |	\
	(0 << STM32_FSMC_BWTR_DATLAT_BIT) |	\
	STM32_FSMC_BWTR_ACCMOD_A
160
#define CONFIG_FSMC_NOR_PSRAM_CS3_ENABLE
161
162
163
164
#define CONFIG_LCD_ILI932x
#define CONFIG_LCD_ILI932x_BASE		FSMC_NOR_PSRAM_CS_ADDR(CONFIG_LCD_CS)
#define CONFIG_LCD_ILI932x_DOUBLE_BUFFER
#endif
165
166

/*
167
 * Configuration of the external Flash memory
168
 */
169
170
171
#define CONFIG_SYS_FLASH_CS		1

#define CONFIG_SYS_FSMC_FLASH_BCR	0x00005015
172
173
#define CONFIG_SYS_FSMC_FLASH_BTR	0x00021206
#define CONFIG_SYS_FSMC_FLASH_BWTR	0x00021106
174
#define CONFIG_FSMC_NOR_PSRAM_CS1_ENABLE
175

176
#define CONFIG_SYS_FLASH_BANK1_BASE	FSMC_NOR_PSRAM_CS_ADDR(CONFIG_SYS_FLASH_CS)
177
178
179
180
181
182
183
184
185

#define CONFIG_SYS_FLASH_CFI		1
#define CONFIG_FLASH_CFI_DRIVER		1
#define CONFIG_SYS_FLASH_CFI_WIDTH	FLASH_CFI_16BIT
#define CONFIG_SYS_FLASH_BANKS_LIST	{ CONFIG_SYS_FLASH_BANK1_BASE }
#define CONFIG_SYS_MAX_FLASH_BANKS	1
#define CONFIG_SYS_MAX_FLASH_SECT	128
#define CONFIG_SYS_FLASH_CFI_AMD_RESET	1
#define CONFIG_SYS_FLASH_PROTECTION	1
186
187
188
189

/*
 * Store env in memory only
 */
190
#define CONFIG_ENV_IS_IN_FLASH
191
#define CONFIG_ENV_SIZE			(4 * 1024)
192
193
194
#define CONFIG_ENV_ADDR			CONFIG_SYS_FLASH_BANK1_BASE
#define CONFIG_INFERNO			1
#define CONFIG_ENV_OVERWRITE		1
195
196
197
198

/*
 * Serial console configuration
 */
199
200
201
202
203
204
#define CONFIG_STM32_USART_CONSOLE
#define CONFIG_STM32_USART_PORT		3	/* USART3 */
#define CONFIG_STM32_USART_TX_IO_PORT	2	/* PORTC */
#define CONFIG_STM32_USART_RX_IO_PORT	2	/* PORTC */
#define CONFIG_STM32_USART_TX_IO_PIN	10	/* GPIO10 */
#define CONFIG_STM32_USART_RX_IO_PIN	11	/* GPIO11 */
205

206
207
208
#define CONFIG_BAUDRATE			115200
#define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }

209
/*
210
 * Ethernet configuration
211
212
 */
#define CONFIG_NET_MULTI
213
#define CONFIG_STM32_ETH
214
215
216
217
218
219
220
221

/*
 * Ethernet RX buffers are malloced from the internal SRAM (more precisely,
 * from CONFIG_SYS_MALLOC_LEN part of it). Each RX buffer has size of 1536B.
 * So, keep this in mind when changing the value of the following config,
 * which determines the number of ethernet RX buffers (number of frames which
 * may be received without processing until overflow happens).
 */
222
#define CONFIG_SYS_RX_ETH_BUFFER	4
223

224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
/*
 * Console I/O buffer size
 */
#define CONFIG_SYS_CBSIZE		256

/*
 * Print buffer size
 */
#define CONFIG_SYS_PBSIZE               (CONFIG_SYS_CBSIZE + \
                                        sizeof(CONFIG_SYS_PROMPT) + 16)

#define CONFIG_SYS_MEMTEST_START	CONFIG_SYS_RAM_BASE
#define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_RAM_BASE + \
					CONFIG_SYS_RAM_SIZE)

/*
 * Needed by "loadb"
 */
#define CONFIG_SYS_LOAD_ADDR		CONFIG_SYS_RAM_BASE

/*
 * Monitor is actually in eNVM. In terms of U-Boot, it is neither "flash",
 * not RAM, but CONFIG_SYS_MONITOR_BASE must be defined.
 */
248
#define CONFIG_SYS_MONITOR_BASE		0x0
249
250
251
252
253

/*
 * Monitor is not in flash. Needs to define this to prevent
 * U-Boot from running flash_protect() on the monitor code.
 */
254
#define CONFIG_MONITOR_IS_IN_RAM	1
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269

/*
 * Enable all those monitor commands that are needed
 */
#include <config_cmd_default.h>
#undef CONFIG_CMD_BOOTD
#undef CONFIG_CMD_CONSOLE
#undef CONFIG_CMD_ECHO
#undef CONFIG_CMD_EDITENV
#undef CONFIG_CMD_FPGA
#undef CONFIG_CMD_IMI
#undef CONFIG_CMD_ITEST
#undef CONFIG_CMD_IMLS
#undef CONFIG_CMD_LOADS
#undef CONFIG_CMD_MISC
270
#define CONFIG_CMD_NET
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
#undef CONFIG_CMD_NFS
#undef CONFIG_CMD_SOURCE
#undef CONFIG_CMD_XIMG

/*
 * To save memory disable long help
 */
#undef CONFIG_SYS_LONGHELP

/*
 * Max number of command args
 */
#define CONFIG_SYS_MAXARGS		16

/*
 * Auto-boot sequence configuration
 */
#define CONFIG_BOOTDELAY		3
#define CONFIG_ZERO_BOOTDELAY_CHECK
#define CONFIG_HOSTNAME			stm3220g-eval
291
292
#define CONFIG_BOOTARGS			"stm32_platform=stm3220g-eval "\
					"console=ttyS2,115200 panic=10"
293
294
#define CONFIG_BOOTCOMMAND		"run netboot"

295
296
#define CONFIG_SYS_CONSOLE_IS_IN_ENV

297
298
299
300
/*
 * Short-cuts to some useful commands (macros)
 */
#define CONFIG_EXTRA_ENV_SETTINGS				\
301
	"loadaddr=0x64000000\0"					\
302
303
304
305
	"addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:eth0:off\0"				\
	"ethaddr=C0:B1:3C:88:88:88\0"				\
	"ipaddr=172.17.4.206\0"					\
	"serverip=172.17.0.1\0"					\
306
	"image=stm32/uImage\0"					\
307
	"stdin=serial\0"					\
308
309
310
311
312
313
314
315
316
	"netboot=tftp ${image};run addip;bootm\0"

/*
 * Linux kernel boot parameters configuration
 */
#define CONFIG_SETUP_MEMORY_TAGS
#define CONFIG_CMDLINE_TAG

#endif /* __CONFIG_H */