setup-sh4-202.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * SH4-202 Setup
  3. *
  4. * Copyright (C) 2006 Paul Mundt
  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/platform_device.h>
  11. #include <linux/init.h>
  12. #include <linux/serial.h>
  13. #include <linux/serial_sci.h>
  14. #include <linux/sh_timer.h>
  15. static struct plat_sci_port sci_platform_data[] = {
  16. {
  17. .mapbase = 0xffe80000,
  18. .flags = UPF_BOOT_AUTOCONF,
  19. .type = PORT_SCIF,
  20. .irqs = { 40, 41, 43, 42 },
  21. }, {
  22. .flags = 0,
  23. }
  24. };
  25. static struct platform_device sci_device = {
  26. .name = "sh-sci",
  27. .id = -1,
  28. .dev = {
  29. .platform_data = sci_platform_data,
  30. },
  31. };
  32. static struct sh_timer_config tmu0_platform_data = {
  33. .name = "TMU0",
  34. .channel_offset = 0x04,
  35. .timer_bit = 0,
  36. .clk = "module_clk",
  37. .clockevent_rating = 200,
  38. };
  39. static struct resource tmu0_resources[] = {
  40. [0] = {
  41. .name = "TMU0",
  42. .start = 0xffd80008,
  43. .end = 0xffd80013,
  44. .flags = IORESOURCE_MEM,
  45. },
  46. [1] = {
  47. .start = 16,
  48. .flags = IORESOURCE_IRQ,
  49. },
  50. };
  51. static struct platform_device tmu0_device = {
  52. .name = "sh_tmu",
  53. .id = 0,
  54. .dev = {
  55. .platform_data = &tmu0_platform_data,
  56. },
  57. .resource = tmu0_resources,
  58. .num_resources = ARRAY_SIZE(tmu0_resources),
  59. };
  60. static struct sh_timer_config tmu1_platform_data = {
  61. .name = "TMU1",
  62. .channel_offset = 0x10,
  63. .timer_bit = 1,
  64. .clk = "module_clk",
  65. .clocksource_rating = 200,
  66. };
  67. static struct resource tmu1_resources[] = {
  68. [0] = {
  69. .name = "TMU1",
  70. .start = 0xffd80014,
  71. .end = 0xffd8001f,
  72. .flags = IORESOURCE_MEM,
  73. },
  74. [1] = {
  75. .start = 17,
  76. .flags = IORESOURCE_IRQ,
  77. },
  78. };
  79. static struct platform_device tmu1_device = {
  80. .name = "sh_tmu",
  81. .id = 1,
  82. .dev = {
  83. .platform_data = &tmu1_platform_data,
  84. },
  85. .resource = tmu1_resources,
  86. .num_resources = ARRAY_SIZE(tmu1_resources),
  87. };
  88. static struct sh_timer_config tmu2_platform_data = {
  89. .name = "TMU2",
  90. .channel_offset = 0x1c,
  91. .timer_bit = 2,
  92. .clk = "module_clk",
  93. };
  94. static struct resource tmu2_resources[] = {
  95. [0] = {
  96. .name = "TMU2",
  97. .start = 0xffd80020,
  98. .end = 0xffd8002f,
  99. .flags = IORESOURCE_MEM,
  100. },
  101. [1] = {
  102. .start = 18,
  103. .flags = IORESOURCE_IRQ,
  104. },
  105. };
  106. static struct platform_device tmu2_device = {
  107. .name = "sh_tmu",
  108. .id = 2,
  109. .dev = {
  110. .platform_data = &tmu2_platform_data,
  111. },
  112. .resource = tmu2_resources,
  113. .num_resources = ARRAY_SIZE(tmu2_resources),
  114. };
  115. static struct platform_device *sh4202_devices[] __initdata = {
  116. &sci_device,
  117. &tmu0_device,
  118. &tmu1_device,
  119. &tmu2_device,
  120. };
  121. static int __init sh4202_devices_setup(void)
  122. {
  123. return platform_add_devices(sh4202_devices,
  124. ARRAY_SIZE(sh4202_devices));
  125. }
  126. __initcall(sh4202_devices_setup);
  127. static struct platform_device *sh4202_early_devices[] __initdata = {
  128. &tmu0_device,
  129. &tmu1_device,
  130. &tmu2_device,
  131. };
  132. void __init plat_early_device_setup(void)
  133. {
  134. early_platform_add_devices(sh4202_early_devices,
  135. ARRAY_SIZE(sh4202_early_devices));
  136. }
  137. void __init plat_irq_setup(void)
  138. {
  139. /* do nothing - all IRL interrupts are handled by the board code */
  140. }