1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * (C) Copyright 2006-2008
4  * Texas Instruments.
5  * Richard Woodruff <r-woodruff2@ti.com>
6  * Syed Mohammed Khasim <x0khasim@ti.com>
7  *
8  * Configuration settings for the TI OMAP3530 Beagle board.
9  */
10 
11 #ifndef __CONFIG_H
12 #define __CONFIG_H
13 
14 #include <configs/ti_omap3_common.h>
15 
16 /*
17  * We are only ever GP parts and will utilize all of the "downloaded image"
18  * area in SRAM which starts at 0x40200000 and ends at 0x4020FFFF (64KB).
19  */
20 #undef CONFIG_SPL_TEXT_BASE
21 #define CONFIG_SPL_TEXT_BASE            0x40200000
22 
23 #define CONFIG_CMDLINE_TAG
24 #define CONFIG_SETUP_MEMORY_TAGS
25 #define CONFIG_INITRD_TAG
26 #define CONFIG_REVISION_TAG
27 
28 /* NAND */
29 #if defined(CONFIG_NAND)
30 #define CONFIG_SYS_FLASH_BASE		NAND_BASE
31 #define CONFIG_SYS_MAX_NAND_DEVICE      1
32 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
33 #define CONFIG_SYS_NAND_PAGE_COUNT      64
34 #define CONFIG_SYS_NAND_PAGE_SIZE       2048
35 #define CONFIG_SYS_NAND_OOBSIZE         64
36 #define CONFIG_SYS_NAND_BLOCK_SIZE      (128*1024)
37 #define CONFIG_SYS_NAND_BAD_BLOCK_POS   NAND_LARGE_BADBLOCK_POS
38 #define CONFIG_SYS_NAND_ECCPOS          {2, 3, 4, 5, 6, 7, 8, 9,\
39                                          10, 11, 12, 13}
40 #define CONFIG_SYS_NAND_ECCSIZE         512
41 #define CONFIG_SYS_NAND_ECCBYTES        3
42 #define CONFIG_NAND_OMAP_ECCSCHEME      OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
43 #define CONFIG_SYS_NAND_U_BOOT_OFFS     0x80000
44 #define CONFIG_SYS_ENV_SECT_SIZE        SZ_128K
45 #define CONFIG_ENV_OFFSET               0x260000
46 #define CONFIG_ENV_ADDR                 0x260000
47 #define CONFIG_ENV_OVERWRITE
48 /* NAND: SPL falcon mode configs */
49 #if defined(CONFIG_SPL_OS_BOOT)
50 #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x2a0000
51 #endif /* CONFIG_SPL_OS_BOOT */
52 #endif /* CONFIG_NAND */
53 
54 /* USB EHCI */
55 #define CONFIG_OMAP_EHCI_PHY1_RESET_GPIO	147
56 
57 /* Enable Multi Bus support for I2C */
58 #define CONFIG_I2C_MULTI_BUS
59 
60 /* DSS Support */
61 #define CONFIG_VIDEO_OMAP3
62 
63 /* TWL4030 LED Support */
64 #define CONFIG_TWL4030_LED
65 
66 /* Environment */
67 #define CONFIG_ENV_SIZE                 SZ_128K
68 
69 #define CONFIG_PREBOOT                  "usb start"
70 
71 #define MEM_LAYOUT_ENV_SETTINGS \
72 	DEFAULT_LINUX_BOOT_ENV
73 
74 #define BOOTENV_DEV_LEGACY_MMC(devtypeu, devtypel, instance) \
75 	"bootcmd_" #devtypel #instance "=" \
76 	"setenv mmcdev " #instance "; " \
77 	"run mmcboot\0"
78 #define BOOTENV_DEV_NAME_LEGACY_MMC(devtypeu, devtypel, instance) \
79 	#devtypel #instance " "
80 
81 #if defined(CONFIG_NAND)
82 
83 #define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
84 	"bootcmd_" #devtypel #instance "=" \
85 	"if test ${mtdids} = '' || test ${mtdparts} = '' ; then " \
86 		"echo NAND boot disabled: No mtdids and/or mtdparts; " \
87 	"else " \
88 		"run nandboot; " \
89 	"fi\0"
90 #define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \
91 	#devtypel #instance " "
92 
93 #define BOOT_TARGET_DEVICES(func) \
94 	func(MMC, mmc, 0) \
95 	func(LEGACY_MMC, legacy_mmc, 0) \
96 	func(UBIFS, ubifs, 0) \
97 	func(NAND, nand, 0)
98 
99 #else /* !CONFIG_NAND */
100 
101 #define BOOT_TARGET_DEVICES(func) \
102 	func(MMC, mmc, 0) \
103 	func(LEGACY_MMC, legacy_mmc, 0)
104 
105 #endif /* CONFIG_NAND */
106 
107 #include <config_distro_bootcmd.h>
108 
109 #define CONFIG_EXTRA_ENV_SETTINGS \
110 	MEM_LAYOUT_ENV_SETTINGS \
111 	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
112 	"fdt_high=0xffffffff\0" \
113 	"console=ttyO2,115200n8\0" \
114 	"bootdir=/boot\0" \
115 	"bootenv=uEnv.txt\0" \
116 	"bootfile=zImage\0" \
117 	"bootpart=0:2\0" \
118 	"bootubivol=rootfs\0" \
119 	"bootubipart=rootfs\0" \
120 	"usbtty=cdc_acm\0" \
121 	"mpurate=auto\0" \
122 	"buddy=none\0" \
123 	"camera=none\0" \
124 	"vram=12M\0" \
125 	"dvimode=640x480MR-16@60\0" \
126 	"defaultdisplay=dvi\0" \
127 	"defaultargs=setenv defargs " \
128 		"mpurate=${mpurate} " \
129 		"buddy=${buddy} "\
130 		"camera=${camera} "\
131 		"vram=${vram} " \
132 		"omapfb.mode=dvi:${dvimode} " \
133 		"omapdss.def_disp=${defaultdisplay}\0" \
134 	"optargs=\0" \
135 	"findfdt=" \
136 		"if test $beaglerev = AxBx; then " \
137 			"setenv fdtfile omap3-beagle.dtb; fi; " \
138 		"if test $beaglerev = Cx; then " \
139 			"setenv fdtfile omap3-beagle.dtb; fi; " \
140 		"if test $beaglerev = C4; then " \
141 			"setenv fdtfile omap3-beagle.dtb; fi; " \
142 		"if test $beaglerev = xMAB; then " \
143 			"setenv fdtfile omap3-beagle-xm-ab.dtb; fi; " \
144 		"if test $beaglerev = xMC; then " \
145 			"setenv fdtfile omap3-beagle-xm.dtb; fi; " \
146 		"if test $fdtfile = undefined; then " \
147 			"echo WARNING: Could not determine device tree to use; fi\0" \
148 	"mmcdev=0\0" \
149 	"mmcpart=2\0" \
150 	"mmcroot=/dev/mmcblk0p2 rw\0" \
151 	"mmcrootfstype=ext4 rootwait\0" \
152 	"mmcargs=run defaultargs; setenv bootargs console=${console} " \
153 		"${mtdparts} " \
154 		"${defargs} " \
155 		"${optargs} " \
156 		"root=${mmcroot} " \
157 		"rootfstype=${mmcrootfstype}\0" \
158 	"userbutton_xm=gpio input 4;\0" \
159 	"userbutton_nonxm=gpio input 7;\0" \
160 	"userbutton=if gpio input 173; then " \
161 			"run userbutton_xm; " \
162 		"else " \
163 			"run userbutton_nonxm; " \
164 		"fi;\0" \
165 	"loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
166 	"ext4bootenv=ext4load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootenv}\0" \
167 	"importbootenv=echo Importing environment from mmc${mmcdev} ...; " \
168 		"env import -t ${loadaddr} ${filesize}\0" \
169 	"mmcbootenv=setenv bootpart ${mmcdev}:${mmcpart}; " \
170 		"mmc dev ${mmcdev}; " \
171 		"if mmc rescan; then " \
172 			"if run userbutton; then " \
173 				"setenv bootenv uEnv.txt;" \
174 			"else " \
175 				"setenv bootenv user.txt;" \
176 			"fi;" \
177 			"run loadbootenv && run importbootenv; " \
178 			"run ext4bootenv && run importbootenv; " \
179 			"if test -n $uenvcmd; then " \
180 				"echo Running uenvcmd ...; " \
181 				"run uenvcmd; " \
182 			"fi; " \
183 		"fi\0" \
184 	"validatefdt=" \
185 		"if test $beaglerev = xMAB; then " \
186 			"if test ! -e mmc ${bootpart} ${bootdir}/${fdtfile}; then " \
187 				"setenv fdtfile omap3-beagle-xm.dtb; " \
188 			"fi; " \
189 		"fi; \0" \
190 	"loadimage=ext4load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
191 	"loaddtb=run validatefdt; ext4load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
192 	"mmcboot=run mmcbootenv; " \
193 		"if run loadimage && run loaddtb; then " \
194 			"echo Booting ${bootdir}/${bootfile} from mmc ${bootpart} ...; " \
195 			"run mmcargs; " \
196 			"if test ${bootfile} = uImage; then " \
197 				"bootm ${loadaddr} - ${fdtaddr}; " \
198 			"fi; " \
199 			"if test ${bootfile} = zImage; then " \
200 				"bootz ${loadaddr} - ${fdtaddr}; " \
201 			"fi; " \
202 		"fi\0" \
203 	"nandroot=ubi0:rootfs ubi.mtd=rootfs rw\0" \
204 	"nandrootfstype=ubifs rootwait\0" \
205 	"nandargs=run defaultargs; setenv bootargs console=${console} " \
206 		"${mtdparts} " \
207 		"${defargs} " \
208 		"${optargs} " \
209 		"root=${nandroot} " \
210 		"rootfstype=${nandrootfstype}\0" \
211 	"nandboot=if nand read ${loadaddr} kernel && nand read ${fdtaddr} dtb; then " \
212 			"echo Booting uImage from NAND MTD 'kernel' partition ...; " \
213 			"run nandargs; " \
214 			"bootm ${loadaddr} - ${fdtaddr}; " \
215 		"fi\0" \
216 	"loadramdisk=ext4load mmc ${bootpart} ${rdaddr} ${bootdir}/${ramdisk}\0" \
217 	"ramdisk=rootfs.ext2.gz.uboot\0" \
218 	"ramdisk_size=16384\0" \
219 	"ramroot=/dev/ram rw\0" \
220 	"ramrootfstype=ext2\0" \
221 	"ramargs=run defaultargs; setenv bootargs console=${console} " \
222 		"${mtdparts} " \
223 		"${defargs} " \
224 		"${optargs} " \
225 		"root=${ramroot} ramdisk_size=${ramdisk_size} " \
226 	 	"rootfstype=${ramrootfstype}\0" \
227 	"ramboot=run mmcbootenv; " \
228 		"if run loadimage && run loaddtb && run loadramdisk; then " \
229 			"echo Booting ${bootdir}/${bootfile} from mmc ${bootpart} w/ramdisk ...; " \
230 			"run ramargs; " \
231 			"bootz ${loadaddr} ${rdaddr} ${fdtaddr}; " \
232 		"fi\0" \
233 	BOOTENV
234 
235 #endif /* __CONFIG_H */
236