Skip to content
Snippets Groups Projects
  1. May 07, 2018
    • Tom Rini's avatar
      SPDX: Convert all of our single license tags to Linux Kernel style · 83d290c5
      Tom Rini authored
      
      When U-Boot started using SPDX tags we were among the early adopters and
      there weren't a lot of other examples to borrow from.  So we picked the
      area of the file that usually had a full license text and replaced it
      with an appropriate SPDX-License-Identifier: entry.  Since then, the
      Linux Kernel has adopted SPDX tags and they place it as the very first
      line in a file (except where shebangs are used, then it's second line)
      and with slightly different comment styles than us.
      
      In part due to community overlap, in part due to better tag visibility
      and in part for other minor reasons, switch over to that style.
      
      This commit changes all instances where we have a single declared
      license in the tag as both the before and after are identical in tag
      contents.  There's also a few places where I found we did not have a tag
      and have introduced one.
      
      Signed-off-by: default avatarTom Rini <trini@konsulko.com>
      83d290c5
  2. Mar 21, 2018
    • Eugeniy Paltsev's avatar
      ARC: Implement a function to sync and cleanup caches · 375945ba
      Eugeniy Paltsev authored
      
      Implement specialized function to clenup caches (and therefore
      sync instruction and data caches) which can be used for cleanup before linux
      launch or to sync caches during U-Boot self-relocation.
      
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      375945ba
    • Eugeniy Paltsev's avatar
      ARC: Move IOC enabling to compile-time options · 48b04832
      Eugeniy Paltsev authored
      
      Use CONFIG_ARC_DBG_IOC_ENABLE Kconfig option instead of
      ioc_enable global variable.
      
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      48b04832
    • Eugeniy Paltsev's avatar
      ARC: Move cache global variables to arch_global_data · bf8974ed
      Eugeniy Paltsev authored
      
      There is a problem with current implementation if we start U-Boot
      from ROM, as we use global variables before ther initialization,
      so these variables get overwritten when we copy .data section
      from ROM.
      
      Instead we move these global variables into our "global data"
      structure so that we may really start from ROM.
      
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      bf8974ed
    • Eugeniy Paltsev's avatar
      ARC: Move BCR encodings to separate header file · 88ae27ed
      Eugeniy Paltsev authored
      
      We're starting to use more and more BCRs and having their
      definitions in-lined in sources becomes a bit annoying
      so we move it all to a separate header.
      
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      88ae27ed
    • Eugeniy Paltsev's avatar
      ARC: Flush & invalidate D$ with a single command · c27814be
      Eugeniy Paltsev authored
      
      We don't implement separate flush_dcache_all() intentionally as
      entire data cache invalidation is dangerous operation even if we flush
      data cache right before invalidation.
      
      There is the real example:
      We may get stuck in the following code if we store any context (like
      BLINK register) on stack in invalidate_dcache_all() function.
      
      BLINK register is the register where return address is automatically saved
      when we do function call with instructions like 'bl'.
      
      void flush_dcache_all() {
      	__dc_entire_op(OP_FLUSH);
      	// Other code //
      }
      
      void invalidate_dcache_all() {
      	__dc_entire_op(OP_INV);
      	// Other code //
      }
      
      void foo(void) {
      	flush_dcache_all();
      	invalidate_dcache_all();
      }
      
      Now let's see what really happens during that code execution:
      
      foo()
        |->> call flush_dcache_all
        	[return address is saved to BLINK register]
        	[push BLINK] (save to stack)              ![point 1]
        	|->> call __dc_entire_op(OP_FLUSH)
        		[return address is saved to BLINK register]
        		[flush L1 D$]
        		return [jump to BLINK]
        	<<------
        	[other flush_dcache_all code]
        	[pop BLINK] (get from stack)
        	return [jump to BLINK]
        <<------
        |->> call invalidate_dcache_all
        	[return address is saved to BLINK register]
        	[push BLINK] (save to stack)               ![point 2]
        	|->> call __dc_entire_op(OP_FLUSH)
        		[return address is saved to BLINK register]
        		[invalidate L1 D$]                 ![point 3]
        		// Oops!!!
        		// We lose return address from invalidate_dcache_all function:
        		// we save it to stack and invalidate L1 D$ after that!
        		return [jump to BLINK]
        	<<------
        	[other invalidate_dcache_all code]
        	[pop BLINK] (get from stack)
        	// we don't have this data in L1 dcache as we invalidated it in [point 3]
        	// so we get it from next memory level (for example DDR memory)
        	// but in the memory we have value which we save in [point 1], which
        	// is return address from flush_dcache_all function (instead of
        	// address from current invalidate_dcache_all function which we
        	// saved in [point 2] !)
        	return [jump to BLINK]
        <<------
        // As BLINK points to invalidate_dcache_all, we call it again and
        // loop forever.
      
      Fortunately we may do flush and invalidation of D$ with a single one
      instruction which automatically mitigates a situation described above.
      
      And because invalidate_dcache_all() isn't used in common U-Boot code we
      implement "flush and invalidate dcache all" instead.
      
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      c27814be
    • Eugeniy Paltsev's avatar
      ARC: Introduce is_isa_X() functions · 5e0c68ed
      Eugeniy Paltsev authored
      
      Introduce is_isa_arcv2() and is_isa_arcompact() functions.
      
      These functions only check configuration options and return
      compile-time constant so they can be used instead of #ifdef's to
      to write cleaner code.
      
      Now we can write:
      -------------->8---------------
      if (is_isa_arcv2())
      	ioc_configure();
      -------------->8---------------
      instead of:
      -------------->8---------------
      ifdef CONFIG_ISA_ARCV2
      	ioc_configure();
      endif
      -------------->8---------------
      
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      5e0c68ed
    • Alexey Brodkin's avatar
      arc: Fine-tune implementation of memory barriers · 71621525
      Alexey Brodkin authored
      
      We improve on 2 things:
       1. Only ARC HS family has "dmb" instructions so do compile-time
          check for automatically defined macro __ARCHS__.
          Previous check for ARCv2 ISA was not good enough because ARC EM
          family is v2 ISA as well but still "dmb" instaruction is not
          supported in EM family.
      
       2. Still if there's no dedicated instruction for memory barrier
          let's at least insert compile-time barrier to make sure
          compiler deosn't reorder critical memory operations.
      
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      71621525
    • Alexey Brodkin's avatar
      arc: Get rid of handwritten string routines · 2178817c
      Alexey Brodkin authored
      
      U-Boot is a bit special piese of software because it is being
      only executed once on power-on as compared to operating system
      for example. That's why we don't care much about performance
      optimizations instead we're more concerned about size. And up-to-date
      compilers might produce much smaller code compared to
      performance-optimized routines copy-pasted from the Linux kernel.
      
      Here's an example:
      ------------------------------->8--------------------------
      --- size_asm_strings.txt
      +++ size_c_strings.txt
      @@ -1,2 +1,2 @@
          text	   data	    bss	    dec	    hex	filename
      - 121260	   3784	   3308	 128352	  1f560	u-boot
      + 120448	   3784	   3308	 127540	  1f234	u-boot
      ------------------------------->8--------------------------
      
      See we were able to shave off ~800 bytes of .text section.
      
      Also usage of string routines implemented in C gives us an ability
      to support more HW flavors for free: generated instructions will match
      our target as long as correct compiler option is used.
      
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      2178817c
  3. Jan 19, 2018
    • Eugeniy Paltsev's avatar
      ARC: ARCv2: Cache: Fixed operation without IOC · 41cada4d
      Eugeniy Paltsev authored
      Previous SLC management implementation is broken. Seems like it was
      never sufficiently tested probably because most of the time IOC was used
      instead (i.e. no manual cache operations were done).
      
      Now if we disable IOC in U-boot we'll get a lot of errors while using
      DMA-enabled peripherals.
      
      This time we fix it by substitution of broken per-line SLC operations
      region operations as it is done in the Linux kernel (we took it from
      v4.14 which is the latest stable as of today).
      
      Among other things this implementation might be a bit faster because
      instead of iteration over each and every cache line we're taking care
      about entire region in one go.
      
      Main changes:
       * Replaced __slc_line_op (per line operations) by __slc_rgn_op
         (region operations).
      
       * Reworked __slc_entire_op to get rid of __after_slc_op and
         __before_slc_op functions.
         Note flush fix (flush only instead of flush-n-inv when OP_FLUSH is
         used, see [1] for more details) is already incorporated here.
      
       * Added SLC invalidation to invalidate_icache_all().
      
       * Added (start >= end) check to invalidate_dcache_range() and
         flush_dcache_range() as some buggy drivers pass region start == end.
      
       * Added read-out of MMU BCR so we may know if PAE40 exists in HW and then
         act on a particular AUX regs accordingly.
      
      [1] http://lists.infradead.org/pipermail/linux-snps-arc/2018-January/003357.html
      
      
      
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      41cada4d
  4. Dec 11, 2017
  5. Dec 10, 2017
  6. Oct 03, 2017
  7. Jun 05, 2017
  8. Apr 05, 2017
  9. Mar 29, 2017
  10. Mar 24, 2017
  11. Jan 25, 2017
  12. Sep 23, 2016
  13. Aug 05, 2016
  14. Jul 04, 2016
    • Alexey Brodkin's avatar
      arc: make global_data.h usable in assembly files · c7dea6e2
      Alexey Brodkin authored
      
      Currently on attempt to use global_data.h in an assembly file following
      will happen:
      -------------------->8-----------------
      ./arch/arc/include/asm/global_data.h: Assembler messages:
      ./arch/arc/include/asm/global_data.h:11: Error: bad instruction 'struct arch_global_data{'
      ./arch/arc/include/asm/global_data.h:12: Error: junk at end of line, first unrecognized character is `}'
      scripts/Makefile.build:316: recipe for target 'arch/arc/lib/start.o' failed
      -------------------->8-----------------
      
      In this change we disable struct arch_global_data in ASM which fixes
      the issue above.
      
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      c7dea6e2
  15. Jun 13, 2016
    • Alexey Brodkin's avatar
      arc: Update data accessors with use of memory barriers · 5bea2bec
      Alexey Brodkin authored
      
      Memory barriers are proven to be a requirement for both compiler and
      real hardware to properly serialize access to critical data.
      
      For example if CPU or data bus it uses may do reordering of data
      accesses absence of memory barriers might easily lead to very subtle and
      hard to debug data corruptions.
      
      This implementation was heavily borrowed from up to date Linux kernel.
      
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      5bea2bec
  16. Apr 11, 2016
  17. Feb 20, 2016
    • Alexey Brodkin's avatar
      arc: cache - utilize IO coherency (AKA IOC) engine · db6ce231
      Alexey Brodkin authored
      
      With release of ARC HS38 v2.1 new IO coherency engine could be built-in
      ARC core. This hardware module ensures coherency between DMA-ed data
      from peripherals and L2 cache.
      
      With L2 and IOC enabled there's no overhead for L2 cache manual
      maintenance which results in significantly improved IO bandwidth.
      
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      db6ce231
    • Alexey Brodkin's avatar
      arc: cache - accommodate different L1 cache line lengths · 379b3280
      Alexey Brodkin authored
      
      ARC core could be configured with different L1 and L2 (AKA SLC) cache
      line lengths. At least these values are possible and were really used:
      32, 64 or 128 bytes.
      
      Current implementation requires cache line to be selected upon U-Boot
      configuration and then it will only work on matching hardware. Indeed
      this is quite efficient because cache line length gets hardcoded during
      code compilation. But OTOH it makes binary less portable.
      
      With this commit we allow U-Boot to determine real L1 cache line length
      early in runtime and use this value later on. This extends portability
      of U-Boot binary a lot.
      
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      379b3280
  18. Nov 17, 2015
  19. Nov 05, 2015
  20. Jul 01, 2015
    • Alexey Brodkin's avatar
      arc: significant cache rework · ef639e6f
      Alexey Brodkin authored
      
      [1] Align cache management functions to those in Linux kernel. I.e.:
          a) Use the same functions for all cache ops (D$ Inv/Flush)
          b) Split cache ops in 3 sub-functions: "before", "lineloop" and
      "after". That way we may re-use "before" and "after" functions for
      region and full cache ops.
      
       [2] Implement full-functional L2 (SLC) management. Before SLC was
      simply disabled early on boot. It's also possible to enable or disable
      L2 cache from config utility.
      
       [3] Disable/enable corresponding caches early on boot. So if U-Boot is
      configured to use caches they will be used at all times (this is useful
      in partucular for speed-up of relocation).
      
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      ef639e6f
  21. Apr 03, 2015
    • Alexey Brodkin's avatar
      arc: add support for SLC (System Level Cache, AKA L2-cache) · 6eb15e50
      Alexey Brodkin authored
      
      ARCv2 cores may have built-in SLC (System Level Cache, AKA L2-cache).
      This change adds functions required for controlling SLC:
       * slc_enable/disable
       * slc_flush/invalidate
      
      For now we just disable SLC to escape DMA coherency issues until either:
       * SLC flush/invalidate is supported in DMA APIin U-Boot
       * hardware DMA coherency is implemented (that might be board specific
         so probably we'll need to have a separate Kconfig option for
         controlling SLC explicitly)
      
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      6eb15e50
    • Alexey Brodkin's avatar
      arc: get rid of CONFIG_SYS_GENERIC_GLOBAL_DATA · f56d625e
      Alexey Brodkin authored
      
      As discussed on mailing list we're drifting away from
      CONFIG_SYS_GENERIC_GLOBAL_DATA in favour to use of board_init_f_mem()
      for global data.
      
      So do this for ARC architecture.
      
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      f56d625e
    • Alexey Brodkin's avatar
      arc: clean-up init procedure · 3fb80163
      Alexey Brodkin authored
      
      Intention behind this work was elimination of as much assembly-written
      code as it is possible.
      
      In case of ARC we already have relocation fix-up implemented in C so why
      don't we use C for U-Boot copying, .bss zeroing etc.
      
      It turned out x86 uses pretty similar approach so we re-used parts of
      code in "board_f.c" initially implemented for x86.
      
      Now assembly usage during init is limited to stack- and frame-pointer
      setup before and after relocation.
      
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      Cc: Simon Glass <sjg@chromium.org>
      3fb80163
  22. Mar 28, 2015
  23. Mar 06, 2015
  24. Feb 13, 2015
    • Alexey Brodkin's avatar
      arc: introduce U-Boot port for ARCv2 ISA · f13606b7
      Alexey Brodkin authored
      
      ARC HS and ARC EM are new cores based on ARCv2 ISA which is binary
      incompatible with ISAv1 (AKA ARCompact).
      
      Significant difference between ISAv2 and v1 is implementation of
      interrupt vector table.
      
      In v1 it is implemented in the same way as on many other architectures -
      as a special location where user may put whether code executed in place
      (if machine word of space is enough) or jump to a full-scale interrupt
      handler.
      
      In v2 interrupt table is just an array of adresses of real interrupt
      handlers. That requires a separate section for IVT that is not encoded
      as code by assembler.
      
      This change adds support for following cores:
       * ARC EM6 (simple 32-bit microcontroller without MMU)
       * ARC HS36 (advanced 32-bit microcontroller without MMU)
       * ARC HS38 (advanced 32-bit microcontroller with MMU)
      
      As a part of ARC HS38 new version of MMU (v4) was introduced.
      
      Also this change adds AXS131 board which is the same DW ARC SDP base board but
      with ARC HS38 CPU tile.
      
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      f13606b7
  25. Feb 09, 2015
Loading