reset.c 804 B

123456789101112131415161718192021222324252627282930313233343536
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2012-2014 Panasonic Corporation
  4. * Copyright (C) 2015-2016 Socionext Inc.
  5. * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
  6. */
  7. #include <common.h>
  8. #include <cpu_func.h>
  9. #include <linux/io.h>
  10. #include <asm/secure.h>
  11. #include "sc-regs.h"
  12. /* If PSCI is enabled, this is used for SYSTEM_RESET function */
  13. #ifdef CONFIG_ARMV7_PSCI
  14. #define __SECURE __secure
  15. #else
  16. #define __SECURE
  17. #endif
  18. void __SECURE reset_cpu(unsigned long ignored)
  19. {
  20. u32 tmp;
  21. writel(5, sc_base + SC_IRQTIMSET); /* default value */
  22. tmp = readl(sc_base + SC_SLFRSTSEL);
  23. tmp &= ~0x3; /* mask [1:0] */
  24. tmp |= 0x0; /* XRST reboot */
  25. writel(tmp, sc_base + SC_SLFRSTSEL);
  26. tmp = readl(sc_base + SC_SLFRSTCTL);
  27. tmp |= 0x1;
  28. writel(tmp, sc_base + SC_SLFRSTCTL);
  29. }