cpu.c 847 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * (C) Copyright 2008 Texas Insturments
  3. *
  4. * (C) Copyright 2002
  5. * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  6. * Marius Groeger <mgroeger@sysgo.de>
  7. *
  8. * (C) Copyright 2002
  9. * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
  10. *
  11. * SPDX-License-Identifier: GPL-2.0+
  12. */
  13. #include <common.h>
  14. #include <command.h>
  15. #include <asm/system.h>
  16. #include <linux/compiler.h>
  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. * disable interrupt and turn off caches etc ...
  24. */
  25. disable_interrupts();
  26. /*
  27. * Turn off I-cache and invalidate it
  28. */
  29. icache_disable();
  30. invalidate_icache_all();
  31. /*
  32. * turn off D-cache
  33. * dcache_disable() in turn flushes the d-cache and disables MMU
  34. */
  35. dcache_disable();
  36. invalidate_dcache_all();
  37. return 0;
  38. }