irq-r7785rp.c 2.3 KB

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