blob: 65c4470dc2eccb59f2ab03fbda70572ec31e6097 [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 */
231#define CONFIG_BAUDRATE 115200
232
233#define CONFIG_CMD_EEPROM
234#define CONFIG_ENV_EEPROM_IS_ON_I2C
235#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */
236#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200237
238/* PMIC support */
239#define CONFIG_POWER_TPS65910
240
241/* SPL */
242#ifndef CONFIG_NOR_BOOT
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200243/* Bootcount using the RTC block */
244#define CONFIG_BOOTCOUNT_LIMIT
245#define CONFIG_BOOTCOUNT_AM33XX
246
247/* USB gadget RNDIS */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200248
249/* General network SPL, both CPSW and USB gadget RNDIS */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200250#define CONFIG_SPL_NET_VCI_STRING "AM335x U-Boot SPL"*/
251
Tom Rini28eec372016-11-07 21:34:54 -0500252#define CONFIG_SPL_LDSCRIPT "arch/arm/mach-omap2/am33xx/u-boot-spl.lds"
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200253
254#ifdef CONFIG_NAND
255#define CONFIG_NAND_OMAP_GPMC
Yegor Yefremov51c4ccb2015-07-06 17:28:36 +0200256#define CONFIG_NAND_OMAP_GPMC_PREFETCH
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200257#define CONFIG_NAND_OMAP_ELM
258#define CONFIG_SYS_NAND_5_ADDR_CYCLE
259#define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
260 CONFIG_SYS_NAND_PAGE_SIZE)
261#define CONFIG_SYS_NAND_PAGE_SIZE 2048
262#define CONFIG_SYS_NAND_OOBSIZE 64
263#define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
264#define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS
265#define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
266 10, 11, 12, 13, 14, 15, 16, 17, \
267 18, 19, 20, 21, 22, 23, 24, 25, \
268 26, 27, 28, 29, 30, 31, 32, 33, \
269 34, 35, 36, 37, 38, 39, 40, 41, \
270 42, 43, 44, 45, 46, 47, 48, 49, \
271 50, 51, 52, 53, 54, 55, 56, 57, }
272
273#define CONFIG_SYS_NAND_ECCSIZE 512
274#define CONFIG_SYS_NAND_ECCBYTES 14
275#define CONFIG_SYS_NAND_ONFI_DETECTION
276#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW
277#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
278#endif
279#endif
280
281/*
282 * USB configuration. We enable MUSB support, both for host and for
283 * gadget. We set USB0 as peripheral and USB1 as host, based on the
284 * board schematic and physical port wired to each. Then for host we
285 * add mass storage support and for gadget we add both RNDIS ethernet
286 * and DFU.
287 */
288#define CONFIG_USB_MUSB_DSPS
Paul Kocialkowskif34dfcb2015-08-04 17:04:06 +0200289#define CONFIG_USB_MUSB_PIO_ONLY
290#define CONFIG_USB_MUSB_DISABLE_BULK_COMBINE_SPLIT
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200291#define CONFIG_AM335X_USB0
Yegor Yefremovd7bd6cb2015-07-09 13:34:24 +0200292#define CONFIG_AM335X_USB0_MODE MUSB_HOST
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200293#define CONFIG_AM335X_USB1
Yegor Yefremovd7bd6cb2015-07-09 13:34:24 +0200294#define CONFIG_AM335X_USB1_MODE MUSB_OTG
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200295
Paul Kocialkowskif34dfcb2015-08-04 17:04:06 +0200296#ifdef CONFIG_USB_MUSB_GADGET
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200297#define CONFIG_USB_ETHER
298#define CONFIG_USB_ETH_RNDIS
299#define CONFIG_USBNET_HOST_ADDR "de:ad:be:af:00:00"
Paul Kocialkowskif34dfcb2015-08-04 17:04:06 +0200300#endif /* CONFIG_USB_MUSB_GADGET */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200301
302#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_USBETH_SUPPORT)
303/* disable host part of MUSB in SPL */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200304/* disable EFI partitions and partition UUID support */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200305/*
306 * Disable CPSW SPL support so we fit within the 101KiB limit.
307 */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200308#endif
309
310/* Network. */
311#define CONFIG_PHY_GIGE
312#define CONFIG_PHYLIB
313#define CONFIG_PHY_ADDR 0
314#define CONFIG_PHY_SMSC
315#define CONFIG_MII
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200316#define CONFIG_PHY_ATHEROS
317
318/* NAND support */
319#ifdef CONFIG_NAND
320#define CONFIG_CMD_NAND
321#define GPMC_NAND_ECC_LP_x8_LAYOUT 1
322#if !defined(CONFIG_SPI_BOOT) && !defined(CONFIG_NOR_BOOT)
323#define MTDIDS_DEFAULT "nand0=omap2-nand.0"
324#define MTDPARTS_DEFAULT "mtdparts=omap2-nand.0:128k(SPL)," \
325 "128k(SPL.backup1)," \
326 "128k(SPL.backup2)," \
327 "128k(SPL.backup3)," \
328 "1920k(u-boot)," \
329 "-(UBI)"
330#define CONFIG_ENV_IS_NOWHERE
331#endif
332#endif
333
334#endif /* ! __CONFIG_BALTOS_H */