bast-irq.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /* linux/arch/arm/mach-s3c2410/bast-irq.c
  2. *
  3. * Copyright (c) 2004 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * http://www.simtec.co.uk/products/EB2410ITX/
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. *
  22. * Modifications:
  23. * 08-Jan-2003 BJD Moved from central IRQ code
  24. */
  25. #include <linux/init.h>
  26. #include <linux/module.h>
  27. #include <linux/ioport.h>
  28. #include <linux/ptrace.h>
  29. #include <linux/sysdev.h>
  30. #include <asm/hardware.h>
  31. #include <asm/irq.h>
  32. #include <asm/io.h>
  33. #include <asm/mach/irq.h>
  34. #include <asm/hardware/s3c2410/irq.h>
  35. #if 0
  36. #include <asm/debug-ll.h>
  37. #endif
  38. #define irqdbf(x...)
  39. #define irqdbf2(x...)
  40. /* handle PC104 ISA interrupts from the system CPLD */
  41. /* table of ISA irq nos to the relevant mask... zero means
  42. * the irq is not implemented
  43. */
  44. static unsigned char bast_pc104_irqmasks[] = {
  45. 0, /* 0 */
  46. 0, /* 1 */
  47. 0, /* 2 */
  48. 1, /* 3 */
  49. 0, /* 4 */
  50. 2, /* 5 */
  51. 0, /* 6 */
  52. 4, /* 7 */
  53. 0, /* 8 */
  54. 0, /* 9 */
  55. 8, /* 10 */
  56. 0, /* 11 */
  57. 0, /* 12 */
  58. 0, /* 13 */
  59. 0, /* 14 */
  60. 0, /* 15 */
  61. };
  62. static unsigned char bast_pc104_irqs[] = { 3, 5, 7, 10 };
  63. static void
  64. bast_pc104_mask(unsigned int irqno)
  65. {
  66. unsigned long temp;
  67. temp = __raw_readb(BAST_VA_PC104_IRQMASK);
  68. temp &= ~bast_pc104_irqmasks[irqno];
  69. __raw_writeb(temp, BAST_VA_PC104_IRQMASK);
  70. if (temp == 0)
  71. bast_extint_mask(IRQ_ISA);
  72. }
  73. static void
  74. bast_pc104_ack(unsigned int irqno)
  75. {
  76. bast_extint_ack(IRQ_ISA);
  77. }
  78. static void
  79. bast_pc104_unmask(unsigned int irqno)
  80. {
  81. unsigned long temp;
  82. temp = __raw_readb(BAST_VA_PC104_IRQMASK);
  83. temp |= bast_pc104_irqmasks[irqno];
  84. __raw_writeb(temp, BAST_VA_PC104_IRQMASK);
  85. bast_extint_unmask(IRQ_ISA);
  86. }
  87. static struct bast_pc104_chip = {
  88. .mask = bast_pc104_mask,
  89. .unmask = bast_pc104_unmask,
  90. .ack = bast_pc104_ack
  91. };
  92. static void
  93. bast_irq_pc104_demux(unsigned int irq,
  94. struct irqdesc *desc,
  95. struct pt_regs *regs)
  96. {
  97. unsigned int stat;
  98. unsigned int irqno;
  99. int i;
  100. stat = __raw_readb(BAST_VA_PC104_IRQREQ) & 0xf;
  101. for (i = 0; i < 4 && stat != 0; i++) {
  102. if (stat & 1) {
  103. irqno = bast_pc104_irqs[i];
  104. desc = irq_desc + irqno;
  105. desc->handle(irqno, desc, regs);
  106. }
  107. stat >>= 1;
  108. }
  109. }