misc.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * MPC85xx generic code.
  3. *
  4. * Maintained by Kumar Gala (see MAINTAINERS for contact information)
  5. *
  6. * Copyright 2005 Freescale Semiconductor Inc.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. */
  13. #include <linux/irq.h>
  14. #include <linux/module.h>
  15. #include <asm/irq.h>
  16. #include <asm/io.h>
  17. #include <asm/prom.h>
  18. #include <sysdev/fsl_soc.h>
  19. static __be32 __iomem *rstcr;
  20. extern void abort(void);
  21. static int __init mpc85xx_rstcr(void)
  22. {
  23. struct device_node *np;
  24. np = of_find_node_by_name(NULL, "global-utilities");
  25. if ((np && of_get_property(np, "fsl,has-rstcr", NULL))) {
  26. const u32 *prop = of_get_property(np, "reg", NULL);
  27. if (prop) {
  28. /* map reset control register
  29. * 0xE00B0 is offset of reset control register
  30. */
  31. rstcr = ioremap(get_immrbase() + *prop + 0xB0, 0xff);
  32. if (!rstcr)
  33. printk (KERN_EMERG "Error: reset control "
  34. "register not mapped!\n");
  35. }
  36. } else
  37. printk (KERN_INFO "rstcr compatible register does not exist!\n");
  38. if (np)
  39. of_node_put(np);
  40. return 0;
  41. }
  42. arch_initcall(mpc85xx_rstcr);
  43. void mpc85xx_restart(char *cmd)
  44. {
  45. local_irq_disable();
  46. if (rstcr)
  47. /* set reset control register */
  48. out_be32(rstcr, 0x2); /* HRESET_REQ */
  49. abort();
  50. }