interrupts.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * (C) Copyright 2000-2004
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
  6. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  7. *
  8. * See file CREDITS for list of people who contributed to this
  9. * project.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License as
  13. * published by the Free Software Foundation; either version 2 of
  14. * the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  24. * MA 02111-1307 USA
  25. */
  26. #include <common.h>
  27. #include <watchdog.h>
  28. #include <asm/processor.h>
  29. #include <asm/immap.h>
  30. #ifdef CONFIG_M5272
  31. int interrupt_init(void)
  32. {
  33. volatile intctrl_t *intp = (intctrl_t *) (MMAP_INTC);
  34. /* disable all external interrupts */
  35. intp->int_icr1 = 0x88888888;
  36. intp->int_icr2 = 0x88888888;
  37. intp->int_icr3 = 0x88888888;
  38. intp->int_icr4 = 0x88888888;
  39. intp->int_pitr = 0x00000000;
  40. /* initialize vector register */
  41. intp->int_pivr = 0x40;
  42. enable_interrupts();
  43. return 0;
  44. }
  45. #if defined(CONFIG_MCFTMR)
  46. void dtimer_intr_setup(void)
  47. {
  48. volatile intctrl_t *intp = (intctrl_t *) (CONFIG_SYS_INTR_BASE);
  49. intp->int_icr1 &= ~INT_ICR1_TMR3MASK;
  50. intp->int_icr1 |= CONFIG_SYS_TMRINTR_PRI;
  51. }
  52. #endif /* CONFIG_MCFTMR */
  53. #endif /* CONFIG_M5272 */
  54. #if defined(CONFIG_M5282) || defined(CONFIG_M5271) || defined(CONFIG_M5275)
  55. int interrupt_init(void)
  56. {
  57. volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE);
  58. /* Make sure all interrupts are disabled */
  59. intp->imrl0 |= 0x1;
  60. enable_interrupts();
  61. return 0;
  62. }
  63. #if defined(CONFIG_MCFTMR)
  64. void dtimer_intr_setup(void)
  65. {
  66. volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE);
  67. intp->icr0[CONFIG_SYS_TMRINTR_NO] = CONFIG_SYS_TMRINTR_PRI;
  68. intp->imrl0 &= 0xFFFFFFFE;
  69. intp->imrl0 &= ~CONFIG_SYS_TMRINTR_MASK;
  70. }
  71. #endif /* CONFIG_MCFTMR */
  72. #endif /* CONFIG_M5282 | CONFIG_M5271 | CONFIG_M5275 */
  73. #if defined(CONFIG_M5249) || defined(CONFIG_M5253)
  74. int interrupt_init(void)
  75. {
  76. enable_interrupts();
  77. return 0;
  78. }
  79. #if defined(CONFIG_MCFTMR)
  80. void dtimer_intr_setup(void)
  81. {
  82. mbar_writeLong(MCFSIM_IMR, mbar_readLong(MCFSIM_IMR) & ~0x00000400);
  83. mbar_writeByte(MCFSIM_TIMER2ICR, CONFIG_SYS_TMRINTR_PRI);
  84. }
  85. #endif /* CONFIG_MCFTMR */
  86. #endif /* CONFIG_M5249 || CONFIG_M5253 */