blob: 38c9480dbe17e16c998c4375fd2ba2794dd9cdec [file] [log] [blame]
Yegor Yefremov6ce89322015-05-29 19:27:29 +02001/*
2 * am335x_evm.h
3 *
4 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef __CONFIG_BALTOS_H
17#define __CONFIG_BALTOS_H
18
Yegor Yefremov5f9c58e2015-07-06 17:28:36 +020019#include <linux/sizes.h>
Yegor Yefremov6ce89322015-05-29 19:27:29 +020020#include <configs/ti_am335x_common.h>
21
22#define MACH_TYPE_TIAM335EVM 3589 /* Until the next sync */
23#define CONFIG_MACH_TYPE MACH_TYPE_TIAM335EVM
Yegor Yefremov6ce89322015-05-29 19:27:29 +020024
25/* Clock Defines */
26#define V_OSCK 24000000 /* Clock output from T2 */
27#define V_SCLK (V_OSCK)
28
29/* Custom script for NOR */
30#define CONFIG_SYS_LDSCRIPT "board/vscom/baltos/u-boot.lds"
31
32/* Always 128 KiB env size */
33#define CONFIG_ENV_SIZE (128 << 10)
34
Yegor Yefremov6ce89322015-05-29 19:27:29 +020035/* FIT support */
Yegor Yefremov5f9c58e2015-07-06 17:28:36 +020036#define CONFIG_SYS_BOOTM_LEN SZ_64M
Yegor Yefremov6ce89322015-05-29 19:27:29 +020037
38/* UBI Support */
39#define CONFIG_CMD_MTDPARTS
40#define CONFIG_MTD_PARTITIONS
41#define CONFIG_MTD_DEVICE
42#define CONFIG_RBTREE
43#define CONFIG_LZO
Yegor Yefremov6ce89322015-05-29 19:27:29 +020044#define CONFIG_CMD_UBIFS
45
46/* I2C configuration */
47#undef CONFIG_SYS_OMAP24_I2C_SPEED
Yegor Yefremove6b1b582015-07-06 17:28:35 +020048#define CONFIG_SYS_OMAP24_I2C_SPEED 1000
Yegor Yefremov6ce89322015-05-29 19:27:29 +020049
50#ifdef CONFIG_NAND
Yegor Yefremov5f9c58e2015-07-06 17:28:36 +020051#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x00080000
Yegor Yefremov6ce89322015-05-29 19:27:29 +020052#ifdef CONFIG_SPL_OS_BOOT
53#define CONFIG_CMD_SPL_NAND_OFS 0x00080000 /* os parameters */
54#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x00200000 /* kernel offset */
55#define CONFIG_CMD_SPL_WRITE_SIZE 0x2000
56#endif
57#define NANDARGS \
58 "mtdids=" MTDIDS_DEFAULT "\0" \
59 "mtdparts=" MTDPARTS_DEFAULT "\0" \
60 "nandargs=setenv bootargs console=${console} " \
61 "${optargs} " \
62 "${mtdparts} " \
63 "root=${nandroot} " \
64 "rootfstype=${nandrootfstype}\0" \
65 "nandroot=ubi0:rootfs rw ubi.mtd=5\0" \
66 "nandrootfstype=ubifs rootwait=1\0" \
67 "nandboot=echo Booting from nand ...; " \
68 "run nandargs; " \
69 "setenv loadaddr 0x84000000; " \
70 "ubi part UBI; " \
71 "ubifsmount ubi0:kernel; " \
72 "ubifsload $loadaddr kernel-fit.itb;" \
73 "ubifsumount; " \
Yegor Yefremov5f9c58e2015-07-06 17:28:36 +020074 "bootm ${loadaddr}#conf${board_name}; " \
75 "if test $? -ne 0; then echo Using default FIT config; " \
76 "bootm ${loadaddr}; fi;\0"
Yegor Yefremov6ce89322015-05-29 19:27:29 +020077#else
78#define NANDARGS ""
79#endif
80
81#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
82
83#ifndef CONFIG_SPL_BUILD
84#define CONFIG_EXTRA_ENV_SETTINGS \
85 DEFAULT_LINUX_BOOT_ENV \
86 "boot_fdt=try\0" \
87 "bootpart=0:2\0" \
88 "bootdir=/boot\0" \
89 "bootfile=zImage\0" \
90 "fdtfile=undefined\0" \
91 "console=ttyO0,115200n8\0" \
92 "partitions=" \
93 "uuid_disk=${uuid_gpt_disk};" \
94 "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
95 "optargs=\0" \
96 "mmcdev=0\0" \
97 "mmcroot=/dev/mmcblk0p2 ro\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +010098 "usbroot=/dev/sda2 ro\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +020099 "mmcrootfstype=ext4 rootwait\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100100 "usbrootfstype=ext4 rootwait\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200101 "rootpath=/export/rootfs\0" \
102 "nfsopts=nolock\0" \
103 "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
104 "::off\0" \
105 "ramroot=/dev/ram0 rw\0" \
106 "ramrootfstype=ext2\0" \
107 "mmcargs=setenv bootargs console=${console} " \
108 "${optargs} " \
109 "${mtdparts} " \
110 "root=${mmcroot} " \
111 "rootfstype=${mmcrootfstype}\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100112 "usbargs=setenv bootargs console=${console} " \
113 "${optargs} " \
114 "${mtdparts} " \
115 "root=${usbroot} " \
116 "rootfstype=${usbrootfstype}\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200117 "spiroot=/dev/mtdblock4 rw\0" \
118 "spirootfstype=jffs2\0" \
119 "spisrcaddr=0xe0000\0" \
120 "spiimgsize=0x362000\0" \
121 "spibusno=0\0" \
122 "spiargs=setenv bootargs console=${console} " \
123 "${optargs} " \
124 "root=${spiroot} " \
125 "rootfstype=${spirootfstype}\0" \
126 "netargs=setenv bootargs console=${console} " \
127 "${optargs} " \
128 "root=/dev/nfs " \
129 "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
130 "ip=dhcp\0" \
131 "bootenv=uEnv.txt\0" \
132 "loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100133 "usbloadbootenv=load usb 0:1 ${loadaddr} ${bootenv}\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200134 "importbootenv=echo Importing environment from mmc ...; " \
135 "env import -t $loadaddr $filesize\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100136 "usbimportbootenv=echo Importing environment from USB ...; " \
137 "env import -t $loadaddr $filesize\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200138 "ramargs=setenv bootargs console=${console} " \
139 "${optargs} " \
140 "root=${ramroot} " \
141 "rootfstype=${ramrootfstype}\0" \
142 "loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
143 "loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100144 "usbloadimage=load usb 0:1 ${loadaddr} kernel-fit.itb\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200145 "loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100146 "usbloados=run usbargs; " \
147 "bootm ${loadaddr}#conf${board_name}; " \
148 "if test $? -ne 0; then " \
149 "echo Using default FIT configuration; " \
150 "bootm ${loadaddr}; " \
151 "fi;\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200152 "mmcloados=run mmcargs; " \
153 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
154 "if run loadfdt; then " \
155 "bootz ${loadaddr} - ${fdtaddr}; " \
156 "else " \
157 "if test ${boot_fdt} = try; then " \
158 "bootz; " \
159 "else " \
160 "echo WARN: Cannot load the DT; " \
161 "fi; " \
162 "fi; " \
163 "else " \
164 "bootz; " \
165 "fi;\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100166 "usbboot=usb reset; " \
167 "if usb storage; then " \
168 "echo USB drive found;" \
169 "if run usbloadbootenv; then " \
170 "echo Loaded environment from ${bootenv};" \
171 "run usbimportbootenv;" \
172 "fi;" \
173 "if test -n $uenvcmd; then " \
174 "echo Running uenvcmd ...;" \
175 "run uenvcmd;" \
176 "fi;" \
177 "if run usbloadimage; then " \
178 "run usbloados;" \
179 "fi;" \
180 "fi;\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200181 "mmcboot=mmc dev ${mmcdev}; " \
182 "if mmc rescan; then " \
183 "echo SD/MMC found on device ${mmcdev};" \
184 "if run loadbootenv; then " \
185 "echo Loaded environment from ${bootenv};" \
186 "run importbootenv;" \
187 "fi;" \
188 "if test -n $uenvcmd; then " \
189 "echo Running uenvcmd ...;" \
190 "run uenvcmd;" \
191 "fi;" \
192 "if run loadimage; then " \
193 "run mmcloados;" \
194 "fi;" \
195 "fi;\0" \
196 "spiboot=echo Booting from spi ...; " \
197 "run spiargs; " \
198 "sf probe ${spibusno}:0; " \
199 "sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \
200 "bootz ${loadaddr}\0" \
201 "netboot=echo Booting from network ...; " \
202 "setenv autoload no; " \
203 "dhcp; " \
204 "tftp ${loadaddr} ${bootfile}; " \
205 "tftp ${fdtaddr} ${fdtfile}; " \
206 "run netargs; " \
207 "bootz ${loadaddr} - ${fdtaddr}\0" \
208 "ramboot=echo Booting from ramdisk ...; " \
209 "run ramargs; " \
210 "bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
211 "findfdt=setenv fdtfile am335x-baltos.dtb\0" \
212 NANDARGS
213 /*DFUARGS*/
214#endif
215
216#define CONFIG_BOOTCOMMAND \
217 "run findfdt; " \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100218 "run usbboot;" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200219 "run mmcboot;" \
220 "setenv mmcdev 1; " \
221 "setenv bootpart 1:2; " \
222 "run mmcboot;" \
223 "run nandboot;"
224
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200225/* NS16550 Configuration */
226#define CONFIG_SYS_NS16550_COM1 0x44e09000 /* Base EVM has UART0 */
227#define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1 */
228#define CONFIG_SYS_NS16550_COM3 0x48024000 /* UART2 */
229#define CONFIG_SYS_NS16550_COM4 0x481a6000 /* UART3 */
230#define CONFIG_SYS_NS16550_COM5 0x481a8000 /* UART4 */
231#define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */
232#define CONFIG_BAUDRATE 115200
233
234#define CONFIG_CMD_EEPROM
235#define CONFIG_ENV_EEPROM_IS_ON_I2C
236#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */
237#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200238
239/* PMIC support */
240#define CONFIG_POWER_TPS65910
241
242/* SPL */
243#ifndef CONFIG_NOR_BOOT
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200244/* Bootcount using the RTC block */
245#define CONFIG_BOOTCOUNT_LIMIT
246#define CONFIG_BOOTCOUNT_AM33XX
247
248/* USB gadget RNDIS */
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200249
250/* General network SPL, both CPSW and USB gadget RNDIS */
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200251#define CONFIG_SPL_NET_VCI_STRING "AM335x U-Boot SPL"*/
252
Tom Rini983e3702016-11-07 21:34:54 -0500253#define CONFIG_SPL_LDSCRIPT "arch/arm/mach-omap2/am33xx/u-boot-spl.lds"
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200254
255#ifdef CONFIG_NAND
256#define CONFIG_NAND_OMAP_GPMC
Yegor Yefremov5f9c58e2015-07-06 17:28:36 +0200257#define CONFIG_NAND_OMAP_GPMC_PREFETCH
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200258#define CONFIG_NAND_OMAP_ELM
259#define CONFIG_SYS_NAND_5_ADDR_CYCLE
260#define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
261 CONFIG_SYS_NAND_PAGE_SIZE)
262#define CONFIG_SYS_NAND_PAGE_SIZE 2048
263#define CONFIG_SYS_NAND_OOBSIZE 64
264#define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
265#define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS
266#define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
267 10, 11, 12, 13, 14, 15, 16, 17, \
268 18, 19, 20, 21, 22, 23, 24, 25, \
269 26, 27, 28, 29, 30, 31, 32, 33, \
270 34, 35, 36, 37, 38, 39, 40, 41, \
271 42, 43, 44, 45, 46, 47, 48, 49, \
272 50, 51, 52, 53, 54, 55, 56, 57, }
273
274#define CONFIG_SYS_NAND_ECCSIZE 512
275#define CONFIG_SYS_NAND_ECCBYTES 14
276#define CONFIG_SYS_NAND_ONFI_DETECTION
277#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW
278#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
279#endif
280#endif
281
282/*
283 * USB configuration. We enable MUSB support, both for host and for
284 * gadget. We set USB0 as peripheral and USB1 as host, based on the
285 * board schematic and physical port wired to each. Then for host we
286 * add mass storage support and for gadget we add both RNDIS ethernet
287 * and DFU.
288 */
289#define CONFIG_USB_MUSB_DSPS
Paul Kocialkowski95de1e22015-08-04 17:04:06 +0200290#define CONFIG_USB_MUSB_PIO_ONLY
291#define CONFIG_USB_MUSB_DISABLE_BULK_COMBINE_SPLIT
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200292#define CONFIG_AM335X_USB0
Yegor Yefremov5e5055f2015-07-09 13:34:24 +0200293#define CONFIG_AM335X_USB0_MODE MUSB_HOST
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200294#define CONFIG_AM335X_USB1
Yegor Yefremov5e5055f2015-07-09 13:34:24 +0200295#define CONFIG_AM335X_USB1_MODE MUSB_OTG
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200296
Paul Kocialkowski95de1e22015-08-04 17:04:06 +0200297#ifdef CONFIG_USB_MUSB_GADGET
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200298#define CONFIG_USB_ETHER
299#define CONFIG_USB_ETH_RNDIS
300#define CONFIG_USBNET_HOST_ADDR "de:ad:be:af:00:00"
Paul Kocialkowski95de1e22015-08-04 17:04:06 +0200301#endif /* CONFIG_USB_MUSB_GADGET */
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200302
303#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_USBETH_SUPPORT)
304/* disable host part of MUSB in SPL */
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200305/* disable EFI partitions and partition UUID support */
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200306/*
307 * Disable CPSW SPL support so we fit within the 101KiB limit.
308 */
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200309#endif
310
311/* Network. */
312#define CONFIG_PHY_GIGE
313#define CONFIG_PHYLIB
314#define CONFIG_PHY_ADDR 0
315#define CONFIG_PHY_SMSC
316#define CONFIG_MII
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200317#define CONFIG_PHY_ATHEROS
318
319/* NAND support */
320#ifdef CONFIG_NAND
321#define CONFIG_CMD_NAND
322#define GPMC_NAND_ECC_LP_x8_LAYOUT 1
323#if !defined(CONFIG_SPI_BOOT) && !defined(CONFIG_NOR_BOOT)
324#define MTDIDS_DEFAULT "nand0=omap2-nand.0"
325#define MTDPARTS_DEFAULT "mtdparts=omap2-nand.0:128k(SPL)," \
326 "128k(SPL.backup1)," \
327 "128k(SPL.backup2)," \
328 "128k(SPL.backup3)," \
329 "1920k(u-boot)," \
330 "-(UBI)"
331#define CONFIG_ENV_IS_NOWHERE
332#endif
333#endif
334
335#endif /* ! __CONFIG_BALTOS_H */