setup-sh3.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Shared SH3 Setup code
  3. *
  4. * Copyright (C) 2008 Magnus Damm
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/init.h>
  11. #include <linux/irq.h>
  12. #include <linux/io.h>
  13. /* All SH3 devices are equipped with IRQ0->5 (except sh7708) */
  14. enum {
  15. UNUSED = 0,
  16. /* interrupt sources */
  17. IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5,
  18. };
  19. static struct intc_vect vectors_irq0123[] __initdata = {
  20. INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620),
  21. INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660),
  22. };
  23. static struct intc_vect vectors_irq45[] __initdata = {
  24. INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0),
  25. };
  26. static struct intc_prio_reg prio_registers[] __initdata = {
  27. { 0xa4000016, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } },
  28. { 0xa4000018, 0, 16, 4, /* IPRD */ { 0, 0, IRQ5, IRQ4 } },
  29. };
  30. static struct intc_sense_reg sense_registers[] __initdata = {
  31. { 0xa4000010, 16, 2, { 0, 0, IRQ5, IRQ4, IRQ3, IRQ2, IRQ1, IRQ0 } },
  32. };
  33. static DECLARE_INTC_DESC(intc_desc_irq0123, "sh3-irq0123", vectors_irq0123,
  34. NULL, NULL, prio_registers, sense_registers);
  35. static DECLARE_INTC_DESC(intc_desc_irq45, "sh3-irq45", vectors_irq45,
  36. NULL, NULL, prio_registers, sense_registers);
  37. #define INTC_ICR1 0xa4000010UL
  38. #define INTC_ICR1_IRQLVL (1<<14)
  39. void __init plat_irq_setup_pins(int mode)
  40. {
  41. if (mode == IRQ_MODE_IRQ) {
  42. ctrl_outw(ctrl_inw(INTC_ICR1) & ~INTC_ICR1_IRQLVL, INTC_ICR1);
  43. register_intc_controller(&intc_desc_irq0123);
  44. return;
  45. }
  46. BUG();
  47. }
  48. void __init plat_irq_setup_sh3(void)
  49. {
  50. register_intc_controller(&intc_desc_irq45);
  51. }