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