u-boot/board/ti/am335x
Heiko Schocher 6789e84eca i2c, omap24xx: convert driver to new mutlibus/mutliadapter framework
- add omap24xx driver to new multibus/multiadpater support
- adapted all config files, which uses this driver

Tested on the am335x based siemens boards rut, dxr2 and pxm2
posted here:
http://patchwork.ozlabs.org/patch/263211/

Signed-off-by: Heiko Schocher <hs@denx.de>
Tested-by: Tom Rini <trini@ti.com>
Cc: Lars Poeschel <poeschel@lemonage.de>
Cc: Steve Sakoman <sakoman@gmail.com>
Cc: Thomas Weber <weber@corscience.de>
Cc: Tom Rix <Tom.Rix@windriver.com>
Cc: Grazvydas Ignotas <notasas@gmail.com>
Cc: Enric Balletbo i Serra <eballetbo@iseebcn.com>
Cc: Luca Ceresoli <luca.ceresoli@comelit.it>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Cc: Ilya Yanok <yanok@emcraft.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Nishanth Menon <nm@ti.com>
Cc: Pali Rohár <pali.rohar@gmail.com>
Cc: Peter Barada <peter.barada@logicpd.com>
Cc: Nagendra T S  <nagendra@mistralsolutions.com>
Cc: Michael Jones <michael.jones@matrix-vision.de>
Cc: Raphael Assenat <raph@8d.com>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Acked-by: Stefano Babic <sbabic@denx.de>
2013-11-13 06:18:17 +01:00
..
board.c i2c, omap24xx: convert driver to new mutlibus/mutliadapter framework 2013-11-13 06:18:17 +01:00
board.h am335x_evm: Rework board_is_foo() checks 2013-07-30 09:21:41 -04:00
Makefile board: ti: convert makefiles to Kbuild style 2013-10-31 13:26:44 -04:00
mux.c ARM: AM33xx: Move s_init to a common place 2013-08-15 08:51:10 -04:00
README am335x_evm: Update README for customization 2013-08-28 11:44:59 -04:00
u-boot.lds am335x_evm: Add support to boot from NOR. 2013-07-30 09:21:41 -04:00

Summary
=======

This document covers various features of the 'am335x_evm' build, and some of
the related build targets (am335x_evm_uartN, etc).

Hardware
========

The binary produced by this board supports, based on parsing of the EEPROM
documented in TI's reference designs:
- AM335x GP EVM
- AM335x EVM SK
- Beaglebone White
- Beaglebone Black

Customization
=============

Given that all of the above boards are reference platforms (and the
Beaglebone platforms are OSHA), it is likely that this platform code and
configuration will be used as the basis of a custom platform.  It is
worth noting that aside from things such as NAND or MMC only being
required if a custom platform makes use of these blocks, the following
are required, depending on design:

- GPIO is only required if DDR3 power is controlled in a way similar to
  EVM SK
- SPI is only required for SPI flash, or exposing the SPI bus.

The following blocks are required:
- I2C, to talk with the PMIC and ensure that we do not run afoul of
  errata 1.0.24.

When removing options as part of customization,
CONFIG_EXTRA_ENV_SETTINGS will need additional care to update for your
needs and to remove no longer relevant options as in some cases we
define additional text blocks (such as for NAND or DFU strings).  Also
note that all of the SPL options are grouped together, rather than with
the IP blocks, so both areas will need their choices updated to reflect
the custom design.

NAND
====

The AM335x GP EVM ships with a 256MiB NAND available in most profiles.  In
this example to program the NAND we assume that an SD card has been
inserted with the files to write in the first SD slot and that mtdparts
have been configured correctly for the board.  As a time saving measure we
load MLO into memory in one location, copy it into the three locatations
that the ROM checks for additional valid copies, then load U-Boot into
memory.  We then write that whole section of memory to NAND.

U-Boot # mmc rescan
U-Boot # env default -f -a
U-Boot # nand erase.chip
U-Boot # saveenv
U-Boot # load mmc 0 81000000 MLO
U-Boot # cp.b 81000000 81020000 20000
U-Boot # cp.b 81000000 81040000 20000
U-Boot # cp.b 81000000 81060000 20000
U-Boot # load mmc 0 81080000 u-boot.img
U-Boot # nand write 81000000 0 260000
U-Boot # load mmc 0 ${loadaddr} uImage
U-Boot # nand write ${loadaddr} kernel 500000

NOR
===

The Beaglebone White can be equiped with a "memory cape" that in turn can
have a NOR module plugged into it.  In this case it is then possible to
program and boot from NOR.  Note that due to how U-Boot is architectured we
must build a specific version of U-Boot that knows we have NOR flash.  This
build is named 'am335x_evm_nor'.  Further, we have a 'am335x_evm_norboot'
build that will assume that the environment is on NOR rather than NAND.  In
the following example we assume that and SD card has been populated with
MLO and u-boot.img from a 'am335x_evm_nor' build and also contains the
'u-boot.bin' from a 'am335x_evm_norboot' build.  When booting from NOR, a
binary must be written to the start of NOR, with no header or similar
prepended.  In the following example we use a size of 512KiB (0x80000)
as that is how much space we set aside before the environment, as per
the config file.

U-Boot # mmc rescan
U-Boot # load mmc 0 ${loadaddr} u-boot.bin
U-Boot # protect off 08000000 +80000
U-Boot # erase 08000000 +80000
U-Boot # cp.b ${loadaddr} 08000000 ${filesize}

Falcon Mode
===========

The default build includes "Falcon Mode" (see doc/README.falcon) via NAND,
eMMC (or raw SD cards) and FAT SD cards.  Our default behavior currently is
to read a 'c' on the console while in SPL at any point prior to loading the
OS payload (so as soon as possible) to opt to booting full U-Boot.  Also
note that while one can program Falcon Mode "in place" great care needs to
be taken by the user to not 'brick' their setup.  As these are all eval
boards with multiple boot methods, recovery should not be an issue in this
worst-case however.

Falcon Mode: eMMC
=================

The recommended layout in this case is:

MMC BLOCKS      |--------------------------------| LOCATION IN BYTES
0x0000 - 0x007F : MBR or GPT table               : 0x000000 - 0x020000
0x0080 - 0x00FF : ARGS or FDT file               : 0x010000 - 0x020000
0x0100 - 0x01FF : SPL.backup1 (first copy used)  : 0x020000 - 0x040000
0x0200 - 0x02FF : SPL.backup2 (second copy used) : 0x040000 - 0x060000
0x0300 - 0x06FF : U-Boot                         : 0x060000 - 0x0e0000
0x0700 - 0x08FF : U-Boot Env + Redundant         : 0x0e0000 - 0x120000
0x0900 - 0x28FF : Kernel                         : 0x120000 - 0x520000

Note that when we run 'spl export' it will prepare to boot the kernel.
This includes relocation of the uImage from where we loaded it to the entry
point defined in the header.  As these locations overlap by default, it
would leave us with an image that if written to MMC will not boot, so
instead of using the loadaddr variable we use 0x81000000 in the following
example.  In this example we are loading from the network, for simplicity,
and assume a valid partition table already exists and 'mmc dev' has already
been run to select the correct device.  Also note that if you previously
had a FAT partition (such as on a Beaglebone Black) it is not enough to
write garbage into the area, you must delete it from the partition table
first.

# Ensure we are able to talk with this mmc device
U-Boot # mmc rescan
U-Boot # tftp 81000000 am335x/MLO
# Write to two of the backup locations ROM uses
U-Boot # mmc write 81000000 100 100
U-Boot # mmc write 81000000 200 100
# Write U-Boot to the location set in the config
U-Boot # tftp 81000000 am335x/u-boot.img
U-Boot # mmc write 81000000 300 400
# Load kernel and device tree into memory, perform export
U-Boot # tftp 81000000 am335x/uImage
U-Boot # run findfdt
U-Boot # tftp ${fdtaddr} am335x/${fdtfile}
U-Boot # run mmcargs
U-Boot # spl export fdt 81000000 - ${fdtaddr}
# Write the updated device tree to MMC
U-Boot # mmc write ${fdtaddr} 80 80
# Write the uImage to MMC
U-Boot # mmc write 81000000 900 2000

Falcon Mode: FAT SD cards
=========================

In this case the additional file is written to the filesystem.  In this
example we assume that the uImage and device tree to be used are already on
the FAT filesystem (only the uImage MUST be for this to function
afterwards) along with a Falcon Mode aware MLO and the FAT partition has
already been created and marked bootable:

U-Boot # mmc rescan
# Load kernel and device tree into memory, perform export
U-Boot # load mmc 0:1 ${loadaddr} uImage
U-Boot # run findfdt
U-Boot # load mmc 0:1 ${fdtaddr} ${fdtfile}
U-Boot # run mmcargs
U-Boot # spl export fdt ${loadaddr} - ${fdtaddr}

This will print a number of lines and then end with something like:
   Using Device Tree in place at 80f80000, end 80f85928
   Using Device Tree in place at 80f80000, end 80f88928
So then you:

U-Boot # fatwrite mmc 0:1 0x80f80000 args 8928

Falcon Mode: NAND
=================

In this case the additional data is written to another partition of the
NAND.  In this example we assume that the uImage and device tree to be are
already located on the NAND somewhere (such as fileystem or mtd partition)
along with a Falcon Mode aware MLO written to the correct locations for
booting and mtdparts have been configured correctly for the board:

U-Boot # nand read ${loadaddr} kernel
U-Boot # load nand rootfs ${fdtaddr} /boot/am335x-evm.dtb
U-Boot # run nandargs
U-Boot # spl export fdt ${loadaddr} - ${fdtaddr}
U-Boot # nand erase.part u-boot-spl-os
U-Boot # nand write ${fdtaddr} u-boot-spl-os