setup-sh3.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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_mask_reg ack_registers[] __initdata = {
  31. { 0xa4000004, 0, 8, /* IRR0 */
  32. { 0, 0, IRQ5, IRQ4, IRQ3, IRQ2, IRQ1, IRQ0 } },
  33. };
  34. static struct intc_sense_reg sense_registers[] __initdata = {
  35. { 0xa4000010, 16, 2, { 0, 0, IRQ5, IRQ4, IRQ3, IRQ2, IRQ1, IRQ0 } },
  36. };
  37. static DECLARE_INTC_DESC_ACK(intc_desc_irq0123, "sh3-irq0123",
  38. vectors_irq0123, NULL, NULL,
  39. prio_registers, sense_registers, ack_registers);
  40. static DECLARE_INTC_DESC_ACK(intc_desc_irq45, "sh3-irq45",
  41. vectors_irq45, NULL, NULL,
  42. prio_registers, sense_registers, ack_registers);
  43. #define INTC_ICR1 0xa4000010UL
  44. #define INTC_ICR1_IRQLVL (1<<14)
  45. void __init plat_irq_setup_pins(int mode)
  46. {
  47. if (mode == IRQ_MODE_IRQ) {
  48. __raw_writew(__raw_readw(INTC_ICR1) & ~INTC_ICR1_IRQLVL, INTC_ICR1);
  49. register_intc_controller(&intc_desc_irq0123);
  50. return;
  51. }
  52. BUG();
  53. }
  54. void __init plat_irq_setup_sh3(void)
  55. {
  56. register_intc_controller(&intc_desc_irq45);
  57. }