cpu.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * (C) Copyright 2002
  3. * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  4. * Marius Groeger <mgroeger@sysgo.de>
  5. *
  6. * (C) Copyright 2002
  7. * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  8. * Alex Zuepke <azu@sysgo.de>
  9. *
  10. * SPDX-License-Identifier: GPL-2.0+
  11. */
  12. /*
  13. * CPU specific code
  14. */
  15. #include <common.h>
  16. #include <command.h>
  17. #include <asm/system.h>
  18. #include <asm/io.h>
  19. #ifdef CONFIG_USE_IRQ
  20. DECLARE_GLOBAL_DATA_PTR;
  21. #endif
  22. static void cache_flush(void);
  23. int cleanup_before_linux (void)
  24. {
  25. /*
  26. * this function is called just before we call linux
  27. * it prepares the processor for linux
  28. *
  29. * just disable everything that can disturb booting linux
  30. */
  31. disable_interrupts ();
  32. /* turn off I-cache */
  33. icache_disable();
  34. dcache_disable();
  35. /* flush I-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. }
  45. #define RST_BASE 0x90030000
  46. #define RSRR 0x00
  47. #define RCSR 0x04
  48. __attribute__((noreturn)) void reset_cpu(ulong addr __attribute__((unused)))
  49. {
  50. /* repeat endlessly */
  51. while (1) {
  52. writel(0, RST_BASE + RCSR);
  53. writel(1, RST_BASE + RSRR);
  54. }
  55. }