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