cpu.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 <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. * just disable everything that can disturb booting linux
  26. */
  27. disable_interrupts ();
  28. /* turn off I-cache */
  29. icache_disable();
  30. dcache_disable();
  31. /* flush I-cache */
  32. cache_flush();
  33. return (0);
  34. }
  35. /* flush I/D-cache */
  36. static void cache_flush (void)
  37. {
  38. unsigned long i = 0;
  39. asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
  40. }
  41. #define RST_BASE 0x90030000
  42. #define RSRR 0x00
  43. #define RCSR 0x04
  44. __attribute__((noreturn)) void reset_cpu(ulong addr __attribute__((unused)))
  45. {
  46. /* repeat endlessly */
  47. while (1) {
  48. writel(0, RST_BASE + RCSR);
  49. writel(1, RST_BASE + RSRR);
  50. }
  51. }