blob: 42a5abd1b41b829ab7c61bae5eeb770ee85219cb [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
Yegor Yefremov6ce89322015-05-29 19:27:29 +020028/* FIT support */
Yegor Yefremov5f9c58e2015-07-06 17:28:36 +020029#define CONFIG_SYS_BOOTM_LEN SZ_64M
Yegor Yefremov6ce89322015-05-29 19:27:29 +020030
Miquel Raynal88718be2019-10-03 19:50:03 +020031#ifdef CONFIG_MTD_RAW_NAND
Yegor Yefremov1abff552018-11-22 09:19:32 +010032
Yegor Yefremov6ce89322015-05-29 19:27:29 +020033#define NANDARGS \
Tom Rini43ede0b2017-10-22 17:55:07 -040034 "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
35 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +020036 "nandargs=setenv bootargs console=${console} " \
37 "${optargs} " \
38 "${mtdparts} " \
39 "root=${nandroot} " \
40 "rootfstype=${nandrootfstype}\0" \
41 "nandroot=ubi0:rootfs rw ubi.mtd=5\0" \
42 "nandrootfstype=ubifs rootwait=1\0" \
43 "nandboot=echo Booting from nand ...; " \
44 "run nandargs; " \
45 "setenv loadaddr 0x84000000; " \
46 "ubi part UBI; " \
47 "ubifsmount ubi0:kernel; " \
48 "ubifsload $loadaddr kernel-fit.itb;" \
49 "ubifsumount; " \
Yegor Yefremov5f9c58e2015-07-06 17:28:36 +020050 "bootm ${loadaddr}#conf${board_name}; " \
51 "if test $? -ne 0; then echo Using default FIT config; " \
52 "bootm ${loadaddr}; fi;\0"
Yegor Yefremov6ce89322015-05-29 19:27:29 +020053#else
54#define NANDARGS ""
55#endif
56
Yegor Yefremov6ce89322015-05-29 19:27:29 +020057#ifndef CONFIG_SPL_BUILD
58#define CONFIG_EXTRA_ENV_SETTINGS \
59 DEFAULT_LINUX_BOOT_ENV \
60 "boot_fdt=try\0" \
61 "bootpart=0:2\0" \
62 "bootdir=/boot\0" \
63 "bootfile=zImage\0" \
64 "fdtfile=undefined\0" \
65 "console=ttyO0,115200n8\0" \
66 "partitions=" \
67 "uuid_disk=${uuid_gpt_disk};" \
68 "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
69 "optargs=\0" \
70 "mmcdev=0\0" \
71 "mmcroot=/dev/mmcblk0p2 ro\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +010072 "usbroot=/dev/sda2 ro\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +020073 "mmcrootfstype=ext4 rootwait\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +010074 "usbrootfstype=ext4 rootwait\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +020075 "rootpath=/export/rootfs\0" \
76 "nfsopts=nolock\0" \
77 "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
78 "::off\0" \
79 "ramroot=/dev/ram0 rw\0" \
80 "ramrootfstype=ext2\0" \
81 "mmcargs=setenv bootargs console=${console} " \
82 "${optargs} " \
83 "${mtdparts} " \
84 "root=${mmcroot} " \
85 "rootfstype=${mmcrootfstype}\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +010086 "usbargs=setenv bootargs console=${console} " \
87 "${optargs} " \
88 "${mtdparts} " \
89 "root=${usbroot} " \
90 "rootfstype=${usbrootfstype}\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +020091 "spiroot=/dev/mtdblock4 rw\0" \
92 "spirootfstype=jffs2\0" \
93 "spisrcaddr=0xe0000\0" \
94 "spiimgsize=0x362000\0" \
95 "spibusno=0\0" \
96 "spiargs=setenv bootargs console=${console} " \
97 "${optargs} " \
98 "root=${spiroot} " \
99 "rootfstype=${spirootfstype}\0" \
100 "netargs=setenv bootargs console=${console} " \
101 "${optargs} " \
102 "root=/dev/nfs " \
103 "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
104 "ip=dhcp\0" \
105 "bootenv=uEnv.txt\0" \
106 "loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100107 "usbloadbootenv=load usb 0:1 ${loadaddr} ${bootenv}\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200108 "importbootenv=echo Importing environment from mmc ...; " \
109 "env import -t $loadaddr $filesize\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100110 "usbimportbootenv=echo Importing environment from USB ...; " \
111 "env import -t $loadaddr $filesize\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200112 "ramargs=setenv bootargs console=${console} " \
113 "${optargs} " \
114 "root=${ramroot} " \
115 "rootfstype=${ramrootfstype}\0" \
116 "loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
117 "loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100118 "usbloadimage=load usb 0:1 ${loadaddr} kernel-fit.itb\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200119 "loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100120 "usbloados=run usbargs; " \
121 "bootm ${loadaddr}#conf${board_name}; " \
122 "if test $? -ne 0; then " \
123 "echo Using default FIT configuration; " \
124 "bootm ${loadaddr}; " \
125 "fi;\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200126 "mmcloados=run mmcargs; " \
127 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
128 "if run loadfdt; then " \
129 "bootz ${loadaddr} - ${fdtaddr}; " \
130 "else " \
131 "if test ${boot_fdt} = try; then " \
132 "bootz; " \
133 "else " \
134 "echo WARN: Cannot load the DT; " \
135 "fi; " \
136 "fi; " \
137 "else " \
138 "bootz; " \
139 "fi;\0" \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100140 "usbboot=usb reset; " \
141 "if usb storage; then " \
142 "echo USB drive found;" \
143 "if run usbloadbootenv; then " \
144 "echo Loaded environment from ${bootenv};" \
145 "run usbimportbootenv;" \
146 "fi;" \
147 "if test -n $uenvcmd; then " \
148 "echo Running uenvcmd ...;" \
149 "run uenvcmd;" \
150 "fi;" \
151 "if run usbloadimage; then " \
152 "run usbloados;" \
153 "fi;" \
154 "fi;\0" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200155 "mmcboot=mmc dev ${mmcdev}; " \
156 "if mmc rescan; then " \
157 "echo SD/MMC found on device ${mmcdev};" \
158 "if run loadbootenv; then " \
159 "echo Loaded environment from ${bootenv};" \
160 "run importbootenv;" \
161 "fi;" \
162 "if test -n $uenvcmd; then " \
163 "echo Running uenvcmd ...;" \
164 "run uenvcmd;" \
165 "fi;" \
166 "if run loadimage; then " \
167 "run mmcloados;" \
168 "fi;" \
169 "fi;\0" \
170 "spiboot=echo Booting from spi ...; " \
171 "run spiargs; " \
172 "sf probe ${spibusno}:0; " \
173 "sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \
174 "bootz ${loadaddr}\0" \
175 "netboot=echo Booting from network ...; " \
176 "setenv autoload no; " \
177 "dhcp; " \
178 "tftp ${loadaddr} ${bootfile}; " \
179 "tftp ${fdtaddr} ${fdtfile}; " \
180 "run netargs; " \
181 "bootz ${loadaddr} - ${fdtaddr}\0" \
182 "ramboot=echo Booting from ramdisk ...; " \
183 "run ramargs; " \
184 "bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
185 "findfdt=setenv fdtfile am335x-baltos.dtb\0" \
186 NANDARGS
187 /*DFUARGS*/
188#endif
189
190#define CONFIG_BOOTCOMMAND \
191 "run findfdt; " \
Yegor Yefremov88679a22016-12-01 12:52:18 +0100192 "run usbboot;" \
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200193 "run mmcboot;" \
194 "setenv mmcdev 1; " \
195 "setenv bootpart 1:2; " \
196 "run mmcboot;" \
197 "run nandboot;"
198
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200199/* NS16550 Configuration */
200#define CONFIG_SYS_NS16550_COM1 0x44e09000 /* Base EVM has UART0 */
201#define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1 */
202#define CONFIG_SYS_NS16550_COM3 0x48024000 /* UART2 */
203#define CONFIG_SYS_NS16550_COM4 0x481a6000 /* UART3 */
204#define CONFIG_SYS_NS16550_COM5 0x481a8000 /* UART4 */
205#define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200206
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200207#define CONFIG_ENV_EEPROM_IS_ON_I2C
208#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */
209#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200210
211/* PMIC support */
212#define CONFIG_POWER_TPS65910
213
214/* SPL */
215#ifndef CONFIG_NOR_BOOT
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200216
Miquel Raynal88718be2019-10-03 19:50:03 +0200217#ifdef CONFIG_MTD_RAW_NAND
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200218#define CONFIG_SYS_NAND_5_ADDR_CYCLE
219#define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
220 CONFIG_SYS_NAND_PAGE_SIZE)
221#define CONFIG_SYS_NAND_PAGE_SIZE 2048
222#define CONFIG_SYS_NAND_OOBSIZE 64
223#define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
224#define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS
225#define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
226 10, 11, 12, 13, 14, 15, 16, 17, \
227 18, 19, 20, 21, 22, 23, 24, 25, \
228 26, 27, 28, 29, 30, 31, 32, 33, \
229 34, 35, 36, 37, 38, 39, 40, 41, \
230 42, 43, 44, 45, 46, 47, 48, 49, \
231 50, 51, 52, 53, 54, 55, 56, 57, }
232
233#define CONFIG_SYS_NAND_ECCSIZE 512
234#define CONFIG_SYS_NAND_ECCBYTES 14
235#define CONFIG_SYS_NAND_ONFI_DETECTION
236#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW
237#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
238#endif
239#endif
240
241/*
242 * USB configuration. We enable MUSB support, both for host and for
243 * gadget. We set USB0 as peripheral and USB1 as host, based on the
244 * board schematic and physical port wired to each. Then for host we
245 * add mass storage support and for gadget we add both RNDIS ethernet
246 * and DFU.
247 */
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200248#define CONFIG_AM335X_USB0
Yegor Yefremov5e5055f2015-07-09 13:34:24 +0200249#define CONFIG_AM335X_USB0_MODE MUSB_HOST
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200250#define CONFIG_AM335X_USB1
Yegor Yefremov5e5055f2015-07-09 13:34:24 +0200251#define CONFIG_AM335X_USB1_MODE MUSB_OTG
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200252
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200253/* NAND support */
Miquel Raynal88718be2019-10-03 19:50:03 +0200254#ifdef CONFIG_MTD_RAW_NAND
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200255#define GPMC_NAND_ECC_LP_x8_LAYOUT 1
Yegor Yefremov6ce89322015-05-29 19:27:29 +0200256#endif
257
258#endif /* ! __CONFIG_BALTOS_H */