cpu.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 <irq_func.h>
  17. #include <asm/system.h>
  18. #include <asm/io.h>
  19. static void cache_flush(void);
  20. int cleanup_before_linux (void)
  21. {
  22. /*
  23. * this function is called just before we call linux
  24. * it prepares the processor for linux
  25. *
  26. * we turn off caches etc ...
  27. */
  28. disable_interrupts();
  29. /* ARM926E-S needs the protection unit enabled for the icache to have
  30. * been enabled - left for possible later use
  31. * should turn off the protection unit as well....
  32. */
  33. /* turn off I/D-cache */
  34. icache_disable();
  35. dcache_disable();
  36. /* flush I/D-cache */
  37. cache_flush();
  38. return 0;
  39. }
  40. /* flush I/D-cache */
  41. static void cache_flush (void)
  42. {
  43. unsigned long i = 0;
  44. asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
  45. asm ("mcr p15, 0, %0, c7, c6, 0": :"r" (i));
  46. }
  47. #ifndef CONFIG_ARCH_INTEGRATOR
  48. __attribute__((noreturn)) void reset_cpu(ulong addr __attribute__((unused)))
  49. {
  50. writew(0x0, 0xfffece10);
  51. writew(0x8, 0xfffece10);
  52. for (;;)
  53. ;
  54. }
  55. #endif /* #ifdef CONFIG_ARCH_INTEGRATOR */