restart.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* linux/arch/arm/mach-vt8500/restart.c
  2. *
  3. * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
  4. *
  5. * This software is licensed under the terms of the GNU General Public
  6. * License version 2, as published by the Free Software Foundation, and
  7. * may be copied, distributed, and modified under those terms.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. */
  15. #include <asm/io.h>
  16. #include <linux/of.h>
  17. #include <linux/of_address.h>
  18. #define LEGACY_PMC_BASE 0xD8130000
  19. #define WMT_PRIZM_PMSR_REG 0x60
  20. static void __iomem *pmc_base;
  21. void wmt_setup_restart(void)
  22. {
  23. struct device_node *np;
  24. /*
  25. * Check if Power Mgmt Controller node is present in device tree. If no
  26. * device tree node, use the legacy PMSR value (valid for all current
  27. * SoCs).
  28. */
  29. np = of_find_compatible_node(NULL, NULL, "wmt,prizm-pmc");
  30. if (np) {
  31. pmc_base = of_iomap(np, 0);
  32. if (!pmc_base)
  33. pr_err("%s:of_iomap(pmc) failed\n", __func__);
  34. of_node_put(np);
  35. } else {
  36. pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000);
  37. if (!pmc_base) {
  38. pr_err("%s:ioremap(rstc) failed\n", __func__);
  39. return;
  40. }
  41. }
  42. }
  43. void wmt_restart(char mode, const char *cmd)
  44. {
  45. if (pmc_base)
  46. writel(1, pmc_base + WMT_PRIZM_PMSR_REG);
  47. }