xref: /openbmc/u-boot/include/configs/chiliboard.h (revision be059e88)
1 /*
2  * Copyright (C) 2017 Grinn - http://grinn-global.com/
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 
7 #ifndef __CONFIG_CHILIBOARD_H
8 #define __CONFIG_CHILIBOARD_H
9 
10 #define CONFIG_NAND
11 
12 #include <configs/ti_am335x_common.h>
13 
14 #define CONFIG_CONS_INDEX		1
15 
16 #ifndef CONFIG_SPL_BUILD
17 # define CONFIG_TIMESTAMP
18 # define CONFIG_LZO
19 #endif
20 
21 /* Clock Defines */
22 #define V_OSCK				24000000  /* Clock output from T2 */
23 #define V_SCLK				(V_OSCK)
24 
25 #define NANDARGS \
26 	"mtdids=" MTDIDS_DEFAULT "\0" \
27 	"mtdparts=" MTDPARTS_DEFAULT "\0" \
28 	"nandargs=setenv bootargs console=${console} ${optargs} " \
29 		"${mtdparts} " \
30 		"root=${nandroot} " \
31 		"rootfstype=${nandrootfstype}\0" \
32 	"nandroot=ubi0:rootfs rw ubi.mtd=NAND.file-system\0" \
33 	"nandrootfstype=ubifs rootwait=1\0" \
34 	"nandboot=echo Booting from nand ...; " \
35 		"run nandargs; " \
36 		"nand read ${fdt_addr} NAND.u-boot-spl-os; " \
37 		"nand read ${loadaddr} NAND.kernel; " \
38 		"bootz ${loadaddr} - ${fdt_addr}\0"
39 
40 #define CONFIG_BOOTCOMMAND \
41 	"run mmcboot; " \
42 	"run nandboot; " \
43 	"run netboot"
44 
45 #define CONFIG_EXTRA_ENV_SETTINGS \
46 	"loadaddr=0x82000000\0" \
47 	"fdt_addr=0x87800000\0" \
48 	"boot_fdt=try\0" \
49 	"console=ttyO0,115200n8\0" \
50 	"image=zImage\0" \
51 	"fdt_file=am335x-chiliboard.dtb\0" \
52 	"ip_dyn=yes\0" \
53 	"optargs=\0" \
54 	"loadbootscript=" \
55 		"load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
56 	"bootscript=echo Running bootscript from mmc ...; " \
57 		"source\0" \
58 	"loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} " \
59 		"${boot_dir}/${image}\0" \
60 	"loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} " \
61 		"${boot_dir}/${fdt_file}\0" \
62 	"mmcdev=0\0" \
63 	"mmcpart=1\0" \
64 	"mmcroot=/dev/mmcblk0p2 rootwait rw\0" \
65 	"mmcargs=setenv bootargs console=${console},${baudrate} ${optargs} " \
66 		"${mtdparts} " \
67 		"root=${mmcroot}\0" \
68 	"mmcloados=run mmcargs; " \
69 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
70 			"if run loadfdt; then " \
71 				"bootz ${loadaddr} - ${fdt_addr}; " \
72 			"else " \
73 				"if test ${boot_fdt} = try; then " \
74 					"bootz; " \
75 				"else " \
76 					"echo WARN: Cannot load the DT; " \
77 				"fi; " \
78 			"fi; " \
79 		"else " \
80 			"bootz; " \
81 		"fi;\0" \
82 	"mmcboot=mmc dev ${mmcdev}; " \
83 		"if mmc rescan; then " \
84 			"echo SD/MMC found on device ${mmcdev};" \
85 			"if run loadimage; then " \
86 				"run mmcloados;" \
87 			"fi;" \
88 		"fi;\0" \
89 	"netargs=setenv bootargs console=${console},${baudrate} ${optargs} " \
90 		"${mtdparts} " \
91 		"root=/dev/nfs " \
92 		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
93 	"netboot=echo Booting from net ...; " \
94 		"run netargs; " \
95 		"if test ${ip_dyn} = yes; then " \
96 			"setenv get_cmd dhcp; " \
97 		"else " \
98 			"setenv get_cmd tftp; " \
99 		"fi; " \
100 		"${get_cmd} ${image}; " \
101 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
102 			"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
103 				"bootz ${loadaddr} - ${fdt_addr}; " \
104 			"else " \
105 				"if test ${boot_fdt} = try; then " \
106 					"bootz; " \
107 				"else " \
108 					"echo WARN: Cannot load the DT; " \
109 				"fi; " \
110 			"fi; " \
111 		"else " \
112 			"bootz; " \
113 		"fi;\0" \
114 	NANDARGS
115 
116 /* NS16550 Configuration */
117 #define CONFIG_SYS_NS16550_COM1		0x44e09000	/* UART0 */
118 #define CONFIG_SYS_NS16550_COM2		0x48022000	/* UART1 */
119 #define CONFIG_SYS_NS16550_COM3		0x48024000	/* UART2 */
120 #define CONFIG_SYS_NS16550_COM4		0x481a6000	/* UART3 */
121 #define CONFIG_SYS_NS16550_COM5		0x481a8000	/* UART4 */
122 #define CONFIG_SYS_NS16550_COM6		0x481aa000	/* UART5 */
123 #define CONFIG_BAUDRATE			115200
124 
125 /* PMIC support */
126 #define CONFIG_POWER_TPS65217
127 
128 /* SPL */
129 /* Bootcount using the RTC block */
130 #define CONFIG_BOOTCOUNT_LIMIT
131 #define CONFIG_BOOTCOUNT_AM33XX
132 #define CONFIG_SYS_BOOTCOUNT_BE
133 
134 #define CONFIG_SPL_LDSCRIPT	"arch/arm/mach-omap2/am33xx/u-boot-spl.lds"
135 
136 /* NAND: device related configs */
137 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
138 #define CONFIG_SYS_NAND_PAGE_COUNT	(CONFIG_SYS_NAND_BLOCK_SIZE / \
139 					 CONFIG_SYS_NAND_PAGE_SIZE)
140 #define CONFIG_SYS_NAND_PAGE_SIZE	2048
141 #define CONFIG_SYS_NAND_OOBSIZE		64
142 #define CONFIG_SYS_NAND_BLOCK_SIZE	(128*1024)
143 /* NAND: driver related configs */
144 #define CONFIG_NAND_OMAP_GPMC
145 #define CONFIG_NAND_OMAP_GPMC_PREFETCH
146 #define CONFIG_NAND_OMAP_ELM
147 #define CONFIG_SYS_NAND_BAD_BLOCK_POS	NAND_LARGE_BADBLOCK_POS
148 #define CONFIG_SYS_NAND_ECCPOS		{ 2, 3, 4, 5, 6, 7, 8, 9, \
149 					 10, 11, 12, 13, 14, 15, 16, 17, \
150 					 18, 19, 20, 21, 22, 23, 24, 25, \
151 					 26, 27, 28, 29, 30, 31, 32, 33, \
152 					 34, 35, 36, 37, 38, 39, 40, 41, \
153 					 42, 43, 44, 45, 46, 47, 48, 49, \
154 					 50, 51, 52, 53, 54, 55, 56, 57, }
155 
156 #define CONFIG_SYS_NAND_ECCSIZE		512
157 #define CONFIG_SYS_NAND_ECCBYTES	14
158 #define CONFIG_SYS_NAND_ONFI_DETECTION
159 #define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_BCH8_CODE_HW
160 #define MTDIDS_DEFAULT			"nand0=8000000.nand"
161 #define MTDPARTS_DEFAULT		"mtdparts=8000000.nand:" \
162 					"128k(NAND.SPL)," \
163 					"128k(NAND.SPL.backup1)," \
164 					"128k(NAND.SPL.backup2)," \
165 					"128k(NAND.SPL.backup3)," \
166 					"256k(NAND.u-boot-spl-os)," \
167 					"1m(NAND.u-boot)," \
168 					"128k(NAND.u-boot-env)," \
169 					"128k(NAND.u-boot-env.backup1)," \
170 					"8m(NAND.kernel)," \
171 					"-(NAND.file-system)"
172 #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x000c0000
173 /* NAND: SPL related configs */
174 #ifdef CONFIG_SPL_NAND_SUPPORT
175 #define CONFIG_SPL_NAND_AM33XX_BCH
176 #endif
177 
178 /* USB configuration */
179 #define CONFIG_USB_MUSB_DSPS
180 #define CONFIG_ARCH_MISC_INIT
181 #define CONFIG_USB_MUSB_PIO_ONLY
182 #define CONFIG_USB_MUSB_DISABLE_BULK_COMBINE_SPLIT
183 #define CONFIG_AM335X_USB1
184 #define CONFIG_AM335X_USB1_MODE MUSB_HOST
185 
186 /*
187  * Disable MMC DM for SPL build and can be re-enabled after adding
188  * DM support in SPL
189  */
190 #ifdef CONFIG_SPL_BUILD
191 #undef CONFIG_DM_MMC
192 #undef CONFIG_TIMER
193 #undef CONFIG_DM_USB
194 #endif
195 
196 #if defined(CONFIG_ENV_IS_IN_NAND)
197 #define CONFIG_ENV_OFFSET		0x001c0000
198 #define CONFIG_ENV_OFFSET_REDUND	0x001e0000
199 #define CONFIG_ENV_SIZE			SZ_128K
200 #define CONFIG_SYS_ENV_SECT_SIZE	CONFIG_SYS_NAND_BLOCK_SIZE
201 #else
202 #define CONFIG_ENV_IS_IN_MMC
203 #define CONFIG_SYS_MMC_ENV_DEV		0
204 #define CONFIG_ENV_OFFSET		SZ_128K
205 #define CONFIG_ENV_OFFSET_REDUND	(CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
206 #define CONFIG_ENV_SIZE			SZ_8K
207 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
208 #endif
209 
210 /* Network. */
211 #define CONFIG_PHYLIB
212 #define CONFIG_PHY_SMSC
213 
214 #endif	/* ! __CONFIG_CHILIBOARD_H */
215