intc-simr.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * intc-simr.c
  3. *
  4. * (C) Copyright 2009, Greg Ungerer <gerg@snapgear.com>
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file COPYING in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/types.h>
  11. #include <linux/init.h>
  12. #include <linux/kernel.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/irq.h>
  15. #include <linux/io.h>
  16. #include <asm/coldfire.h>
  17. #include <asm/mcfsim.h>
  18. #include <asm/traps.h>
  19. static void intc_irq_mask(unsigned int irq)
  20. {
  21. if ((irq >= MCFINT_VECBASE) && (irq <= MCFINT_VECBASE + 63))
  22. __raw_writeb(irq - MCFINT_VECBASE, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_SIMR);
  23. }
  24. static void intc_irq_unmask(unsigned int irq)
  25. {
  26. if ((irq >= MCFINT_VECBASE) && (irq <= MCFINT_VECBASE + 63))
  27. __raw_writeb(irq - MCFINT_VECBASE, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_CIMR);
  28. }
  29. static int intc_irq_set_type(unsigned int irq, unsigned int type)
  30. {
  31. if ((irq >= MCFINT_VECBASE) && (irq <= MCFINT_VECBASE + 63))
  32. __raw_writeb(5, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + irq - MCFINT_VECBASE);
  33. return 0;
  34. }
  35. static struct irq_chip intc_irq_chip = {
  36. .name = "CF-INTC",
  37. .mask = intc_irq_mask,
  38. .unmask = intc_irq_unmask,
  39. .set_type = intc_irq_set_type,
  40. };
  41. void __init init_IRQ(void)
  42. {
  43. int irq;
  44. init_vectors();
  45. for (irq = 0; (irq < NR_IRQS); irq++) {
  46. irq_desc[irq].status = IRQ_DISABLED;
  47. irq_desc[irq].action = NULL;
  48. irq_desc[irq].depth = 1;
  49. irq_desc[irq].chip = &intc_irq_chip;
  50. intc_irq_set_type(irq, 0);
  51. }
  52. }