1 /*
2  * (C) Copyright 2011 Logic Product Development <www.logicpd.com>
3  *	Peter Barada <peter.barada@logicpd.com>
4  *
5  * Configuration settings for the Logic OMAP35x/DM37x SOM LV/Torpedo
6  * reference boards.
7  *
8  * SPDX-License-Identifier:	GPL-2.0+
9  */
10 
11 #ifndef __CONFIG_H
12 #define __CONFIG_H
13 
14 /* High Level Configuration Options */
15 
16 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
17 
18 #include <configs/ti_omap3_common.h>
19 
20 #ifdef CONFIG_SPL_BUILD
21 /*
22  * Disable MMC DM for SPL build and can be re-enabled after adding
23  * DM support in SPL
24  */
25 #undef CONFIG_DM_MMC
26 #undef OMAP_HSMMC_USE_GPIO
27 
28 /* select serial console configuration for SPL */
29 #undef CONFIG_CONS_INDEX
30 #define CONFIG_CONS_INDEX              1
31 #define CONFIG_SYS_NS16550_COM1                OMAP34XX_UART1
32 #endif
33 
34 
35 /*
36  * We are only ever GP parts and will utilize all of the "downloaded image"
37  * area in SRAM which starts at 0x40200000 and ends at 0x4020FFFF (64KB) in
38  * order to allow for BCH8 to fit in.
39  */
40 #undef CONFIG_SPL_TEXT_BASE
41 #define CONFIG_SPL_FRAMEWORK
42 #define CONFIG_SPL_TEXT_BASE		0x40200000
43 
44 #define CONFIG_MISC_INIT_R		/* misc_init_r dumps the die id */
45 #define CONFIG_CMDLINE_TAG		/* enable passing of ATAGs */
46 #define CONFIG_SETUP_MEMORY_TAGS
47 #define CONFIG_INITRD_TAG
48 #define CONFIG_REVISION_TAG
49 
50 /* Hardware drivers */
51 
52 #define CONFIG_USB_OMAP3
53 
54 /* commands to include */
55 #define CONFIG_CMD_NAND
56 #define CONFIG_CMD_MTDPARTS
57 #define CONFIG_CMD_NAND_LOCK_UNLOCK	/* nand (un)lock commands	*/
58 
59 /* I2C */
60 #define CONFIG_SYS_I2C_OMAP34XX
61 #define CONFIG_SYS_I2C_EEPROM_ADDR	0x50	/* EEPROM AT24C64      */
62 
63 /* USB */
64 #define CONFIG_USB_MUSB_OMAP2PLUS
65 #define CONFIG_USB_MUSB_PIO_ONLY
66 #define CONFIG_USB_ETHER
67 #define CONFIG_USB_ETHER_RNDIS
68 #define CONFIG_USB_FUNCTION_FASTBOOT
69 #define CONFIG_CMD_FASTBOOT
70 #define CONFIG_ANDROID_BOOT_IMAGE
71 #define CONFIG_FASTBOOT_BUF_ADDR	CONFIG_SYS_LOAD_ADDR
72 #define CONFIG_FASTBOOT_BUF_SIZE	0x07000000
73 
74 /* TWL4030 */
75 #define CONFIG_TWL4030_PWM
76 #define CONFIG_TWL4030_USB
77 
78 /* Board NAND Info. */
79 #ifdef CONFIG_NAND
80 #define CONFIG_NAND_OMAP_GPMC
81 
82 #define CONFIG_CMD_UBIFS		/* Read-only UBI volume operations */
83 #define CONFIG_RBTREE			/* required by CONFIG_CMD_UBI */
84 #define CONFIG_LZO			/* required by CONFIG_CMD_UBIFS */
85 
86 #define CONFIG_SYS_NAND_ADDR		NAND_BASE /* physical address */
87 						  /* to access nand */
88 #define CONFIG_SYS_MAX_NAND_DEVICE	1	  /* Max number of */
89 						  /* NAND devices */
90 #define CONFIG_SYS_NAND_BUSWIDTH_16BIT
91 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
92 #define CONFIG_SYS_NAND_PAGE_COUNT	64
93 #define CONFIG_SYS_NAND_PAGE_SIZE	2048
94 #define CONFIG_SYS_NAND_OOBSIZE		64
95 #define CONFIG_SYS_NAND_BLOCK_SIZE	(128 * 1024)
96 #define CONFIG_SYS_NAND_BAD_BLOCK_POS	NAND_LARGE_BADBLOCK_POS
97 #define CONFIG_SYS_NAND_ECCPOS		{2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, \
98 					 13, 14, 16, 17, 18, 19, 20, 21, 22, \
99 					 23, 24, 25, 26, 27, 28, 30, 31, 32, \
100 					 33, 34, 35, 36, 37, 38, 39, 40, 41, \
101 					 42, 44, 45, 46, 47, 48, 49, 50, 51, \
102 					 52, 53, 54, 55, 56}
103 
104 #define CONFIG_SYS_NAND_ECCSIZE		512
105 #define CONFIG_SYS_NAND_ECCBYTES	13
106 #define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
107 #define CONFIG_BCH
108 #define CONFIG_SYS_NAND_MAX_OOBFREE	2
109 #define CONFIG_SYS_NAND_MAX_ECCPOS	56
110 #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000
111 #define CONFIG_MTD_DEVICE		/* needed for mtdparts commands */
112 #define CONFIG_MTD_PARTITIONS		/* required for UBI partition support */
113 #define MTDIDS_DEFAULT			"nand0=omap2-nand.0"
114 #define MTDPARTS_DEFAULT	"mtdparts=omap2-nand.0:"\
115 							"512k(MLO),"\
116 							"1792k(u-boot),"\
117 							"128k(spl-os)," \
118 							"128k(u-boot-env),"\
119 							"6m(kernel),-(fs)"
120 #endif
121 
122 /* Environment information */
123 
124 #define CONFIG_PREBOOT \
125 	"setenv preboot;"						\
126 	"nand unlock;"							\
127 	"saveenv;"
128 
129 #define CONFIG_EXTRA_ENV_SETTINGS \
130 	DEFAULT_LINUX_BOOT_ENV \
131 	"mtdids=" MTDIDS_DEFAULT "\0"	\
132 	"mtdparts=" MTDPARTS_DEFAULT "\0" \
133 	"mmcdev=0\0" \
134 	"mmcroot=/dev/mmcblk0p2 rw\0" \
135 	"mmcrootfstype=ext4 rootwait\0" \
136 	"nandroot=ubi0:rootfs rw ubi.mtd=fs noinitrd\0" \
137 	"nandrootfstype=ubifs rootwait\0" \
138 	"autoboot=mmc dev ${mmcdev}; if mmc rescan; then " \
139 			"if run loadbootscript; then " \
140 				"run bootscript; " \
141 			"else " \
142 				"run defaultboot;" \
143 			"fi; " \
144 		"else run defaultboot; fi\0" \
145 	"defaultboot=run mmcramboot\0" \
146 	"consoledevice=ttyO0\0" \
147 	"setconsole=setenv console ${consoledevice},${baudrate}n8\0" \
148 	"dump_bootargs=echo 'Bootargs: '; echo $bootargs\0" \
149 	"rotation=0\0" \
150 	"vrfb_arg=if itest ${rotation} -ne 0; then " \
151 		"setenv bootargs ${bootargs} omapfb.vrfb=y " \
152 		"omapfb.rotate=${rotation}; " \
153 		"fi\0" \
154 	"optargs=ignore_loglevel early_printk no_console_suspend\0" \
155 	"common_bootargs=run setconsole; setenv bootargs " \
156 		"${bootargs} "\
157 		"console=${console} " \
158 		"${mtdparts} "\
159 		"${optargs}; " \
160 		"run vrfb_arg\0" \
161 	"loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr\0" \
162 	"bootscript=echo 'Running bootscript from mmc ...'; " \
163 		"source ${loadaddr}\0" \
164 	"loadimage=mmc rescan; " \
165 		"load mmc ${mmcdev} ${loadaddr} ${bootfile}\0" \
166 	"ramdisksize=64000\0" \
167 	"ramdiskimage=rootfs.ext2.gz.uboot\0" \
168 	"loadramdisk=mmc rescan; " \
169 		"load mmc ${mmcdev} ${rdaddr} ${ramdiskimage}\0" \
170 	"ramargs=setenv bootargs "\
171 		"root=/dev/ram rw ramdisk_size=${ramdisksize}\0" \
172 	"mmcargs=setenv bootargs "\
173 		"root=${mmcroot} rootfstype=${mmcrootfstype}\0" \
174 	"nandargs=setenv bootargs "\
175 		"root=${nandroot} " \
176 		"rootfstype=${nandrootfstype}\0" \
177 	"nfsargs=setenv serverip ${tftpserver}; " \
178 		"setenv bootargs root=/dev/nfs " \
179 		"nfsroot=${nfsrootpath} " \
180 		"ip=${ipaddr}:${tftpserver}:${gatewayip}:${netmask}::eth0:off\0" \
181 	"nfsrootpath=/opt/nfs-exports/omap\0" \
182 	"autoload=no\0" \
183 	"loadfdt=mmc rescan; " \
184 		"load mmc ${mmcdev} ${fdtaddr} ${fdtimage}\0" \
185 	"mmcbootcommon=echo Booting with DT from mmc${mmcdev} ...; " \
186 		"run mmcargs; " \
187 		"run common_bootargs; " \
188 		"run dump_bootargs; " \
189 		"run loadimage; " \
190 		"run loadfdt;\0 " \
191 	"mmcbootz=setenv bootfile zImage; " \
192 		"run mmcbootcommon; "\
193 		"bootz ${loadaddr} - ${fdtaddr}\0" \
194 	"mmcboot=setenv bootfile uImage; "\
195 		"run mmcbootcommon; "\
196 		"bootm ${loadaddr} - ${fdtaddr}\0" \
197 	"mmcrambootcommon=echo 'Booting kernel from MMC w/ramdisk...'; " \
198 		"run ramargs; " \
199 		"run common_bootargs; " \
200 		"run dump_bootargs; " \
201 		"run loadimage; " \
202 		"run loadfdt; " \
203 		"run loadramdisk\0" \
204 	"mmcramboot=setenv bootfile uImage; " \
205 		"run mmcrambootcommon; " \
206 		"bootm ${loadaddr} ${rdaddr} ${fdtimage}\0" \
207 	"mmcrambootz=setenv bootfile zImage; " \
208 		"run mmcrambootcommon; " \
209 		"bootz ${loadaddr} ${rdaddr} ${fdtimage}\0" \
210 	"tftpboot=echo 'Booting kernel/ramdisk rootfs from tftp...'; " \
211 		"run ramargs; " \
212 		"run common_bootargs; " \
213 		"run dump_bootargs; " \
214 		"tftpboot ${loadaddr} ${zimage}; " \
215 		"tftpboot ${rdaddr} ${ramdiskimage}; " \
216 		"bootm ${loadaddr} ${rdaddr}\0" \
217 	"tftpbootz=echo 'Booting kernel NFS rootfs...'; " \
218 		"dhcp;" \
219 		"run nfsargs;" \
220 		"run common_bootargs;" \
221 		"run dump_bootargs;" \
222 		"tftpboot $loadaddr zImage;" \
223 		"bootz $loadaddr\0" \
224 	"nandbootcommon=echo 'Booting kernel from NAND...';" \
225 		"nand unlock;" \
226 		"run nandargs;" \
227 		"run common_bootargs;" \
228 		"run dump_bootargs;" \
229 		"nand read ${loadaddr} kernel;" \
230 		"nand read ${fdtaddr} spl-os;\0" \
231 	"nandbootz=run nandbootcommon; "\
232 		"bootz ${loadaddr} - ${fdtaddr}\0"\
233 	"nandboot=run nandbootcommon; "\
234 		"bootm ${loadaddr} - ${fdtaddr}\0"\
235 
236 #define CONFIG_BOOTCOMMAND \
237 	"run autoboot"
238 
239 /* Miscellaneous configurable options */
240 
241 /* memtest works on */
242 #define CONFIG_SYS_MEMTEST_START	(OMAP34XX_SDRC_CS0)
243 #define CONFIG_SYS_MEMTEST_END		(OMAP34XX_SDRC_CS0 + \
244 					0x01F00000) /* 31MB */
245 
246 /* FLASH and environment organization */
247 
248 /* **** PISMO SUPPORT *** */
249 #if defined(CONFIG_CMD_NAND)
250 #define CONFIG_SYS_FLASH_BASE		NAND_BASE
251 #endif
252 
253 /* Monitor at start of flash */
254 #define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_FLASH_BASE
255 
256 #define CONFIG_ENV_IS_IN_NAND		1
257 #define CONFIG_ENV_SIZE			(128 << 10)	/* 128 KiB */
258 #define SMNAND_ENV_OFFSET		0x260000 /* environment starts here */
259 
260 #define CONFIG_SYS_ENV_SECT_SIZE	(128 << 10)	/* 128 KiB */
261 #define CONFIG_ENV_OFFSET		SMNAND_ENV_OFFSET
262 #define CONFIG_ENV_ADDR			SMNAND_ENV_OFFSET
263 
264 /* SMSC922x Ethernet */
265 #if defined(CONFIG_CMD_NET)
266 #define CONFIG_SMC911X
267 #define CONFIG_SMC911X_32_BIT
268 #define CONFIG_SMC911X_BASE	0x08000000
269 #endif /* (CONFIG_CMD_NET) */
270 
271 /* Defines for SPL */
272 
273 #define CONFIG_SPL_OMAP3_ID_NAND
274 
275 /* NAND: SPL falcon mode configs */
276 #ifdef CONFIG_SPL_OS_BOOT
277 #define CONFIG_CMD_SPL_NAND_OFS		0x240000
278 #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS	0x280000
279 #define CONFIG_CMD_SPL_WRITE_SIZE	0x2000
280 #endif
281 
282 #endif /* __CONFIG_H */
283