xref: /openbmc/u-boot/board/ti/am335x/README (revision fa840b09216c6ea728240294b66d2d9ae42c36e1)
15d4dbf1cSTom RiniSummary
25d4dbf1cSTom Rini=======
35d4dbf1cSTom Rini
45d4dbf1cSTom RiniThis document covers various features of the 'am335x_evm' build, and some of
55d4dbf1cSTom Rinithe related build targets (am335x_evm_uartN, etc).
65d4dbf1cSTom Rini
75d4dbf1cSTom RiniHardware
85d4dbf1cSTom Rini========
95d4dbf1cSTom Rini
105d4dbf1cSTom RiniThe binary produced by this board supports, based on parsing of the EEPROM
115d4dbf1cSTom Rinidocumented in TI's reference designs:
125d4dbf1cSTom Rini- AM335x GP EVM
135d4dbf1cSTom Rini- AM335x EVM SK
145d4dbf1cSTom Rini- Beaglebone White
155d4dbf1cSTom Rini- Beaglebone Black
16d7ccfc5bSTom Rini
17d7ccfc5bSTom RiniCustomization
18d7ccfc5bSTom Rini=============
19d7ccfc5bSTom Rini
20d7ccfc5bSTom RiniGiven that all of the above boards are reference platforms (and the
21d7ccfc5bSTom RiniBeaglebone platforms are OSHA), it is likely that this platform code and
22d7ccfc5bSTom Riniconfiguration will be used as the basis of a custom platform.  It is
23d7ccfc5bSTom Riniworth noting that aside from things such as NAND or MMC only being
24d7ccfc5bSTom Rinirequired if a custom platform makes use of these blocks, the following
25d7ccfc5bSTom Riniare required, depending on design:
26d7ccfc5bSTom Rini
27d7ccfc5bSTom Rini- GPIO is only required if DDR3 power is controlled in a way similar to
28d7ccfc5bSTom Rini  EVM SK
29d7ccfc5bSTom Rini- SPI is only required for SPI flash, or exposing the SPI bus.
30d7ccfc5bSTom Rini
31d7ccfc5bSTom RiniThe following blocks are required:
32d7ccfc5bSTom Rini- I2C, to talk with the PMIC and ensure that we do not run afoul of
33d7ccfc5bSTom Rini  errata 1.0.24.
34d7ccfc5bSTom Rini
35d7ccfc5bSTom RiniWhen removing options as part of customization,
36d7ccfc5bSTom RiniCONFIG_EXTRA_ENV_SETTINGS will need additional care to update for your
37d7ccfc5bSTom Rinineeds and to remove no longer relevant options as in some cases we
38d7ccfc5bSTom Rinidefine additional text blocks (such as for NAND or DFU strings).  Also
39d7ccfc5bSTom Rininote that all of the SPL options are grouped together, rather than with
40d7ccfc5bSTom Rinithe IP blocks, so both areas will need their choices updated to reflect
41d7ccfc5bSTom Rinithe custom design.
42d7ccfc5bSTom Rini
4397559b52STom RiniNAND
4497559b52STom Rini====
4597559b52STom Rini
4697559b52STom RiniThe AM335x GP EVM ships with a 256MiB NAND available in most profiles.  In
4797559b52STom Rinithis example to program the NAND we assume that an SD card has been
4897559b52STom Riniinserted with the files to write in the first SD slot and that mtdparts
4932f4d729Spekon guptahave been configured correctly for the board. All images are first loaded
5032f4d729Spekon guptainto memory, then written to NAND.
5197559b52STom Rini
5232f4d729Spekon guptaStep-1: Building u-boot for NAND boot
5332f4d729Spekon gupta	Set following CONFIGxx options for NAND device.
5432f4d729Spekon gupta	CONFIG_SYS_NAND_PAGE_SIZE	number of main bytes in NAND page
5532f4d729Spekon gupta	CONFIG_SYS_NAND_OOBSIZE		number of OOB bytes in NAND page
5632f4d729Spekon gupta	CONFIG_SYS_NAND_BLOCK_SIZE	number of bytes in NAND erase-block
5732f4d729Spekon gupta	CONFIG_SYS_NAND_ECCPOS		ECC map for NAND page
5832f4d729Spekon gupta	CONFIG_NAND_OMAP_ECCSCHEME	(refer doc/README.nand)
5932f4d729Spekon gupta
6032f4d729Spekon guptaStep-2: Flashing NAND via MMC/SD
6132f4d729Spekon gupta	# select BOOTSEL to MMC/SD boot and boot from MMC/SD card
6297559b52STom Rini	U-Boot # mmc rescan
6332f4d729Spekon gupta	# erase flash
6497559b52STom Rini	U-Boot # nand erase.chip
6532f4d729Spekon gupta	U-Boot # env default -f -a
6697559b52STom Rini	U-Boot # saveenv
6732f4d729Spekon gupta	# flash MLO. Redundant copies of MLO are kept for failsafe
6832f4d729Spekon gupta	U-Boot # load mmc 0 0x82000000 MLO
6932f4d729Spekon gupta	U-Boot # nand write 0x82000000 0x00000 0x20000
7032f4d729Spekon gupta	U-Boot # nand write 0x82000000 0x20000 0x20000
7132f4d729Spekon gupta	U-Boot # nand write 0x82000000 0x40000 0x20000
7232f4d729Spekon gupta	U-Boot # nand write 0x82000000 0x60000 0x20000
7332f4d729Spekon gupta	# flash u-boot.img
7432f4d729Spekon gupta	U-Boot # load mmc 0 0x82000000 u-boot.img
7532f4d729Spekon gupta	U-Boot # nand write 0x82000000 0x80000 0x60000
7632f4d729Spekon gupta	# flash kernel image
7732f4d729Spekon gupta	U-Boot # load mmc 0 0x82000000 uImage
7832f4d729Spekon gupta	U-Boot # nand write 0x82000000 ${nandsrcaddr} ${nandimgsize}
7932f4d729Spekon gupta	# flash filesystem image
8032f4d729Spekon gupta	U-Boot # load mmc 0 0x82000000 filesystem.img
8132f4d729Spekon gupta	U-Boot # nand write 0x82000000 ${loadaddress} 0x300000
8232f4d729Spekon gupta
8332f4d729Spekon guptaStep-3: Set BOOTSEL pin to select NAND boot, and POR the device.
8432f4d729Spekon gupta	The device should boot from images flashed on NAND device.
855d4dbf1cSTom Rini
86486da229STom RiniNOR
87486da229STom Rini===
88486da229STom Rini
89*fa840b09SJeremiah MahlerThe Beaglebone White can be equipped with a "memory cape" that in turn can
90486da229STom Rinihave a NOR module plugged into it.  In this case it is then possible to
91*fa840b09SJeremiah Mahlerprogram and boot from NOR.  Note that due to how U-Boot is designed we
92486da229STom Rinimust build a specific version of U-Boot that knows we have NOR flash.  This
93486da229STom Rinibuild is named 'am335x_evm_nor'.  Further, we have a 'am335x_evm_norboot'
94486da229STom Rinibuild that will assume that the environment is on NOR rather than NAND.  In
95486da229STom Rinithe following example we assume that and SD card has been populated with
96486da229STom RiniMLO and u-boot.img from a 'am335x_evm_nor' build and also contains the
97486da229STom Rini'u-boot.bin' from a 'am335x_evm_norboot' build.  When booting from NOR, a
98486da229STom Rinibinary must be written to the start of NOR, with no header or similar
99486da229STom Riniprepended.  In the following example we use a size of 512KiB (0x80000)
100486da229STom Rinias that is how much space we set aside before the environment, as per
101486da229STom Rinithe config file.
102486da229STom Rini
103486da229STom RiniU-Boot # mmc rescan
104486da229STom RiniU-Boot # load mmc 0 ${loadaddr} u-boot.bin
105486da229STom RiniU-Boot # protect off 08000000 +80000
106486da229STom RiniU-Boot # erase 08000000 +80000
107486da229STom RiniU-Boot # cp.b ${loadaddr} 08000000 ${filesize}
108486da229STom Rini
1095d4dbf1cSTom RiniFalcon Mode
1105d4dbf1cSTom Rini===========
1115d4dbf1cSTom Rini
1125d4dbf1cSTom RiniThe default build includes "Falcon Mode" (see doc/README.falcon) via NAND,
1135d4dbf1cSTom RinieMMC (or raw SD cards) and FAT SD cards.  Our default behavior currently is
1145d4dbf1cSTom Rinito read a 'c' on the console while in SPL at any point prior to loading the
1155d4dbf1cSTom RiniOS payload (so as soon as possible) to opt to booting full U-Boot.  Also
1165d4dbf1cSTom Rininote that while one can program Falcon Mode "in place" great care needs to
1175d4dbf1cSTom Rinibe taken by the user to not 'brick' their setup.  As these are all eval
1185d4dbf1cSTom Riniboards with multiple boot methods, recovery should not be an issue in this
1195d4dbf1cSTom Riniworst-case however.
1205d4dbf1cSTom Rini
1215d4dbf1cSTom RiniFalcon Mode: eMMC
1225d4dbf1cSTom Rini=================
1235d4dbf1cSTom Rini
1245d4dbf1cSTom RiniThe recommended layout in this case is:
1255d4dbf1cSTom Rini
1265d4dbf1cSTom RiniMMC BLOCKS      |--------------------------------| LOCATION IN BYTES
1275d4dbf1cSTom Rini0x0000 - 0x007F : MBR or GPT table               : 0x000000 - 0x020000
1285d4dbf1cSTom Rini0x0080 - 0x00FF : ARGS or FDT file               : 0x010000 - 0x020000
1295d4dbf1cSTom Rini0x0100 - 0x01FF : SPL.backup1 (first copy used)  : 0x020000 - 0x040000
1305d4dbf1cSTom Rini0x0200 - 0x02FF : SPL.backup2 (second copy used) : 0x040000 - 0x060000
1315d4dbf1cSTom Rini0x0300 - 0x06FF : U-Boot                         : 0x060000 - 0x0e0000
1325d4dbf1cSTom Rini0x0700 - 0x08FF : U-Boot Env + Redundant         : 0x0e0000 - 0x120000
1335d4dbf1cSTom Rini0x0900 - 0x28FF : Kernel                         : 0x120000 - 0x520000
1345d4dbf1cSTom Rini
1355d4dbf1cSTom RiniNote that when we run 'spl export' it will prepare to boot the kernel.
1365d4dbf1cSTom RiniThis includes relocation of the uImage from where we loaded it to the entry
1375d4dbf1cSTom Rinipoint defined in the header.  As these locations overlap by default, it
1385d4dbf1cSTom Riniwould leave us with an image that if written to MMC will not boot, so
1395d4dbf1cSTom Riniinstead of using the loadaddr variable we use 0x81000000 in the following
1405d4dbf1cSTom Riniexample.  In this example we are loading from the network, for simplicity,
1415d4dbf1cSTom Riniand assume a valid partition table already exists and 'mmc dev' has already
1425d4dbf1cSTom Rinibeen run to select the correct device.  Also note that if you previously
1435d4dbf1cSTom Rinihad a FAT partition (such as on a Beaglebone Black) it is not enough to
1445d4dbf1cSTom Riniwrite garbage into the area, you must delete it from the partition table
1455d4dbf1cSTom Rinifirst.
1465d4dbf1cSTom Rini
1475d4dbf1cSTom Rini# Ensure we are able to talk with this mmc device
1485d4dbf1cSTom RiniU-Boot # mmc rescan
1495d4dbf1cSTom RiniU-Boot # tftp 81000000 am335x/MLO
1505d4dbf1cSTom Rini# Write to two of the backup locations ROM uses
1515d4dbf1cSTom RiniU-Boot # mmc write 81000000 100 100
1525d4dbf1cSTom RiniU-Boot # mmc write 81000000 200 100
1535d4dbf1cSTom Rini# Write U-Boot to the location set in the config
1545d4dbf1cSTom RiniU-Boot # tftp 81000000 am335x/u-boot.img
1555d4dbf1cSTom RiniU-Boot # mmc write 81000000 300 400
1565d4dbf1cSTom Rini# Load kernel and device tree into memory, perform export
1575d4dbf1cSTom RiniU-Boot # tftp 81000000 am335x/uImage
1585d4dbf1cSTom RiniU-Boot # run findfdt
1595d4dbf1cSTom RiniU-Boot # tftp ${fdtaddr} am335x/${fdtfile}
1605d4dbf1cSTom RiniU-Boot # run mmcargs
1615d4dbf1cSTom RiniU-Boot # spl export fdt 81000000 - ${fdtaddr}
1625d4dbf1cSTom Rini# Write the updated device tree to MMC
1635d4dbf1cSTom RiniU-Boot # mmc write ${fdtaddr} 80 80
1645d4dbf1cSTom Rini# Write the uImage to MMC
1655d4dbf1cSTom RiniU-Boot # mmc write 81000000 900 2000
1665d4dbf1cSTom Rini
1675d4dbf1cSTom RiniFalcon Mode: FAT SD cards
1685d4dbf1cSTom Rini=========================
1695d4dbf1cSTom Rini
1705d4dbf1cSTom RiniIn this case the additional file is written to the filesystem.  In this
1715d4dbf1cSTom Riniexample we assume that the uImage and device tree to be used are already on
1725d4dbf1cSTom Rinithe FAT filesystem (only the uImage MUST be for this to function
1735d4dbf1cSTom Riniafterwards) along with a Falcon Mode aware MLO and the FAT partition has
1745d4dbf1cSTom Rinialready been created and marked bootable:
1755d4dbf1cSTom Rini
1765d4dbf1cSTom RiniU-Boot # mmc rescan
1775d4dbf1cSTom Rini# Load kernel and device tree into memory, perform export
1785d4dbf1cSTom RiniU-Boot # load mmc 0:1 ${loadaddr} uImage
1795d4dbf1cSTom RiniU-Boot # run findfdt
1805d4dbf1cSTom RiniU-Boot # load mmc 0:1 ${fdtaddr} ${fdtfile}
1815d4dbf1cSTom RiniU-Boot # run mmcargs
1825d4dbf1cSTom RiniU-Boot # spl export fdt ${loadaddr} - ${fdtaddr}
1835d4dbf1cSTom Rini
1845d4dbf1cSTom RiniThis will print a number of lines and then end with something like:
1855d4dbf1cSTom Rini   Using Device Tree in place at 80f80000, end 80f85928
1865d4dbf1cSTom Rini   Using Device Tree in place at 80f80000, end 80f88928
1875d4dbf1cSTom RiniSo then you:
1885d4dbf1cSTom Rini
1895d4dbf1cSTom RiniU-Boot # fatwrite mmc 0:1 0x80f80000 args 8928
1905d4dbf1cSTom Rini
1915d4dbf1cSTom RiniFalcon Mode: NAND
1925d4dbf1cSTom Rini=================
1935d4dbf1cSTom Rini
1945d4dbf1cSTom RiniIn this case the additional data is written to another partition of the
1955d4dbf1cSTom RiniNAND.  In this example we assume that the uImage and device tree to be are
196*fa840b09SJeremiah Mahleralready located on the NAND somewhere (such as filesystem or mtd partition)
1975d4dbf1cSTom Rinialong with a Falcon Mode aware MLO written to the correct locations for
1985d4dbf1cSTom Rinibooting and mtdparts have been configured correctly for the board:
1995d4dbf1cSTom Rini
2005d4dbf1cSTom RiniU-Boot # nand read ${loadaddr} kernel
2015d4dbf1cSTom RiniU-Boot # load nand rootfs ${fdtaddr} /boot/am335x-evm.dtb
2025d4dbf1cSTom RiniU-Boot # run nandargs
2035d4dbf1cSTom RiniU-Boot # spl export fdt ${loadaddr} - ${fdtaddr}
2045d4dbf1cSTom RiniU-Boot # nand erase.part u-boot-spl-os
2055d4dbf1cSTom RiniU-Boot # nand write ${fdtaddr} u-boot-spl-os
206