cpu.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 <irq_func.h>
  18. #include <asm/system.h>
  19. #include <asm/io.h>
  20. static void cache_flush(void);
  21. int cleanup_before_linux (void)
  22. {
  23. /*
  24. * this function is called just before we call linux
  25. * it prepares the processor for linux
  26. *
  27. * just disable everything that can disturb booting linux
  28. */
  29. disable_interrupts();
  30. /* turn off I-cache */
  31. icache_disable();
  32. dcache_disable();
  33. /* flush I-cache */
  34. cache_flush();
  35. return (0);
  36. }
  37. /* flush I/D-cache */
  38. static void cache_flush (void)
  39. {
  40. unsigned long i = 0;
  41. asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
  42. }
  43. #define RST_BASE 0x90030000
  44. #define RSRR 0x00
  45. #define RCSR 0x04
  46. __attribute__((noreturn)) void reset_cpu(ulong addr __attribute__((unused)))
  47. {
  48. /* repeat endlessly */
  49. while (1) {
  50. writel(0, RST_BASE + RCSR);
  51. writel(1, RST_BASE + RSRR);
  52. }
  53. }