1*4882a593SmuzhiyunSummary 2*4882a593Smuzhiyun======= 3*4882a593Smuzhiyun 4*4882a593SmuzhiyunThis document covers various features of the 'am335x_evm' build, and some of 5*4882a593Smuzhiyunthe related build targets (am335x_evm_uartN, etc). 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunHardware 8*4882a593Smuzhiyun======== 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunThe binary produced by this board supports, based on parsing of the EEPROM 11*4882a593Smuzhiyundocumented in TI's reference designs: 12*4882a593Smuzhiyun- AM335x GP EVM 13*4882a593Smuzhiyun- AM335x EVM SK 14*4882a593Smuzhiyun- Beaglebone White 15*4882a593Smuzhiyun- Beaglebone Black 16*4882a593Smuzhiyun 17*4882a593SmuzhiyunCustomization 18*4882a593Smuzhiyun============= 19*4882a593Smuzhiyun 20*4882a593SmuzhiyunGiven that all of the above boards are reference platforms (and the 21*4882a593SmuzhiyunBeaglebone platforms are OSHA), it is likely that this platform code and 22*4882a593Smuzhiyunconfiguration will be used as the basis of a custom platform. It is 23*4882a593Smuzhiyunworth noting that aside from things such as NAND or MMC only being 24*4882a593Smuzhiyunrequired if a custom platform makes use of these blocks, the following 25*4882a593Smuzhiyunare required, depending on design: 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun- GPIO is only required if DDR3 power is controlled in a way similar to 28*4882a593Smuzhiyun EVM SK 29*4882a593Smuzhiyun- SPI is only required for SPI flash, or exposing the SPI bus. 30*4882a593Smuzhiyun 31*4882a593SmuzhiyunThe following blocks are required: 32*4882a593Smuzhiyun- I2C, to talk with the PMIC and ensure that we do not run afoul of 33*4882a593Smuzhiyun errata 1.0.24. 34*4882a593Smuzhiyun 35*4882a593SmuzhiyunWhen removing options as part of customization, 36*4882a593SmuzhiyunCONFIG_EXTRA_ENV_SETTINGS will need additional care to update for your 37*4882a593Smuzhiyunneeds and to remove no longer relevant options as in some cases we 38*4882a593Smuzhiyundefine additional text blocks (such as for NAND or DFU strings). Also 39*4882a593Smuzhiyunnote that all of the SPL options are grouped together, rather than with 40*4882a593Smuzhiyunthe IP blocks, so both areas will need their choices updated to reflect 41*4882a593Smuzhiyunthe custom design. 42*4882a593Smuzhiyun 43*4882a593SmuzhiyunNAND 44*4882a593Smuzhiyun==== 45*4882a593Smuzhiyun 46*4882a593SmuzhiyunThe AM335x GP EVM ships with a 256MiB NAND available in most profiles. In 47*4882a593Smuzhiyunthis example to program the NAND we assume that an SD card has been 48*4882a593Smuzhiyuninserted with the files to write in the first SD slot and that mtdparts 49*4882a593Smuzhiyunhave been configured correctly for the board. All images are first loaded 50*4882a593Smuzhiyuninto memory, then written to NAND. 51*4882a593Smuzhiyun 52*4882a593SmuzhiyunStep-1: Building u-boot for NAND boot 53*4882a593Smuzhiyun Set following CONFIGxx options for NAND device. 54*4882a593Smuzhiyun CONFIG_SYS_NAND_PAGE_SIZE number of main bytes in NAND page 55*4882a593Smuzhiyun CONFIG_SYS_NAND_OOBSIZE number of OOB bytes in NAND page 56*4882a593Smuzhiyun CONFIG_SYS_NAND_BLOCK_SIZE number of bytes in NAND erase-block 57*4882a593Smuzhiyun CONFIG_SYS_NAND_ECCPOS ECC map for NAND page 58*4882a593Smuzhiyun CONFIG_NAND_OMAP_ECCSCHEME (refer doc/README.nand) 59*4882a593Smuzhiyun 60*4882a593SmuzhiyunStep-2: Flashing NAND via MMC/SD 61*4882a593Smuzhiyun # select BOOTSEL to MMC/SD boot and boot from MMC/SD card 62*4882a593Smuzhiyun U-Boot # mmc rescan 63*4882a593Smuzhiyun # erase flash 64*4882a593Smuzhiyun U-Boot # nand erase.chip 65*4882a593Smuzhiyun U-Boot # env default -f -a 66*4882a593Smuzhiyun U-Boot # saveenv 67*4882a593Smuzhiyun # flash MLO. Redundant copies of MLO are kept for failsafe 68*4882a593Smuzhiyun U-Boot # load mmc 0 0x82000000 MLO 69*4882a593Smuzhiyun U-Boot # nand write 0x82000000 0x00000 0x20000 70*4882a593Smuzhiyun U-Boot # nand write 0x82000000 0x20000 0x20000 71*4882a593Smuzhiyun U-Boot # nand write 0x82000000 0x40000 0x20000 72*4882a593Smuzhiyun U-Boot # nand write 0x82000000 0x60000 0x20000 73*4882a593Smuzhiyun # flash u-boot.img 74*4882a593Smuzhiyun U-Boot # load mmc 0 0x82000000 u-boot.img 75*4882a593Smuzhiyun U-Boot # nand write 0x82000000 0x80000 0x60000 76*4882a593Smuzhiyun # flash kernel image 77*4882a593Smuzhiyun U-Boot # load mmc 0 0x82000000 uImage 78*4882a593Smuzhiyun U-Boot # nand write 0x82000000 ${nandsrcaddr} ${nandimgsize} 79*4882a593Smuzhiyun # flash filesystem image 80*4882a593Smuzhiyun U-Boot # load mmc 0 0x82000000 filesystem.img 81*4882a593Smuzhiyun U-Boot # nand write 0x82000000 ${loadaddress} 0x300000 82*4882a593Smuzhiyun 83*4882a593SmuzhiyunStep-3: Set BOOTSEL pin to select NAND boot, and POR the device. 84*4882a593Smuzhiyun The device should boot from images flashed on NAND device. 85*4882a593Smuzhiyun 86*4882a593SmuzhiyunNOR 87*4882a593Smuzhiyun=== 88*4882a593Smuzhiyun 89*4882a593SmuzhiyunThe Beaglebone White can be equipped with a "memory cape" that in turn can 90*4882a593Smuzhiyunhave a NOR module plugged into it. In this case it is then possible to 91*4882a593Smuzhiyunprogram and boot from NOR. Note that due to how U-Boot is designed we 92*4882a593Smuzhiyunmust build a specific version of U-Boot that knows we have NOR flash. This 93*4882a593Smuzhiyunbuild is named 'am335x_evm_nor'. Further, we have a 'am335x_evm_norboot' 94*4882a593Smuzhiyunbuild that will assume that the environment is on NOR rather than NAND. In 95*4882a593Smuzhiyunthe following example we assume that and SD card has been populated with 96*4882a593SmuzhiyunMLO and u-boot.img from a 'am335x_evm_nor' build and also contains the 97*4882a593Smuzhiyun'u-boot.bin' from a 'am335x_evm_norboot' build. When booting from NOR, a 98*4882a593Smuzhiyunbinary must be written to the start of NOR, with no header or similar 99*4882a593Smuzhiyunprepended. In the following example we use a size of 512KiB (0x80000) 100*4882a593Smuzhiyunas that is how much space we set aside before the environment, as per 101*4882a593Smuzhiyunthe config file. 102*4882a593Smuzhiyun 103*4882a593SmuzhiyunU-Boot # mmc rescan 104*4882a593SmuzhiyunU-Boot # load mmc 0 ${loadaddr} u-boot.bin 105*4882a593SmuzhiyunU-Boot # protect off 08000000 +80000 106*4882a593SmuzhiyunU-Boot # erase 08000000 +80000 107*4882a593SmuzhiyunU-Boot # cp.b ${loadaddr} 08000000 ${filesize} 108*4882a593Smuzhiyun 109*4882a593SmuzhiyunFalcon Mode 110*4882a593Smuzhiyun=========== 111*4882a593Smuzhiyun 112*4882a593SmuzhiyunThe default build includes "Falcon Mode" (see doc/README.falcon) via NAND, 113*4882a593SmuzhiyuneMMC (or raw SD cards) and FAT SD cards. Our default behavior currently is 114*4882a593Smuzhiyunto read a 'c' on the console while in SPL at any point prior to loading the 115*4882a593SmuzhiyunOS payload (so as soon as possible) to opt to booting full U-Boot. Also 116*4882a593Smuzhiyunnote that while one can program Falcon Mode "in place" great care needs to 117*4882a593Smuzhiyunbe taken by the user to not 'brick' their setup. As these are all eval 118*4882a593Smuzhiyunboards with multiple boot methods, recovery should not be an issue in this 119*4882a593Smuzhiyunworst-case however. 120*4882a593Smuzhiyun 121*4882a593SmuzhiyunFalcon Mode: eMMC 122*4882a593Smuzhiyun================= 123*4882a593Smuzhiyun 124*4882a593SmuzhiyunThe recommended layout in this case is: 125*4882a593Smuzhiyun 126*4882a593SmuzhiyunMMC BLOCKS |--------------------------------| LOCATION IN BYTES 127*4882a593Smuzhiyun0x0000 - 0x007F : MBR or GPT table : 0x000000 - 0x020000 128*4882a593Smuzhiyun0x0080 - 0x00FF : ARGS or FDT file : 0x010000 - 0x020000 129*4882a593Smuzhiyun0x0100 - 0x01FF : SPL.backup1 (first copy used) : 0x020000 - 0x040000 130*4882a593Smuzhiyun0x0200 - 0x02FF : SPL.backup2 (second copy used) : 0x040000 - 0x060000 131*4882a593Smuzhiyun0x0300 - 0x06FF : U-Boot : 0x060000 - 0x0e0000 132*4882a593Smuzhiyun0x0700 - 0x08FF : U-Boot Env + Redundant : 0x0e0000 - 0x120000 133*4882a593Smuzhiyun0x0900 - 0x28FF : Kernel : 0x120000 - 0x520000 134*4882a593Smuzhiyun 135*4882a593SmuzhiyunNote that when we run 'spl export' it will prepare to boot the kernel. 136*4882a593SmuzhiyunThis includes relocation of the uImage from where we loaded it to the entry 137*4882a593Smuzhiyunpoint defined in the header. As these locations overlap by default, it 138*4882a593Smuzhiyunwould leave us with an image that if written to MMC will not boot, so 139*4882a593Smuzhiyuninstead of using the loadaddr variable we use 0x81000000 in the following 140*4882a593Smuzhiyunexample. In this example we are loading from the network, for simplicity, 141*4882a593Smuzhiyunand assume a valid partition table already exists and 'mmc dev' has already 142*4882a593Smuzhiyunbeen run to select the correct device. Also note that if you previously 143*4882a593Smuzhiyunhad a FAT partition (such as on a Beaglebone Black) it is not enough to 144*4882a593Smuzhiyunwrite garbage into the area, you must delete it from the partition table 145*4882a593Smuzhiyunfirst. 146*4882a593Smuzhiyun 147*4882a593Smuzhiyun# Ensure we are able to talk with this mmc device 148*4882a593SmuzhiyunU-Boot # mmc rescan 149*4882a593SmuzhiyunU-Boot # tftp 81000000 am335x/MLO 150*4882a593Smuzhiyun# Write to two of the backup locations ROM uses 151*4882a593SmuzhiyunU-Boot # mmc write 81000000 100 100 152*4882a593SmuzhiyunU-Boot # mmc write 81000000 200 100 153*4882a593Smuzhiyun# Write U-Boot to the location set in the config 154*4882a593SmuzhiyunU-Boot # tftp 81000000 am335x/u-boot.img 155*4882a593SmuzhiyunU-Boot # mmc write 81000000 300 400 156*4882a593Smuzhiyun# Load kernel and device tree into memory, perform export 157*4882a593SmuzhiyunU-Boot # tftp 81000000 am335x/uImage 158*4882a593SmuzhiyunU-Boot # run findfdt 159*4882a593SmuzhiyunU-Boot # tftp ${fdtaddr} am335x/${fdtfile} 160*4882a593SmuzhiyunU-Boot # run mmcargs 161*4882a593SmuzhiyunU-Boot # spl export fdt 81000000 - ${fdtaddr} 162*4882a593Smuzhiyun# Write the updated device tree to MMC 163*4882a593SmuzhiyunU-Boot # mmc write ${fdtaddr} 80 80 164*4882a593Smuzhiyun# Write the uImage to MMC 165*4882a593SmuzhiyunU-Boot # mmc write 81000000 900 2000 166*4882a593Smuzhiyun 167*4882a593SmuzhiyunFalcon Mode: FAT SD cards 168*4882a593Smuzhiyun========================= 169*4882a593Smuzhiyun 170*4882a593SmuzhiyunIn this case the additional file is written to the filesystem. In this 171*4882a593Smuzhiyunexample we assume that the uImage and device tree to be used are already on 172*4882a593Smuzhiyunthe FAT filesystem (only the uImage MUST be for this to function 173*4882a593Smuzhiyunafterwards) along with a Falcon Mode aware MLO and the FAT partition has 174*4882a593Smuzhiyunalready been created and marked bootable: 175*4882a593Smuzhiyun 176*4882a593SmuzhiyunU-Boot # mmc rescan 177*4882a593Smuzhiyun# Load kernel and device tree into memory, perform export 178*4882a593SmuzhiyunU-Boot # load mmc 0:1 ${loadaddr} uImage 179*4882a593SmuzhiyunU-Boot # run findfdt 180*4882a593SmuzhiyunU-Boot # load mmc 0:1 ${fdtaddr} ${fdtfile} 181*4882a593SmuzhiyunU-Boot # run mmcargs 182*4882a593SmuzhiyunU-Boot # spl export fdt ${loadaddr} - ${fdtaddr} 183*4882a593Smuzhiyun 184*4882a593SmuzhiyunThis will print a number of lines and then end with something like: 185*4882a593Smuzhiyun Using Device Tree in place at 80f80000, end 80f85928 186*4882a593Smuzhiyun Using Device Tree in place at 80f80000, end 80f88928 187*4882a593SmuzhiyunSo then you: 188*4882a593Smuzhiyun 189*4882a593SmuzhiyunU-Boot # fatwrite mmc 0:1 0x80f80000 args 8928 190*4882a593Smuzhiyun 191*4882a593SmuzhiyunFalcon Mode: NAND 192*4882a593Smuzhiyun================= 193*4882a593Smuzhiyun 194*4882a593SmuzhiyunIn this case the additional data is written to another partition of the 195*4882a593SmuzhiyunNAND. In this example we assume that the uImage and device tree to be are 196*4882a593Smuzhiyunalready located on the NAND somewhere (such as filesystem or mtd partition) 197*4882a593Smuzhiyunalong with a Falcon Mode aware MLO written to the correct locations for 198*4882a593Smuzhiyunbooting and mtdparts have been configured correctly for the board: 199*4882a593Smuzhiyun 200*4882a593SmuzhiyunU-Boot # nand read ${loadaddr} kernel 201*4882a593SmuzhiyunU-Boot # load nand rootfs ${fdtaddr} /boot/am335x-evm.dtb 202*4882a593SmuzhiyunU-Boot # run nandargs 203*4882a593SmuzhiyunU-Boot # spl export fdt ${loadaddr} - ${fdtaddr} 204*4882a593SmuzhiyunU-Boot # nand erase.part u-boot-spl-os 205*4882a593SmuzhiyunU-Boot # nand write ${fdtaddr} u-boot-spl-os 206