blob: fbf657fe659618ff39e073947e53e70fb6ff80d0 [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
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020028/* Always 128 KiB env size */
29#define CONFIG_ENV_SIZE (128 << 10)
30
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020031/* FIT support */
Yegor Yefremov51c4ccb2015-07-06 17:28:36 +020032#define CONFIG_SYS_BOOTM_LEN SZ_64M
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020033
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020034#ifdef CONFIG_NAND
Yegor Yefremov319293a2018-11-22 09:19:32 +010035
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020036#define NANDARGS \
Tom Rini5ad8e112017-10-22 17:55:07 -040037 "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
38 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020039 "nandargs=setenv bootargs console=${console} " \
40 "${optargs} " \
41 "${mtdparts} " \
42 "root=${nandroot} " \
43 "rootfstype=${nandrootfstype}\0" \
44 "nandroot=ubi0:rootfs rw ubi.mtd=5\0" \
45 "nandrootfstype=ubifs rootwait=1\0" \
46 "nandboot=echo Booting from nand ...; " \
47 "run nandargs; " \
48 "setenv loadaddr 0x84000000; " \
49 "ubi part UBI; " \
50 "ubifsmount ubi0:kernel; " \
51 "ubifsload $loadaddr kernel-fit.itb;" \
52 "ubifsumount; " \
Yegor Yefremov51c4ccb2015-07-06 17:28:36 +020053 "bootm ${loadaddr}#conf${board_name}; " \
54 "if test $? -ne 0; then echo Using default FIT config; " \
55 "bootm ${loadaddr}; fi;\0"
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020056#else
57#define NANDARGS ""
58#endif
59
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020060#ifndef CONFIG_SPL_BUILD
61#define CONFIG_EXTRA_ENV_SETTINGS \
62 DEFAULT_LINUX_BOOT_ENV \
63 "boot_fdt=try\0" \
64 "bootpart=0:2\0" \
65 "bootdir=/boot\0" \
66 "bootfile=zImage\0" \
67 "fdtfile=undefined\0" \
68 "console=ttyO0,115200n8\0" \
69 "partitions=" \
70 "uuid_disk=${uuid_gpt_disk};" \
71 "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
72 "optargs=\0" \
73 "mmcdev=0\0" \
74 "mmcroot=/dev/mmcblk0p2 ro\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +010075 "usbroot=/dev/sda2 ro\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020076 "mmcrootfstype=ext4 rootwait\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +010077 "usbrootfstype=ext4 rootwait\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020078 "rootpath=/export/rootfs\0" \
79 "nfsopts=nolock\0" \
80 "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
81 "::off\0" \
82 "ramroot=/dev/ram0 rw\0" \
83 "ramrootfstype=ext2\0" \
84 "mmcargs=setenv bootargs console=${console} " \
85 "${optargs} " \
86 "${mtdparts} " \
87 "root=${mmcroot} " \
88 "rootfstype=${mmcrootfstype}\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +010089 "usbargs=setenv bootargs console=${console} " \
90 "${optargs} " \
91 "${mtdparts} " \
92 "root=${usbroot} " \
93 "rootfstype=${usbrootfstype}\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +020094 "spiroot=/dev/mtdblock4 rw\0" \
95 "spirootfstype=jffs2\0" \
96 "spisrcaddr=0xe0000\0" \
97 "spiimgsize=0x362000\0" \
98 "spibusno=0\0" \
99 "spiargs=setenv bootargs console=${console} " \
100 "${optargs} " \
101 "root=${spiroot} " \
102 "rootfstype=${spirootfstype}\0" \
103 "netargs=setenv bootargs console=${console} " \
104 "${optargs} " \
105 "root=/dev/nfs " \
106 "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
107 "ip=dhcp\0" \
108 "bootenv=uEnv.txt\0" \
109 "loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100110 "usbloadbootenv=load usb 0:1 ${loadaddr} ${bootenv}\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200111 "importbootenv=echo Importing environment from mmc ...; " \
112 "env import -t $loadaddr $filesize\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100113 "usbimportbootenv=echo Importing environment from USB ...; " \
114 "env import -t $loadaddr $filesize\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200115 "ramargs=setenv bootargs console=${console} " \
116 "${optargs} " \
117 "root=${ramroot} " \
118 "rootfstype=${ramrootfstype}\0" \
119 "loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
120 "loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100121 "usbloadimage=load usb 0:1 ${loadaddr} kernel-fit.itb\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200122 "loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100123 "usbloados=run usbargs; " \
124 "bootm ${loadaddr}#conf${board_name}; " \
125 "if test $? -ne 0; then " \
126 "echo Using default FIT configuration; " \
127 "bootm ${loadaddr}; " \
128 "fi;\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200129 "mmcloados=run mmcargs; " \
130 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
131 "if run loadfdt; then " \
132 "bootz ${loadaddr} - ${fdtaddr}; " \
133 "else " \
134 "if test ${boot_fdt} = try; then " \
135 "bootz; " \
136 "else " \
137 "echo WARN: Cannot load the DT; " \
138 "fi; " \
139 "fi; " \
140 "else " \
141 "bootz; " \
142 "fi;\0" \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100143 "usbboot=usb reset; " \
144 "if usb storage; then " \
145 "echo USB drive found;" \
146 "if run usbloadbootenv; then " \
147 "echo Loaded environment from ${bootenv};" \
148 "run usbimportbootenv;" \
149 "fi;" \
150 "if test -n $uenvcmd; then " \
151 "echo Running uenvcmd ...;" \
152 "run uenvcmd;" \
153 "fi;" \
154 "if run usbloadimage; then " \
155 "run usbloados;" \
156 "fi;" \
157 "fi;\0" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200158 "mmcboot=mmc dev ${mmcdev}; " \
159 "if mmc rescan; then " \
160 "echo SD/MMC found on device ${mmcdev};" \
161 "if run loadbootenv; then " \
162 "echo Loaded environment from ${bootenv};" \
163 "run importbootenv;" \
164 "fi;" \
165 "if test -n $uenvcmd; then " \
166 "echo Running uenvcmd ...;" \
167 "run uenvcmd;" \
168 "fi;" \
169 "if run loadimage; then " \
170 "run mmcloados;" \
171 "fi;" \
172 "fi;\0" \
173 "spiboot=echo Booting from spi ...; " \
174 "run spiargs; " \
175 "sf probe ${spibusno}:0; " \
176 "sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \
177 "bootz ${loadaddr}\0" \
178 "netboot=echo Booting from network ...; " \
179 "setenv autoload no; " \
180 "dhcp; " \
181 "tftp ${loadaddr} ${bootfile}; " \
182 "tftp ${fdtaddr} ${fdtfile}; " \
183 "run netargs; " \
184 "bootz ${loadaddr} - ${fdtaddr}\0" \
185 "ramboot=echo Booting from ramdisk ...; " \
186 "run ramargs; " \
187 "bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
188 "findfdt=setenv fdtfile am335x-baltos.dtb\0" \
189 NANDARGS
190 /*DFUARGS*/
191#endif
192
193#define CONFIG_BOOTCOMMAND \
194 "run findfdt; " \
Yegor Yefremov2f5697e2016-12-01 12:52:18 +0100195 "run usbboot;" \
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200196 "run mmcboot;" \
197 "setenv mmcdev 1; " \
198 "setenv bootpart 1:2; " \
199 "run mmcboot;" \
200 "run nandboot;"
201
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200202/* NS16550 Configuration */
203#define CONFIG_SYS_NS16550_COM1 0x44e09000 /* Base EVM has UART0 */
204#define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1 */
205#define CONFIG_SYS_NS16550_COM3 0x48024000 /* UART2 */
206#define CONFIG_SYS_NS16550_COM4 0x481a6000 /* UART3 */
207#define CONFIG_SYS_NS16550_COM5 0x481a8000 /* UART4 */
208#define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200209
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200210#define CONFIG_ENV_EEPROM_IS_ON_I2C
211#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */
212#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200213
214/* PMIC support */
215#define CONFIG_POWER_TPS65910
216
217/* SPL */
218#ifndef CONFIG_NOR_BOOT
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200219
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200220#ifdef CONFIG_NAND
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200221#define CONFIG_SYS_NAND_5_ADDR_CYCLE
222#define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
223 CONFIG_SYS_NAND_PAGE_SIZE)
224#define CONFIG_SYS_NAND_PAGE_SIZE 2048
225#define CONFIG_SYS_NAND_OOBSIZE 64
226#define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
227#define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS
228#define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
229 10, 11, 12, 13, 14, 15, 16, 17, \
230 18, 19, 20, 21, 22, 23, 24, 25, \
231 26, 27, 28, 29, 30, 31, 32, 33, \
232 34, 35, 36, 37, 38, 39, 40, 41, \
233 42, 43, 44, 45, 46, 47, 48, 49, \
234 50, 51, 52, 53, 54, 55, 56, 57, }
235
236#define CONFIG_SYS_NAND_ECCSIZE 512
237#define CONFIG_SYS_NAND_ECCBYTES 14
238#define CONFIG_SYS_NAND_ONFI_DETECTION
239#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW
240#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
241#endif
242#endif
243
244/*
245 * USB configuration. We enable MUSB support, both for host and for
246 * gadget. We set USB0 as peripheral and USB1 as host, based on the
247 * board schematic and physical port wired to each. Then for host we
248 * add mass storage support and for gadget we add both RNDIS ethernet
249 * and DFU.
250 */
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200251#define CONFIG_AM335X_USB0
Yegor Yefremovd7bd6cb2015-07-09 13:34:24 +0200252#define CONFIG_AM335X_USB0_MODE MUSB_HOST
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200253#define CONFIG_AM335X_USB1
Yegor Yefremovd7bd6cb2015-07-09 13:34:24 +0200254#define CONFIG_AM335X_USB1_MODE MUSB_OTG
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200255
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200256/* NAND support */
257#ifdef CONFIG_NAND
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200258#define GPMC_NAND_ECC_LP_x8_LAYOUT 1
Yegor Yefremovfa8b71b2015-05-29 19:27:29 +0200259#endif
260
261#endif /* ! __CONFIG_BALTOS_H */