irq.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /* linux/include/asm-arm/plat-s3c24xx/irq.h
  2. *
  3. * Copyright (c) 2004-2005 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * Header file for S3C24XX CPU IRQ support
  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 version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/io.h>
  13. #include <mach/hardware.h>
  14. #include <mach/regs-irq.h>
  15. #include <mach/regs-gpio.h>
  16. #define irqdbf(x...)
  17. #define irqdbf2(x...)
  18. #define EXTINT_OFF (IRQ_EINT4 - 4)
  19. /* these are exported for arch/arm/mach-* usage */
  20. extern struct irq_chip s3c_irq_level_chip;
  21. extern struct irq_chip s3c_irq_chip;
  22. static inline void
  23. s3c_irqsub_mask(unsigned int irqno, unsigned int parentbit,
  24. int subcheck)
  25. {
  26. unsigned long mask;
  27. unsigned long submask;
  28. submask = __raw_readl(S3C2410_INTSUBMSK);
  29. mask = __raw_readl(S3C2410_INTMSK);
  30. submask |= (1UL << (irqno - IRQ_S3CUART_RX0));
  31. /* check to see if we need to mask the parent IRQ */
  32. if ((submask & subcheck) == subcheck) {
  33. __raw_writel(mask | parentbit, S3C2410_INTMSK);
  34. }
  35. /* write back masks */
  36. __raw_writel(submask, S3C2410_INTSUBMSK);
  37. }
  38. static inline void
  39. s3c_irqsub_unmask(unsigned int irqno, unsigned int parentbit)
  40. {
  41. unsigned long mask;
  42. unsigned long submask;
  43. submask = __raw_readl(S3C2410_INTSUBMSK);
  44. mask = __raw_readl(S3C2410_INTMSK);
  45. submask &= ~(1UL << (irqno - IRQ_S3CUART_RX0));
  46. mask &= ~parentbit;
  47. /* write back masks */
  48. __raw_writel(submask, S3C2410_INTSUBMSK);
  49. __raw_writel(mask, S3C2410_INTMSK);
  50. }
  51. static inline void
  52. s3c_irqsub_maskack(unsigned int irqno, unsigned int parentmask, unsigned int group)
  53. {
  54. unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
  55. s3c_irqsub_mask(irqno, parentmask, group);
  56. __raw_writel(bit, S3C2410_SUBSRCPND);
  57. /* only ack parent if we've got all the irqs (seems we must
  58. * ack, all and hope that the irq system retriggers ok when
  59. * the interrupt goes off again)
  60. */
  61. if (1) {
  62. __raw_writel(parentmask, S3C2410_SRCPND);
  63. __raw_writel(parentmask, S3C2410_INTPND);
  64. }
  65. }
  66. static inline void
  67. s3c_irqsub_ack(unsigned int irqno, unsigned int parentmask, unsigned int group)
  68. {
  69. unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
  70. __raw_writel(bit, S3C2410_SUBSRCPND);
  71. /* only ack parent if we've got all the irqs (seems we must
  72. * ack, all and hope that the irq system retriggers ok when
  73. * the interrupt goes off again)
  74. */
  75. if (1) {
  76. __raw_writel(parentmask, S3C2410_SRCPND);
  77. __raw_writel(parentmask, S3C2410_INTPND);
  78. }
  79. }
  80. /* exported for use in arch/arm/mach-s3c2410 */
  81. #ifdef CONFIG_PM
  82. extern int s3c_irq_wake(unsigned int irqno, unsigned int state);
  83. #else
  84. #define s3c_irq_wake NULL
  85. #endif
  86. extern int s3c_irqext_type(unsigned int irq, unsigned int type);