1. 15 Mar, 2021 1 commit
  2. 12 Jan, 2021 1 commit
    • Andre Przywara's avatar
      fel: Add FIT image parsing and loading · 14b3492e
      Andre Przywara authored
      So far sunxi-fel expects a legacy U-Boot image after the SPL, when
      called with the "uboot" command.
      This only works for (current) 32-bit builds, which only need one image
      to load (U-Boot proper).
      
      64-bit builds also include at least a Trusted Firmware binary, and also
      might contain a firmware image for the ARISC management processor. So
      we use the more capable FIT image, which can contain multiple images
      to load.
      
      Introduce support for that, by adding code to parse a FIT image, find
      the image files included, and load them to their respective load
      addresses. On the way we keep track of the entry point, that only one of
      those images provides, and also note the architecture of this image
      (ARMv7 or AArch64).
      On top of that we detect which of the images is the actual U-Boot proper
      image, and append the chosen DTB to the end of it.
      
      This all mimics the code U-Boot's SPL uses to achieve the same goal when
      running from MMC or SPI flash, compare the implementation of
      spl_load_simple_fit() in U-Boot's common/spl/spl_fit.c:
      https://gitlab.denx.de/u-boot/u-boot/-/blob/master/common/spl/spl_fit.c
      
      
      
      This requires the libfdt library for parsing the FIT image (which is in
      fact a devicetree blob).
      Signed-off-by: default avatarAndre Przywara <osp@andrep.de>
      14b3492e
  3. 11 Jan, 2021 4 commits
    • Andre Przywara's avatar
      fel: Detect (and report) FIT image · 65412b14
      Andre Przywara authored
      
      
      In preparation for proper FIT image support, detect a FIT image by
      checking its first four byte against the DTB magic.
      
      Report this as not-yet-supported to the user, for now.
      Signed-off-by: default avatarAndre Przywara <osp@andrep.de>
      65412b14
    • Andre Przywara's avatar
      fel: Parse SPL DT name · 5541673d
      Andre Przywara authored
      
      
      A while ago the SPL header was extended to hold the name of the DTB file
      that shall be used for the board a firmware image is made for.
      
      Add some code to extract that name from the SPL header. This will be
      used in later patches to load the proper DTB file.
      Signed-off-by: default avatarAndre Przywara <osp@andrep.de>
      5541673d
    • Andre Przywara's avatar
      fel: autoboot: Support entering in AArch64 · 059b8311
      Andre Przywara authored
      
      
      So far FEL was limited to 32-bit payloads only, but this will change.
      To accomodate 64-bit entry points, introduce a corresponding flag and
      use either the normal FEL execute call or the RMR request to kick off
      execution.
      Signed-off-by: default avatarAndre Przywara <osp@andrep.de>
      059b8311
    • Andre Przywara's avatar
      fel: Skip uploading empty image · f917e69d
      Andre Przywara authored
      
      
      Our FEL code does not deal very well with the upload size being 0.
      
      Check for that before calling any USB routines, and skip the call
      entirely. Mark the buffer as "const" on the way, since we have no
      business other than reading from it.
      
      That helps to properly skip dummy images later.
      Signed-off-by: default avatarAndre Przywara <osp@andrep.de>
      f917e69d
  4. 03 Jan, 2021 1 commit
  5. 31 Dec, 2020 5 commits
    • Andre Przywara's avatar
      fel: A64/H5: Allow bigger SPL size · ada24830
      Andre Przywara authored
      
      
      The A64 and H5 have a rather generous SRAM C directly adjacent to
      SRAM A1, so we can make use of the larger continuous SRAM area to
      increase the maximum SPL size.
      
      Move the location of the FEL stack backup buffer up, towards the end of
      SRAM C. We restrict ourselves to the slightly tighter requirements of
      the H5, to be able to still share the joint swap_buffers data structure.
      Signed-off-by: default avatarAndre Przywara <osp@andrep.de>
      ada24830
    • Andre Przywara's avatar
      fel: H6: Allow bigger SPL size · 2f59b574
      Andre Przywara authored
      
      
      The H6 has quite a large chunk of continuous SRAM, and also the BROM
      allows to load eGON images far bigger than 32KB.
      
      Move the FEL stack backup buffers and the thunk address towards the end
      of SRAM C, so that we have a larger chunk of continuous SRAM available
      for the SPL.
      Signed-off-by: default avatarAndre Przywara <osp@andrep.de>
      2f59b574
    • Andre Przywara's avatar
      fel: H616: Allow bigger SPL size · 2a2af190
      Andre Przywara authored
      
      
      The H616 has quite a large chunk of continuous SRAM, and also the BROM
      allows to load eGON images far bigger than 32KB. U-Boot's SPL is
      actually relying on this, as we need more code for the PMIC and DRAM
      driver.
      
      Move the FEL stack backup buffers and the thunk address towards the end
      of SRAM C, so that we have a larger chunk of continuous SRAM available
      for the SPL.
      Signed-off-by: default avatarAndre Przywara <osp@andrep.de>
      2a2af190
    • Andre Przywara's avatar
      fel: Observe SRAM size to extend SPL load size · 4c6a1a01
      Andre Przywara authored
      
      
      At the moment we limit the maximum SPL load size to 32 KB, because this
      was a BROM limit in previous SoCs.
      Newer SoCs (H6 and later) lift this limit, but also this tool is not
      bound by the BROM limit, since we can load any size.
      
      Use the just introduced SRAM size to establish an upper limit for the
      SPL size, then limit this as we go if any part of the memory is used for
      the FEL backup buffers.
      
      Given the buffer addresses chosen wisely, this can drastically increase
      the maximum SPL load size, even on those SoCs with a 32KB BROM limit.
      Signed-off-by: default avatarAndre Przywara <osp@andrep.de>
      4c6a1a01
    • Andre Przywara's avatar
      soc_info: Introduce SRAM size · 276a97da
      Andre Przywara authored
      
      
      At the moment we assume the SPL load size to be limited to 32KB, even
      though many SoCs have more SRAM A1 or a large SRAM C directly after SRAM
      A1.
      
      To later allow to extend the SPL load size, let's introduce a SoC
      specific variable to hold the SRAM size after the SPL load address. This
      could either cover the whole of SRAM A1, or even SRAM C, if that is
      contiguous to SRAM A1.
      
      Eventually this variable is meant to hold the *usable* SRAM size, so not
      including regions that are used by the BROM code. However this value is
      very SoC specific and not documented, and the SPL size is limited by the
      thunk and stack buffers anyway at the moment, so the values used here
      right now are just taken from the respective manuals.
      Signed-off-by: default avatarAndre Przywara <osp@andrep.de>
      276a97da
  6. 29 Dec, 2020 3 commits
    • Andre Przywara's avatar
      fel: Check actual SPL size before considering U-Boot proper · 75960dd2
      Andre Przywara authored
      
      
      At the moment we always use a 32KB offset to place the U-Boot image
      after the SPL.
      Newer SoCs can (and will) have bigger SPLs, so we need to become more
      flexible with this offset.
      
      Read the actual SPL size, and assume the U-Boot payload is located right
      behind the SPL, if the SPL size is bigger than 32KB.
      We use at least 32KB, because this is how U-Boot is doing it today, even
      when the SPL size is actually smaller than that.
      Signed-off-by: default avatarAndre Przywara <osp@andrep.de>
      75960dd2
    • Andre Przywara's avatar
      fel: Fix SPL size check against thunk addr · 2b67b2d7
      Andre Przywara authored
      
      
      We have a check to avoid that the SPL accidentally overwrites the thunk
      buffer we use to execute code on the board.
      
      Unfortunately this compares the SPL *size* against the thunk *address*,
      which is only valid when the SPL starts at 0 (older 32-bit SoCs).
      
      Factor in the SoC dependent SPL start address, to make this check work
      properly on newer (64-bit) SoCs.
      Signed-off-by: default avatarAndre Przywara <osp@andrep.de>
      2b67b2d7
    • Andre Przywara's avatar
      fel: Check for U-Boot image before considering checksum · 8af203ec
      Andre Przywara authored
      
      
      Currently we check the U-Boot (legacy!) image header checksum very early
      and bail out with an error message if it does not match.
      
      Move that check later into the function, *after* we have established
      that we are actually dealing with such an U-Boot image.
      
      This avoids confusing error messages in case there is no U-Boot image
      used at all.
      Signed-off-by: default avatarAndre Przywara <osp@andrep.de>
      8af203ec
  7. 23 Nov, 2020 1 commit
  8. 19 Nov, 2020 1 commit
  9. 12 Nov, 2020 1 commit
  10. 10 Nov, 2020 6 commits
  11. 08 Nov, 2020 1 commit
  12. 20 Oct, 2020 1 commit
  13. 19 Oct, 2020 1 commit
  14. 08 Oct, 2020 1 commit
  15. 06 Oct, 2020 1 commit
  16. 02 Oct, 2020 1 commit
  17. 29 Sep, 2020 7 commits
  18. 19 Sep, 2020 2 commits
    • Icenowy Zheng's avatar
      fel: SPI: add Eon support · bf02fd31
      Icenowy Zheng authored
      
      
      Add the JEDEC manufacturer ID for Eon to the list of recognized
      vendors, also add the EN25QH series to the list of supported chips.
      Those chips are used on some internal boards with V831 from Sipeed now,
      but the chips themselves are widely available on the market. Tag the
      struct definition with the member names on the way to improve readability
      of the SPI flash chip description.
      Signed-off-by: default avatarIcenowy Zheng <icenowy@aosc.io>
      bf02fd31
    • Icenowy Zheng's avatar
      spi: add support for V3s SoC · b330eeb8
      Icenowy Zheng authored
      
      
      The Allwinner V3s SoC have the same SPI0 pinmux configuration, SPI clock
      configuration and SPI controller (base address and the controller) with
      H3.
      
      Add spiflash support for it.
      Signed-off-by: default avatarIcenowy Zheng <icenowy@aosc.io>
      b330eeb8
  19. 14 Sep, 2020 1 commit