condor.c 995 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * board/renesas/condor/condor.c
  4. * This file is Condor board support.
  5. *
  6. * Copyright (C) 2019 Marek Vasut <marek.vasut+renesas@gmail.com>
  7. */
  8. #include <common.h>
  9. #include <cpu_func.h>
  10. #include <hang.h>
  11. #include <init.h>
  12. #include <asm/global_data.h>
  13. #include <asm/processor.h>
  14. #include <asm/mach-types.h>
  15. #include <asm/io.h>
  16. #include <linux/errno.h>
  17. #include <asm/arch/sys_proto.h>
  18. DECLARE_GLOBAL_DATA_PTR;
  19. int board_init(void)
  20. {
  21. return 0;
  22. }
  23. #define RST_BASE 0xE6160000
  24. #define RST_CA57RESCNT (RST_BASE + 0x40)
  25. #define RST_CA53RESCNT (RST_BASE + 0x44)
  26. #define RST_RSTOUTCR (RST_BASE + 0x58)
  27. #define RST_CA57_CODE 0xA5A5000F
  28. #define RST_CA53_CODE 0x5A5A000F
  29. void reset_cpu(void)
  30. {
  31. unsigned long midr, cputype;
  32. asm volatile("mrs %0, midr_el1" : "=r" (midr));
  33. cputype = (midr >> 4) & 0xfff;
  34. if (cputype == 0xd03)
  35. writel(RST_CA53_CODE, RST_CA53RESCNT);
  36. else if (cputype == 0xd07)
  37. writel(RST_CA57_CODE, RST_CA57RESCNT);
  38. else
  39. hang();
  40. }