interrupts.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2000-2004
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. *
  6. * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
  7. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  8. */
  9. #include <common.h>
  10. #include <watchdog.h>
  11. #include <asm/processor.h>
  12. #include <asm/immap.h>
  13. #include <asm/io.h>
  14. #ifdef CONFIG_M5272
  15. int interrupt_init(void)
  16. {
  17. intctrl_t *intp = (intctrl_t *) (MMAP_INTC);
  18. /* disable all external interrupts */
  19. out_be32(&intp->int_icr1, 0x88888888);
  20. out_be32(&intp->int_icr2, 0x88888888);
  21. out_be32(&intp->int_icr3, 0x88888888);
  22. out_be32(&intp->int_icr4, 0x88888888);
  23. out_be32(&intp->int_pitr, 0x00000000);
  24. /* initialize vector register */
  25. out_8(&intp->int_pivr, 0x40);
  26. enable_interrupts();
  27. return 0;
  28. }
  29. #if defined(CONFIG_MCFTMR)
  30. void dtimer_intr_setup(void)
  31. {
  32. intctrl_t *intp = (intctrl_t *) (CONFIG_SYS_INTR_BASE);
  33. clrbits_be32(&intp->int_icr1, INT_ICR1_TMR3MASK);
  34. setbits_be32(&intp->int_icr1, CONFIG_SYS_TMRINTR_PRI);
  35. }
  36. #endif /* CONFIG_MCFTMR */
  37. #endif /* CONFIG_M5272 */
  38. #if defined(CONFIG_M5208) || defined(CONFIG_M5282) || \
  39. defined(CONFIG_M5271) || defined(CONFIG_M5275)
  40. int interrupt_init(void)
  41. {
  42. int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE);
  43. /* Make sure all interrupts are disabled */
  44. #if defined(CONFIG_M5208)
  45. out_be32(&intp->imrl0, 0xffffffff);
  46. out_be32(&intp->imrh0, 0xffffffff);
  47. #else
  48. setbits_be32(&intp->imrl0, 0x1);
  49. #endif
  50. enable_interrupts();
  51. return 0;
  52. }
  53. #if defined(CONFIG_MCFTMR)
  54. void dtimer_intr_setup(void)
  55. {
  56. int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE);
  57. out_8(&intp->icr0[CONFIG_SYS_TMRINTR_NO], CONFIG_SYS_TMRINTR_PRI);
  58. clrbits_be32(&intp->imrl0, 0x00000001);
  59. clrbits_be32(&intp->imrl0, CONFIG_SYS_TMRINTR_MASK);
  60. }
  61. #endif /* CONFIG_MCFTMR */
  62. #endif /* CONFIG_M5282 | CONFIG_M5271 | CONFIG_M5275 */
  63. #if defined(CONFIG_M5249) || defined(CONFIG_M5253)
  64. int interrupt_init(void)
  65. {
  66. enable_interrupts();
  67. return 0;
  68. }
  69. #if defined(CONFIG_MCFTMR)
  70. void dtimer_intr_setup(void)
  71. {
  72. mbar_writeLong(MCFSIM_IMR, mbar_readLong(MCFSIM_IMR) & ~0x00000400);
  73. mbar_writeByte(MCFSIM_TIMER2ICR, CONFIG_SYS_TMRINTR_PRI);
  74. }
  75. #endif /* CONFIG_MCFTMR */
  76. #endif /* CONFIG_M5249 || CONFIG_M5253 */