cpu.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 <cpu_func.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_ARCH_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_ARCH_INTEGRATOR */