]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - include/configs/tseries.h
board/BuR/tseries: Enable U-Boot BOOTCOUNT feature
[karo-tx-uboot.git] / include / configs / tseries.h
1 /*
2  * tseries.h
3  *
4  * specific parts for B&R T-Series Motherboard
5  *
6  * Copyright (C) 2013 Hannes Petermaier <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_TSERIES_H__
13 #define __CONFIG_TSERIES_H__
14
15 #include <configs/bur_am335x_common.h>
16 /* ------------------------------------------------------------------------- */
17 #define CONFIG_AM335X_LCD
18 #define CONFIG_LCD
19 #define CONFIG_LCD_NOSTDOUT
20 #define CONFIG_SYS_WHITE_ON_BLACK
21 #define LCD_BPP                         LCD_COLOR32
22
23 #define CONFIG_HW_WATCHDOG
24 #define CONFIG_OMAP_WATCHDOG
25 #define CONFIG_SPL_WATCHDOG_SUPPORT
26 /* Bootcount using the RTC block */
27 #define CONFIG_SYS_BOOTCOUNT_ADDR       0x44E3E000
28 #define CONFIG_BOOTCOUNT_LIMIT
29 #define CONFIG_BOOTCOUNT_AM33XX
30 /* Clock Defines */
31 #define V_OSCK                          26000000  /* Clock output from T2 */
32 #define V_SCLK                          (V_OSCK)
33
34 #define CONFIG_POWER_TPS65217
35
36 /* Support both device trees and ATAGs. */
37 #define CONFIG_OF_LIBFDT
38 #define CONFIG_USE_FDT                  /* use fdt within board code */
39 #define CONFIG_OF_BOARD_SETUP
40 #define CONFIG_CMDLINE_TAG
41 #define CONFIG_SETUP_MEMORY_TAGS
42 #define CONFIG_INITRD_TAG
43 #define CONFIG_CMD_BOOTZ
44 /*#define CONFIG_MACH_TYPE              3589*/
45 #define CONFIG_MACH_TYPE                0xFFFFFFFF /* TODO: check with kernel*/
46
47 /* MMC/SD IP block */
48 #if defined(CONFIG_EMMC_BOOT)
49  #define CONFIG_MMC
50  #define CONFIG_GENERIC_MMC
51  #define CONFIG_OMAP_HSMMC
52  #define CONFIG_CMD_MMC
53  #define CONFIG_SUPPORT_EMMC_BOOT
54 /* RAW SD card / eMMC locations. */
55  #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR        0x300 /*addr. 0x60000 */
56  #define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS             0x200 /* 256 KB */
57  #define CONFIG_SPL_MMC_SUPPORT
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 #undef CONFIG_SPL_OS_BOOT
71 #ifdef CONFIG_SPL_OS_BOOT
72 #define CONFIG_SYS_SPL_ARGS_ADDR                0x80F80000
73
74 /* RAW SD card / eMMC */
75 #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x900   /* address 0x120000 */
76 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR   0x80    /* address 0x10000 */
77 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS  0x80    /* 64KiB */
78
79 /* NAND */
80 #ifdef CONFIG_NAND
81 #define CONFIG_CMD_SPL_NAND_OFS                 0x080000 /* end of u-boot */
82 #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS         0x140000
83 #define CONFIG_CMD_SPL_WRITE_SIZE               0x2000
84 #endif /* CONFIG_NAND */
85 #endif /* CONFIG_SPL_OS_BOOT */
86
87 #ifdef CONFIG_NAND
88 #define CONFIG_SPL_NAND_AM33XX_BCH      /* OMAP4 and later ELM support */
89 #define CONFIG_SPL_NAND_SUPPORT
90 #define CONFIG_SPL_NAND_BASE
91 #define CONFIG_SPL_NAND_DRIVERS
92 #define CONFIG_SPL_NAND_ECC
93 #define CONFIG_SYS_NAND_U_BOOT_START    CONFIG_SYS_TEXT_BASE
94 #define CONFIG_SYS_NAND_U_BOOT_OFFS     0x80000
95 #endif /* CONFIG_NAND */
96
97 /* Always 128 KiB env size */
98 #define CONFIG_ENV_SIZE                 (128 << 10)
99
100 #ifdef CONFIG_NAND
101 #define NANDARGS \
102         "mtdids=" MTDIDS_DEFAULT "\0" \
103         "mtdparts=" MTDPARTS_DEFAULT "\0" \
104         "nandargs=setenv bootargs console=${console} " \
105                 "${optargs} " \
106                 "root=${nandroot} " \
107                 "rootfstype=${nandrootfstype}\0" \
108         "nandroot=ubi0:rootfs rw ubi.mtd=8,2048\0" \
109         "nandrootfstype=ubifs rootwait=1\0" \
110         "nandimgsize=0x500000\0" \
111         "nandboot=echo Booting from nand ...; " \
112                 "run nandargs; " \
113                 "nand read ${loadaddr} kernel ${nandimgsize}; " \
114                 "bootz ${loadaddr}\0"
115 #else
116 #define NANDARGS ""
117 #endif /* CONFIG_NAND */
118
119 #ifdef CONFIG_MMC
120 #define MMCARGS \
121         "silent=1\0"
122 #else
123 #define MMCARGS ""
124 #endif /* CONFIG_MMC */
125
126 #ifndef CONFIG_SPL_BUILD
127 #define CONFIG_EXTRA_ENV_SETTINGS \
128         "autoload=0\0" \
129         "loadaddr=0x80200000\0" \
130         "bootfile=zImage\0" \
131         "console=ttyO0,115200n8\0" \
132         "optargs=\0" \
133         "rootpath=/tftpboot/tseries/rootfs-small\0" \
134         "nfsopts=nolock\0" \
135         "netargs=setenv bootargs console=${console} " \
136                 "${optargs} " \
137                 "root=/dev/nfs " \
138                 "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
139                 "ip=dhcp\0" \
140         "netboot=echo Booting from network ...; " \
141                 "setenv autoload no; " \
142                 "dhcp; " \
143                 "tftp ${loadaddr} ${bootfile}; " \
144                 "run netargs; " \
145                 "bootm ${loadaddr}\0" \
146         "usbupdate=echo Updating UBOOT from USB-Stick ...; " \
147                 "usb start; " \
148                 "fatload usb 0 0x80000000 updateubootusb.img; " \
149                 "source;\0" \
150         "netupdate=echo Updating UBOOT from Network (TFTP) ...; " \
151                 "setenv autoload 0; " \
152                 "dhcp;" \
153                 "tftp 0x80000000 updateUBOOT.img;" \
154                 "source;\0" \
155         NANDARGS \
156         MMCARGS
157 #endif /* !CONFIG_SPL_BUILD*/
158
159 #define CONFIG_BOOTCOMMAND \
160         "run mmcboot1;"
161 #define CONFIG_BOOTDELAY                1 /* TODO: für release auf 0 setzen */
162
163 #ifdef CONFIG_NAND
164 /*
165  * GPMC  block.  We support 1 device and the physical address to
166  * access CS0 at is 0x8000000.
167  */
168 #define CONFIG_SYS_MAX_NAND_DEVICE      1
169 #define CONFIG_SYS_NAND_BASE            0x8000000
170 #define CONFIG_NAND_OMAP_GPMC
171 #define CONFIG_CMD_NAND
172 /* don't change OMAP_ELM, ECCSCHEME. ROM code only supports this */
173 #define CONFIG_NAND_OMAP_ELM
174 #define CONFIG_NAND_OMAP_ECCSCHEME      OMAP_ECC_BCH8_CODE_HW
175 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
176 #define CONFIG_SYS_NAND_BLOCK_SIZE      (128*1024)
177 #define CONFIG_SYS_NAND_PAGE_SIZE       2048
178 #define CONFIG_SYS_NAND_PAGE_COUNT      (CONFIG_SYS_NAND_BLOCK_SIZE / \
179                                         CONFIG_SYS_NAND_PAGE_SIZE)
180 #define CONFIG_SYS_NAND_OOBSIZE         64
181 #define CONFIG_SYS_NAND_BAD_BLOCK_POS   NAND_LARGE_BADBLOCK_POS
182 #define CONFIG_SYS_NAND_ECCPOS          {2, 3, 4, 5, 6, 7, 8, 9, \
183                                         10, 11, 12, 13, 14, 15, 16, 17, \
184                                         18, 19, 20, 21, 22, 23, 24, 25, \
185                                         26, 27, 28, 29, 30, 31, 32, 33, \
186                                         34, 35, 36, 37, 38, 39, 40, 41, \
187                                         42, 43, 44, 45, 46, 47, 48, 49, \
188                                         50, 51, 52, 53, 54, 55, 56, 57, }
189
190 #define CONFIG_SYS_NAND_ECCSIZE         512
191 #define CONFIG_SYS_NAND_ECCBYTES        14
192
193 #define CONFIG_SYS_NAND_U_BOOT_START    CONFIG_SYS_TEXT_BASE
194 #define CONFIG_SYS_NAND_U_BOOT_OFFS     0x80000
195
196 #define MTDIDS_DEFAULT                  "nand0=omap2-nand.0"
197 #define MTDPARTS_DEFAULT                "mtdparts=omap2-nand.0:" \
198                                         "128k(SPL)," \
199                                         "128k(SPL.backup1)," \
200                                         "128k(SPL.backup2)," \
201                                         "128k(SPL.backup3)," \
202                                         "512k(u-boot)," \
203                                         "128k(u-boot-spl-os)," \
204                                         "128k(u-boot-env)," \
205                                         "5m(kernel),"\
206                                         "-(rootfs)"
207 #endif /* CONFIG_NAND */
208
209 /* USB configuration */
210 #define CONFIG_USB_MUSB_DSPS
211 #define CONFIG_ARCH_MISC_INIT
212 #define CONFIG_MUSB_PIO_ONLY
213 #define CONFIG_MUSB_DISABLE_BULK_COMBINE_SPLIT
214 /* attention! not only for gadget, enables also highspeed in hostmode */
215 #define CONFIG_USB_GADGET_DUALSPEED
216 #define CONFIG_MUSB_HOST
217 #define CONFIG_AM335X_USB0
218 #define CONFIG_AM335X_USB0_MODE MUSB_HOST
219 #define CONFIG_AM335X_USB1
220 #define CONFIG_AM335X_USB1_MODE MUSB_HOST
221
222 #ifdef CONFIG_MUSB_HOST
223 #define CONFIG_CMD_USB
224 #define CONFIG_USB_STORAGE
225 #endif /* CONFIG_MUSB_HOST */
226
227 #if defined(CONFIG_SPI_BOOT)
228 /* McSPI IP block */
229 #define CONFIG_SPI
230 #define CONFIG_OMAP3_SPI
231 #define CONFIG_CMD_SPI
232 #define CONFIG_CMD_SF
233 #define CONFIG_SPI_FLASH
234 #define CONFIG_SPI_FLASH_STMICRO
235 #define CONFIG_SF_DEFAULT_SPEED         24000000
236
237 #define CONFIG_SPL_SPI_SUPPORT
238 #define CONFIG_SPL_SPI_FLASH_SUPPORT
239 #define CONFIG_SPL_SPI_LOAD
240 #define CONFIG_SYS_SPI_U_BOOT_OFFS      0x20000
241 #undef CONFIG_ENV_IS_NOWHERE
242 #define CONFIG_ENV_IS_IN_SPI_FLASH
243 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
244 #define CONFIG_ENV_SPI_MAX_HZ           CONFIG_SF_DEFAULT_SPEED
245 #define CONFIG_ENV_SECT_SIZE            (4 << 10) /* 4 KB sectors */
246 #define CONFIG_ENV_OFFSET               (768 << 10) /* 768 KiB in */
247 #define CONFIG_ENV_OFFSET_REDUND        (896 << 10) /* 896 KiB in */
248
249 #elif defined(CONFIG_EMMC_BOOT)
250 #undef CONFIG_ENV_IS_NOWHERE
251 #define CONFIG_ENV_IS_IN_MMC
252 #define CONFIG_SYS_MMC_ENV_DEV          0
253 #define CONFIG_SYS_MMC_ENV_PART         2
254 #define CONFIG_ENV_OFFSET               0x40000 /* TODO: Adresse definieren */
255 #define CONFIG_ENV_OFFSET_REDUND        (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
256 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
257
258 #elif defined(CONFIG_NAND)
259 /* No NAND env support in SPL */
260 #ifdef CONFIG_SPL_BUILD
261 #define CONFIG_ENV_IS_NOWHERE
262 #else
263 #define CONFIG_ENV_IS_IN_NAND
264 #endif
265 #define CONFIG_ENV_OFFSET               0x120000 /* TODO: Adresse definieren */
266 #define CONFIG_SYS_ENV_SECT_SIZE        CONFIG_ENV_SIZE
267 #else
268 #error "no storage for Environment defined!"
269 #endif
270 /*
271  * Common filesystems support.  When we have removable storage we
272  * enabled a number of useful commands and support.
273  */
274 #if defined(CONFIG_MMC) || defined(CONFIG_USB_STORAGE)
275 #define CONFIG_DOS_PARTITION
276 #define CONFIG_CMD_FAT
277 #define CONFIG_FAT_WRITE
278 #define CONFIG_CMD_FS_GENERIC
279 #endif /* CONFIG_MMC, ... */
280
281 #endif  /* ! __CONFIG_TSERIES_H__ */