bonito-irq.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Copyright 2001 MontaVista Software Inc.
  4. * Author: Jun Sun, [email protected] or [email protected]
  5. * Copyright (C) 2000, 2001 Ralf Baechle ([email protected])
  6. *
  7. * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology
  8. * Author: Fuxin Zhang, [email protected]
  9. */
  10. #include <linux/interrupt.h>
  11. #include <linux/compiler.h>
  12. #include <loongson.h>
  13. static inline void bonito_irq_enable(struct irq_data *d)
  14. {
  15. LOONGSON_INTENSET = (1 << (d->irq - LOONGSON_IRQ_BASE));
  16. mmiowb();
  17. }
  18. static inline void bonito_irq_disable(struct irq_data *d)
  19. {
  20. LOONGSON_INTENCLR = (1 << (d->irq - LOONGSON_IRQ_BASE));
  21. mmiowb();
  22. }
  23. static struct irq_chip bonito_irq_type = {
  24. .name = "bonito_irq",
  25. .irq_mask = bonito_irq_disable,
  26. .irq_unmask = bonito_irq_enable,
  27. };
  28. void bonito_irq_init(void)
  29. {
  30. u32 i;
  31. for (i = LOONGSON_IRQ_BASE; i < LOONGSON_IRQ_BASE + 32; i++)
  32. irq_set_chip_and_handler(i, &bonito_irq_type,
  33. handle_level_irq);
  34. #ifdef CONFIG_CPU_LOONGSON2E
  35. i = LOONGSON_IRQ_BASE + 10;
  36. if (request_irq(i, no_action, 0, "dma_timeout", NULL))
  37. pr_err("Failed to request irq %d (dma_timeout)\n", i);
  38. #endif
  39. }