irq.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Freescale STMP37XX/STMP378X common interrupt handling code
  3. *
  4. * Author: Vladislav Buzov <vbuzov@embeddedalley.com>
  5. *
  6. * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
  7. * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved.
  8. */
  9. /*
  10. * The code contained herein is licensed under the GNU General Public
  11. * License. You may obtain a copy of the GNU General Public License
  12. * Version 2 or later at the following locations:
  13. *
  14. * http://www.opensource.org/licenses/gpl-license.html
  15. * http://www.gnu.org/copyleft/gpl.html
  16. */
  17. #include <linux/init.h>
  18. #include <linux/interrupt.h>
  19. #include <linux/delay.h>
  20. #include <linux/irq.h>
  21. #include <linux/sysdev.h>
  22. #include <mach/stmp3xxx.h>
  23. #include <mach/platform.h>
  24. #include <mach/regs-icoll.h>
  25. void __init stmp3xxx_init_irq(struct irq_chip *chip)
  26. {
  27. unsigned int i, lv;
  28. /* Reset the interrupt controller */
  29. stmp3xxx_reset_block(REGS_ICOLL_BASE + HW_ICOLL_CTRL, true);
  30. /* Disable all interrupts initially */
  31. for (i = 0; i < NR_REAL_IRQS; i++) {
  32. chip->mask(i);
  33. set_irq_chip(i, chip);
  34. set_irq_handler(i, handle_level_irq);
  35. set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
  36. }
  37. /* Ensure vector is cleared */
  38. for (lv = 0; lv < 4; lv++)
  39. __raw_writel(1 << lv, REGS_ICOLL_BASE + HW_ICOLL_LEVELACK);
  40. __raw_writel(0, REGS_ICOLL_BASE + HW_ICOLL_VECTOR);
  41. /* Barrier */
  42. (void)__raw_readl(REGS_ICOLL_BASE + HW_ICOLL_STAT);
  43. }