1 /*
2  * Configuration settings for the Gumstix Overo board.
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 
7 #ifndef __CONFIG_H
8 #define __CONFIG_H
9 
10 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
11 #define CONFIG_NAND
12 
13 #include <configs/ti_omap3_common.h>
14 
15 /* Display CPU and Board information */
16 #define CONFIG_DISPLAY_CPUINFO
17 #define CONFIG_DISPLAY_BOARDINFO
18 
19 /* call misc_init_r */
20 #define CONFIG_MISC_INIT_R
21 
22 /* pass the revision tag */
23 #define CONFIG_REVISION_TAG
24 
25 /* override size of malloc() pool */
26 #undef CONFIG_SYS_MALLOC_LEN
27 #define CONFIG_ENV_SIZE		(128 << 10)	/* 128 KiB sector */
28 /* Shift 128 << 15 provides 4 MiB heap to support UBI commands.
29  * Shift 128 << 10 provides 128 KiB heap for limited-memory devices. */
30 #define CONFIG_SYS_MALLOC_LEN	(CONFIG_ENV_SIZE + (128 << 15))
31 
32 /* I2C Support */
33 #define CONFIG_SYS_I2C_OMAP34XX
34 
35 /* TWL4030 LED */
36 #define CONFIG_TWL4030_LED
37 
38 /* USB EHCI */
39 #define CONFIG_USB_EHCI
40 #define CONFIG_USB_EHCI_OMAP
41 #define CONFIG_USB_STORAGE
42 #define CONFIG_OMAP_EHCI_PHY1_RESET_GPIO	183
43 #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS	3
44 
45 /* Initialize GPIOs by default */
46 #define CONFIG_OMAP3_GPIO_2	/* GPIO32..63 is in GPIO Bank 2 */
47 #define CONFIG_OMAP3_GPIO_3	/* GPIO64..95 is in GPIO Bank 3 */
48 #define CONFIG_OMAP3_GPIO_4	/* GPIO96..127 is in GPIO Bank 4 */
49 #define CONFIG_OMAP3_GPIO_5	/* GPIO128..159 is in GPIO Bank 5 */
50 #define CONFIG_OMAP3_GPIO_6	/* GPIO160..191 is in GPIO Bank 6 */
51 
52 /* commands to include */
53 #define CONFIG_CMD_CACHE
54 #define CONFIG_CMD_USB
55 #undef CONFIG_CMD_FPGA		/* FPGA configuration Support	*/
56 #undef CONFIG_CMD_IMI		/* iminfo			*/
57 #undef CONFIG_CMD_NFS		/* NFS support			*/
58 
59 #ifdef CONFIG_NAND
60 #define CONFIG_CMD_UBI		/* UBI-formated MTD partition support */
61 #define CONFIG_CMD_UBIFS	/* Read-only UBI volume operations */
62 
63 #define CONFIG_RBTREE		/* required by CONFIG_CMD_UBI */
64 #define CONFIG_LZO		/* required by CONFIG_CMD_UBIFS */
65 
66 #define CONFIG_MTD_PARTITIONS	/* required for UBI partition support */
67 
68 /* NAND block size is 128 KiB.  Synchronize these values with
69  * overo_nand_partitions in mach-omap2/board-overo.c in Linux:
70  *  xloader              4 * NAND_BLOCK_SIZE = 512 KiB
71  *  uboot               14 * NAND_BLOCK_SIZE = 1792 KiB
72  *  uboot environtment   2 * NAND_BLOCK_SIZE = 256 KiB
73  *  linux               64 * NAND_BLOCK_SIZE = 8 MiB
74  *  rootfs              remainder
75  */
76 #define MTDIDS_DEFAULT "nand0=omap2-nand.0"
77 #define MTDPARTS_DEFAULT "mtdparts=omap2-nand.0:"	\
78 	"512k(xloader),"				\
79 	"1792k(u-boot),"				\
80 	"256k(environ),"				\
81 	"8m(linux),"					\
82 	"-(rootfs)"
83 #else /* CONFIG_NAND */
84 #define MTDPARTS_DEFAULT
85 #endif /* CONFIG_NAND */
86 
87 /* Board NAND Info. */
88 #define CONFIG_SYS_NAND_QUIET_TEST
89 #define CONFIG_SYS_NAND_ADDR		NAND_BASE	/* physical address */
90 							/* to access nand */
91 /* Environment information */
92 #define CONFIG_EXTRA_ENV_SETTINGS \
93 	DEFAULT_LINUX_BOOT_ENV \
94 	"bootdir=/boot\0" \
95 	"bootfile=zImage\0" \
96 	"usbtty=cdc_acm\0" \
97 	"console=ttyO2,115200n8\0" \
98 	"mpurate=auto\0" \
99 	"optargs=\0" \
100 	"vram=12M\0" \
101 	"dvimode=1024x768MR-16@60\0" \
102 	"defaultdisplay=dvi\0" \
103 	"mmcdev=0\0" \
104 	"mmcroot=/dev/mmcblk0p2 rw\0" \
105 	"mmcrootfstype=ext3 rootwait\0" \
106 	"nandroot=ubi0:rootfs ubi.mtd=4\0" \
107 	"nandrootfstype=ubifs\0" \
108 	"mtdparts=" MTDPARTS_DEFAULT "\0" \
109 	"mmcargs=setenv bootargs console=${console} " \
110 		"${optargs} " \
111 		"mpurate=${mpurate} " \
112 		"vram=${vram} " \
113 		"omapfb.mode=dvi:${dvimode} " \
114 		"omapdss.def_disp=${defaultdisplay} " \
115 		"root=${mmcroot} " \
116 		"rootfstype=${mmcrootfstype}\0" \
117 	"nandargs=setenv bootargs console=${console} " \
118 		"${optargs} " \
119 		"mpurate=${mpurate} " \
120 		"vram=${vram} " \
121 		"omapfb.mode=dvi:${dvimode} " \
122 		"omapdss.def_disp=${defaultdisplay} " \
123 		"root=${nandroot} " \
124 		"rootfstype=${nandrootfstype}\0" \
125 	"loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr\0" \
126 	"bootscript=echo Running boot script from mmc ...; " \
127 		"source ${loadaddr}\0" \
128 	"loadbootenv=load mmc ${mmcdev} ${loadaddr} uEnv.txt\0" \
129 	"importbootenv=echo Importing environment from mmc ...; " \
130 		"env import -t ${loadaddr} ${filesize}\0" \
131 	"loaduimage=load mmc ${mmcdev} ${loadaddr} uImage\0" \
132 	"mmcboot=echo Booting from mmc...; " \
133 		"run mmcargs; " \
134 		"bootm ${loadaddr}\0" \
135 	"loadzimage=load mmc ${mmcdev}:2 ${loadaddr} ${bootdir}/${bootfile}\0" \
136 	"loadfdt=load mmc ${mmcdev}:2 ${fdtaddr} ${bootdir}/${fdtfile}\0" \
137 	"mmcbootfdt=echo Booting with DT from mmc ...; " \
138 		"run mmcargs; " \
139 		"bootz ${loadaddr} - ${fdtaddr}\0" \
140 	"nandboot=echo Booting from nand ...; " \
141 		"run nandargs; " \
142 		"if nand read ${loadaddr} linux; then " \
143 			"bootm ${loadaddr};" \
144 		"fi;\0" \
145 
146 #define CONFIG_BOOTCOMMAND \
147 	"mmc dev ${mmcdev}; if mmc rescan; then " \
148 		"if run loadbootscript; then " \
149 			"run bootscript; " \
150 		"fi;" \
151 		"if run loadbootenv; then " \
152 			"echo Loaded environment from ${bootenv};" \
153 			"run importbootenv;" \
154 		"fi;" \
155 		"if test -n $uenvcmd; then " \
156 			"echo Running uenvcmd ...;" \
157 			"run uenvcmd;" \
158 		"fi;" \
159 		"if run loaduimage; then " \
160 			"run mmcboot;" \
161 		"fi;" \
162 		"if run loadzimage; then " \
163 			"if test -z \"${fdtfile}\"; then " \
164 				"setenv fdtfile omap3-${boardname}-${expansionname}.dtb;" \
165 			"fi;" \
166 			"if run loadfdt; then " \
167 				"run mmcbootfdt;" \
168 			"fi;" \
169 		"fi;" \
170 	"fi;" \
171 	"run nandboot; " \
172 
173 /*
174  * Miscellaneous configurable options
175  */
176 #undef CONFIG_SYS_PROMPT
177 #define CONFIG_SYS_PROMPT		"Overo # "
178 
179 /* memtest works on */
180 #define CONFIG_SYS_MEMTEST_START	(OMAP34XX_SDRC_CS0)
181 #define CONFIG_SYS_MEMTEST_END		(OMAP34XX_SDRC_CS0 + \
182 					0x01F00000) /* 31MB */
183 
184 /* FLASH and environment organization */
185 #if defined(CONFIG_NAND)
186 #define CONFIG_SYS_FLASH_BASE		NAND_BASE
187 #endif
188 
189 /* Monitor at start of flash */
190 #define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_FLASH_BASE
191 #define CONFIG_SYS_ONENAND_BASE		ONENAND_MAP
192 
193 #define CONFIG_ENV_IS_IN_NAND
194 #define ONENAND_ENV_OFFSET		0x240000 /* environment starts here */
195 #define SMNAND_ENV_OFFSET		0x240000 /* environment starts here */
196 
197 #define CONFIG_SYS_ENV_SECT_SIZE	(128 << 10)	/* 128 KiB */
198 #define CONFIG_ENV_OFFSET		SMNAND_ENV_OFFSET
199 #define CONFIG_ENV_ADDR			SMNAND_ENV_OFFSET
200 
201 /* Configure SMSC9211 ethernet */
202 #if defined(CONFIG_CMD_NET)
203 #define CONFIG_SMC911X
204 #define CONFIG_SMC911X_32_BIT
205 #define CONFIG_SMC911X_BASE		0x2C000000
206 #endif /* (CONFIG_CMD_NET) */
207 
208 /* Initial RAM setup */
209 #define CONFIG_SYS_INIT_RAM_ADDR	0x4020f800
210 #define CONFIG_SYS_INIT_RAM_SIZE	0x800
211 #define CONFIG_SYS_CACHELINE_SIZE	64
212 
213 /* NAND boot config */
214 #define CONFIG_SYS_NAND_BUSWIDTH_16BIT	16
215 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
216 #define CONFIG_SYS_NAND_PAGE_COUNT	64
217 #define CONFIG_SYS_NAND_PAGE_SIZE	2048
218 #define CONFIG_SYS_NAND_OOBSIZE		64
219 #define CONFIG_SYS_NAND_BLOCK_SIZE	(128*1024)
220 #define CONFIG_SYS_NAND_BAD_BLOCK_POS	NAND_LARGE_BADBLOCK_POS
221 #define CONFIG_SYS_NAND_ECCPOS		{2, 3, 4, 5, 6, 7, 8, 9,\
222 						10, 11, 12, 13}
223 #define CONFIG_SYS_NAND_ECCSIZE		512
224 #define CONFIG_SYS_NAND_ECCBYTES	3
225 #define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_HAM1_CODE_HW
226 #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE
227 #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000
228 /* NAND: SPL falcon mode configs */
229 #ifdef CONFIG_SPL_OS_BOOT
230 #define CONFIG_CMD_SPL_NAND_OFS		0x240000
231 #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS	0x280000
232 #define CONFIG_CMD_SPL_WRITE_SIZE	0x2000
233 #endif
234 
235 #endif				/* __CONFIG_H */
236