setup-sh7705.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * SH7705 Setup
  3. *
  4. * Copyright (C) 2006 - 2009 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, SCIF0, SCIF2, ADC_ADI, USB,
  23. TPU0, TPU1, TPU2, TPU3,
  24. TMU0, TMU1, TMU2,
  25. RTC, WDT, REF_RCMI,
  26. };
  27. static struct intc_vect vectors[] __initdata = {
  28. /* IRQ0->5 are handled in setup-sh3.c */
  29. INTC_VECT(PINT07, 0x700), INTC_VECT(PINT815, 0x720),
  30. INTC_VECT(DMAC, 0x800), INTC_VECT(DMAC, 0x820),
  31. INTC_VECT(DMAC, 0x840), INTC_VECT(DMAC, 0x860),
  32. INTC_VECT(SCIF0, 0x880), INTC_VECT(SCIF0, 0x8a0),
  33. INTC_VECT(SCIF0, 0x8e0),
  34. INTC_VECT(SCIF2, 0x900), INTC_VECT(SCIF2, 0x920),
  35. INTC_VECT(SCIF2, 0x960),
  36. INTC_VECT(ADC_ADI, 0x980),
  37. INTC_VECT(USB, 0xa20), INTC_VECT(USB, 0xa40),
  38. INTC_VECT(TPU0, 0xc00), INTC_VECT(TPU1, 0xc20),
  39. INTC_VECT(TPU2, 0xc80), INTC_VECT(TPU3, 0xca0),
  40. INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
  41. INTC_VECT(TMU2, 0x440), INTC_VECT(TMU2, 0x460),
  42. INTC_VECT(RTC, 0x480), INTC_VECT(RTC, 0x4a0),
  43. INTC_VECT(RTC, 0x4c0),
  44. INTC_VECT(WDT, 0x560),
  45. INTC_VECT(REF_RCMI, 0x580),
  46. };
  47. static struct intc_prio_reg prio_registers[] __initdata = {
  48. { 0xfffffee2, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } },
  49. { 0xfffffee4, 0, 16, 4, /* IPRB */ { WDT, REF_RCMI, 0, 0 } },
  50. { 0xa4000016, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } },
  51. { 0xa4000018, 0, 16, 4, /* IPRD */ { PINT07, PINT815, IRQ5, IRQ4 } },
  52. { 0xa400001a, 0, 16, 4, /* IPRE */ { DMAC, SCIF0, SCIF2, ADC_ADI } },
  53. { 0xa4080000, 0, 16, 4, /* IPRF */ { 0, 0, USB } },
  54. { 0xa4080002, 0, 16, 4, /* IPRG */ { TPU0, TPU1 } },
  55. { 0xa4080004, 0, 16, 4, /* IPRH */ { TPU2, TPU3 } },
  56. };
  57. static DECLARE_INTC_DESC(intc_desc, "sh7705", vectors, NULL,
  58. NULL, prio_registers, NULL);
  59. static struct plat_sci_port sci_platform_data[] = {
  60. {
  61. .mapbase = 0xa4410000,
  62. .flags = UPF_BOOT_AUTOCONF,
  63. .type = PORT_SCIF,
  64. .irqs = { 56, 56, 56 },
  65. }, {
  66. .mapbase = 0xa4400000,
  67. .flags = UPF_BOOT_AUTOCONF,
  68. .type = PORT_SCIF,
  69. .irqs = { 52, 52, 52 },
  70. }, {
  71. .flags = 0,
  72. }
  73. };
  74. static struct platform_device sci_device = {
  75. .name = "sh-sci",
  76. .id = -1,
  77. .dev = {
  78. .platform_data = sci_platform_data,
  79. },
  80. };
  81. static struct resource rtc_resources[] = {
  82. [0] = {
  83. .start = 0xfffffec0,
  84. .end = 0xfffffec0 + 0x1e,
  85. .flags = IORESOURCE_IO,
  86. },
  87. [1] = {
  88. .start = 20,
  89. .flags = IORESOURCE_IRQ,
  90. },
  91. };
  92. static struct sh_rtc_platform_info rtc_info = {
  93. .capabilities = RTC_CAP_4_DIGIT_YEAR,
  94. };
  95. static struct platform_device rtc_device = {
  96. .name = "sh-rtc",
  97. .id = -1,
  98. .num_resources = ARRAY_SIZE(rtc_resources),
  99. .resource = rtc_resources,
  100. .dev = {
  101. .platform_data = &rtc_info,
  102. },
  103. };
  104. static struct platform_device *sh7705_devices[] __initdata = {
  105. &sci_device,
  106. &rtc_device,
  107. };
  108. static int __init sh7705_devices_setup(void)
  109. {
  110. return platform_add_devices(sh7705_devices,
  111. ARRAY_SIZE(sh7705_devices));
  112. }
  113. __initcall(sh7705_devices_setup);
  114. void __init plat_irq_setup(void)
  115. {
  116. register_intc_controller(&intc_desc);
  117. plat_irq_setup_sh3();
  118. }