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