memoryDefinitionHeterogeneousSynchronous.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /* linux/arch/arm/plat-s3c24xx/irq.c
  2. *
  3. * Copyright (c) 2003-2004 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #include <linux/init.h>
  21. #include <linux/module.h>
  22. #include <linux/interrupt.h>
  23. #include <linux/ioport.h>
  24. #include <linux/device.h>
  25. #include <linux/syscore_ops.h>
  26. #include <asm/irq.h>
  27. #include <asm/mach/irq.h>
  28. #include <plat/regs-irqtype.h>
  29. #include <plat/cpu.h>
  30. #include <plat/pm.h>
  31. #include <plat/irq.h>
  32. static void
  33. s3c_irq_mask(struct irq_data *data)
  34. {
  35. unsigned int irqno = data->irq - IRQ_EINT0;
  36. unsigned long mask;
  37. mask = __raw_readl(S3C2410_INTMSK);
  38. mask |= 1UL << irqno;
  39. __raw_writel(mask, S3C2410_INTMSK);
  40. }
  41. static inline void
  42. s3c_irq_ack(struct irq_data *data)
  43. {
  44. unsigned long bitval = 1UL << (data->irq - IRQ_EINT0);
  45. __raw_writel(bitval, S3C2410_SRCPND);
  46. __raw_writel(bitval, S3C2410_INTPND);
  47. }
  48. static inline void
  49. s3c_irq_maskack(struct irq_data *data)
  50. {
  51. unsigned long bitval = 1UL << (data->irq - IRQ_EINT0);
  52. unsigned long mask;
  53. mask = __raw_readl(S3C2410_INTMSK);
  54. __raw_writel(mask|bitval, S3C2410_INTMSK);
  55. __raw_writel(bitval, S3C2410_SRCPND);
  56. __raw_writel(bitval, S3C2410_INTPND);
  57. }
  58. static void
  59. s3c_irq_unmask(struct irq_data *data)
  60. {
  61. unsigned int irqno = data->irq;
  62. unsigned long mask;
  63. if (irqno != IRQ_TIMER4 && irqno != IRQ_EINT8t23)
  64. irqdbf2("s3c_irq_unmask %d\n", irqno);
  65. irqno -= IRQ_EINT0;
  66. mask = __raw_readl(S3C2410_INTMSK);
  67. mask &= ~(1UL << irqno);
  68. __raw_writel(mask, S3C2410_INTMSK);
  69. }
  70. struct irq_chip s3c_irq_level_chip = {
  71. .name = "s3c-level",
  72. .irq_ack = s3c_irq_maskack,
  73. .irq_mask = s3c_irq_mask,
  74. .irq_unmask = s3c_irq_unmask,
  75. .irq_set_wake = s3c_irq_wake
  76. };
  77. struct irq_chip s3c_irq_chip = {
  78. .name = "s3c",
  79. .irq_ack = s3c_irq_ack,
  80. .irq_mask = s3c_irq_mask,
  81. .irq_unmask = s3c_irq_unmask,
  82. .irq_set_wake = s3c_irq_wake
  83. };
  84. static void
  85. s3c_irqext_mask(struct irq_data *data)
  86. {
  87. unsigned int irqno = data->irq - EXTINT_OFF;
  88. unsigned long mask;
  89. mask = __raw_readl(S3C24XX_EINTMASK);