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