blob: 006b049d09d71eeb1a5afc67362052ebc8cb1191 [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
Tom Rini92a1bab2017-01-25 20:42:36 -050022#define CONFIG_MACH_TYPE MACH_TYPE_AM335XEVM
Yegor Yefremov6ce89322015-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 Yefremov6ce89322015-05-29 19:27:29 +020034/* FIT support */
Yegor Yefremov5f9c58e2015-07-06 17:28:36 +020035#define CONFIG_SYS_BOOTM_LEN SZ_64M
Yegor Yefremov6ce89322015-05-29 19:27:29 +020036
37/* UBI Support */
Yegor Yefremov6ce89322015-05-29 19:27:29 +020038
39/* I2C configuration */
Yegor Yefremov6ce89322015-05-29 19:27:29 +020040
41#ifdef CONFIG_NAND
Yegor Yefremov5f9c58e2015-07-06 17:28:36 +020042#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x00080000
Yegor Yefremov6ce89322015-05-29 19:27:29 +020043#ifdef CONFIG_SPL_OS_BOOT
Yegor Yefremov6ce89322015-05-29 19:27:29 +020044#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x00200000 /* kernel offset */
Yegor Yefremov6ce89322015-05-29 19:27:29 +020045#endif
46#define NANDARGS \
Tom Rini43ede0b2017-10-22 17:55:07 -040047 "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
48 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +020049 "nandargs=setenv bootargs console=${console} " \
50 "${optargs} " \
51 "${mtdparts} " \
52 "root=${nandroot} " \
53 "rootfstype=${nandrootfstype}\0" \
54 "nandroot=ubi0:rootfs rw ubi.mtd=5\0" \
55 "nandrootfstype=ubifs rootwait=1\0" \
56 "nandboot=echo Booting from nand ...; " \
57 "run nandargs; " \
58 "setenv loadaddr 0x84000000; " \
59 "ubi part UBI; " \
60 "ubifsmount ubi0:kernel; " \
61 "ubifsload $loadaddr kernel-fit.itb;" \
62 "ubifsumount; " \
Yegor Yefremov5f9c58e2015-07-06 17:28:36 +020063 "bootm ${loadaddr}#conf${board_name}; " \
64 "if test $? -ne 0; then echo Using default FIT config; " \
65 "bootm ${loadaddr}; fi;\0"
Yegor Yefremov6ce89322015-05-29 19:27:29 +020066#else
67#define NANDARGS ""
68#endif
69
Yegor Yefremov6ce89322015-05-29 19:27:29 +020070#ifndef CONFIG_SPL_BUILD
71#define CONFIG_EXTRA_ENV_SETTINGS \
72 DEFAULT_LINUX_BOOT_ENV \
73 "boot_fdt=try\0" \
74 "bootpart=0:2\0" \
75 "bootdir=/boot\0" \
76 "bootfile=zImage\0" \
77 "fdtfile=undefined\0" \
78 "console=ttyO0,115200n8\0" \
79 "partitions=" \
80 "uuid_disk=${uuid_gpt_disk};" \
81 "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
82 "optargs=\0" \
83 "mmcdev=0\0" \
84 "mmcroot=/dev/mmcblk0p2 ro\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +010085 "usbroot=/dev/sda2 ro\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +020086 "mmcrootfstype=ext4 rootwait\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +010087 "usbrootfstype=ext4 rootwait\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +020088 "rootpath=/export/rootfs\0" \
89 "nfsopts=nolock\0" \
90 "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
91 "::off\0" \
92 "ramroot=/dev/ram0 rw\0" \
93 "ramrootfstype=ext2\0" \
94 "mmcargs=setenv bootargs console=${console} " \
95 "${optargs} " \
96 "${mtdparts} " \
97 "root=${mmcroot} " \
98 "rootfstype=${mmcrootfstype}\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +010099 "usbargs=setenv bootargs console=${console} " \
100 "${optargs} " \
101 "${mtdparts} " \
102 "root=${usbroot} " \
103 "rootfstype=${usbrootfstype}\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200104 "spiroot=/dev/mtdblock4 rw\0" \
105 "spirootfstype=jffs2\0" \
106 "spisrcaddr=0xe0000\0" \
107 "spiimgsize=0x362000\0" \
108 "spibusno=0\0" \
109 "spiargs=setenv bootargs console=${console} " \
110 "${optargs} " \
111 "root=${spiroot} " \
112 "rootfstype=${spirootfstype}\0" \
113 "netargs=setenv bootargs console=${console} " \
114 "${optargs} " \
115 "root=/dev/nfs " \
116 "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
117 "ip=dhcp\0" \
118 "bootenv=uEnv.txt\0" \
119 "loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100120 "usbloadbootenv=load usb 0:1 ${loadaddr} ${bootenv}\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200121 "importbootenv=echo Importing environment from mmc ...; " \
122 "env import -t $loadaddr $filesize\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100123 "usbimportbootenv=echo Importing environment from USB ...; " \
124 "env import -t $loadaddr $filesize\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200125 "ramargs=setenv bootargs console=${console} " \
126 "${optargs} " \
127 "root=${ramroot} " \
128 "rootfstype=${ramrootfstype}\0" \
129 "loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
130 "loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100131 "usbloadimage=load usb 0:1 ${loadaddr} kernel-fit.itb\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200132 "loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100133 "usbloados=run usbargs; " \
134 "bootm ${loadaddr}#conf${board_name}; " \
135 "if test $? -ne 0; then " \
136 "echo Using default FIT configuration; " \
137 "bootm ${loadaddr}; " \
138 "fi;\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200139 "mmcloados=run mmcargs; " \
140 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
141 "if run loadfdt; then " \
142 "bootz ${loadaddr} - ${fdtaddr}; " \
143 "else " \
144 "if test ${boot_fdt} = try; then " \
145 "bootz; " \
146 "else " \
147 "echo WARN: Cannot load the DT; " \
148 "fi; " \
149 "fi; " \
150 "else " \
151 "bootz; " \
152 "fi;\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100153 "usbboot=usb reset; " \
154 "if usb storage; then " \
155 "echo USB drive found;" \
156 "if run usbloadbootenv; then " \
157 "echo Loaded environment from ${bootenv};" \
158 "run usbimportbootenv;" \
159 "fi;" \
160 "if test -n $uenvcmd; then " \
161 "echo Running uenvcmd ...;" \
162 "run uenvcmd;" \
163 "fi;" \
164 "if run usbloadimage; then " \
165 "run usbloados;" \
166 "fi;" \
167 "fi;\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200168 "mmcboot=mmc dev ${mmcdev}; " \
169 "if mmc rescan; then " \
170 "echo SD/MMC found on device ${mmcdev};" \
171 "if run loadbootenv; then " \
172 "echo Loaded environment from ${bootenv};" \
173 "run importbootenv;" \
174 "fi;" \
175 "if test -n $uenvcmd; then " \
176 "echo Running uenvcmd ...;" \
177 "run uenvcmd;" \
178 "fi;" \
179 "if run loadimage; then " \
180 "run mmcloados;" \
181 "fi;" \
182 "fi;\0" \
183 "spiboot=echo Booting from spi ...; " \
184 "run spiargs; " \
185 "sf probe ${spibusno}:0; " \
186 "sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \
187 "bootz ${loadaddr}\0" \
188 "netboot=echo Booting from network ...; " \
189 "setenv autoload no; " \
190 "dhcp; " \
191 "tftp ${loadaddr} ${bootfile}; " \
192 "tftp ${fdtaddr} ${fdtfile}; " \
193 "run netargs; " \
194 "bootz ${loadaddr} - ${fdtaddr}\0" \
195 "ramboot=echo Booting from ramdisk ...; " \
196 "run ramargs; " \
197 "bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
198 "findfdt=setenv fdtfile am335x-baltos.dtb\0" \
199 NANDARGS
200 /*DFUARGS*/
201#endif
202
203#define CONFIG_BOOTCOMMAND \
204 "run findfdt; " \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100205 "run usbboot;" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200206 "run mmcboot;" \
207 "setenv mmcdev 1; " \
208 "setenv bootpart 1:2; " \
209 "run mmcboot;" \
210 "run nandboot;"
211
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200212/* NS16550 Configuration */
213#define CONFIG_SYS_NS16550_COM1 0x44e09000 /* Base EVM has UART0 */
214#define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1 */
215#define CONFIG_SYS_NS16550_COM3 0x48024000 /* UART2 */
216#define CONFIG_SYS_NS16550_COM4 0x481a6000 /* UART3 */
217#define CONFIG_SYS_NS16550_COM5 0x481a8000 /* UART4 */
218#define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200219
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200220#define CONFIG_ENV_EEPROM_IS_ON_I2C
221#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */
222#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200223
224/* PMIC support */
225#define CONFIG_POWER_TPS65910
226
227/* SPL */
228#ifndef CONFIG_NOR_BOOT
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200229
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200230#ifdef CONFIG_NAND
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200231#define CONFIG_SYS_NAND_5_ADDR_CYCLE
232#define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
233 CONFIG_SYS_NAND_PAGE_SIZE)
234#define CONFIG_SYS_NAND_PAGE_SIZE 2048
235#define CONFIG_SYS_NAND_OOBSIZE 64
236#define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
237#define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS
238#define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
239 10, 11, 12, 13, 14, 15, 16, 17, \
240 18, 19, 20, 21, 22, 23, 24, 25, \
241 26, 27, 28, 29, 30, 31, 32, 33, \
242 34, 35, 36, 37, 38, 39, 40, 41, \
243 42, 43, 44, 45, 46, 47, 48, 49, \
244 50, 51, 52, 53, 54, 55, 56, 57, }
245
246#define CONFIG_SYS_NAND_ECCSIZE 512
247#define CONFIG_SYS_NAND_ECCBYTES 14
248#define CONFIG_SYS_NAND_ONFI_DETECTION
249#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW
250#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
251#endif
252#endif
253
254/*
255 * USB configuration. We enable MUSB support, both for host and for
256 * gadget. We set USB0 as peripheral and USB1 as host, based on the
257 * board schematic and physical port wired to each. Then for host we
258 * add mass storage support and for gadget we add both RNDIS ethernet
259 * and DFU.
260 */
Paul Kocialkowski95de1e22015-08-04 17:04:06 +0200261#define CONFIG_USB_MUSB_DISABLE_BULK_COMBINE_SPLIT
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200262#define CONFIG_AM335X_USB0
Yegor Yefremov5e5055f2015-07-09 13:34:24 +0200263#define CONFIG_AM335X_USB0_MODE MUSB_HOST
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200264#define CONFIG_AM335X_USB1
Yegor Yefremov5e5055f2015-07-09 13:34:24 +0200265#define CONFIG_AM335X_USB1_MODE MUSB_OTG
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200266
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200267/* Network. */
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200268#define CONFIG_PHY_SMSC
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200269#define CONFIG_PHY_ATHEROS
270
271/* NAND support */
272#ifdef CONFIG_NAND
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200273#define GPMC_NAND_ECC_LP_x8_LAYOUT 1
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200274#endif
275
276#endif /* ! __CONFIG_BALTOS_H */