setup-sh7705.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*
  2. * SH7705 Setup
  3. *
  4. * Copyright (C) 2006, 2007 Paul Mundt
  5. * Copyright (C) 2007 Nobuhiro Iwamatsu
  6. *
  7. * This file is subject to the terms and conditions of the GNU General Public
  8. * License. See the file "COPYING" in the main directory of this archive
  9. * for more details.
  10. */
  11. #include <linux/platform_device.h>
  12. #include <linux/init.h>
  13. #include <linux/irq.h>
  14. #include <linux/serial.h>
  15. #include <linux/serial_sci.h>
  16. #include <asm/rtc.h>
  17. enum {
  18. UNUSED = 0,
  19. /* interrupt sources */
  20. IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5,
  21. PINT07, PINT815,
  22. DMAC_DEI0, DMAC_DEI1, DMAC_DEI2, DMAC_DEI3,
  23. SCIF0_ERI, SCIF0_RXI, SCIF0_TXI,
  24. SCIF2_ERI, SCIF2_RXI, SCIF2_TXI,
  25. ADC_ADI,
  26. USB_USI0, USB_USI1,
  27. TPU0, TPU1, TPU2, TPU3,
  28. TMU0, TMU1, TMU2_TUNI, TMU2_TICPI,
  29. RTC_ATI, RTC_PRI, RTC_CUI,
  30. WDT,
  31. REF_RCMI,
  32. /* interrupt groups */
  33. RTC, TMU2, DMAC, USB, SCIF2, SCIF0,
  34. };
  35. static struct intc_vect vectors[] __initdata = {
  36. /* IRQ0->5 are handled in setup-sh3.c */
  37. INTC_VECT(PINT07, 0x700), INTC_VECT(PINT815, 0x720),
  38. INTC_VECT(DMAC_DEI0, 0x800), INTC_VECT(DMAC_DEI1, 0x820),
  39. INTC_VECT(DMAC_DEI2, 0x840), INTC_VECT(DMAC_DEI3, 0x860),
  40. INTC_VECT(SCIF0_ERI, 0x880), INTC_VECT(SCIF0_RXI, 0x8a0),
  41. INTC_VECT(SCIF0_TXI, 0x8e0),
  42. INTC_VECT(SCIF2_ERI, 0x900), INTC_VECT(SCIF2_RXI, 0x920),
  43. INTC_VECT(SCIF2_TXI, 0x960),
  44. INTC_VECT(ADC_ADI, 0x980),
  45. INTC_VECT(USB_USI0, 0xa20), INTC_VECT(USB_USI1, 0xa40),
  46. INTC_VECT(TPU0, 0xc00), INTC_VECT(TPU1, 0xc20),
  47. INTC_VECT(TPU2, 0xc80), INTC_VECT(TPU3, 0xca0),
  48. INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
  49. INTC_VECT(TMU2_TUNI, 0x440), INTC_VECT(TMU2_TICPI, 0x460),
  50. INTC_VECT(RTC_ATI, 0x480), INTC_VECT(RTC_PRI, 0x4a0),
  51. INTC_VECT(RTC_CUI, 0x4c0),
  52. INTC_VECT(WDT, 0x560),
  53. INTC_VECT(REF_RCMI, 0x580),
  54. };
  55. static struct intc_group groups[] __initdata = {
  56. INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI),
  57. INTC_GROUP(TMU2, TMU2_TUNI, TMU2_TICPI),
  58. INTC_GROUP(DMAC, DMAC_DEI0, DMAC_DEI1, DMAC_DEI2, DMAC_DEI3),
  59. INTC_GROUP(USB, USB_USI0, USB_USI1),
  60. INTC_GROUP(SCIF0, SCIF0_ERI, SCIF0_RXI, SCIF0_TXI),
  61. INTC_GROUP(SCIF2, SCIF2_ERI, SCIF2_RXI, SCIF2_TXI),
  62. };
  63. static struct intc_prio_reg prio_registers[] __initdata = {
  64. { 0xfffffee2, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } },
  65. { 0xfffffee4, 0, 16, 4, /* IPRB */ { WDT, REF_RCMI, 0, 0 } },
  66. { 0xa4000016, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } },
  67. { 0xa4000018, 0, 16, 4, /* IPRD */ { PINT07, PINT815, IRQ5, IRQ4 } },
  68. { 0xa400001a, 0, 16, 4, /* IPRE */ { DMAC, SCIF0, SCIF2, ADC_ADI } },
  69. { 0xa4080000, 0, 16, 4, /* IPRF */ { 0, 0, USB } },
  70. { 0xa4080002, 0, 16, 4, /* IPRG */ { TPU0, TPU1 } },
  71. { 0xa4080004, 0, 16, 4, /* IPRH */ { TPU2, TPU3 } },
  72. };
  73. static DECLARE_INTC_DESC(intc_desc, "sh7705", vectors, groups,
  74. NULL, prio_registers, NULL);
  75. static struct plat_sci_port sci_platform_data[] = {
  76. {
  77. .mapbase = 0xa4410000,
  78. .flags = UPF_BOOT_AUTOCONF,
  79. .type = PORT_SCIF,
  80. .irqs = { 56, 57, 59 },
  81. }, {
  82. .mapbase = 0xa4400000,
  83. .flags = UPF_BOOT_AUTOCONF,
  84. .type = PORT_SCIF,
  85. .irqs = { 52, 53, 55 },
  86. }, {
  87. .flags = 0,
  88. }
  89. };
  90. static struct platform_device sci_device = {
  91. .name = "sh-sci",
  92. .id = -1,
  93. .dev = {
  94. .platform_data = sci_platform_data,
  95. },
  96. };
  97. static struct resource rtc_resources[] = {
  98. [0] = {
  99. .start = 0xfffffec0,
  100. .end = 0xfffffec0 + 0x1e,
  101. .flags = IORESOURCE_IO,
  102. },
  103. [1] = {
  104. .start = 20,
  105. .flags = IORESOURCE_IRQ,
  106. },
  107. [2] = {
  108. .start = 21,
  109. .flags = IORESOURCE_IRQ,
  110. },
  111. [3] = {
  112. .start = 22,
  113. .flags = IORESOURCE_IRQ,
  114. },
  115. };
  116. static struct sh_rtc_platform_info rtc_info = {
  117. .capabilities = RTC_CAP_4_DIGIT_YEAR,
  118. };
  119. static struct platform_device rtc_device = {
  120. .name = "sh-rtc",
  121. .id = -1,
  122. .num_resources = ARRAY_SIZE(rtc_resources),
  123. .resource = rtc_resources,
  124. .dev = {
  125. .platform_data = &rtc_info,
  126. },
  127. };
  128. static struct platform_device *sh7705_devices[] __initdata = {
  129. &sci_device,
  130. &rtc_device,
  131. };
  132. static int __init sh7705_devices_setup(void)
  133. {
  134. return platform_add_devices(sh7705_devices,
  135. ARRAY_SIZE(sh7705_devices));
  136. }
  137. __initcall(sh7705_devices_setup);
  138. void __init plat_irq_setup(void)
  139. {
  140. register_intc_controller(&intc_desc);
  141. plat_irq_setup_sh3();
  142. }