cpu.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  9. * Alex Zuepke <azu@sysgo.de>
  10. */
  11. /*
  12. * CPU specific code
  13. */
  14. #include <common.h>
  15. #include <command.h>
  16. #include <cpu_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. * just disable everything that can disturb booting linux
  27. */
  28. disable_interrupts ();
  29. /* turn off I-cache */
  30. icache_disable();
  31. dcache_disable();
  32. /* flush I-cache */
  33. cache_flush();
  34. return (0);
  35. }
  36. /* flush I/D-cache */
  37. static void cache_flush (void)
  38. {
  39. unsigned long i = 0;
  40. asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
  41. }
  42. #define RST_BASE 0x90030000
  43. #define RSRR 0x00
  44. #define RCSR 0x04
  45. __attribute__((noreturn)) void reset_cpu(ulong addr __attribute__((unused)))
  46. {
  47. /* repeat endlessly */
  48. while (1) {
  49. writel(0, RST_BASE + RCSR);
  50. writel(1, RST_BASE + RSRR);
  51. }
  52. }