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