reset.c 767 B

1234567891011121314151617181920212223242526272829303132333435
  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 <cpu_func.h>
  8. #include <linux/io.h>
  9. #include <asm/secure.h>
  10. #include "sc-regs.h"
  11. /* If PSCI is enabled, this is used for SYSTEM_RESET function */
  12. #ifdef CONFIG_ARMV7_PSCI
  13. #define __SECURE __secure
  14. #else
  15. #define __SECURE
  16. #endif
  17. void __SECURE reset_cpu(void)
  18. {
  19. u32 tmp;
  20. writel(5, sc_base + SC_IRQTIMSET); /* default value */
  21. tmp = readl(sc_base + SC_SLFRSTSEL);
  22. tmp &= ~0x3; /* mask [1:0] */
  23. tmp |= 0x0; /* XRST reboot */
  24. writel(tmp, sc_base + SC_SLFRSTSEL);
  25. tmp = readl(sc_base + SC_SLFRSTCTL);
  26. tmp |= 0x1;
  27. writel(tmp, sc_base + SC_SLFRSTCTL);
  28. }