1. 20 Oct, 2018 10 commits
    • Andre Przywara's avatar
      allwinner: Pass FDT address to sunxi_pmic_setup() · df301601
      Andre Przywara authored
      
      
      For Allwinner boards we now use some heuritistics to find a preloaded
      .dtb file.
      
      Pass this address on to the PMIC setup routine, so that it can use the
      information contained therein to setup some initial power rails.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      df301601
    • 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: H6: Factor out I2C platform setup · d5ddf67a
      Andre Przywara authored
      
      
      In the H6 platform code there is a routine to do the platform
      initialisation of the R_I2C controller. We will need a very similar
      setup routine to initialise the RSB controller on the A64.
      
      Move this code to sunxi_common.c and generalise it to support all SoCs
      and also to cover the related RSB bus.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      d5ddf67a
    • Andre Przywara's avatar
      allwinner: Introduce GPIO helper function · 7020dca0
      Andre Przywara authored
      
      
      Many boards without a dedicated PMIC contain simple regulators, which
      can be controlled via GPIO pins.
      
      To later allow turning them off easily, introduce a simple function to
      configure a given pin as a GPIO out pin and set it to the desired level.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      7020dca0
    • Andre Przywara's avatar
      allwinner: Export sunxi_private.h · 4ec1a239
      Andre Przywara authored
      
      
      So far we have a sunxi_private.h header file in the common code directory.
      This holds the prototypes of various functions we share in *common*
      code. However we will need some of those in the platform specific code
      parts as well, and want to introduce new functions shared across the
      whole platform port.
      
      So move the sunxi_private.h file into the common/include directory, so
      that it becomes visible to all parts of the platform code.
      Fix up the existing #includes and add missing ones, also add the
      sunxi_read_soc_id() prototype here.
      
      This will be used in follow up patches.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      4ec1a239
    • Andre Przywara's avatar
      allwinner: Pass SoC ID to sunxi_pmic_setup() · fe57c7d4
      Andre Przywara authored
      
      
      In the BL31 platform setup we read the Allwinner SoC ID to identify the
      chip and print its name.
      In addition to that we will need to differentiate the power setup
      between the SoCs, to pass on the SoC ID to the PMIC setup routine.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      fe57c7d4
    • Andre Przywara's avatar
      allwinner: Introduce names for SoC IDs · 123bcb3f
      Andre Przywara authored
      
      
      We will soon make more use of the Allwinner SoC ID, to differentiate the
      platform setup.
      Introduce definitions to avoid dealing with magic numbers and make the
      code more readable.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      123bcb3f
    • 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
    • Andre Przywara's avatar
      allwinner: Unify platform.mk files · a80490c5
      Andre Przywara authored
      
      
      For the two different platforms we support in the Allwinner port we
      mostly rely on header files covering the differences. This leads to the
      platform.mk files in the respective directories to be almost identical.
      
      To avoid further divergence and make sure that one platform doesn't
      break accidentally, let's create a shared allwinner-common.mk file and
      include that from the platform directory.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      a80490c5
  2. 19 Sep, 2018 1 commit
    • Andre Przywara's avatar
      drivers: i2c: mentor: move platform code into header files · dfc0fb27
      Andre Przywara authored
      
      
      At the moment we have two I2C stub drivers (for the Allwinner and the
      Marvell platform), which #include the actual .c driver file.
      Change this into the more usual design, by renaming and moving the stub
      drivers into platform specific header files and including these from the
      actual driver file. The platform specific include directories make sure
      the driver picks up the right header automatically.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      dfc0fb27
  3. 07 Sep, 2018 2 commits
  4. 20 Jul, 2018 1 commit
  5. 03 Jul, 2018 1 commit
    • Andre Przywara's avatar
      allwinner: Add Allwinner H6 SoC support · bed42a5d
      Andre Przywara authored
      
      
      The H6 is Allwinner's most recent SoC. It shares most peripherals with the
      other ARMv8 Allwinner SoCs (A64/H5), but has a completely different memory
      map.
      
      Introduce a separate platform target, which includes a different header
      file to cater for the address differences. Also add the new build target
      to the documentation.
      
      The new ATF platform name is "sun50i_h6".
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      bed42a5d
  6. 28 Jun, 2018 7 commits
  7. 23 Jun, 2018 1 commit
  8. 15 Jun, 2018 4 commits
    • Andre Przywara's avatar
      allwinner: Add security setup · acb8b3ca
      Andre Przywara authored
      
      
      Some peripherals are TrustZone aware, so they need to be configured to
      be accessible from non-secure world, as we don't need any of them being
      exclusive to the secure world.
      This affects some clocks, DMA channels and the Secure Peripheral
      Controller (SPC). The latter controls access to most devices, but is not
      active unless booting with the secure boot fuse burnt.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      acb8b3ca
    • Samuel Holland's avatar
      allwinner: Add platform PSCI functions required for SMP · 560581ec
      Samuel Holland authored
      
      
      The reset vector entry point is preserved across CPU resets, so it only
      needs to be set once at boot.
      
      Hotplugged CPUs are not actually powered down, but are put in a wfi with
      the GIC disconnected.
      
      With this commit, Linux is able to enable, hotplug and use all four CPUs.
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      560581ec
    • Samuel Holland's avatar
      allwinner: Add functions to control CPU power/reset · 333d66cf
      Samuel Holland authored
      
      
      sun50i_cpu_on will be used by the PSCI implementation to initialize
      secondary cores for SMP. Unfortunately, sun50i_cpu_off is not usable by
      PSCI directly, because it is not possible for a CPU to use this function
      to power itself down. Power cannot be shut off until the outputs are
      clamped, and MMIO does not work once the outputs are clamped.
      
      But at least CPU0 can shutdown the other cores early in the BL31 boot
      process and before shutting down the system.
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      333d66cf
    • 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