1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * am3517_evm.h - Default configuration for AM3517 EVM board.
4  *
5  * Author: Vaibhav Hiremath <hvaibhav@ti.com>
6  *
7  * Based on omap3_evm_config.h
8  *
9  * Copyright (C) 2010 Texas Instruments Incorporated
10  */
11 
12 #ifndef __CONFIG_H
13 #define __CONFIG_H
14 
15 #include <configs/ti_omap3_common.h>
16 
17 #define CONFIG_REVISION_TAG
18 
19 /* Hardware drivers */
20 
21 /*
22  * USB configuration
23  * Enable CONFIG_USB_MUSB_HOST for Host functionalities MSC, keyboard
24  * Enable CONFIG_USB_MUSB_GADGET for Device functionalities.
25  */
26 #ifdef CONFIG_SPL_BUILD
27 #undef CONFIG_USB_EHCI_OMAP
28 #else
29 #define CONFIG_OMAP_EHCI_PHY1_RESET_GPIO	57
30 #endif
31 
32 /* I2C */
33 
34 /* Ethernet */
35 #define CONFIG_NET_RETRY_COUNT		10
36 
37 /* Board NAND Info. */
38 #ifdef CONFIG_MTD_RAW_NAND
39 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
40 #define CONFIG_SYS_NAND_PAGE_COUNT	64
41 #define CONFIG_SYS_NAND_PAGE_SIZE	2048
42 #define CONFIG_SYS_NAND_OOBSIZE		64
43 #define CONFIG_SYS_NAND_BLOCK_SIZE	(128 * 1024)
44 #define CONFIG_SYS_NAND_BAD_BLOCK_POS	NAND_LARGE_BADBLOCK_POS
45 #define CONFIG_SYS_NAND_ECCPOS		{ 2,  3,  4,  5,  6,  7,  8,  9, 10, \
46 					 11, 12, 13, 14, 16, 17, 18, 19, 20, \
47 					 21, 22, 23, 24, 25, 26, 27, 28, 30, \
48 					 31, 32, 33, 34, 35, 36, 37, 38, 39, \
49 					 40, 41, 42, 44, 45, 46, 47, 48, 49, \
50 					 50, 51, 52, 53, 54, 55, 56 }
51 
52 #define CONFIG_SYS_NAND_ECCSIZE		512
53 #define CONFIG_SYS_NAND_ECCBYTES	13
54 #define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
55 #define CONFIG_SYS_NAND_MAX_OOBFREE	2
56 #define CONFIG_SYS_NAND_MAX_ECCPOS	56
57 #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE
58 #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000
59 #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x2a0000
60 /* NAND block size is 128 KiB.  Synchronize these values with
61  * corresponding Device Tree entries in Linux:
62  *  MLO(SPL)             4 * NAND_BLOCK_SIZE = 512 KiB  @ 0x000000
63  *  U-Boot              15 * NAND_BLOCK_SIZE = 1920 KiB @ 0x080000
64  *  U-Boot environment   2 * NAND_BLOCK_SIZE = 256 KiB  @ 0x260000
65  *  Kernel              64 * NAND_BLOCK_SIZE = 8 MiB    @ 0x2A0000
66  *  DTB                  4 * NAND_BLOCK_SIZE = 512 KiB  @ 0xAA0000
67  *  RootFS              Remaining Flash Space           @ 0xB20000
68  */
69 #endif /* CONFIG_MTD_RAW_NAND */
70 
71 /* Environment information */
72 
73 #define CONFIG_BOOTFILE		"uImage"
74 
75 #define CONFIG_EXTRA_ENV_SETTINGS \
76 	"loadaddr=0x82000000\0" \
77 	"console=ttyS2,115200n8\0" \
78 	"fdtfile=am3517-evm.dtb\0" \
79 	"fdtaddr=0x82C00000\0" \
80 	"vram=16M\0" \
81 	"bootenv=uEnv.txt\0" \
82 	"cmdline=\0" \
83 	"optargs=\0" \
84 	"mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
85 	"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
86 	"mmcdev=0\0" \
87 	"mmcpart=1\0" \
88 	"mmcroot=/dev/mmcblk0p2 rw\0" \
89 	"mmcrootfstype=ext4 rootwait fixrtc\0" \
90 	"mmcargs=setenv bootargs console=${console} " \
91 		"${mtdparts} " \
92 		"${optargs} " \
93 		"root=${mmcroot} " \
94 		"rootfstype=${mmcrootfstype} " \
95 		"${cmdline}\0" \
96 	"nandargs=setenv bootargs console=${console} " \
97 		"${mtdparts} " \
98 		"${optargs} " \
99 		"root=ubi0:rootfs rw ubi.mtd=rootfs " \
100 		"rootfstype=ubifs rootwait " \
101 		"${cmdline}\0" \
102 	"loadbootenv=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${bootenv}\0"\
103 	"importbootenv=echo Importing environment from mmc ...; " \
104 		"env import -t ${loadaddr} ${filesize}\0" \
105 	"bootscript=echo Running bootscript from mmc ...; " \
106 		"source ${loadaddr}\0" \
107 	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${bootfile}\0" \
108 	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdtaddr} ${fdtfile}\0" \
109 	"mmcboot=echo Booting from mmc ...; " \
110 		"run mmcargs; " \
111 		"bootz ${loadaddr} - ${fdtaddr}\0" \
112 	"nandboot=echo Booting from nand ...; " \
113 		"run nandargs; " \
114 		"nand read ${loadaddr} 2a0000 800000; " \
115 		"nand read ${fdtaddr} aa0000 80000; " \
116 		"bootm ${loadaddr} - ${fdtaddr}\0" \
117 
118 #define CONFIG_BOOTCOMMAND \
119 	"mmc dev ${mmcdev}; if mmc rescan; then " \
120 		"echo SD/MMC found on device $mmcdev; " \
121 		"if run loadbootenv; then " \
122 			"run importbootenv; " \
123 		"fi; " \
124 		"echo Checking if uenvcmd is set ...; " \
125 		"if test -n $uenvcmd; then " \
126 			"echo Running uenvcmd ...; " \
127 			"run uenvcmd; " \
128 		"fi; " \
129 		"echo Running default loadimage ...; " \
130 		"setenv bootfile zImage; " \
131 		"if run loadimage; then " \
132 			"run loadfdt; " \
133 			"run mmcboot; " \
134 		"fi; " \
135 	"else run nandboot; fi"
136 
137 /* Miscellaneous configurable options */
138 
139 /* We set the max number of command args high to avoid HUSH bugs. */
140 #define CONFIG_SYS_MAXARGS		64
141 
142 /* Print Buffer Size */
143 #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE \
144 					+ sizeof(CONFIG_SYS_PROMPT) + 16)
145 /* Boot Argument Buffer Size */
146 #define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
147 
148 /* memtest works on */
149 
150 /* Physical Memory Map */
151 #define CONFIG_SYS_CS0_SIZE		(256 * 1024 * 1024)
152 
153 /* FLASH and environment organization */
154 
155 /* **** PISMO SUPPORT *** */
156 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors */
157 						/* on one chip */
158 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
159 #define CONFIG_SYS_MONITOR_LEN		(256 << 10)	/* Reserve 2 sectors */
160 
161 #if defined(CONFIG_MTD_RAW_NAND)
162 #define CONFIG_SYS_FLASH_BASE		NAND_BASE
163 #endif
164 
165 /* Monitor at start of flash */
166 #define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_FLASH_BASE
167 
168 #define CONFIG_SYS_ENV_SECT_SIZE	(128 << 10)	/* 128 KiB */
169 
170 /* Defines for SPL */
171 
172 #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME		"u-boot.img"
173 
174 #endif /* __CONFIG_H */
175