cpu.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #include <asm/io.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. /* ARM926E-S needs the protection unit enabled for the icache to have
  29. * been enabled - left for possible later use
  30. * should turn off the protection unit as well....
  31. */
  32. /* turn off I/D-cache */
  33. icache_disable();
  34. dcache_disable();
  35. /* flush I/D-cache */
  36. cache_flush();
  37. return 0;
  38. }
  39. /* flush I/D-cache */
  40. static void cache_flush (void)
  41. {
  42. unsigned long i = 0;
  43. asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
  44. asm ("mcr p15, 0, %0, c7, c6, 0": :"r" (i));
  45. }
  46. #ifndef CONFIG_INTEGRATOR
  47. __attribute__((noreturn)) void reset_cpu(ulong addr __attribute__((unused)))
  48. {
  49. writew(0x0, 0xfffece10);
  50. writew(0x8, 0xfffece10);
  51. for (;;)
  52. ;
  53. }
  54. #endif /* #ifdef CONFIG_INTEGRATOR */