irq.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * linux/arch/arm/mach-epxa10db/irq.c
  3. *
  4. * Copyright (C) 2001 Altera Corporation
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #include <linux/init.h>
  21. #include <linux/ioport.h>
  22. #include <linux/stddef.h>
  23. #include <linux/timer.h>
  24. #include <linux/list.h>
  25. #include <asm/io.h>
  26. #include <asm/hardware.h>
  27. #include <asm/irq.h>
  28. #include <asm/mach/irq.h>
  29. #include <asm/arch/platform.h>
  30. #include <asm/arch/int_ctrl00.h>
  31. static void epxa_mask_irq(unsigned int irq)
  32. {
  33. writel(1 << irq, INT_MC(IO_ADDRESS(EXC_INT_CTRL00_BASE)));
  34. }
  35. static void epxa_unmask_irq(unsigned int irq)
  36. {
  37. writel(1 << irq, INT_MS(IO_ADDRESS(EXC_INT_CTRL00_BASE)));
  38. }
  39. static struct irqchip epxa_irq_chip = {
  40. .ack = epxa_mask_irq,
  41. .mask = epxa_mask_irq,
  42. .unmask = epxa_unmask_irq,
  43. };
  44. static struct resource irq_resource = {
  45. .name = "irq_handler",
  46. .start = IO_ADDRESS(EXC_INT_CTRL00_BASE),
  47. .end = IO_ADDRESS(INT_PRIORITY_FC(EXC_INT_CTRL00_BASE))+4,
  48. };
  49. void __init epxa10db_init_irq(void)
  50. {
  51. unsigned int i;
  52. request_resource(&iomem_resource, &irq_resource);
  53. /*
  54. * This bit sets up the interrupt controller using
  55. * the 6 PLD interrupts mode (the default) each
  56. * irqs is assigned a priority which is the same
  57. * as its interrupt number. This scheme is used because
  58. * its easy, but you may want to change it depending
  59. * on the contents of your PLD
  60. */
  61. writel(3,INT_MODE(IO_ADDRESS(EXC_INT_CTRL00_BASE)));
  62. for (i = 0; i < NR_IRQS; i++){
  63. writel(i+1, INT_PRIORITY_P0(IO_ADDRESS(EXC_INT_CTRL00_BASE)) + (4*i));
  64. set_irq_chip(i,&epxa_irq_chip);
  65. set_irq_handler(i,do_level_IRQ);
  66. set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
  67. }
  68. /* Disable all interrupts */
  69. writel(-1,INT_MC(IO_ADDRESS(EXC_INT_CTRL00_BASE)));
  70. }