cpu.c 813 B

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