xref: /openbmc/u-boot/include/configs/brppt1.h (revision 6645fd2c)
1 /*
2  * brtpp1.h
3  *
4  * specific parts for B&R T-Series Motherboard
5  *
6  * Copyright (C) 2013 Hannes Schmelzer <oe5hpm@oevsv.at> -
7  * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
8  *
9  * SPDX-License-Identifier:        GPL-2.0+
10  */
11 
12 #ifndef __CONFIG_BRPPT1_H__
13 #define __CONFIG_BRPPT1_H__
14 
15 #include <configs/bur_cfg_common.h>
16 #include <configs/bur_am335x_common.h>
17 /* ------------------------------------------------------------------------- */
18 #define CONFIG_AM335X_LCD
19 #define CONFIG_LCD_ROTATION
20 #define CONFIG_LCD_DT_SIMPLEFB
21 #define CONFIG_SYS_WHITE_ON_BLACK
22 #define LCD_BPP				LCD_COLOR32
23 
24 #define CONFIG_HW_WATCHDOG
25 #define CONFIG_OMAP_WATCHDOG
26 
27 /* Bootcount using the RTC block */
28 #define CONFIG_SYS_BOOTCOUNT_ADDR	0x44E3E000
29 #define CONFIG_BOOTCOUNT_LIMIT
30 #define CONFIG_BOOTCOUNT_AM33XX
31 
32 /* memory */
33 #define CONFIG_SYS_MALLOC_LEN		(5 * 1024 * 1024)
34 
35 /* Clock Defines */
36 #define V_OSCK				26000000  /* Clock output from T2 */
37 #define V_SCLK				(V_OSCK)
38 
39 #define CONFIG_POWER_TPS65217
40 
41 /* Support both device trees and ATAGs. */
42 #define CONFIG_USE_FDT			/* use fdt within board code */
43 #define CONFIG_CMDLINE_TAG
44 #define CONFIG_SETUP_MEMORY_TAGS
45 #define CONFIG_INITRD_TAG
46 /*#define CONFIG_MACH_TYPE		3589*/
47 #define CONFIG_MACH_TYPE		0xFFFFFFFF /* TODO: check with kernel*/
48 
49 /* MMC/SD IP block */
50 #if defined(CONFIG_EMMC_BOOT)
51  #define CONFIG_MMC
52  #define CONFIG_GENERIC_MMC
53  #define CONFIG_OMAP_HSMMC
54  #define CONFIG_SUPPORT_EMMC_BOOT
55 /* RAW SD card / eMMC locations. */
56  #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR	0x300 /*addr. 0x60000 */
57  #define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS		0x200 /* 256 KB */
58 #endif /* CONFIG_EMMC_BOOT */
59 
60 /*
61  * When we have SPI or NAND flash we expect to be making use of mtdparts,
62  * both for ease of use in U-Boot and for passing information on to
63  * the Linux kernel.
64  */
65 #if defined(CONFIG_SPI_BOOT) || defined(CONFIG_NAND)
66 #define CONFIG_MTD_DEVICE		/* Required for mtdparts */
67 #define CONFIG_CMD_MTDPARTS
68 #endif /* CONFIG_SPI_BOOT, ... */
69 
70 #ifdef CONFIG_SPL_OS_BOOT
71 #define CONFIG_SYS_SPL_ARGS_ADDR		0x80F80000
72 
73 /* RAW SD card / eMMC */
74 #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR	0x900	/* address 0x120000 */
75 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR	0x80	/* address 0x10000 */
76 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS	0x80	/* 64KiB */
77 
78 /* NAND */
79 #ifdef CONFIG_NAND
80 #define CONFIG_CMD_SPL_NAND_OFS			0x080000 /* end of u-boot */
81 #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS		0x140000
82 #define CONFIG_CMD_SPL_WRITE_SIZE		0x2000
83 #endif /* CONFIG_NAND */
84 #endif /* CONFIG_SPL_OS_BOOT */
85 
86 #ifdef CONFIG_NAND
87 #define CONFIG_SPL_NAND_AM33XX_BCH	/* OMAP4 and later ELM support */
88 #define CONFIG_SPL_NAND_BASE
89 #define CONFIG_SPL_NAND_DRIVERS
90 #define CONFIG_SPL_NAND_ECC
91 #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE
92 #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000
93 #endif /* CONFIG_NAND */
94 
95 /* Always 64 KiB env size */
96 #define CONFIG_ENV_SIZE			(64 << 10)
97 
98 #ifdef CONFIG_NAND
99 #define NANDARGS \
100 	"mtdids=" MTDIDS_DEFAULT "\0" \
101 	"mtdparts=" MTDPARTS_DEFAULT "\0" \
102 	"nandargs=setenv bootargs console=${console} " \
103 		"${optargs} " \
104 		"${optargs_rot} " \
105 		"root=mtd6 " \
106 		"rootfstype=jffs2\0" \
107 	"kernelsize=0x400000\0" \
108 	"nandboot=echo booting from nand ...; " \
109 		"run nandargs; " \
110 		"nand read ${loadaddr} kernel ${kernelsize}; " \
111 		"bootz ${loadaddr} - ${dtbaddr}\0" \
112 	"defboot=run nandboot\0" \
113 	"bootlimit=1\0" \
114 	"simplefb=1\0 " \
115 	"altbootcmd=run usbscript\0"
116 #else
117 #define NANDARGS ""
118 #endif /* CONFIG_NAND */
119 
120 #ifdef CONFIG_MMC
121 #define MMCARGS \
122 "dtbdev=mmc\0" \
123 "dtbpart=0:1\0" \
124 "mmcroot0=setenv bootargs ${optargs_rot} ${optargs} console=${console}\0" \
125 "mmcroot1=setenv bootargs ${optargs_rot} ${optargs} console=${console} " \
126 	"root=/dev/mmcblk0p2 rootfstype=ext4\0" \
127 "mmcboot0=echo booting Updatesystem from mmc (ext4-fs) ...; " \
128 	"setenv simplefb 1; " \
129 	"ext4load mmc 0:1 ${loadaddr} /${kernel}; " \
130 	"ext4load mmc 0:1 ${ramaddr} /${ramdisk}; " \
131 	"run mmcroot0; bootz ${loadaddr} ${ramaddr} ${dtbaddr};\0" \
132 "mmcboot1=echo booting PPT-OS from mmc (ext4-fs) ...; " \
133 	"setenv simplefb 0; " \
134 	"ext4load mmc 0:2 ${loadaddr} /boot/${kernel}; " \
135 	"run mmcroot1; bootz ${loadaddr} - ${dtbaddr};\0" \
136 "defboot=ext4load mmc 0:2 ${loadaddr} /boot/PPTImage.md5 && run mmcboot1; " \
137 	"ext4load mmc 0:1 ${dtbaddr} /$dtb && run mmcboot0; " \
138 	"run ramboot; run usbscript;\0" \
139 "bootlimit=1\0" \
140 "altbootcmd=run mmcboot0;\0" \
141 "upduboot=dhcp; " \
142 	"tftp ${loadaddr} MLO && mmc write ${loadaddr} 100 100; " \
143 	"tftp ${loadaddr} u-boot.img && mmc write ${loadaddr} 300 400;\0"
144 #else
145 #define MMCARGS ""
146 #endif /* CONFIG_MMC */
147 
148 #ifndef CONFIG_SPL_BUILD
149 #define CONFIG_EXTRA_ENV_SETTINGS \
150 BUR_COMMON_ENV \
151 "verify=no\0" \
152 "autoload=0\0" \
153 "dtb=bur-ppt-ts30.dtb\0" \
154 "dtbaddr=0x80100000\0" \
155 "loadaddr=0x80200000\0" \
156 "ramaddr=0x80A00000\0" \
157 "kernel=zImage\0" \
158 "ramdisk=rootfs.cpio.uboot\0" \
159 "console=ttyO0,115200n8\0" \
160 "optargs=consoleblank=0 quiet panic=2\0" \
161 "nfsroot=/tftpboot/tseries/rootfs-small\0" \
162 "nfsopts=nolock\0" \
163 "ramargs=setenv bootargs ${optargs} console=${console} root=/dev/ram0\0" \
164 "netargs=setenv bootargs console=${console} " \
165 	"${optargs} " \
166 	"root=/dev/nfs " \
167 	"nfsroot=${serverip}:${nfsroot},${nfsopts} rw " \
168 	"ip=dhcp\0" \
169 "netboot=echo Booting from network ...; " \
170 	"dhcp; " \
171 	"tftp ${loadaddr} ${kernel}; " \
172 	"tftp ${dtbaddr} ${dtb}; " \
173 	"run netargs; " \
174 	"bootz ${loadaddr} - ${dtbaddr}\0" \
175 "ramboot=echo Booting from network into RAM ...; "\
176 	"if dhcp; then; " \
177 	"tftp ${loadaddr} ${kernel}; " \
178 	"tftp ${ramaddr} ${ramdisk}; " \
179 	"if ext4load ${dtbdev} ${dtbpart} ${dtbaddr} /${dtb}; " \
180 	"then; else tftp ${dtbaddr} ${dtb}; fi;" \
181 	"run mmcroot0; " \
182 	"bootz ${loadaddr} ${ramaddr} ${dtbaddr}; fi;\0" \
183 "netupdate=echo Updating UBOOT from Network (TFTP) ...; " \
184 	"setenv autoload 0; " \
185 	"dhcp && tftp 0x80000000 updateUBOOT.img && source;\0" \
186 NANDARGS \
187 MMCARGS
188 #endif /* !CONFIG_SPL_BUILD*/
189 
190 #define CONFIG_BOOTCOMMAND \
191 	"run defboot;"
192 
193 #ifdef CONFIG_NAND
194 /*
195  * GPMC  block.  We support 1 device and the physical address to
196  * access CS0 at is 0x8000000.
197  */
198 #define CONFIG_SYS_MAX_NAND_DEVICE	1
199 #define CONFIG_SYS_NAND_BASE		0x8000000
200 #define CONFIG_NAND_OMAP_GPMC
201 /* don't change OMAP_ELM, ECCSCHEME. ROM code only supports this */
202 #define CONFIG_NAND_OMAP_ELM
203 #define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_BCH8_CODE_HW
204 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
205 #define CONFIG_SYS_NAND_BLOCK_SIZE	(128*1024)
206 #define CONFIG_SYS_NAND_PAGE_SIZE	2048
207 #define CONFIG_SYS_NAND_PAGE_COUNT	(CONFIG_SYS_NAND_BLOCK_SIZE / \
208 					CONFIG_SYS_NAND_PAGE_SIZE)
209 #define CONFIG_SYS_NAND_OOBSIZE		64
210 #define CONFIG_SYS_NAND_BAD_BLOCK_POS	NAND_LARGE_BADBLOCK_POS
211 #define CONFIG_SYS_NAND_ECCPOS		{2, 3, 4, 5, 6, 7, 8, 9, \
212 					10, 11, 12, 13, 14, 15, 16, 17, \
213 					18, 19, 20, 21, 22, 23, 24, 25, \
214 					26, 27, 28, 29, 30, 31, 32, 33, \
215 					34, 35, 36, 37, 38, 39, 40, 41, \
216 					42, 43, 44, 45, 46, 47, 48, 49, \
217 					50, 51, 52, 53, 54, 55, 56, 57, }
218 
219 #define CONFIG_SYS_NAND_ECCSIZE		512
220 #define CONFIG_SYS_NAND_ECCBYTES	14
221 
222 #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE
223 #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000
224 
225 #define MTDIDS_DEFAULT			"nand0=omap2-nand.0"
226 #define MTDPARTS_DEFAULT		"mtdparts=omap2-nand.0:" \
227 					"128k(MLO)," \
228 					"128k(MLO.backup)," \
229 					"128k(dtb)," \
230 					"128k(u-boot-env)," \
231 					"512k(u-boot)," \
232 					"4m(kernel),"\
233 					"128m(rootfs),"\
234 					"-(user)"
235 #define CONFIG_NAND_OMAP_GPMC_WSCFG	1
236 #endif /* CONFIG_NAND */
237 
238 /* USB configuration */
239 #define CONFIG_USB_MUSB_DSPS
240 #define CONFIG_ARCH_MISC_INIT
241 #define CONFIG_USB_MUSB_PIO_ONLY
242 #define CONFIG_USB_MUSB_DISABLE_BULK_COMBINE_SPLIT
243 #define CONFIG_AM335X_USB0
244 #define CONFIG_AM335X_USB0_MODE	MUSB_HOST
245 #define CONFIG_AM335X_USB1
246 #define CONFIG_AM335X_USB1_MODE MUSB_HOST
247 
248 #if defined(CONFIG_SPI_BOOT)
249 /* McSPI IP block */
250 #define CONFIG_SPI
251 #define CONFIG_OMAP3_SPI
252 #define CONFIG_SF_DEFAULT_SPEED		24000000
253 
254 #define CONFIG_SPL_SPI_LOAD
255 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x20000
256 #undef CONFIG_ENV_IS_NOWHERE
257 #define CONFIG_ENV_IS_IN_SPI_FLASH
258 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
259 #define CONFIG_ENV_SPI_MAX_HZ		CONFIG_SF_DEFAULT_SPEED
260 #define CONFIG_ENV_SECT_SIZE		(4 << 10) /* 4 KB sectors */
261 #define CONFIG_ENV_OFFSET		(768 << 10) /* 768 KiB in */
262 #define CONFIG_ENV_OFFSET_REDUND	(896 << 10) /* 896 KiB in */
263 
264 #elif defined(CONFIG_EMMC_BOOT)
265 #undef CONFIG_ENV_IS_NOWHERE
266 #define CONFIG_ENV_IS_IN_MMC
267 #define CONFIG_SYS_MMC_ENV_DEV		0
268 #define CONFIG_SYS_MMC_ENV_PART		2
269 #define CONFIG_ENV_OFFSET		0x40000	/* TODO: Adresse definieren */
270 #define CONFIG_ENV_OFFSET_REDUND	(CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
271 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
272 
273 #elif defined(CONFIG_NAND)
274 /* No NAND env support in SPL */
275 #ifdef CONFIG_SPL_BUILD
276 #define CONFIG_ENV_IS_NOWHERE
277 #else
278 #define CONFIG_ENV_IS_IN_NAND
279 #endif
280 #define CONFIG_ENV_OFFSET		0x60000
281 #define CONFIG_SYS_ENV_SECT_SIZE	CONFIG_ENV_SIZE
282 #else
283 #error "no storage for Environment defined!"
284 #endif
285 /*
286  * Common filesystems support.  When we have removable storage we
287  * enabled a number of useful commands and support.
288  */
289 #if defined(CONFIG_MMC) || defined(CONFIG_USB_STORAGE)
290 #define CONFIG_DOS_PARTITION
291 #define CONFIG_FAT_WRITE
292 #define CONFIG_FS_EXT4
293 #define CONFIG_EXT4_WRITE
294 #endif /* CONFIG_MMC, ... */
295 
296 #endif	/* ! __CONFIG_BRPPT1_H__ */
297