blob: 37c71bb43341b09f581c2b0913070a756a635a97 [file] [log] [blame]
Yegor Yefremovfa8b71b2015-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 Yefremov51c4ccb2015-07-06 17:28:36 +020019#include <linux/sizes.h>
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020020#include <configs/ti_am335x_common.h>
21
Tom Rinid997f7c2017-01-25 20:42:36 -050022#define CONFIG_MACH_TYPE MACH_TYPE_AM335XEVM
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020023
24/* Clock Defines */
25#define V_OSCK 24000000 /* Clock output from T2 */
26#define V_SCLK (V_OSCK)
27
28/* Custom script for NOR */
29#define CONFIG_SYS_LDSCRIPT "board/vscom/baltos/u-boot.lds"
30
31/* Always 128 KiB env size */
32#define CONFIG_ENV_SIZE (128 << 10)
33
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020034/* FIT support */
Yegor Yefremov51c4ccb2015-07-06 17:28:36 +020035#define CONFIG_SYS_BOOTM_LEN SZ_64M
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020036
37/* UBI Support */
38#define CONFIG_CMD_MTDPARTS
39#define CONFIG_MTD_PARTITIONS
40#define CONFIG_MTD_DEVICE
41#define CONFIG_RBTREE
42#define CONFIG_LZO
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020043#define CONFIG_CMD_UBIFS
44
45/* I2C configuration */
46#undef CONFIG_SYS_OMAP24_I2C_SPEED
Yegor Yefremov429b0792015-07-06 17:28:35 +020047#define CONFIG_SYS_OMAP24_I2C_SPEED 1000
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020048
49#ifdef CONFIG_NAND
Yegor Yefremov51c4ccb2015-07-06 17:28:36 +020050#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x00080000
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020051#ifdef CONFIG_SPL_OS_BOOT
52#define CONFIG_CMD_SPL_NAND_OFS 0x00080000 /* os parameters */
53#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x00200000 /* kernel offset */
54#define CONFIG_CMD_SPL_WRITE_SIZE 0x2000
55#endif
56#define NANDARGS \
57 "mtdids=" MTDIDS_DEFAULT "\0" \
58 "mtdparts=" MTDPARTS_DEFAULT "\0" \
59 "nandargs=setenv bootargs console=${console} " \
60 "${optargs} " \
61 "${mtdparts} " \
62 "root=${nandroot} " \
63 "rootfstype=${nandrootfstype}\0" \
64 "nandroot=ubi0:rootfs rw ubi.mtd=5\0" \
65 "nandrootfstype=ubifs rootwait=1\0" \
66 "nandboot=echo Booting from nand ...; " \
67 "run nandargs; " \
68 "setenv loadaddr 0x84000000; " \
69 "ubi part UBI; " \
70 "ubifsmount ubi0:kernel; " \
71 "ubifsload $loadaddr kernel-fit.itb;" \
72 "ubifsumount; " \
Yegor Yefremov51c4ccb2015-07-06 17:28:36 +020073 "bootm ${loadaddr}#conf${board_name}; " \
74 "if test $? -ne 0; then echo Using default FIT config; " \
75 "bootm ${loadaddr}; fi;\0"
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020076#else
77#define NANDARGS ""
78#endif
79
80#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
81
82#ifndef CONFIG_SPL_BUILD
83#define CONFIG_EXTRA_ENV_SETTINGS \
84 DEFAULT_LINUX_BOOT_ENV \
85 "boot_fdt=try\0" \
86 "bootpart=0:2\0" \
87 "bootdir=/boot\0" \
88 "bootfile=zImage\0" \
89 "fdtfile=undefined\0" \
90 "console=ttyO0,115200n8\0" \
91 "partitions=" \
92 "uuid_disk=${uuid_gpt_disk};" \
93 "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
94 "optargs=\0" \
95 "mmcdev=0\0" \
96 "mmcroot=/dev/mmcblk0p2 ro\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +010097 "usbroot=/dev/sda2 ro\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020098 "mmcrootfstype=ext4 rootwait\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +010099 "usbrootfstype=ext4 rootwait\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200100 "rootpath=/export/rootfs\0" \
101 "nfsopts=nolock\0" \
102 "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
103 "::off\0" \
104 "ramroot=/dev/ram0 rw\0" \
105 "ramrootfstype=ext2\0" \
106 "mmcargs=setenv bootargs console=${console} " \
107 "${optargs} " \
108 "${mtdparts} " \
109 "root=${mmcroot} " \
110 "rootfstype=${mmcrootfstype}\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100111 "usbargs=setenv bootargs console=${console} " \
112 "${optargs} " \
113 "${mtdparts} " \
114 "root=${usbroot} " \
115 "rootfstype=${usbrootfstype}\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200116 "spiroot=/dev/mtdblock4 rw\0" \
117 "spirootfstype=jffs2\0" \
118 "spisrcaddr=0xe0000\0" \
119 "spiimgsize=0x362000\0" \
120 "spibusno=0\0" \
121 "spiargs=setenv bootargs console=${console} " \
122 "${optargs} " \
123 "root=${spiroot} " \
124 "rootfstype=${spirootfstype}\0" \
125 "netargs=setenv bootargs console=${console} " \
126 "${optargs} " \
127 "root=/dev/nfs " \
128 "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
129 "ip=dhcp\0" \
130 "bootenv=uEnv.txt\0" \
131 "loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100132 "usbloadbootenv=load usb 0:1 ${loadaddr} ${bootenv}\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200133 "importbootenv=echo Importing environment from mmc ...; " \
134 "env import -t $loadaddr $filesize\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100135 "usbimportbootenv=echo Importing environment from USB ...; " \
136 "env import -t $loadaddr $filesize\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200137 "ramargs=setenv bootargs console=${console} " \
138 "${optargs} " \
139 "root=${ramroot} " \
140 "rootfstype=${ramrootfstype}\0" \
141 "loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
142 "loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100143 "usbloadimage=load usb 0:1 ${loadaddr} kernel-fit.itb\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200144 "loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100145 "usbloados=run usbargs; " \
146 "bootm ${loadaddr}#conf${board_name}; " \
147 "if test $? -ne 0; then " \
148 "echo Using default FIT configuration; " \
149 "bootm ${loadaddr}; " \
150 "fi;\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200151 "mmcloados=run mmcargs; " \
152 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
153 "if run loadfdt; then " \
154 "bootz ${loadaddr} - ${fdtaddr}; " \
155 "else " \
156 "if test ${boot_fdt} = try; then " \
157 "bootz; " \
158 "else " \
159 "echo WARN: Cannot load the DT; " \
160 "fi; " \
161 "fi; " \
162 "else " \
163 "bootz; " \
164 "fi;\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100165 "usbboot=usb reset; " \
166 "if usb storage; then " \
167 "echo USB drive found;" \
168 "if run usbloadbootenv; then " \
169 "echo Loaded environment from ${bootenv};" \
170 "run usbimportbootenv;" \
171 "fi;" \
172 "if test -n $uenvcmd; then " \
173 "echo Running uenvcmd ...;" \
174 "run uenvcmd;" \
175 "fi;" \
176 "if run usbloadimage; then " \
177 "run usbloados;" \
178 "fi;" \
179 "fi;\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200180 "mmcboot=mmc dev ${mmcdev}; " \
181 "if mmc rescan; then " \
182 "echo SD/MMC found on device ${mmcdev};" \
183 "if run loadbootenv; then " \
184 "echo Loaded environment from ${bootenv};" \
185 "run importbootenv;" \
186 "fi;" \
187 "if test -n $uenvcmd; then " \
188 "echo Running uenvcmd ...;" \
189 "run uenvcmd;" \
190 "fi;" \
191 "if run loadimage; then " \
192 "run mmcloados;" \
193 "fi;" \
194 "fi;\0" \
195 "spiboot=echo Booting from spi ...; " \
196 "run spiargs; " \
197 "sf probe ${spibusno}:0; " \
198 "sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \
199 "bootz ${loadaddr}\0" \
200 "netboot=echo Booting from network ...; " \
201 "setenv autoload no; " \
202 "dhcp; " \
203 "tftp ${loadaddr} ${bootfile}; " \
204 "tftp ${fdtaddr} ${fdtfile}; " \
205 "run netargs; " \
206 "bootz ${loadaddr} - ${fdtaddr}\0" \
207 "ramboot=echo Booting from ramdisk ...; " \
208 "run ramargs; " \
209 "bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
210 "findfdt=setenv fdtfile am335x-baltos.dtb\0" \
211 NANDARGS
212 /*DFUARGS*/
213#endif
214
215#define CONFIG_BOOTCOMMAND \
216 "run findfdt; " \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100217 "run usbboot;" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200218 "run mmcboot;" \
219 "setenv mmcdev 1; " \
220 "setenv bootpart 1:2; " \
221 "run mmcboot;" \
222 "run nandboot;"
223
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200224/* NS16550 Configuration */
225#define CONFIG_SYS_NS16550_COM1 0x44e09000 /* Base EVM has UART0 */
226#define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1 */
227#define CONFIG_SYS_NS16550_COM3 0x48024000 /* UART2 */
228#define CONFIG_SYS_NS16550_COM4 0x481a6000 /* UART3 */
229#define CONFIG_SYS_NS16550_COM5 0x481a8000 /* UART4 */
230#define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200231
232#define CONFIG_CMD_EEPROM
233#define CONFIG_ENV_EEPROM_IS_ON_I2C
234#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */
235#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200236
237/* PMIC support */
238#define CONFIG_POWER_TPS65910
239
240/* SPL */
241#ifndef CONFIG_NOR_BOOT
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200242/* Bootcount using the RTC block */
243#define CONFIG_BOOTCOUNT_LIMIT
244#define CONFIG_BOOTCOUNT_AM33XX
245
246/* USB gadget RNDIS */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200247
248/* General network SPL, both CPSW and USB gadget RNDIS */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200249#define CONFIG_SPL_NET_VCI_STRING "AM335x U-Boot SPL"*/
250
Tom Rini28eec372016-11-07 21:34:54 -0500251#define CONFIG_SPL_LDSCRIPT "arch/arm/mach-omap2/am33xx/u-boot-spl.lds"
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200252
253#ifdef CONFIG_NAND
254#define CONFIG_NAND_OMAP_GPMC
Yegor Yefremov51c4ccb2015-07-06 17:28:36 +0200255#define CONFIG_NAND_OMAP_GPMC_PREFETCH
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200256#define CONFIG_NAND_OMAP_ELM
257#define CONFIG_SYS_NAND_5_ADDR_CYCLE
258#define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
259 CONFIG_SYS_NAND_PAGE_SIZE)
260#define CONFIG_SYS_NAND_PAGE_SIZE 2048
261#define CONFIG_SYS_NAND_OOBSIZE 64
262#define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
263#define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS
264#define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
265 10, 11, 12, 13, 14, 15, 16, 17, \
266 18, 19, 20, 21, 22, 23, 24, 25, \
267 26, 27, 28, 29, 30, 31, 32, 33, \
268 34, 35, 36, 37, 38, 39, 40, 41, \
269 42, 43, 44, 45, 46, 47, 48, 49, \
270 50, 51, 52, 53, 54, 55, 56, 57, }
271
272#define CONFIG_SYS_NAND_ECCSIZE 512
273#define CONFIG_SYS_NAND_ECCBYTES 14
274#define CONFIG_SYS_NAND_ONFI_DETECTION
275#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW
276#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
277#endif
278#endif
279
280/*
281 * USB configuration. We enable MUSB support, both for host and for
282 * gadget. We set USB0 as peripheral and USB1 as host, based on the
283 * board schematic and physical port wired to each. Then for host we
284 * add mass storage support and for gadget we add both RNDIS ethernet
285 * and DFU.
286 */
287#define CONFIG_USB_MUSB_DSPS
Paul Kocialkowskif34dfcb2015-08-04 17:04:06 +0200288#define CONFIG_USB_MUSB_PIO_ONLY
289#define CONFIG_USB_MUSB_DISABLE_BULK_COMBINE_SPLIT
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200290#define CONFIG_AM335X_USB0
Yegor Yefremovd7bd6cb2015-07-09 13:34:24 +0200291#define CONFIG_AM335X_USB0_MODE MUSB_HOST
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200292#define CONFIG_AM335X_USB1
Yegor Yefremovd7bd6cb2015-07-09 13:34:24 +0200293#define CONFIG_AM335X_USB1_MODE MUSB_OTG
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200294
Paul Kocialkowskif34dfcb2015-08-04 17:04:06 +0200295#ifdef CONFIG_USB_MUSB_GADGET
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200296#define CONFIG_USB_ETHER
297#define CONFIG_USB_ETH_RNDIS
298#define CONFIG_USBNET_HOST_ADDR "de:ad:be:af:00:00"
Paul Kocialkowskif34dfcb2015-08-04 17:04:06 +0200299#endif /* CONFIG_USB_MUSB_GADGET */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200300
301#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_USBETH_SUPPORT)
302/* disable host part of MUSB in SPL */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200303/* disable EFI partitions and partition UUID support */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200304/*
305 * Disable CPSW SPL support so we fit within the 101KiB limit.
306 */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200307#endif
308
309/* Network. */
310#define CONFIG_PHY_GIGE
311#define CONFIG_PHYLIB
312#define CONFIG_PHY_ADDR 0
313#define CONFIG_PHY_SMSC
314#define CONFIG_MII
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200315#define CONFIG_PHY_ATHEROS
316
317/* NAND support */
318#ifdef CONFIG_NAND
319#define CONFIG_CMD_NAND
320#define GPMC_NAND_ECC_LP_x8_LAYOUT 1
321#if !defined(CONFIG_SPI_BOOT) && !defined(CONFIG_NOR_BOOT)
322#define MTDIDS_DEFAULT "nand0=omap2-nand.0"
323#define MTDPARTS_DEFAULT "mtdparts=omap2-nand.0:128k(SPL)," \
324 "128k(SPL.backup1)," \
325 "128k(SPL.backup2)," \
326 "128k(SPL.backup3)," \
327 "1920k(u-boot)," \
328 "-(UBI)"
329#define CONFIG_ENV_IS_NOWHERE
330#endif
331#endif
332
333#endif /* ! __CONFIG_BALTOS_H */