irq.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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->irq_mask(irq_get_irq_data(i));
  33. irq_set_chip_and_handler(i, chip, handle_level_irq);
  34. set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
  35. }
  36. /* Ensure vector is cleared */
  37. for (lv = 0; lv < 4; lv++)
  38. __raw_writel(1 << lv, REGS_ICOLL_BASE + HW_ICOLL_LEVELACK);
  39. __raw_writel(0, REGS_ICOLL_BASE + HW_ICOLL_VECTOR);
  40. /* Barrier */
  41. (void)__raw_readl(REGS_ICOLL_BASE + HW_ICOLL_STAT);
  42. }