cpu.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. /* ARM926E-S needs the protection unit enabled for the icache to have
  28. * been enabled - left for possible later use
  29. * should turn off the protection unit as well....
  30. */
  31. /* turn off I/D-cache */
  32. icache_disable();
  33. dcache_disable();
  34. /* flush I/D-cache */
  35. cache_flush();
  36. return 0;
  37. }
  38. /* flush I/D-cache */
  39. static void cache_flush (void)
  40. {
  41. unsigned long i = 0;
  42. asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
  43. asm ("mcr p15, 0, %0, c7, c6, 0": :"r" (i));
  44. }