irq.h 2.5 KB

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