cpu.c 838 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 <arm925t.h>
  17. #include <asm/system.h>
  18. static void cache_flush(void);
  19. int cleanup_before_linux (void)
  20. {
  21. /*
  22. * this function is called just before we call linux
  23. * it prepares the processor for linux
  24. *
  25. * we turn off caches etc ...
  26. */
  27. disable_interrupts ();
  28. /* turn off I/D-cache */
  29. icache_disable();
  30. dcache_disable();
  31. /* flush I/D-cache */
  32. cache_flush();
  33. return 0;
  34. }
  35. /* flush I/D-cache */
  36. static void cache_flush (void)
  37. {
  38. unsigned long i = 0;
  39. asm ("mcr p15, 0, %0, c7, c7, 0": :"r" (i));
  40. }