1. 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
  2. 29 Dec, 2019 2 commits
  3. 14 Dec, 2019 3 commits
  4. 04 Dec, 2019 1 commit
  5. 28 Jun, 2019 1 commit
  6. 08 Jun, 2019 1 commit
    • Samuel Holland's avatar
      allwinner: Disable unused features to save space · 8f31853b
      Samuel Holland authored
      
      
      As all Allwinner platforms are single-cluster A53 chips, we can disable
      support for newer, unsupported architecture extensions. We can also
      avoid some cache maintenance code, since no platform-specific setup is
      required to enable coherency.
      
      These changes reduce the size of .text on a default build with GCC 9.1
      enough that .vectors again fits in the second half of a page, instead
      of requiring its own page.
      
      This commit was boot-tested on the Pinebook.
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Change-Id: Ib90454ef0c798d5e714b7780c585be0b1ed49c6d
      8f31853b
  7. 10 Apr, 2019 1 commit
  8. 18 Feb, 2019 2 commits
  9. 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
  10. 07 Dec, 2018 1 commit
    • Julius Werner's avatar
      drivers/console: Link console framework code by default · 985ee0b7
      Julius Werner authored
      
      
      This patch makes the build system link the console framework code by
      default, like it already does with other common libraries (e.g. cache
      helpers). This should not make a difference in practice since TF is
      linked with --gc-sections, so the linker will garbage collect all
      functions and data that are not referenced by any other code. Thus, if a
      platform doesn't want to include console code for size reasons and
      doesn't make any references to console functions, the code will not be
      included in the final binary.
      
      To avoid compatibility issues with older platform ports, only make this
      change for the MULTI_CONSOLE_API.
      
      Change-Id: I153a9dbe680d57aadb860d1c829759ba701130d3
      Signed-off-by: default avatarJulius Werner <jwerner@chromium.org>
      985ee0b7
  11. 14 Nov, 2018 1 commit
    • Andre Przywara's avatar
      allwinner: A64/H5: setup missing bus clocks · 19a7507a
      Andre Przywara authored
      
      
      The legacy Allwinner ATF port used to setup some clocks, and U-Boot is
      still relying on this. We don't need to setup the full set, as the SPL
      is doing most of it, but it misses one clock (AHB2) and programs another
      (AHB1) to quite conservative values.
      
      Fix this up during the platform setup to improve USB and Ethernet
      performance, iperf values go up by 31% in my setup with that patch.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      19a7507a
  12. 08 Nov, 2018 1 commit
    • Antonio Nino Diaz's avatar
      Standardise header guards across codebase · c3cf06f1
      Antonio Nino Diaz authored
      
      
      All identifiers, regardless of use, that start with two underscores are
      reserved. This means they can't be used in header guards.
      
      The style that this project is now to use the full name of the file in
      capital letters followed by 'H'. For example, for a file called
      "uart_example.h", the header guard is UART_EXAMPLE_H.
      
      The exceptions are files that are imported from other projects:
      
      - CryptoCell driver
      - dt-bindings folders
      - zlib headers
      
      Change-Id: I50561bf6c88b491ec440d0c8385c74650f3c106e
      Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
      c3cf06f1
  13. 20 Oct, 2018 12 commits
    • Andre Przywara's avatar
      allwinner: Use the arisc to turn off ARM cores · 7db0c960
      Andre Przywara authored
      
      
      PSCI requires a core to turn itself off, which we can't do properly by
      just executing an algorithm on that very core. As a consequence we just
      put a core into WFI on CPU_OFF right now.
      To fix this let's task the "arisc" management processor (an OpenRISC
      core) with that task of asserting reset and turning off the core's power
      domain. We use a handcrafted sequence of OpenRISC instructions to
      achieve this, and hand this data over to the new sunxi_execute_arisc_code()
      routine.
      The commented source code for this routine is provided in a separate file,
      but the ATF code contains the already encoded instructions as data.
      The H6 uses the same algorithm, but differs in the MMIO addresses, so
      provide a SoC (family) specific copy of that code.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      7db0c960
    • Andre Przywara's avatar
      allwinner: Prepare for executing code on the management processor · 11480b90
      Andre Przywara authored
      
      
      The more recent Allwinner SoCs contain an OpenRISC management
      controller (called arisc or CPUS), which shares the bus with the ARM cores,
      but runs on a separate power domain. This is meant to handle power
      management with the ARM cores off.
      There are efforts to run sophisticated firmware on that core
      (communicating via SCPI with the ARM world), but for now can use it for
      the rather simple task of helping to turn the ARM cores off. As this
      cannot be done by ARM code itself (because execution stops at the
      first of the three required steps), we can offload some instructions to
      this management processor.
      This introduces a helper function to hand over a bunch of instructions
      and triggers execution. We introduce a bakery lock to avoid two cores
      trying to use that (single) arisc core. The arisc code is expected to
      put itself into reset after is has finished execution.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      11480b90
    • 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
  14. 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
  15. 07 Sep, 2018 2 commits
  16. 20 Jul, 2018 1 commit
  17. 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
  18. 28 Jun, 2018 7 commits