irq.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. #define irqdbf(x...)
  13. #define irqdbf2(x...)
  14. #define EXTINT_OFF (IRQ_EINT4 - 4)
  15. /* these are exported for arch/arm/mach-* usage */
  16. extern struct irq_chip s3c_irq_level_chip;
  17. extern struct irq_chip s3c_irq_chip;
  18. static inline void
  19. s3c_irqsub_mask(unsigned int irqno, unsigned int parentbit,
  20. int subcheck)
  21. {
  22. unsigned long mask;
  23. unsigned long submask;
  24. submask = __raw_readl(S3C2410_INTSUBMSK);
  25. mask = __raw_readl(S3C2410_INTMSK);
  26. submask |= (1UL << (irqno - IRQ_S3CUART_RX0));
  27. /* check to see if we need to mask the parent IRQ */
  28. if ((submask & subcheck) == subcheck) {
  29. __raw_writel(mask | parentbit, S3C2410_INTMSK);
  30. }
  31. /* write back masks */
  32. __raw_writel(submask, S3C2410_INTSUBMSK);
  33. }
  34. static inline void
  35. s3c_irqsub_unmask(unsigned int irqno, unsigned int parentbit)
  36. {
  37. unsigned long mask;
  38. unsigned long submask;
  39. submask = __raw_readl(S3C2410_INTSUBMSK);
  40. mask = __raw_readl(S3C2410_INTMSK);
  41. submask &= ~(1UL << (irqno - IRQ_S3CUART_RX0));
  42. mask &= ~parentbit;
  43. /* write back masks */
  44. __raw_writel(submask, S3C2410_INTSUBMSK);
  45. __raw_writel(mask, S3C2410_INTMSK);
  46. }
  47. static inline void
  48. s3c_irqsub_maskack(unsigned int irqno, unsigned int parentmask, unsigned int group)
  49. {
  50. unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
  51. s3c_irqsub_mask(irqno, parentmask, group);
  52. __raw_writel(bit, S3C2410_SUBSRCPND);
  53. /* only ack parent if we've got all the irqs (seems we must
  54. * ack, all and hope that the irq system retriggers ok when
  55. * the interrupt goes off again)
  56. */
  57. if (1) {
  58. __raw_writel(parentmask, S3C2410_SRCPND);
  59. __raw_writel(parentmask, S3C2410_INTPND);
  60. }
  61. }
  62. static inline void
  63. s3c_irqsub_ack(unsigned int irqno, unsigned int parentmask, unsigned int group)
  64. {
  65. unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
  66. __raw_writel(bit, S3C2410_SUBSRCPND);
  67. /* only ack parent if we've got all the irqs (seems we must
  68. * ack, all and hope that the irq system retriggers ok when
  69. * the interrupt goes off again)
  70. */
  71. if (1) {
  72. __raw_writel(parentmask, S3C2410_SRCPND);
  73. __raw_writel(parentmask, S3C2410_INTPND);
  74. }
  75. }
  76. /* exported for use in arch/arm/mach-s3c2410 */
  77. #ifdef CONFIG_PM
  78. extern int s3c_irq_wake(unsigned int irqno, unsigned int state);
  79. #else
  80. #define s3c_irq_wake NULL
  81. #endif
  82. extern int s3c_irqext_type(unsigned int irq, unsigned int type);