Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause |
| 2 | .. sectionauthor:: Tom Rini <trini@konsulko.com> |
| 3 | |
Bryan Brattlof | 0820e11 | 2022-12-19 14:29:49 -0600 | [diff] [blame] | 4 | AM335x Generation |
| 5 | ================= |
| 6 | |
Tom Rini | 5d4dbf1 | 2013-07-08 12:15:18 -0400 | [diff] [blame] | 7 | Summary |
Bryan Brattlof | 0820e11 | 2022-12-19 14:29:49 -0600 | [diff] [blame] | 8 | ------- |
Tom Rini | 5d4dbf1 | 2013-07-08 12:15:18 -0400 | [diff] [blame] | 9 | |
Tom Rini | b829224 | 2021-09-11 08:57:32 -0400 | [diff] [blame] | 10 | This document covers various features of the `am335x_evm` default |
| 11 | configuration, some of the related defconfigs, and how to enable hardware |
| 12 | features not present by default in the defconfigs. |
Tom Rini | 5d4dbf1 | 2013-07-08 12:15:18 -0400 | [diff] [blame] | 13 | |
| 14 | Hardware |
Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 15 | -------- |
Tom Rini | 5d4dbf1 | 2013-07-08 12:15:18 -0400 | [diff] [blame] | 16 | |
| 17 | The binary produced by this board supports, based on parsing of the EEPROM |
| 18 | documented in TI's reference designs: |
Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 19 | * AM335x GP EVM |
| 20 | * AM335x EVM SK |
Tom Rini | b829224 | 2021-09-11 08:57:32 -0400 | [diff] [blame] | 21 | * The Beaglebone family of designs |
Tom Rini | d7ccfc5 | 2013-08-20 08:53:50 -0400 | [diff] [blame] | 22 | |
| 23 | Customization |
Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 24 | ------------- |
Tom Rini | d7ccfc5 | 2013-08-20 08:53:50 -0400 | [diff] [blame] | 25 | |
| 26 | Given that all of the above boards are reference platforms (and the |
| 27 | Beaglebone platforms are OSHA), it is likely that this platform code and |
| 28 | configuration will be used as the basis of a custom platform. It is |
| 29 | worth noting that aside from things such as NAND or MMC only being |
| 30 | required if a custom platform makes use of these blocks, the following |
| 31 | are required, depending on design: |
| 32 | |
Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 33 | * GPIO is only required if DDR3 power is controlled in a way similar to EVM SK |
| 34 | * SPI is only required for SPI flash, or exposing the SPI bus. |
Tom Rini | d7ccfc5 | 2013-08-20 08:53:50 -0400 | [diff] [blame] | 35 | |
| 36 | The following blocks are required: |
Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 37 | |
| 38 | * I2C, to talk with the PMIC and ensure that we do not run afoul of |
Tom Rini | d7ccfc5 | 2013-08-20 08:53:50 -0400 | [diff] [blame] | 39 | errata 1.0.24. |
| 40 | |
Tom Rini | b829224 | 2021-09-11 08:57:32 -0400 | [diff] [blame] | 41 | When removing options as part of customization, note that you will likely need |
| 42 | to look at both `include/configs/am335x_evm.h`, |
| 43 | `include/configs/ti_am335x_common.h` and `include/configs/am335x_evm.h` as the |
| 44 | migration to Kconfig is not yet complete. |
Tom Rini | d7ccfc5 | 2013-08-20 08:53:50 -0400 | [diff] [blame] | 45 | |
Tom Rini | 97559b5 | 2013-07-17 12:24:30 -0400 | [diff] [blame] | 46 | NAND |
Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 47 | ---- |
Tom Rini | 97559b5 | 2013-07-17 12:24:30 -0400 | [diff] [blame] | 48 | |
| 49 | The AM335x GP EVM ships with a 256MiB NAND available in most profiles. In |
| 50 | this example to program the NAND we assume that an SD card has been |
| 51 | inserted with the files to write in the first SD slot and that mtdparts |
pekon gupta | 32f4d72 | 2013-11-19 11:02:18 +0530 | [diff] [blame] | 52 | have been configured correctly for the board. All images are first loaded |
| 53 | into memory, then written to NAND. |
Tom Rini | 97559b5 | 2013-07-17 12:24:30 -0400 | [diff] [blame] | 54 | |
pekon gupta | 32f4d72 | 2013-11-19 11:02:18 +0530 | [diff] [blame] | 55 | Step-1: Building u-boot for NAND boot |
| 56 | Set following CONFIGxx options for NAND device. |
| 57 | CONFIG_SYS_NAND_PAGE_SIZE number of main bytes in NAND page |
| 58 | CONFIG_SYS_NAND_OOBSIZE number of OOB bytes in NAND page |
| 59 | CONFIG_SYS_NAND_BLOCK_SIZE number of bytes in NAND erase-block |
Tom Rini | 4e59094 | 2022-11-12 17:36:51 -0500 | [diff] [blame] | 60 | CFG_SYS_NAND_ECCPOS ECC map for NAND page |
pekon gupta | 32f4d72 | 2013-11-19 11:02:18 +0530 | [diff] [blame] | 61 | CONFIG_NAND_OMAP_ECCSCHEME (refer doc/README.nand) |
| 62 | |
| 63 | Step-2: Flashing NAND via MMC/SD |
Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 64 | |
| 65 | .. code-block:: text |
| 66 | |
pekon gupta | 32f4d72 | 2013-11-19 11:02:18 +0530 | [diff] [blame] | 67 | # select BOOTSEL to MMC/SD boot and boot from MMC/SD card |
| 68 | U-Boot # mmc rescan |
| 69 | # erase flash |
| 70 | U-Boot # nand erase.chip |
| 71 | U-Boot # env default -f -a |
| 72 | U-Boot # saveenv |
| 73 | # flash MLO. Redundant copies of MLO are kept for failsafe |
| 74 | U-Boot # load mmc 0 0x82000000 MLO |
| 75 | U-Boot # nand write 0x82000000 0x00000 0x20000 |
| 76 | U-Boot # nand write 0x82000000 0x20000 0x20000 |
| 77 | U-Boot # nand write 0x82000000 0x40000 0x20000 |
| 78 | U-Boot # nand write 0x82000000 0x60000 0x20000 |
| 79 | # flash u-boot.img |
| 80 | U-Boot # load mmc 0 0x82000000 u-boot.img |
| 81 | U-Boot # nand write 0x82000000 0x80000 0x60000 |
| 82 | # flash kernel image |
| 83 | U-Boot # load mmc 0 0x82000000 uImage |
| 84 | U-Boot # nand write 0x82000000 ${nandsrcaddr} ${nandimgsize} |
| 85 | # flash filesystem image |
| 86 | U-Boot # load mmc 0 0x82000000 filesystem.img |
| 87 | U-Boot # nand write 0x82000000 ${loadaddress} 0x300000 |
| 88 | |
| 89 | Step-3: Set BOOTSEL pin to select NAND boot, and POR the device. |
| 90 | The device should boot from images flashed on NAND device. |
Tom Rini | 5d4dbf1 | 2013-07-08 12:15:18 -0400 | [diff] [blame] | 91 | |
Tom Rini | 486da22 | 2013-07-18 15:13:05 -0400 | [diff] [blame] | 92 | |
Tom Rini | 5d4dbf1 | 2013-07-08 12:15:18 -0400 | [diff] [blame] | 93 | Falcon Mode |
Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 94 | ----------- |
Tom Rini | 5d4dbf1 | 2013-07-08 12:15:18 -0400 | [diff] [blame] | 95 | |
| 96 | The default build includes "Falcon Mode" (see doc/README.falcon) via NAND, |
| 97 | eMMC (or raw SD cards) and FAT SD cards. Our default behavior currently is |
| 98 | to read a 'c' on the console while in SPL at any point prior to loading the |
| 99 | OS payload (so as soon as possible) to opt to booting full U-Boot. Also |
| 100 | note that while one can program Falcon Mode "in place" great care needs to |
| 101 | be taken by the user to not 'brick' their setup. As these are all eval |
| 102 | boards with multiple boot methods, recovery should not be an issue in this |
| 103 | worst-case however. |
| 104 | |
| 105 | Falcon Mode: eMMC |
Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 106 | ----------------- |
Tom Rini | 5d4dbf1 | 2013-07-08 12:15:18 -0400 | [diff] [blame] | 107 | |
| 108 | The recommended layout in this case is: |
| 109 | |
Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 110 | .. code-block:: text |
| 111 | |
| 112 | MMC BLOCKS |--------------------------------| LOCATION IN BYTES |
| 113 | 0x0000 - 0x007F : MBR or GPT table : 0x000000 - 0x020000 |
| 114 | 0x0080 - 0x00FF : ARGS or FDT file : 0x010000 - 0x020000 |
| 115 | 0x0100 - 0x01FF : SPL.backup1 (first copy used) : 0x020000 - 0x040000 |
| 116 | 0x0200 - 0x02FF : SPL.backup2 (second copy used) : 0x040000 - 0x060000 |
| 117 | 0x0300 - 0x06FF : U-Boot : 0x060000 - 0x0e0000 |
| 118 | 0x0700 - 0x08FF : U-Boot Env + Redundant : 0x0e0000 - 0x120000 |
| 119 | 0x0900 - 0x28FF : Kernel : 0x120000 - 0x520000 |
Tom Rini | 5d4dbf1 | 2013-07-08 12:15:18 -0400 | [diff] [blame] | 120 | |
| 121 | Note that when we run 'spl export' it will prepare to boot the kernel. |
| 122 | This includes relocation of the uImage from where we loaded it to the entry |
| 123 | point defined in the header. As these locations overlap by default, it |
| 124 | would leave us with an image that if written to MMC will not boot, so |
| 125 | instead of using the loadaddr variable we use 0x81000000 in the following |
| 126 | example. In this example we are loading from the network, for simplicity, |
| 127 | and assume a valid partition table already exists and 'mmc dev' has already |
| 128 | been run to select the correct device. Also note that if you previously |
| 129 | had a FAT partition (such as on a Beaglebone Black) it is not enough to |
| 130 | write garbage into the area, you must delete it from the partition table |
| 131 | first. |
| 132 | |
Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 133 | .. code-block:: text |
| 134 | |
| 135 | # Ensure we are able to talk with this mmc device |
| 136 | U-Boot # mmc rescan |
| 137 | U-Boot # tftp 81000000 am335x/MLO |
| 138 | # Write to two of the backup locations ROM uses |
| 139 | U-Boot # mmc write 81000000 100 100 |
| 140 | U-Boot # mmc write 81000000 200 100 |
| 141 | # Write U-Boot to the location set in the config |
| 142 | U-Boot # tftp 81000000 am335x/u-boot.img |
| 143 | U-Boot # mmc write 81000000 300 400 |
| 144 | # Load kernel and device tree into memory, perform export |
| 145 | U-Boot # tftp 81000000 am335x/uImage |
| 146 | U-Boot # run findfdt |
| 147 | U-Boot # tftp ${fdtaddr} am335x/${fdtfile} |
| 148 | U-Boot # run mmcargs |
| 149 | U-Boot # spl export fdt 81000000 - ${fdtaddr} |
| 150 | # Write the updated device tree to MMC |
| 151 | U-Boot # mmc write ${fdtaddr} 80 80 |
| 152 | # Write the uImage to MMC |
| 153 | U-Boot # mmc write 81000000 900 2000 |
Tom Rini | 5d4dbf1 | 2013-07-08 12:15:18 -0400 | [diff] [blame] | 154 | |
| 155 | Falcon Mode: FAT SD cards |
Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 156 | ------------------------- |
Tom Rini | 5d4dbf1 | 2013-07-08 12:15:18 -0400 | [diff] [blame] | 157 | |
| 158 | In this case the additional file is written to the filesystem. In this |
| 159 | example we assume that the uImage and device tree to be used are already on |
| 160 | the FAT filesystem (only the uImage MUST be for this to function |
| 161 | afterwards) along with a Falcon Mode aware MLO and the FAT partition has |
| 162 | already been created and marked bootable: |
| 163 | |
Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 164 | .. code-block:: text |
| 165 | |
| 166 | U-Boot # mmc rescan |
| 167 | # Load kernel and device tree into memory, perform export |
| 168 | U-Boot # load mmc 0:1 ${loadaddr} uImage |
| 169 | U-Boot # run findfdt |
| 170 | U-Boot # load mmc 0:1 ${fdtaddr} ${fdtfile} |
| 171 | U-Boot # run mmcargs |
| 172 | U-Boot # spl export fdt ${loadaddr} - ${fdtaddr} |
Tom Rini | 5d4dbf1 | 2013-07-08 12:15:18 -0400 | [diff] [blame] | 173 | |
| 174 | This will print a number of lines and then end with something like: |
Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 175 | |
| 176 | .. code-block:: text |
| 177 | |
| 178 | Using Device Tree in place at 80f80000, end 80f85928 |
| 179 | Using Device Tree in place at 80f80000, end 80f88928 |
| 180 | |
Tom Rini | 5d4dbf1 | 2013-07-08 12:15:18 -0400 | [diff] [blame] | 181 | So then you: |
| 182 | |
Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 183 | .. code-block:: text |
| 184 | |
| 185 | U-Boot # fatwrite mmc 0:1 0x80f80000 args 8928 |
Tom Rini | 5d4dbf1 | 2013-07-08 12:15:18 -0400 | [diff] [blame] | 186 | |
| 187 | Falcon Mode: NAND |
Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 188 | ----------------- |
Tom Rini | 5d4dbf1 | 2013-07-08 12:15:18 -0400 | [diff] [blame] | 189 | |
| 190 | In this case the additional data is written to another partition of the |
| 191 | NAND. In this example we assume that the uImage and device tree to be are |
Jeremiah Mahler | fa840b0 | 2015-01-06 16:40:28 -0800 | [diff] [blame] | 192 | already located on the NAND somewhere (such as filesystem or mtd partition) |
Tom Rini | 5d4dbf1 | 2013-07-08 12:15:18 -0400 | [diff] [blame] | 193 | along with a Falcon Mode aware MLO written to the correct locations for |
| 194 | booting and mtdparts have been configured correctly for the board: |
| 195 | |
Tom Rini | c8fff5d | 2021-09-11 08:57:31 -0400 | [diff] [blame] | 196 | .. code-block:: text |
| 197 | |
| 198 | U-Boot # nand read ${loadaddr} kernel |
| 199 | U-Boot # load nand rootfs ${fdtaddr} /boot/am335x-evm.dtb |
| 200 | U-Boot # run nandargs |
| 201 | U-Boot # spl export fdt ${loadaddr} - ${fdtaddr} |
| 202 | U-Boot # nand erase.part u-boot-spl-os |
| 203 | U-Boot # nand write ${fdtaddr} u-boot-spl-os |