irq.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * linux/arch/arm/mach-nuc93x/irq.c
  3. *
  4. * Copyright (c) 2008 Nuvoton technology corporation.
  5. *
  6. * Wan ZongShun <mcuos.com@gmail.com>
  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;version 2 of the License.
  11. *
  12. */
  13. #include <linux/init.h>
  14. #include <linux/module.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/ioport.h>
  17. #include <linux/ptrace.h>
  18. #include <linux/sysdev.h>
  19. #include <linux/io.h>
  20. #include <asm/irq.h>
  21. #include <asm/mach/irq.h>
  22. #include <mach/hardware.h>
  23. #include <mach/regs-irq.h>
  24. static void nuc93x_irq_mask(struct irq_data *d)
  25. {
  26. __raw_writel(1 << d->irq, REG_AIC_MDCR);
  27. }
  28. /*
  29. * By the w90p910 spec,any irq,only write 1
  30. * to REG_AIC_EOSCR for ACK
  31. */
  32. static void nuc93x_irq_ack(struct irq_data *d)
  33. {
  34. __raw_writel(0x01, REG_AIC_EOSCR);
  35. }
  36. static void nuc93x_irq_unmask(struct irq_data *d)
  37. {
  38. __raw_writel(1 << d->irq, REG_AIC_MECR);
  39. }
  40. static struct irq_chip nuc93x_irq_chip = {
  41. .irq_ack = nuc93x_irq_ack,
  42. .irq_mask = nuc93x_irq_mask,
  43. .irq_unmask = nuc93x_irq_unmask,
  44. };
  45. void __init nuc93x_init_irq(void)
  46. {
  47. int irqno;
  48. __raw_writel(0xFFFFFFFE, REG_AIC_MDCR);
  49. for (irqno = IRQ_WDT; irqno <= NR_IRQS; irqno++) {
  50. irq_set_chip_and_handler(irqno, &nuc93x_irq_chip,
  51. handle_level_irq);
  52. set_irq_flags(irqno, IRQF_VALID);
  53. }
  54. }