cpu.c 816 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * (C) Copyright 2002
  3. * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  4. * Marius Groeger <mgroeger@sysgo.de>
  5. *
  6. * (C) Copyright 2002
  7. * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
  8. *
  9. * SPDX-License-Identifier: GPL-2.0+
  10. */
  11. /*
  12. * CPU specific code
  13. */
  14. #include <common.h>
  15. #include <command.h>
  16. #include <asm/system.h>
  17. static void cache_flush(void);
  18. int cleanup_before_linux (void)
  19. {
  20. /*
  21. * this function is called just before we call linux
  22. * it prepares the processor for linux
  23. *
  24. * we turn off caches etc ...
  25. */
  26. disable_interrupts ();
  27. /* turn off I/D-cache */
  28. icache_disable();
  29. dcache_disable();
  30. /* flush I/D-cache */
  31. cache_flush();
  32. return 0;
  33. }
  34. /* flush I/D-cache */
  35. static void cache_flush (void)
  36. {
  37. unsigned long i = 0;
  38. asm ("mcr p15, 0, %0, c7, c7, 0": :"r" (i));
  39. }