irq-r7785rp.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Renesas Solutions Highlander R7785RP Support.
  3. *
  4. * Copyright (C) 2002 Atom Create Engineering Co., Ltd.
  5. * Copyright (C) 2006 - 2008 Paul Mundt
  6. * Copyright (C) 2007 Magnus Damm
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file "COPYING" in the main directory of this archive
  10. * for more details.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/irq.h>
  14. #include <linux/io.h>
  15. #include <mach/highlander.h>
  16. enum {
  17. UNUSED = 0,
  18. /* FPGA specific interrupt sources */
  19. CF, /* Compact Flash */
  20. SMBUS, /* SMBUS */
  21. TP, /* Touch panel */
  22. RTC, /* RTC Alarm */
  23. TH_ALERT, /* Temperature sensor */
  24. AX88796, /* Ethernet controller */
  25. /* external bus connector */
  26. EXT0, EXT1, EXT2, EXT3, EXT4, EXT5, EXT6, EXT7,
  27. };
  28. static struct intc_vect vectors[] __initdata = {
  29. INTC_IRQ(CF, IRQ_CF),
  30. INTC_IRQ(SMBUS, IRQ_SMBUS),
  31. INTC_IRQ(TP, IRQ_TP),
  32. INTC_IRQ(RTC, IRQ_RTC),
  33. INTC_IRQ(TH_ALERT, IRQ_TH_ALERT),
  34. INTC_IRQ(EXT0, IRQ_EXT0), INTC_IRQ(EXT1, IRQ_EXT1),
  35. INTC_IRQ(EXT2, IRQ_EXT2), INTC_IRQ(EXT3, IRQ_EXT3),
  36. INTC_IRQ(EXT4, IRQ_EXT4), INTC_IRQ(EXT5, IRQ_EXT5),
  37. INTC_IRQ(EXT6, IRQ_EXT6), INTC_IRQ(EXT7, IRQ_EXT7),
  38. INTC_IRQ(AX88796, IRQ_AX88796),
  39. };
  40. static struct intc_mask_reg mask_registers[] __initdata = {
  41. { 0xa4000010, 0, 16, /* IRLMCR1 */
  42. { 0, 0, 0, 0, CF, AX88796, SMBUS, TP,
  43. RTC, 0, TH_ALERT, 0, 0, 0, 0, 0 } },
  44. { 0xa4000012, 0, 16, /* IRLMCR2 */
  45. { 0, 0, 0, 0, 0, 0, 0, 0,
  46. EXT7, EXT6, EXT5, EXT4, EXT3, EXT2, EXT1, EXT0 } },
  47. };
  48. static unsigned char irl2irq[HL_NR_IRL] __initdata = {
  49. 0, IRQ_CF, IRQ_EXT4, IRQ_EXT5,
  50. IRQ_EXT6, IRQ_EXT7, IRQ_SMBUS, IRQ_TP,
  51. IRQ_RTC, IRQ_TH_ALERT, IRQ_AX88796, IRQ_EXT0,
  52. IRQ_EXT1, IRQ_EXT2, IRQ_EXT3,
  53. };
  54. static DECLARE_INTC_DESC(intc_desc, "r7785rp", vectors,
  55. NULL, mask_registers, NULL, NULL);
  56. unsigned char * __init highlander_plat_irq_setup(void)
  57. {
  58. if ((__raw_readw(0xa4000158) & 0xf000) != 0x1000)
  59. return NULL;
  60. printk(KERN_INFO "Using r7785rp interrupt controller.\n");
  61. __raw_writew(0x0000, PA_IRLSSR1); /* FPGA IRLSSR1(CF_CD clear) */
  62. /* Setup the FPGA IRL */
  63. __raw_writew(0x0000, PA_IRLPRA); /* FPGA IRLA */
  64. __raw_writew(0xe598, PA_IRLPRB); /* FPGA IRLB */
  65. __raw_writew(0x7060, PA_IRLPRC); /* FPGA IRLC */
  66. __raw_writew(0x0000, PA_IRLPRD); /* FPGA IRLD */
  67. __raw_writew(0x4321, PA_IRLPRE); /* FPGA IRLE */
  68. __raw_writew(0xdcba, PA_IRLPRF); /* FPGA IRLF */
  69. register_intc_controller(&intc_desc);
  70. return irl2irq;
  71. }