Neha Malcom Francis | b61ad15 | 2023-09-08 15:06:16 +0530 | [diff] [blame^] | 1 | .. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause |
| 2 | .. sectionauthor:: Neha Malcom Francis <n-francis@ti.com> |
| 3 | |
| 4 | AM43xx Generation |
| 5 | ================= |
| 6 | |
| 7 | Secure Boot |
| 8 | ----------- |
| 9 | |
| 10 | .. include:: am335x_evm.rst |
| 11 | :start-after: .. secure_boot_include_start_config_ti_secure_device |
| 12 | :end-before: .. secure_boot_include_end_config_ti_secure_device |
| 13 | |
| 14 | .. include:: am335x_evm.rst |
| 15 | :start-after: .. secure_boot_include_start_spl_boot |
| 16 | :end-before: .. secure_boot_include_end_spl_boot |
| 17 | |
| 18 | <IMAGE_FLAG> is a value that specifies the type of the image to |
| 19 | generate OR the action the image generation tool will take. Valid |
| 20 | values are: |
| 21 | |
| 22 | .. list-table:: |
| 23 | :widths: 25 25 |
| 24 | :header-rows: 0 |
| 25 | |
| 26 | * - SPI_X-LOADER |
| 27 | - Generates an image for SPI flash (byte swapped) |
| 28 | * - XIP_X-LOADER |
| 29 | - Generates a single stage u-boot for NOR/QSPI XiP |
| 30 | * - ISSW |
| 31 | - Generates an image for all other boot modes |
| 32 | |
| 33 | <INPUT_FILE> is the full path and filename of the public world boot |
| 34 | loaderbinary file (depending on the boot media, this is usually |
| 35 | either u-boot-spl.bin or u-boot.bin). |
| 36 | |
| 37 | <OUTPUT_FILE> is the full path and filename of the final secure |
| 38 | image. The output binary images should be used in place of the standard |
| 39 | non-secure binary images (see the platform-specific user's guides and |
| 40 | releases notes for how the non-secure images are typically used) |
| 41 | |
| 42 | .. list-table:: |
| 43 | :widths: 25 25 |
| 44 | :header-rows: 0 |
| 45 | |
| 46 | * - u-boot-spl_HS_SPI_X-LOADER |
| 47 | - byte swapped boot image for SPI flash |
| 48 | * - u-boot_HS_XIP_X-LOADER |
| 49 | - boot image for NOR or QSPI Xip flash |
| 50 | * - u-boot-spl_HS_ISSW |
| 51 | - boot image for all other boot media |
| 52 | |
| 53 | |
| 54 | <SPL_LOAD_ADDR> is the address at which SOC ROM should load the |
| 55 | <INPUT_FILE> |
| 56 | |
| 57 | .. include:: am335x_evm.rst |
| 58 | :start-after: .. secure_boot_include_start_primary_u_boot |
| 59 | :end-before: .. secure_boot_include_end_primary_u_boot |
| 60 | |
| 61 | .. qspi_boot_support_include_start |
| 62 | |
| 63 | QSPI U-Boot support |
| 64 | ------------------- |
| 65 | |
| 66 | Host processor is connected to serial flash device via qpsi |
| 67 | interface. QSPI is a kind of spi module that allows single, |
| 68 | dual and quad read access to external spi devices. The module |
| 69 | has a memory mapped interface which provide direct interface |
| 70 | for accessing data form external spi devices. |
| 71 | |
| 72 | The one QSPI in the device is primarily intended for fast booting |
| 73 | from Quad SPI flash devices. |
| 74 | |
| 75 | Usecase |
| 76 | ^^^^^^^ |
| 77 | |
| 78 | MLO/u-boot.img will be flashed from SD/MMC to the flash device |
| 79 | using serial flash erase and write commands. Then, switch settings |
| 80 | will be changed to qspi boot. Then, the ROM code will read MLO |
| 81 | from the predefined location in the flash, where it was flashed and |
| 82 | execute it after storing it in SDRAM. Then, the MLO will read |
| 83 | u-boot.img from flash and execute it from SDRAM. |
| 84 | |
| 85 | SPI mode |
| 86 | ^^^^^^^^ |
| 87 | |
| 88 | SPI mode uses mtd spi framework for transfer and reception of data. |
| 89 | Can be used in: |
| 90 | |
| 91 | #. Normal mode: use single pin for transfers |
| 92 | #. Dual Mode: use two pins for transfers. |
| 93 | #. Quad mode: use four pin for transfer |
| 94 | |
| 95 | Memory mapped read mode |
| 96 | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 97 | |
| 98 | In this, SPI controller is configured using configuration port and then |
| 99 | controller is switched to memory mapped port for data read. |
| 100 | |
| 101 | Driver |
| 102 | ^^^^^^ |
| 103 | |
| 104 | drivers/qspi/ti_qspi.c |
| 105 | - File which is responsible for configuring the |
| 106 | qspi controller and also for providing the low level api which |
| 107 | is responsible for transferring the datas from host controller |
| 108 | to flash device and vice versa. |
| 109 | |
| 110 | .. qspi_boot_support_include_end |
| 111 | |
| 112 | Testing |
| 113 | ^^^^^^^ |
| 114 | |
| 115 | These are the testing details of qspi flash driver with Macronix M25L51235 |
| 116 | flash device. |
| 117 | |
| 118 | The test includes |
| 119 | - probing the flash device |
| 120 | - erasing the flash device |
| 121 | - Writing to flash |
| 122 | - Reading the contents of the flash. |
| 123 | |
| 124 | Test Log |
| 125 | |
| 126 | .. code-block:: bash |
| 127 | |
| 128 | Hit any key to stop autoboot: 0 |
| 129 | => sf probe 0 |
| 130 | SF: Detected MX25L51235F with page size 256 Bytes, erase size 64 KiB, total 64 MiB, mapped at 30000000 |
| 131 | => sf erase 0 0x80000 |
| 132 | SF: 524288 bytes @ 0x0 Erased: OK |
| 133 | => mw 81000000 0xdededede 0x40000 |
| 134 | => sf write 81000000 0 0x40000 |
| 135 | SF: 262144 bytes @ 0x0 Written: OK |
| 136 | => sf read 82000000 0 0x40000 |
| 137 | SF: 262144 bytes @ 0x0 Read: OK |
| 138 | => md 0x82000000 |
| 139 | 82000000: dededede dededede dededede dededede ................ |
| 140 | 82000010: dededede dededede dededede dededede ................ |
| 141 | 82000020: dededede dededede dededede dededede ................ |
| 142 | 82000030: dededede dededede dededede dededede ................ |
| 143 | 82000040: dededede dededede dededede dededede ................ |
| 144 | 82000050: dededede dededede dededede dededede ................ |
| 145 | 82000060: dededede dededede dededede dededede ................ |
| 146 | 82000070: dededede dededede dededede dededede ................ |
| 147 | 82000080: dededede dededede dededede dededede ................ |
| 148 | 82000090: dededede dededede dededede dededede ................ |
| 149 | 820000a0: dededede dededede dededede dededede ................ |
| 150 | 820000b0: dededede dededede dededede dededede ................ |
| 151 | 820000c0: dededede dededede dededede dededede ................ |
| 152 | 820000d0: dededede dededede dededede dededede ................ |
| 153 | 820000e0: dededede dededede dededede dededede ................ |
| 154 | 820000f0: dededede dededede dededede dededede ................ |
| 155 | => md 0x82010000 |
| 156 | 82010000: dededede dededede dededede dededede ................ |
| 157 | 82010010: dededede dededede dededede dededede ................ |
| 158 | 82010020: dededede dededede dededede dededede ................ |
| 159 | 82010030: dededede dededede dededede dededede ................ |
| 160 | 82010040: dededede dededede dededede dededede ................ |
| 161 | 82010050: dededede dededede dededede dededede ................ |
| 162 | 82010060: dededede dededede dededede dededede ................ |
| 163 | 82010070: dededede dededede dededede dededede ................ |
| 164 | 82010080: dededede dededede dededede dededede ................ |
| 165 | 82010090: dededede dededede dededede dededede ................ |
| 166 | 820100a0: dededede dededede dededede dededede ................ |
| 167 | 820100b0: dededede dededede dededede dededede ................ |
| 168 | 820100c0: dededede dededede dededede dededede ................ |
| 169 | 820100d0: dededede dededede dededede dededede ................ |
| 170 | 820100e0: dededede dededede dededede dededede ................ |
| 171 | 820100f0: dededede dededede dededede dededede ................ |
| 172 | => md 0x82030000 |
| 173 | 82030000: dededede dededede dededede dededede ................ |
| 174 | 82030010: dededede dededede dededede dededede ................ |
| 175 | 82030020: dededede dededede dededede dededede ................ |
| 176 | 82030030: dededede dededede dededede dededede ................ |
| 177 | 82030040: dededede dededede dededede dededede ................ |
| 178 | 82030050: dededede dededede dededede dededede ................ |
| 179 | 82030060: dededede dededede dededede dededede ................ |
| 180 | 82030070: dededede dededede dededede dededede ................ |
| 181 | 82030080: dededede dededede dededede dededede ................ |
| 182 | 82030090: dededede dededede dededede dededede ................ |
| 183 | 820300a0: dededede dededede dededede dededede ................ |
| 184 | 820300b0: dededede dededede dededede dededede ................ |
| 185 | 820300c0: dededede dededede dededede dededede ................ |
| 186 | 820300d0: dededede dededede dededede dededede ................ |
| 187 | 820300e0: dededede dededede dededede dededede ................ |
| 188 | 820300f0: dededede dededede dededede dededede ................ |