1. 14 Dec, 2020 1 commit
    • Samuel Holland's avatar
      allwinner: Fix non-default PRELOADED_BL33_BASE · 3d36d8e6
      Samuel Holland authored
      
      
      While the Allwinner platform code nominally supported a custom
      PRELOADED_BL33_BASE, some references to the BL33 load address used
      another constant: PLAT_SUNXI_NS_IMAGE_OFFSET. To allow the DTB search
      code to work if a U-Boot BL33 is loaded to a custom address,
      consistently use PRELOADED_BL33_BASE. And to avoid this confusion in
      the future, remove the other constant.
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Change-Id: Ie6b97ae1fdec95d784676aef39200bef161471b0
      3d36d8e6
  2. 13 Feb, 2020 3 commits
    • Samuel Holland's avatar
      allwinner: Implement PSCI system suspend using SCPI · e382c88e
      Samuel Holland authored
      
      
      If an SCP firmware is present and able to communicate via SCPI, then use
      that to implement CPU and system power state transitions, including CPU
      hotplug and system suspend. Otherwise, fall back to the existing CPU
      power control implementation.
      
      The last 16 KiB of SRAM A2 are reserved for the SCP firmware, and the
      SCPI shared memory is at the very end of this region (and therefore the
      end of SRAM A2). BL31 continues to start at the beginning of SRAM A2
      (not counting the ARISC exception vector area) and fills up to the
      beginning of the SCP firmware.
      
      Because the SCP firmware is not loaded adjacent to the ARISC exception
      vector area, the jump instructions used for exception handling cannot be
      included in the SCP firmware image, and must be initialized here before
      turning on the SCP.
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Change-Id: I37b9b9636f94d4125230423726f3ac5e9cdb551c
      e382c88e
    • Samuel Holland's avatar
      allwinner: Reserve and map space for the SCP firmware · 57b36632
      Samuel Holland authored
      
      
      The SCP firmware is allocated the last 16KiB of SRAM A2. This includes
      the SCPI shared memory area, which must be mapped as MT_DEVICE to
      prevent problems with cache coherency between the AP CPUs and the SCP.
      For simplicity, map the whole SCP region as MT_DEVICE.
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Change-Id: Ie39eb5ff281b8898a3c1d9748dc08755f528e2f8
      57b36632
    • Samuel Holland's avatar
      allwinner: Adjust SRAM A2 base to include the ARISC vectors · ae3fe6e3
      Samuel Holland authored
      
      
      The ARISC vector area consists of 0x4000 bytes before the beginning of
      usable SRAM. Still, it is technically a part of SRAM A2, so include it
      in the memory definition. This avoids the confusing practice of
      subtracting from the beginning of the SRAM region when referencing the
      ARISC vectors.
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Change-Id: Iae89e01aeab93560159562692e03e88306e2a1bf
      ae3fe6e3
  3. 24 Jan, 2020 1 commit
  4. 20 Jan, 2020 1 commit
    • Samuel Holland's avatar
      allwinner: Clean up MMU setup · ddb4c9e0
      Samuel Holland authored
      
      
      Remove the general BL31 mmap region: it duplicates the existing static
      mapping for the entire SRAM region. Use the helper definitions when
      applicable to simplify the code and add the MT_EXECUTE_NEVER flag.
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Change-Id: I7a6b79e50e4b5c698774229530dd3d2a89e94a6d
      ddb4c9e0
  5. 15 Jan, 2020 1 commit
    • Samuel Holland's avatar
      allwinner: Reenable USE_COHERENT_MEM · 6c281cc3
      Samuel Holland authored
      
      
      Now that there is plenty of space (32 KiB) available for NOBITS
      sections, we can afford using an entire page for coherent memory. In
      fact, because it simplifies the code, this is a beneficial change for
      loaded image (.text) size, where we are still close to the size limit.
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Change-Id: I0b899dabcb162015c63b0e4aed0869569c889ed9
      6c281cc3
  6. 29 Dec, 2019 1 commit
  7. 04 Jan, 2019 1 commit
    • Antonio Nino Diaz's avatar
      Sanitise includes across codebase · 09d40e0e
      Antonio Nino Diaz authored
      Enforce full include path for includes. Deprecate old paths.
      
      The following folders inside include/lib have been left unchanged:
      
      - include/lib/cpus/${ARCH}
      - include/lib/el3_runtime/${ARCH}
      
      The reason for this change is that having a global namespace for
      includes isn't a good idea. It defeats one of the advantages of having
      folders and it introduces problems that are sometimes subtle (because
      you may not know the header you are actually including if there are two
      of them).
      
      For example, this patch had to be created because two headers were
      called the same way: e0ea0928 ("Fix gpio includes of mt8173 platform
      to avoid collision."). More recently, this patch has had similar
      problems: 46f9b2c3 ("drivers: add tzc380 support").
      
      This problem was introduced in commit 4ecca339
      
       ("Move include and
      source files to logical locations"). At that time, there weren't too
      many headers so it wasn't a real issue. However, time has shown that
      this creates problems.
      
      Platforms that want to preserve the way they include headers may add the
      removed paths to PLAT_INCLUDES, but this is discouraged.
      
      Change-Id: I39dc53ed98f9e297a5966e723d1936d6ccf2fc8f
      Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
      09d40e0e
  8. 20 Oct, 2018 3 commits
    • Andre Przywara's avatar
      allwinner: Find DTB in BL33 image · 41538930
      Andre Przywara authored
      
      
      The initial PMIC setup for the Allwinner platform is quite board
      specific, and used to be guarded by reading the .dtb stub *name* from the
      SPL image in the legacy ATF port. This doesn't scale particularly well,
      and requires constant maintainance.
      Instead having the actual .dtb available would be much better, as the PMIC
      setup requirements could be read from there directly.
      The only available BL33 for Allwinner platforms so far is U-Boot, and
      fortunately U-Boot comes with the full featured .dtb, appended to the
      end of the U-Boot image.
      
      Introduce some code that scans the beginning of the BL33 image to look
      for the load address, which is followed by the image size. Adding those
      two values together gives us the end of the image and thus the .dtb
      address. Verify that this heuristic is valid by sanitising some values
      and checking the DTB magic.
      
      Print out the DTB address and the model name, if specified in the root
      node.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      41538930
    • Andre Przywara's avatar
      allwinner: Disable USE_COHERENT_MEM · 43060513
      Andre Przywara authored
      
      
      According to the documentation, platforms may choose to trade memory
      footprint for performance (and elegancy) by not providing a separately
      mapped coherent page.
      
      Since a debug build is getting close to the SRAM size limit already, this
      allows us to save about 3.5KB of BSS and have some room for future
      enhancements.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      43060513
    • Andre Przywara's avatar
      allwinner: Adjust memory mapping to fit into 256MB · c3af6b00
      Andre Przywara authored
      
      
      At the moment we map as much of the DRAM into EL3 as possible, however
      we actually don't use it. The only exception is the secure DRAM for
      BL32 (if that is configured).
      
      To decrease the memory footprint of ATF, we save on some page tables by
      reducing the memory mapping to the actually required regions: SRAM, device
      MMIO, secure DRAM and U-Boot (to be used later).
      This introduces a non-identity mapping for the DRAM regions.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      c3af6b00
  9. 20 Jul, 2018 1 commit
  10. 28 Jun, 2018 2 commits
  11. 23 Jun, 2018 1 commit
  12. 15 Jun, 2018 1 commit
    • Samuel Holland's avatar
      allwinner: Introduce basic platform support · 58032586
      Samuel Holland authored
      
      
      This platform supports Allwinner's SoCs with ARMv8 cores. So far they
      all sport a single cluster of Cortex-A53 cores.
      
      "sunxi" is the original code name used for this platform, and since it
      appears in the Linux kernel and in U-Boot as well, we use it here as a
      short file name prefix and for identifiers.
      
      This port includes BL31 support only. U-Boot's SPL takes the role of the
      primary loader, also doing the DRAM initialization. It then loads the
      rest of the firmware, namely ATF and U-Boot (BL33), then hands execution
      over to ATF.
      
      This commit includes the basic platform code shared across all SoCs.
      There is no platform.mk yet.
      
      [Andre: moved files into proper directories, supported RESET_TO_BL31,
      	various clean ups and simplifications ]
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      58032586