ints.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * U-boot - ints.c Interrupt related routines
  3. *
  4. * Copyright (c) 2005-2007 Analog Devices Inc.
  5. *
  6. * This file is based on ints.c
  7. *
  8. * Apr18 2003, Changed by HuTao to support interrupt cascading for Blackfin
  9. * drivers
  10. *
  11. * Copyright 1996 Roman Zippel
  12. * Copyright 1999 D. Jeff Dionne <jeff@uclinux.org>
  13. * Copyright 2000-2001 Lineo, Inc. D. Jefff Dionne <jeff@lineo.ca>
  14. * Copyright 2002 Arcturus Networks Inc. MaTed <mated@sympatico.ca>
  15. * Copyright 2003 Metrowerks/Motorola
  16. *
  17. * (C) Copyright 2000-2004
  18. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  19. *
  20. * See file CREDITS for list of people who contributed to this
  21. * project.
  22. *
  23. * This program is free software; you can redistribute it and/or
  24. * modify it under the terms of the GNU General Public License as
  25. * published by the Free Software Foundation; either version 2 of
  26. * the License, or (at your option) any later version.
  27. *
  28. * This program is distributed in the hope that it will be useful,
  29. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  30. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  31. * GNU General Public License for more details.
  32. *
  33. * You should have received a copy of the GNU General Public License
  34. * along with this program; if not, write to the Free Software
  35. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
  36. * MA 02110-1301 USA
  37. */
  38. #include <common.h>
  39. #include <linux/stddef.h>
  40. #include <asm/system.h>
  41. #include <asm/traps.h>
  42. #include <asm/io.h>
  43. #include <asm/errno.h>
  44. #include <asm/blackfin.h>
  45. #include "cpu.h"
  46. void blackfin_irq_panic(int reason, struct pt_regs *regs)
  47. {
  48. printf("\n\nException: IRQ 0x%x entered\n", reason);
  49. printf("code=[0x%x], ", (unsigned int)(regs->seqstat & 0x3f));
  50. printf("stack frame=0x%x, ", (unsigned int)regs);
  51. printf("bad PC=0x%04x\n", (unsigned int)regs->pc);
  52. dump(regs);
  53. printf("Unhandled IRQ or exceptions!\n");
  54. printf("Please reset the board \n");
  55. }
  56. void blackfin_init_IRQ(void)
  57. {
  58. *(unsigned volatile long *)(SICA_IMASK0) = 0;
  59. #ifndef CONFIG_KGDB
  60. *(unsigned volatile long *)(EVT1) = 0x0;
  61. #endif
  62. *(unsigned volatile long *)(EVT2) =
  63. (unsigned volatile long)evt_nmi;
  64. *(unsigned volatile long *)(EVT3) =
  65. (unsigned volatile long)trap;
  66. *(unsigned volatile long *)(EVT5) =
  67. (unsigned volatile long)evt_ivhw;
  68. *(unsigned volatile long *)(EVT0) =
  69. (unsigned volatile long)evt_rst;
  70. *(unsigned volatile long *)(EVT6) =
  71. (unsigned volatile long)evt_timer;
  72. *(unsigned volatile long *)(EVT7) =
  73. (unsigned volatile long)evt_evt7;
  74. *(unsigned volatile long *)(EVT8) =
  75. (unsigned volatile long)evt_evt8;
  76. *(unsigned volatile long *)(EVT9) =
  77. (unsigned volatile long)evt_evt9;
  78. *(unsigned volatile long *)(EVT10) =
  79. (unsigned volatile long)evt_evt10;
  80. *(unsigned volatile long *)(EVT11) =
  81. (unsigned volatile long)evt_evt11;
  82. *(unsigned volatile long *)(EVT12) =
  83. (unsigned volatile long)evt_evt12;
  84. *(unsigned volatile long *)(EVT13) =
  85. (unsigned volatile long)evt_evt13;
  86. *(unsigned volatile long *)(EVT14) =
  87. (unsigned volatile long)evt_system_call;
  88. *(unsigned volatile long *)(EVT15) =
  89. (unsigned volatile long)evt_soft_int1;
  90. *(volatile unsigned long *)ILAT = 0;
  91. asm("csync;");
  92. *(volatile unsigned long *)IMASK = 0xffbf;
  93. asm("csync;");
  94. }
  95. void exception_handle(void)
  96. {
  97. #if defined (CONFIG_PANIC_HANG)
  98. display_excp();
  99. #else
  100. udelay(100000); /* allow messages to go out */
  101. do_reset(NULL, 0, 0, NULL);
  102. #endif
  103. }
  104. void display_excp(void)
  105. {
  106. printf("Exception!\n");
  107. }