blob: 03559bd4f5f6536a6017af135e7b77c0bbcadd92 [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 */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020038#define CONFIG_MTD_PARTITIONS
39#define CONFIG_MTD_DEVICE
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020040
41/* I2C configuration */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020042
43#ifdef CONFIG_NAND
Yegor Yefremov51c4ccb2015-07-06 17:28:36 +020044#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x00080000
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020045#ifdef CONFIG_SPL_OS_BOOT
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020046#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x00200000 /* kernel offset */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020047#endif
48#define NANDARGS \
Tom Rini5ad8e112017-10-22 17:55:07 -040049 "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
50 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020051 "nandargs=setenv bootargs console=${console} " \
52 "${optargs} " \
53 "${mtdparts} " \
54 "root=${nandroot} " \
55 "rootfstype=${nandrootfstype}\0" \
56 "nandroot=ubi0:rootfs rw ubi.mtd=5\0" \
57 "nandrootfstype=ubifs rootwait=1\0" \
58 "nandboot=echo Booting from nand ...; " \
59 "run nandargs; " \
60 "setenv loadaddr 0x84000000; " \
61 "ubi part UBI; " \
62 "ubifsmount ubi0:kernel; " \
63 "ubifsload $loadaddr kernel-fit.itb;" \
64 "ubifsumount; " \
Yegor Yefremov51c4ccb2015-07-06 17:28:36 +020065 "bootm ${loadaddr}#conf${board_name}; " \
66 "if test $? -ne 0; then echo Using default FIT config; " \
67 "bootm ${loadaddr}; fi;\0"
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020068#else
69#define NANDARGS ""
70#endif
71
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020072#ifndef CONFIG_SPL_BUILD
73#define CONFIG_EXTRA_ENV_SETTINGS \
74 DEFAULT_LINUX_BOOT_ENV \
75 "boot_fdt=try\0" \
76 "bootpart=0:2\0" \
77 "bootdir=/boot\0" \
78 "bootfile=zImage\0" \
79 "fdtfile=undefined\0" \
80 "console=ttyO0,115200n8\0" \
81 "partitions=" \
82 "uuid_disk=${uuid_gpt_disk};" \
83 "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
84 "optargs=\0" \
85 "mmcdev=0\0" \
86 "mmcroot=/dev/mmcblk0p2 ro\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +010087 "usbroot=/dev/sda2 ro\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020088 "mmcrootfstype=ext4 rootwait\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +010089 "usbrootfstype=ext4 rootwait\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020090 "rootpath=/export/rootfs\0" \
91 "nfsopts=nolock\0" \
92 "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
93 "::off\0" \
94 "ramroot=/dev/ram0 rw\0" \
95 "ramrootfstype=ext2\0" \
96 "mmcargs=setenv bootargs console=${console} " \
97 "${optargs} " \
98 "${mtdparts} " \
99 "root=${mmcroot} " \
100 "rootfstype=${mmcrootfstype}\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100101 "usbargs=setenv bootargs console=${console} " \
102 "${optargs} " \
103 "${mtdparts} " \
104 "root=${usbroot} " \
105 "rootfstype=${usbrootfstype}\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200106 "spiroot=/dev/mtdblock4 rw\0" \
107 "spirootfstype=jffs2\0" \
108 "spisrcaddr=0xe0000\0" \
109 "spiimgsize=0x362000\0" \
110 "spibusno=0\0" \
111 "spiargs=setenv bootargs console=${console} " \
112 "${optargs} " \
113 "root=${spiroot} " \
114 "rootfstype=${spirootfstype}\0" \
115 "netargs=setenv bootargs console=${console} " \
116 "${optargs} " \
117 "root=/dev/nfs " \
118 "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
119 "ip=dhcp\0" \
120 "bootenv=uEnv.txt\0" \
121 "loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100122 "usbloadbootenv=load usb 0:1 ${loadaddr} ${bootenv}\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200123 "importbootenv=echo Importing environment from mmc ...; " \
124 "env import -t $loadaddr $filesize\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100125 "usbimportbootenv=echo Importing environment from USB ...; " \
126 "env import -t $loadaddr $filesize\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200127 "ramargs=setenv bootargs console=${console} " \
128 "${optargs} " \
129 "root=${ramroot} " \
130 "rootfstype=${ramrootfstype}\0" \
131 "loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
132 "loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100133 "usbloadimage=load usb 0:1 ${loadaddr} kernel-fit.itb\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200134 "loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100135 "usbloados=run usbargs; " \
136 "bootm ${loadaddr}#conf${board_name}; " \
137 "if test $? -ne 0; then " \
138 "echo Using default FIT configuration; " \
139 "bootm ${loadaddr}; " \
140 "fi;\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200141 "mmcloados=run mmcargs; " \
142 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
143 "if run loadfdt; then " \
144 "bootz ${loadaddr} - ${fdtaddr}; " \
145 "else " \
146 "if test ${boot_fdt} = try; then " \
147 "bootz; " \
148 "else " \
149 "echo WARN: Cannot load the DT; " \
150 "fi; " \
151 "fi; " \
152 "else " \
153 "bootz; " \
154 "fi;\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100155 "usbboot=usb reset; " \
156 "if usb storage; then " \
157 "echo USB drive found;" \
158 "if run usbloadbootenv; then " \
159 "echo Loaded environment from ${bootenv};" \
160 "run usbimportbootenv;" \
161 "fi;" \
162 "if test -n $uenvcmd; then " \
163 "echo Running uenvcmd ...;" \
164 "run uenvcmd;" \
165 "fi;" \
166 "if run usbloadimage; then " \
167 "run usbloados;" \
168 "fi;" \
169 "fi;\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200170 "mmcboot=mmc dev ${mmcdev}; " \
171 "if mmc rescan; then " \
172 "echo SD/MMC found on device ${mmcdev};" \
173 "if run loadbootenv; then " \
174 "echo Loaded environment from ${bootenv};" \
175 "run importbootenv;" \
176 "fi;" \
177 "if test -n $uenvcmd; then " \
178 "echo Running uenvcmd ...;" \
179 "run uenvcmd;" \
180 "fi;" \
181 "if run loadimage; then " \
182 "run mmcloados;" \
183 "fi;" \
184 "fi;\0" \
185 "spiboot=echo Booting from spi ...; " \
186 "run spiargs; " \
187 "sf probe ${spibusno}:0; " \
188 "sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \
189 "bootz ${loadaddr}\0" \
190 "netboot=echo Booting from network ...; " \
191 "setenv autoload no; " \
192 "dhcp; " \
193 "tftp ${loadaddr} ${bootfile}; " \
194 "tftp ${fdtaddr} ${fdtfile}; " \
195 "run netargs; " \
196 "bootz ${loadaddr} - ${fdtaddr}\0" \
197 "ramboot=echo Booting from ramdisk ...; " \
198 "run ramargs; " \
199 "bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
200 "findfdt=setenv fdtfile am335x-baltos.dtb\0" \
201 NANDARGS
202 /*DFUARGS*/
203#endif
204
205#define CONFIG_BOOTCOMMAND \
206 "run findfdt; " \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100207 "run usbboot;" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200208 "run mmcboot;" \
209 "setenv mmcdev 1; " \
210 "setenv bootpart 1:2; " \
211 "run mmcboot;" \
212 "run nandboot;"
213
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200214/* NS16550 Configuration */
215#define CONFIG_SYS_NS16550_COM1 0x44e09000 /* Base EVM has UART0 */
216#define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1 */
217#define CONFIG_SYS_NS16550_COM3 0x48024000 /* UART2 */
218#define CONFIG_SYS_NS16550_COM4 0x481a6000 /* UART3 */
219#define CONFIG_SYS_NS16550_COM5 0x481a8000 /* UART4 */
220#define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200221
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200222#define CONFIG_ENV_EEPROM_IS_ON_I2C
223#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */
224#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200225
226/* PMIC support */
227#define CONFIG_POWER_TPS65910
228
229/* SPL */
230#ifndef CONFIG_NOR_BOOT
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200231
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200232#ifdef CONFIG_NAND
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200233#define CONFIG_SYS_NAND_5_ADDR_CYCLE
234#define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
235 CONFIG_SYS_NAND_PAGE_SIZE)
236#define CONFIG_SYS_NAND_PAGE_SIZE 2048
237#define CONFIG_SYS_NAND_OOBSIZE 64
238#define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
239#define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS
240#define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
241 10, 11, 12, 13, 14, 15, 16, 17, \
242 18, 19, 20, 21, 22, 23, 24, 25, \
243 26, 27, 28, 29, 30, 31, 32, 33, \
244 34, 35, 36, 37, 38, 39, 40, 41, \
245 42, 43, 44, 45, 46, 47, 48, 49, \
246 50, 51, 52, 53, 54, 55, 56, 57, }
247
248#define CONFIG_SYS_NAND_ECCSIZE 512
249#define CONFIG_SYS_NAND_ECCBYTES 14
250#define CONFIG_SYS_NAND_ONFI_DETECTION
251#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW
252#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
253#endif
254#endif
255
256/*
257 * USB configuration. We enable MUSB support, both for host and for
258 * gadget. We set USB0 as peripheral and USB1 as host, based on the
259 * board schematic and physical port wired to each. Then for host we
260 * add mass storage support and for gadget we add both RNDIS ethernet
261 * and DFU.
262 */
Paul Kocialkowskif34dfcb2015-08-04 17:04:06 +0200263#define CONFIG_USB_MUSB_DISABLE_BULK_COMBINE_SPLIT
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200264#define CONFIG_AM335X_USB0
Yegor Yefremovd7bd6cb2015-07-09 13:34:24 +0200265#define CONFIG_AM335X_USB0_MODE MUSB_HOST
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200266#define CONFIG_AM335X_USB1
Yegor Yefremovd7bd6cb2015-07-09 13:34:24 +0200267#define CONFIG_AM335X_USB1_MODE MUSB_OTG
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200268
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200269/* Network. */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200270#define CONFIG_PHY_SMSC
271#define CONFIG_MII
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200272#define CONFIG_PHY_ATHEROS
273
274/* NAND support */
275#ifdef CONFIG_NAND
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200276#define GPMC_NAND_ECC_LP_x8_LAYOUT 1
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200277#endif
278
279#endif /* ! __CONFIG_BALTOS_H */