irq.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (C) 2011 Google, Inc.
  3. *
  4. * Author:
  5. * Colin Cross <ccross@android.com>
  6. *
  7. * Copyright (C) 2010, NVIDIA Corporation
  8. *
  9. * This software is licensed under the terms of the GNU General Public
  10. * License version 2, as published by the Free Software Foundation, and
  11. * may be copied, distributed, and modified under those terms.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. */
  19. #include <linux/kernel.h>
  20. #include <linux/delay.h>
  21. #include <linux/init.h>
  22. #include <linux/interrupt.h>
  23. #include <linux/irq.h>
  24. #include <linux/io.h>
  25. #include <asm/hardware/gic.h>
  26. #include <mach/iomap.h>
  27. #include <mach/legacy_irq.h>
  28. #include "board.h"
  29. static void tegra_mask(struct irq_data *d)
  30. {
  31. if (d->irq >= 32)
  32. tegra_legacy_mask_irq(d->irq);
  33. }
  34. static void tegra_unmask(struct irq_data *d)
  35. {
  36. if (d->irq >= 32)
  37. tegra_legacy_unmask_irq(d->irq);
  38. }
  39. static void tegra_ack(struct irq_data *d)
  40. {
  41. if (d->irq >= 32)
  42. tegra_legacy_force_irq_clr(d->irq);
  43. }
  44. static int tegra_retrigger(struct irq_data *d)
  45. {
  46. if (d->irq < 32)
  47. return 0;
  48. tegra_legacy_force_irq_set(d->irq);
  49. return 1;
  50. }
  51. void __init tegra_init_irq(void)
  52. {
  53. tegra_init_legacy_irq();
  54. gic_arch_extn.irq_ack = tegra_ack;
  55. gic_arch_extn.irq_mask = tegra_mask;
  56. gic_arch_extn.irq_unmask = tegra_unmask;
  57. gic_arch_extn.irq_retrigger = tegra_retrigger;
  58. gic_init(0, 29, IO_ADDRESS(TEGRA_ARM_INT_DIST_BASE),
  59. IO_ADDRESS(TEGRA_ARM_PERIF_BASE + 0x100));
  60. }