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