misc.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * misc setup functions for MPC83xx
  3. *
  4. * Maintainer: Kumar Gala <galak@kernel.crashing.org>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2 of the License, or (at your
  9. * option) any later version.
  10. */
  11. #include <linux/stddef.h>
  12. #include <linux/kernel.h>
  13. #include <asm/io.h>
  14. #include <asm/hw_irq.h>
  15. #include <sysdev/fsl_soc.h>
  16. #include "mpc83xx.h"
  17. static __be32 __iomem *restart_reg_base;
  18. static int __init mpc83xx_restart_init(void)
  19. {
  20. /* map reset restart_reg_baseister space */
  21. restart_reg_base = ioremap(get_immrbase() + 0x900, 0xff);
  22. return 0;
  23. }
  24. arch_initcall(mpc83xx_restart_init);
  25. void mpc83xx_restart(char *cmd)
  26. {
  27. #define RST_OFFSET 0x00000900
  28. #define RST_PROT_REG 0x00000018
  29. #define RST_CTRL_REG 0x0000001c
  30. local_irq_disable();
  31. if (restart_reg_base) {
  32. /* enable software reset "RSTE" */
  33. out_be32(restart_reg_base + (RST_PROT_REG >> 2), 0x52535445);
  34. /* set software hard reset */
  35. out_be32(restart_reg_base + (RST_CTRL_REG >> 2), 0x2);
  36. } else {
  37. printk (KERN_EMERG "Error: Restart registers not mapped, spinning!\n");
  38. }
  39. for (;;) ;
  40. }
  41. long __init mpc83xx_time_init(void)
  42. {
  43. #define SPCR_OFFSET 0x00000110
  44. #define SPCR_TBEN 0x00400000
  45. __be32 __iomem *spcr = ioremap(get_immrbase() + SPCR_OFFSET, 4);
  46. __be32 tmp;
  47. tmp = in_be32(spcr);
  48. out_be32(spcr, tmp | SPCR_TBEN);
  49. iounmap(spcr);
  50. return 0;
  51. }