4 * Copyright (c) 2012-2014 Birdland Audio - http://birdland.com/oem
5 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation version 2.
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #ifndef __CONFIG_BAV335X_H
18 #define __CONFIG_BAV335X_H
20 #include <configs/ti_am335x_common.h>
22 #ifndef CONFIG_SPL_BUILD
23 # define CONFIG_TIMESTAMP
26 #define CONFIG_SYS_BOOTM_LEN (16 << 20)
28 #define CONFIG_MACH_TYPE MACH_TYPE_AM335XEVM
31 #define V_OSCK 24000000 /* Clock output from T2 */
32 #define V_SCLK (V_OSCK)
34 #ifdef CONFIG_MTD_RAW_NAND
36 "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
37 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
38 "nandargs=setenv bootargs console=${console} " \
41 "rootfstype=${nandrootfstype}\0" \
42 "nandroot=ubi0:rootfs rw ubi.mtd=9,2048\0" \
43 "nandrootfstype=ubifs rootwait=1\0" \
44 "nandboot=echo Booting from nand ...; " \
46 "nand read ${fdtaddr} u-boot-spl-os; " \
47 "nand read ${loadaddr} kernel; " \
48 "bootz ${loadaddr} - ${fdtaddr}\0"
53 #ifndef CONFIG_SPL_BUILD
54 #define CONFIG_EXTRA_ENV_SETTINGS \
55 DEFAULT_LINUX_BOOT_ENV \
61 "fdtfile=undefined\0" \
62 "console=ttyO0,115200n8\0" \
63 "loadaddr=0x82000000\0" \
64 "fdtaddr=0x88000000\0" \
65 "rdaddr=0x88080000\0" \
66 "initrd_high=0xffffffff\0" \
67 "fdt_high=0xffffffff\0" \
69 "uuid_disk=${uuid_gpt_disk};" \
70 "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
75 "mmcroot=/dev/mmcblk0p2 ro\0" \
76 "mmcrootfstype=ext4 rootwait fixrtc\0" \
77 "rootpath=/export/rootfs\0" \
79 "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off\0" \
80 "ramroot=/dev/ram0 rw\0" \
81 "ramrootfstype=ext2\0" \
82 "mmcargs=setenv bootargs console=${console} ${optargs} " \
83 "root=${mmcroot} rootfstype=${mmcrootfstype} ${cmdline}\0" \
84 "server_ip=192.168.1.100\0" \
85 "gw_ip=192.168.1.1\0" \
86 "netmask=255.255.255.0\0" \
90 "root_dir=/home/userid/targetNFS\0" \
91 "nfs_options=,vers=3\0" \
92 "nfsrootfstype=ext4 rootwait fixrtc\0" \
93 "nfsargs=setenv bootargs console=${console} ${optargs} " \
94 "root=/dev/nfs rw rootfstype=${nfsrootfstype} " \
95 "nfsroot=${nfsroot} ip=${ip} ${cmdline}\0" \
96 "netargs=setenv bootargs console=${console} " \
97 "${optargs} root=/dev/nfs " \
98 "nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp\0" \
99 "bootenv=uEnv.txt\0" \
100 "script=boot.scr\0" \
101 "scriptfile=${script}\0" \
102 "loadbootscript=load mmc ${bootpart} ${loadaddr} ${scriptfile};\0" \
103 "bootscript=echo Running bootscript from mmc${bootpart} ...; " \
104 "source ${loadaddr}\0" \
105 "loadbootenv=load mmc ${bootpart} ${loadaddr} ${bootenv}\0" \
106 "importbootenv=echo Importing environment from mmc ...; " \
107 "env import -t -r $loadaddr $filesize\0" \
108 "ramargs=setenv bootargs console=${console} " \
109 "${optargs} root=${ramroot} rootfstype=${ramrootfstype}\0" \
110 "loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
111 "loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
112 "loadrd=load mmc ${bootpart} ${rdaddr} " \
113 "${bootdir}/${rdfile}; setenv rdsize ${filesize}\0" \
114 "loadfdt=echo loading ${fdtdir}/${fdtfile} ...; " \
115 "load mmc ${bootpart} ${fdtaddr} ${fdtdir}/${fdtfile}\0" \
116 "mmcboot=mmc dev ${mmcdev}; " \
117 "if mmc rescan; then " \
119 "setenv bootpart ${mmcdev}:1; " \
120 "if test -e mmc ${bootpart} /etc/fstab; then " \
121 "setenv mmcpart 1;" \
123 "echo Checking for: /uEnv.txt ...;" \
124 "if test -e mmc ${bootpart} /uEnv.txt; then " \
125 "if run loadbootenv; then " \
127 "echo Loaded environment from ${bootenv};" \
128 "run importbootenv;" \
130 "echo Checking if uenvcmd is set ...;" \
131 "if test -n ${uenvcmd}; then " \
133 "echo Running uenvcmd ...;" \
136 "echo Checking if client_ip is set ...;" \
137 "if test -n ${client_ip}; then " \
138 "if test -n ${dtb}; then " \
139 "setenv fdtfile ${dtb};" \
140 "echo using ${fdtfile} ...;" \
143 "if test -n ${uname_r}; then " \
144 "echo Running nfsboot_uname_r ...;" \
145 "run nfsboot_uname_r;" \
147 "echo Running nfsboot ...;" \
151 "echo Checking for: /${script} ...;" \
152 "if test -e mmc ${bootpart} /${script}; then " \
154 "setenv scriptfile ${script};" \
155 "run loadbootscript;" \
156 "echo Loaded script from ${scriptfile};" \
160 "echo Checking for: /boot/${script} ...;" \
161 "if test -e mmc ${bootpart} /boot/${script}; then " \
163 "setenv scriptfile /boot/${script};" \
164 "run loadbootscript;" \
165 "echo Loaded script from ${scriptfile};" \
169 "echo Checking for: /boot/uEnv.txt ...;" \
170 "for i in 1 2 3 4 5 6 7 ; do " \
171 "setenv mmcpart ${i};" \
172 "setenv bootpart ${mmcdev}:${mmcpart};" \
173 "if test -e mmc ${bootpart} /boot/uEnv.txt; then " \
175 "load mmc ${bootpart} ${loadaddr} " \
177 "env import -t ${loadaddr} ${filesize};" \
178 "echo Loaded environment from /boot/uEnv.txt;" \
179 "if test -n ${dtb}; then " \
180 "setenv fdtfile ${dtb};" \
181 "echo Using: dtb=${fdtfile} ...;" \
183 "echo Checking if uname_r is set in " \
184 "/boot/uEnv.txt...;" \
185 "if test -n ${uname_r}; then " \
187 "echo Running uname_boot ...;" \
188 "setenv mmcroot /dev/mmcblk${mmcdev}" \
195 "netboot=echo Booting from network ...; " \
196 "setenv autoload no; " \
198 "tftp ${loadaddr} ${bootfile}; " \
199 "tftp ${fdtaddr} ${fdtfile}; " \
201 "bootz ${loadaddr} - ${fdtaddr}\0" \
202 "nfsboot=echo Booting from ${server_ip} ...; " \
203 "setenv nfsroot ${server_ip}:${root_dir}${nfs_options}; " \
204 "setenv ip ${client_ip}:${server_ip}:${gw_ip}:${netmask}:${hostname}" \
205 ":${device}:${autoconf}; " \
206 "setenv autoload no; " \
207 "setenv serverip ${server_ip}; " \
208 "setenv ipaddr ${client_ip}; " \
209 "tftp ${loadaddr} ${bootfile}; " \
210 "tftp ${fdtaddr} dtbs/${fdtfile}; " \
212 "bootz ${loadaddr} - ${fdtaddr}\0" \
213 "nfsboot_uname_r=echo Booting from ${server_ip} ...; " \
214 "setenv nfsroot ${server_ip}:${root_dir}${nfs_options}; " \
215 "setenv ip ${client_ip}:${server_ip}:${gw_ip}:${netmask}:${hostname}" \
216 ":${device}:${autoconf}; " \
217 "setenv autoload no; " \
218 "setenv serverip ${server_ip}; " \
219 "setenv ipaddr ${client_ip}; " \
220 "tftp ${loadaddr} vmlinuz-${uname_r}; " \
221 "tftp ${fdtaddr} dtbs/${uname_r}/${fdtfile}; " \
223 "bootz ${loadaddr} - ${fdtaddr}\0" \
224 "ramboot=echo Booting from ramdisk ...; " \
226 "bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
228 "if test $board_rev = B; then " \
229 "setenv fdtfile birdland_bav335b.dtb; " \
230 "setenv fdtbase am335x-boneblack; fi; " \
231 "if test $board_rev = A; then " \
232 "setenv fdtfile birdland_bav335a.dtb; " \
233 "setenv fdtbase am335x-boneblack; fi; " \
234 "if test $fdtfile = undefined; then " \
235 "echo WARNING: Could not determine device tree to use; fi; \0" \
237 "setenv bootdir /boot; " \
238 "setenv bootfile vmlinuz-${uname_r}; " \
239 "if test -e mmc ${bootpart} ${bootdir}/${bootfile}; then " \
240 "echo loading ${bootdir}/${bootfile} ...; "\
242 "setenv fdtdir /boot/dtbs/${uname_r}; " \
243 "if test -e mmc ${bootpart} ${fdtdir}/${fdtfile}; then " \
246 "setenv fdtdir /lib/firmware/${uname_r}/device-tree; " \
247 "if test -e mmc ${bootpart} ${fdtdir}/" \
248 "${fdtfile}; then " \
251 "setenv fdtdir /boot/dtb-${uname_r}; " \
252 "if test -e mmc ${bootpart} ${fdtdir}" \
253 "/${fdtfile}; then " \
256 "setenv fdtdir /boot/dtbs; " \
257 "if test -e mmc ${bootpart} ${fdtdir}" \
258 "/${fdtfile}; then " \
261 "echo; echo unable to find " \
263 "did you name it correctly?" \
264 "echo booting fallback " \
267 "/${fdtbase}.dtb]...;" \
268 "setenv fdtdir /boot/dtbs/" \
278 "setenv rdfile initrd.img-${uname_r}; " \
279 "if test -e mmc ${bootpart} ${bootdir}/${rdfile}; then " \
280 "echo loading ${bootdir}/${rdfile} ...; "\
282 "if test -n ${uuid}; then " \
283 "setenv mmcroot UUID=${uuid} ro;" \
286 "echo debug: [${bootargs}] ... ;" \
287 "echo debug: [bootz ${loadaddr} ${rdaddr}:${rdsize} " \
288 "${fdtaddr}] ... ;" \
289 "bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}; " \
292 "echo debug: [${bootargs}] ... ;" \
293 "echo debug: [bootz ${loadaddr} - ${fdtaddr}] ... ;" \
294 "bootz ${loadaddr} - ${fdtaddr}; " \
301 #define CONFIG_BOOTCOMMAND \
303 "i2c mw 0x24 1 0x3e; " \
305 "setenv mmcdev 0; " \
306 "setenv bootpart 0:1; " \
311 "setenv mmcdev 1; " \
312 "setenv bootpart 1:1; " \
315 /* NS16550 Configuration */
316 #define CONFIG_SYS_NS16550_COM1 0x44e09000 /* UART0 */
317 #define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1 */
318 #define CONFIG_SYS_NS16550_COM3 0x48024000 /* UART2 */
319 #define CONFIG_SYS_NS16550_COM4 0x481a6000 /* UART3 */
320 #define CONFIG_SYS_NS16550_COM5 0x481a8000 /* UART4 */
321 #define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */
323 #define CONFIG_ENV_EEPROM_IS_ON_I2C
324 #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */
325 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
328 #define CONFIG_POWER_TPS65217
329 #define CONFIG_POWER_TPS65910
332 #ifndef CONFIG_NOR_BOOT
333 /* Bootcount using the RTC block */
334 #define CONFIG_SYS_BOOTCOUNT_BE
336 /* USB gadget RNDIS */
339 #ifdef CONFIG_MTD_RAW_NAND
340 /* NAND: device related configs */
341 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
342 #define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
343 CONFIG_SYS_NAND_PAGE_SIZE)
344 #define CONFIG_SYS_NAND_PAGE_SIZE 2048
345 #define CONFIG_SYS_NAND_OOBSIZE 64
346 #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
347 /* NAND: driver related configs */
348 #define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS
349 #define CONFIG_SYS_NAND_ECCPOS { \
350 2, 3, 4, 5, 6, 7, 8, 9, \
351 10, 11, 12, 13, 14, 15, 16, 17, \
352 18, 19, 20, 21, 22, 23, 24, 25, \
353 26, 27, 28, 29, 30, 31, 32, 33, \
354 34, 35, 36, 37, 38, 39, 40, 41, \
355 42, 43, 44, 45, 46, 47, 48, 49, \
356 50, 51, 52, 53, 54, 55, 56, 57, }
358 #define CONFIG_SYS_NAND_ECCSIZE 512
359 #define CONFIG_SYS_NAND_ECCBYTES 14
360 #define CONFIG_SYS_NAND_ONFI_DETECTION
361 #define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW
362 #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x000c0000
363 #define CONFIG_SYS_ENV_SECT_SIZE CONFIG_SYS_NAND_BLOCK_SIZE
364 /* NAND: SPL related configs */
365 #ifdef CONFIG_SPL_OS_BOOT
366 #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x00200000 /* kernel offset */
368 #endif /* !CONFIG_MTD_RAW_NAND */
371 * For NOR boot, we must set this to the start of where NOR is mapped
376 * USB configuration. We enable MUSB support, both for host and for
377 * gadget. We set USB0 as peripheral and USB1 as host, based on the
378 * board schematic and physical port wired to each. Then for host we
379 * add mass storage support and for gadget we add both RNDIS ethernet
382 #define CONFIG_AM335X_USB0
383 #define CONFIG_AM335X_USB0_MODE MUSB_PERIPHERAL
384 #define CONFIG_AM335X_USB1
385 #define CONFIG_AM335X_USB1_MODE MUSB_HOST
387 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_USB_ETHER)
388 /* disable host part of MUSB in SPL */
389 /* disable EFI partitions and partition UUID support */
392 /* USB Device Firmware Update support */
393 #ifndef CONFIG_SPL_BUILD
394 #define DFU_ALT_INFO_MMC \
395 "dfu_alt_info_mmc=" \
399 "MLO.raw raw 0x100 0x100;" \
400 "u-boot.img.raw raw 0x300 0x400;" \
401 "spl-os-args.raw raw 0x80 0x80;" \
402 "spl-os-image.raw raw 0x900 0x2000;" \
403 "spl-os-args fat 0 1;" \
404 "spl-os-image fat 0 1;" \
405 "u-boot.img fat 0 1;" \
407 #ifdef CONFIG_MTD_RAW_NAND
408 #define DFU_ALT_INFO_NAND \
409 "dfu_alt_info_nand=" \
411 "SPL.backup1 part 0 2;" \
412 "SPL.backup2 part 0 3;" \
413 "SPL.backup3 part 0 4;" \
415 "u-boot-spl-os part 0 6;" \
419 #define DFU_ALT_INFO_NAND ""
421 #define DFU_ALT_INFO_RAM \
422 "dfu_alt_info_ram=" \
423 "kernel ram 0x80200000 0xD80000;" \
424 "fdt ram 0x80F80000 0x80000;" \
425 "ramdisk ram 0x81000000 0x4000000\0"
427 "dfu_alt_info_emmc=rawemmc raw 0 3751936\0" \
434 * Default to using SPI for environment, etc.
435 * 0x000000 - 0x020000 : SPL (128KiB)
436 * 0x020000 - 0x0A0000 : U-Boot (512KiB)
437 * 0x0A0000 - 0x0BFFFF : First copy of U-Boot Environment (128KiB)
438 * 0x0C0000 - 0x0DFFFF : Second copy of U-Boot Environment (128KiB)
439 * 0x0E0000 - 0x442000 : Linux Kernel
440 * 0x442000 - 0x800000 : Userland
442 #if defined(CONFIG_SPI_BOOT)
444 #elif defined(CONFIG_EMMC_BOOT)
445 #define CONFIG_SYS_MMC_ENV_DEV 1
446 #define CONFIG_SYS_MMC_ENV_PART 2
452 #define CONFIG_PHY_SMSC
456 * Number of Sectors/Blocks = 128
457 * Sector Size = 128 KiB
458 * Word length = 16 bits
460 * 0x000000 - 0x07FFFF : U-Boot (512 KiB)
461 * 0x080000 - 0x09FFFF : First copy of U-Boot Environment (128 KiB)
462 * 0x0A0000 - 0x0BFFFF : Second copy of U-Boot Environment (128 KiB)
463 * 0x0C0000 - 0x4BFFFF : Linux Kernel (4 MiB)
464 * 0x4C0000 - 0xFFFFFF : Userland (11 MiB + 256 KiB)
466 #if defined(CONFIG_NOR)
467 #define CONFIG_SYS_MAX_FLASH_SECT 128
468 #define CONFIG_SYS_MAX_FLASH_BANKS 1
469 #define CONFIG_SYS_FLASH_BASE (0x08000000)
470 #define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT
471 #define CONFIG_SYS_FLASH_SIZE 0x01000000
472 #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE
473 /* Reduce SPL size by removing unlikey targets */
474 #endif /* NOR support */
476 #endif /* ! __CONFIG_AM335X_EVM_H */