1 /*
2  * Copyright (C) 2013 Marek Vasut <marex@denx.de>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of
7  * the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
17  * MA 02111-1307 USA
18  */
19 #ifndef __MX23_OLINUXINO_CONFIG_H__
20 #define __MX23_OLINUXINO_CONFIG_H__
21 
22 #include <asm/arch/iomux-mx23.h>
23 
24 /*
25  * SoC configurations
26  */
27 #define	CONFIG_MX23				/* i.MX23 SoC */
28 #define	CONFIG_MXS_GPIO				/* GPIO control */
29 #define	CONFIG_SYS_HZ		1000		/* Ticks per second */
30 
31 #define	CONFIG_MACH_TYPE	4105
32 
33 #include <asm/arch/regs-base.h>
34 
35 #define	CONFIG_SYS_NO_FLASH
36 #define	CONFIG_BOARD_EARLY_INIT_F
37 #define	CONFIG_ARCH_MISC_INIT
38 
39 /*
40  * SPL
41  */
42 #define	CONFIG_SPL
43 #define	CONFIG_SPL_NO_CPU_SUPPORT_CODE
44 #define	CONFIG_SPL_START_S_PATH		"arch/arm/cpu/arm926ejs/mxs"
45 #define	CONFIG_SPL_LDSCRIPT	"arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds"
46 #define	CONFIG_SPL_LIBCOMMON_SUPPORT
47 #define	CONFIG_SPL_LIBGENERIC_SUPPORT
48 #define	CONFIG_SPL_GPIO_SUPPORT
49 
50 /*
51  * U-Boot Commands
52  */
53 #include <config_cmd_default.h>
54 #define	CONFIG_DISPLAY_CPUINFO
55 #define	CONFIG_DOS_PARTITION
56 
57 #define	CONFIG_CMD_CACHE
58 #define	CONFIG_CMD_EXT2
59 #define	CONFIG_CMD_FAT
60 #define	CONFIG_CMD_GPIO
61 #define	CONFIG_CMD_LED
62 #define	CONFIG_CMD_MMC
63 
64 /*
65  * Memory configurations
66  */
67 #define	CONFIG_NR_DRAM_BANKS		1		/* 1 bank of DRAM */
68 #define	PHYS_SDRAM_1			0x40000000	/* Base address */
69 #define	PHYS_SDRAM_1_SIZE		0x08000000	/* Max 128 MB RAM */
70 #define	CONFIG_SYS_MALLOC_LEN		0x00400000	/* 4 MB for malloc */
71 #define	CONFIG_SYS_GBL_DATA_SIZE	128		/* Initial data */
72 #define	CONFIG_SYS_MEMTEST_START	0x40000000	/* Memtest start adr */
73 #define	CONFIG_SYS_MEMTEST_END		0x40400000	/* 4 MB RAM test */
74 #define	CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
75 /* Point initial SP in SRAM so SPL can use it too. */
76 
77 #define CONFIG_SYS_INIT_RAM_ADDR	0x00000000
78 #define CONFIG_SYS_INIT_RAM_SIZE	(128 * 1024)
79 
80 #define CONFIG_SYS_INIT_SP_OFFSET \
81 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
82 #define CONFIG_SYS_INIT_SP_ADDR \
83 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
84 /*
85  * We need to sacrifice first 4 bytes of RAM here to avoid triggering some
86  * strange BUG in ROM corrupting first 4 bytes of RAM when loading U-Boot
87  * binary. In case there was more of this mess, 0x100 bytes are skipped.
88  */
89 #define	CONFIG_SYS_TEXT_BASE		0x40000100
90 
91 /*
92  * U-Boot general configurations
93  */
94 #define	CONFIG_SYS_LONGHELP
95 #define	CONFIG_SYS_PROMPT	"=> "
96 #define	CONFIG_SYS_CBSIZE	1024		/* Console I/O buffer size */
97 #define	CONFIG_SYS_PBSIZE	\
98 	(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
99 						/* Print buffer size */
100 #define	CONFIG_SYS_MAXARGS	32		/* Max number of command args */
101 #define	CONFIG_SYS_BARGSIZE	CONFIG_SYS_CBSIZE
102 						/* Boot argument buffer size */
103 #define	CONFIG_VERSION_VARIABLE			/* U-BOOT version */
104 #define	CONFIG_AUTO_COMPLETE			/* Command auto complete */
105 #define	CONFIG_CMDLINE_EDITING			/* Command history etc */
106 #define	CONFIG_SYS_HUSH_PARSER
107 
108 /*
109  * Serial Driver
110  */
111 #define	CONFIG_PL011_SERIAL
112 #define	CONFIG_PL011_CLOCK		24000000
113 #define	CONFIG_PL01x_PORTS		{ (void *)MXS_UARTDBG_BASE }
114 #define	CONFIG_CONS_INDEX		0
115 #define	CONFIG_BAUDRATE			115200	/* Default baud rate */
116 
117 /*
118  * Status LED
119  */
120 #define	CONFIG_STATUS_LED
121 #define	CONFIG_GPIO_LED
122 #define	CONFIG_BOARD_SPECIFIC_LED
123 #define	STATUS_LED_BOOT	0
124 #define	STATUS_LED_BIT	MX23_PAD_SSP1_DETECT__GPIO_2_1
125 #define	STATUS_LED_STATE	STATUS_LED_ON
126 #define	STATUS_LED_PERIOD	(CONFIG_SYS_HZ / 2)
127 
128 /*
129  * MMC Driver
130  */
131 #ifdef	CONFIG_CMD_MMC
132 #define CONFIG_MMC
133 #define CONFIG_BOUNCE_BUFFER
134 #define CONFIG_GENERIC_MMC
135 #define CONFIG_MXS_MMC
136 #endif
137 
138 /*
139  * APBH DMA
140  */
141 #define CONFIG_APBH_DMA
142 
143 /*
144  * Boot Linux
145  */
146 #define	CONFIG_CMDLINE_TAG
147 #define	CONFIG_SETUP_MEMORY_TAGS
148 #define	CONFIG_BOOTDELAY	3
149 #define	CONFIG_BOOTFILE		"uImage"
150 #define	CONFIG_LOADADDR		0x42000000
151 #define	CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
152 #define	CONFIG_OF_LIBFDT
153 
154 /*
155  * Environment
156  */
157 #define	CONFIG_ENV_IS_IN_MMC
158 #define	CONFIG_ENV_OVERWRITE
159 #ifdef	CONFIG_ENV_IS_IN_MMC
160 #define	CONFIG_ENV_OFFSET	(256 * 1024)
161 #define	CONFIG_ENV_SIZE	(16 * 1024)
162 #define	CONFIG_SYS_MMC_ENV_DEV 0
163 #endif
164 
165 /*
166  * Extra Environments
167  */
168 #define CONFIG_EXTRA_ENV_SETTINGS \
169 	"update_sd_firmware_filename=u-boot.sd\0" \
170 	"update_sd_firmware="		/* Update the SD firmware partition */ \
171 		"if mmc rescan ; then "	\
172 		"if tftp ${update_sd_firmware_filename} ; then " \
173 		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
174 		"setexpr fw_sz ${fw_sz} + 1 ; "	\
175 		"mmc write ${loadaddr} 0x800 ${fw_sz} ; " \
176 		"fi ; "	\
177 		"fi\0" \
178 	"script=boot.scr\0"	\
179 	"uimage=uImage\0" \
180 	"console=ttyAMA0\0" \
181 	"fdt_file=imx23-olinuxino.dtb\0" \
182 	"fdt_addr=0x41000000\0" \
183 	"boot_fdt=try\0" \
184 	"mmcdev=0\0" \
185 	"mmcpart=2\0" \
186 	"mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
187 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
188 		"root=${mmcroot}\0" \
189 	"loadbootscript="  \
190 		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
191 	"bootscript=echo Running bootscript from mmc ...; "	\
192 		"source\0" \
193 	"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
194 	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
195 	"mmcboot=echo Booting from mmc ...; " \
196 		"run mmcargs; " \
197 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
198 			"if run loadfdt; then " \
199 				"bootm ${loadaddr} - ${fdt_addr}; " \
200 			"else " \
201 				"if test ${boot_fdt} = try; then " \
202 					"bootm; " \
203 				"else " \
204 					"echo WARN: Cannot load the DT; " \
205 				"fi; " \
206 			"fi; " \
207 		"else " \
208 			"bootm; " \
209 		"fi;\0"
210 
211 #define CONFIG_BOOTCOMMAND \
212 	"mmc dev ${mmcdev}; if mmc rescan; then " \
213 		"if run loadbootscript; then " \
214 			"run bootscript; " \
215 		"else " \
216 			"if run loaduimage; then " \
217 				"run mmcboot; " \
218 			"else " \
219 				"echo ERR: Fail to boot from MMC; " \
220 			"fi; " \
221 		"fi; " \
222 	"else exit; fi"
223 
224 #endif /* __MX23_OLINUXINO_CONFIG_H__ */
225