irq.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology
  3. * Author: Fuxin Zhang, zhangfx@lemote.com
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 2 of the License, or (at your
  8. * option) any later version.
  9. */
  10. #include <linux/delay.h>
  11. #include <linux/interrupt.h>
  12. #include <loongson.h>
  13. /*
  14. * the first level int-handler will jump here if it is a bonito irq
  15. */
  16. void bonito_irqdispatch(void)
  17. {
  18. u32 int_status;
  19. int i;
  20. /* workaround the IO dma problem: let cpu looping to allow DMA finish */
  21. int_status = LOONGSON_INTISR;
  22. while (int_status & (1 << 10)) {
  23. udelay(1);
  24. int_status = LOONGSON_INTISR;
  25. }
  26. /* Get pending sources, masked by current enables */
  27. int_status = LOONGSON_INTISR & LOONGSON_INTEN;
  28. if (int_status) {
  29. i = __ffs(int_status);
  30. do_IRQ(LOONGSON_IRQ_BASE + i);
  31. }
  32. }
  33. asmlinkage void plat_irq_dispatch(void)
  34. {
  35. unsigned int pending;
  36. pending = read_c0_cause() & read_c0_status() & ST0_IM;
  37. /* machine-specific plat_irq_dispatch */
  38. mach_irq_dispatch(pending);
  39. }
  40. void __init arch_init_irq(void)
  41. {
  42. /*
  43. * Clear all of the interrupts while we change the able around a bit.
  44. * int-handler is not on bootstrap
  45. */
  46. clear_c0_status(ST0_IM | ST0_BEV);
  47. /* no steer */
  48. LOONGSON_INTSTEER = 0;
  49. /*
  50. * Mask out all interrupt by writing "1" to all bit position in
  51. * the interrupt reset reg.
  52. */
  53. LOONGSON_INTENCLR = ~0;
  54. /* machine specific irq init */
  55. mach_init_irq();
  56. }