1. 05 Aug, 2016 1 commit
    • Tom Rini's avatar
      ARM: Rework and correct barrier definitions · a78cd861
      Tom Rini authored
      As part of testing booting Linux kernels on Rockchip devices, it was
      discovered by Ziyuan Xu and Sandy Patterson that we had multiple and for
      some cases incomplete isb definitions.  This was causing a failure to
      boot of the Linux kernel.
      In order to solve this problem as well as cover any corner cases that we
      may also have had a number of changes are made in order to consolidate
      things.  First, <asm/barriers.h> now becomes the source of isb/dsb/dmb
      definitions.  This however introduces another complexity.  Due to
      needing to build SPL for 32bit tegra with -march=armv4 we need to borrow
      the __LINUX_ARM_ARCH__ logic from the Linux Kernel in a more complete
      form.  Move this from arch/arm/lib/Makefile to arch/arm/Makefile and add
      a comment about it.  Now that we can always know what the target CPU is
      capable off we can get always do the correct thing for the barrier.  The
      final part of this is that need to be consistent everywhere and call
      isb()/dsb()/dmb() and NOT call ISB/DSB/DMB in some cases and the
      function names in others.
      Reviewed-by: default avatarStephen Warren <swarren@nvidia.com>
      Tested-by: default avatarStephen Warren <swarren@nvidia.com>
      Acked-by: default avatarZiyuan Xu <xzy.xu@rock-chips.com>
      Acked-by: default avatarSandy Patterson <apatterson@sightlogix.com>
      Reported-by: default avatarZiyuan Xu <xzy.xu@rock-chips.com>
      Reported-by: default avatarSandy Patterson <apatterson@sightlogix.com>
      Signed-off-by: default avatarTom Rini <trini@konsulko.com>
  2. 12 May, 2016 1 commit
  3. 27 Apr, 2016 1 commit
    • Hans de Goede's avatar
      sunxi: mctl_mem_matches: Add missing memory barrier · bfb33f0b
      Hans de Goede authored
      We are running with the caches disabled when mctl_mem_matches gets called,
      but the cpu's write buffer is still there and can still get in the way,
      add a memory barrier to fix this.
      This avoids mctl_mem_matches always returning false in some cases, which
      was resulting in:
      U-Boot SPL 2015.07 (Apr 14 2016 - 18:47:26)
      DRAM: 1024 MiB
      U-Boot 2015.07 (Apr 14 2016 - 18:47:26 +0200) Allwinner Technology
      CPU:   Allwinner A23 (SUN8I)
      DRAM:  512 MiB
      Where 512 MiB is the right amount, but the DRAM controller would be
      initialized for 1024 MiB.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarIan Campbell <ijc@hellion.org.uk>
  4. 01 Apr, 2016 2 commits
  5. 16 Feb, 2015 1 commit
  6. 14 Jan, 2015 5 commits
    • Siarhei Siamashka's avatar
      sunxi: Fix buggy sun6i/sun8i DRAM size detection logic · c3d2b963
      Siarhei Siamashka authored
      After reboot, reset or even short power off, DRAM typically retains
      the old stale data for some period of time (for this type of memory,
      the bits of data are stored in slowly discharging capacitors).
      The current sun6i/sun8i DRAM size detection logic, which is
      inherited from the Allwinner code, relies on using a large magic
      signature with the hope that it is unique enough and unlikely to
      ever accidentally match this leftover garbage data in RAM. But
      this approach is inherently unsafe, as can be demonstrated using
      the following test program:
      /***** A testcase for reproducing the problem ******/
      void main(int argc, char *argv[])
          size_t size, i;
          uint32_t *buf;
          /* Allocate the buffer */
          if (argc < 2 || !(size = (size_t)atoi(argv[1]) * 1048576) ||
                          !(buf = malloc(size))) {
              printf("Need buffer size in MiB as a cmdline argument\n");
          /* Fill it with the Allwinner DRAM "magic" values */
          for (i = 0; i < size / 4; i++)
              buf[i] = 0xaa55aa55 + ((uintptr_t)&buf[i] / 4) % 64;
          /* Try to reboot */
          /* And wait */
          for (;;) {}
      If this test program is run on the device (giving it a large
      chunk of memory), then the DRAM size detection logic in u-boot
      gets confused after reboot and fails to initialize DRAM properly.
      A better approach is not to rely on luck and abstain from making
      any assumptions about the properties of the leftover garbage
      data in RAM. Instead just use a more reliable code for testing
      whether two different addresses refer to the same memory location.
      Signed-off-by: default avatarSiarhei Siamashka <siarhei.siamashka@gmail.com>
      Acked-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    • Hans de Goede's avatar
      sun8i: Add dram initialization support · 08fd1479
      Hans de Goede authored
      Based on the register / dram_para headers from the Allwinner u-boot / linux
      sources + the init sequences from boot0.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarIan Campbell <ijc@hellion.org.uk>
    • Hans de Goede's avatar
      sunxi: Use memcmp for mctl_mem_matches · 2367b44d
      Hans de Goede authored
      Use memcmp for mctl_mem_matches instead of DIY.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarIan Campbell <ijc@hellion.org.uk>
    • Hans de Goede's avatar
      sunxi: Fill memory before comparing it when doing dram init on sun6i · 5665f50e
      Hans de Goede authored
      The sun8i boot0 code fills the DRAM with a "random" pattern before comparing
      it at different offsets to do columns, etc. detection. The sun6i boot0 code
      does not do it, instead relying on the memory contents being random enough
      to begin with for the memcmp to properly detect the wrap-around address, iow
      it is working purely by chance. Since our sun6i dram code was modelled after
      the boot0 code it contained the same issue.
      This commit fixes this by filling the memory with a unique, distinct pattern.
      The new mctl_mem_fill function this introduces is added as an inline helper
      in dram.h, so that it can be shared with the sun8i dram code.
      While at it move mctl_mem_matches to dram.h for re-use in sun8i too.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarIan Campbell <ijc@hellion.org.uk>
    • Hans de Goede's avatar
      sunxi: Move await_completion dram helper to dram.h · 07f4fe7d
      Hans de Goede authored
      The await_completion helper is already copy pasted between the sun4i and sun6i
      dram code, and we need it for sun8i too, so lets make it an inline helper in
      dram.h, rather then adding yet another copy.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarIan Campbell <ijc@hellion.org.uk>
  7. 13 Nov, 2014 2 commits
  8. 12 Aug, 2014 5 commits
  9. 25 May, 2014 1 commit