definitionOfLeakageHazard.c 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. /*
  2. * sh7372 processor support
  3. *
  4. * Copyright (C) 2010 Magnus Damm
  5. * Copyright (C) 2008 Yoshihiro Shimoda
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; version 2 of the License.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include <linux/kernel.h>
  21. #include <linux/init.h>
  22. #include <linux/interrupt.h>
  23. #include <linux/irq.h>
  24. #include <linux/platform_device.h>
  25. #include <linux/of_platform.h>
  26. #include <linux/uio_driver.h>
  27. #include <linux/delay.h>
  28. #include <linux/input.h>
  29. #include <linux/io.h>
  30. #include <linux/serial_sci.h>
  31. #include <linux/sh_dma.h>
  32. #include <linux/sh_intc.h>
  33. #include <linux/sh_timer.h>
  34. #include <linux/pm_domain.h>
  35. #include <linux/dma-mapping.h>
  36. #include <mach/dma-register.h>
  37. #include <mach/hardware.h>
  38. #include <mach/irqs.h>
  39. #include <mach/sh7372.h>
  40. #include <mach/common.h>
  41. #include <asm/mach/map.h>
  42. #include <asm/mach-types.h>
  43. #include <asm/mach/arch.h>
  44. #include <asm/mach/time.h>
  45. static struct map_desc sh7372_io_desc[] __initdata = {
  46. /* create a 1:1 entity map for 0xe6xxxxxx
  47. * used by CPGA, INTC and PFC.
  48. */
  49. {
  50. .virtual = 0xe6000000,
  51. .pfn = __phys_to_pfn(0xe6000000),
  52. .length = 256 << 20,
  53. .type = MT_DEVICE_NONSHARED
  54. },
  55. };
  56. void __init sh7372_map_io(void)
  57. {
  58. iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc));
  59. }
  60. /* SCIFA0 */
  61. static struct plat_sci_port scif0_platform_data = {
  62. .mapbase = 0xe6c40000,
  63. .flags = UPF_BOOT_AUTOCONF,
  64. .scscr = SCSCR_RE | SCSCR_TE,
  65. .scbrr_algo_id = SCBRR_ALGO_4,
  66. .type = PORT_SCIFA,
  67. .irqs = { evt2irq(0x0c00), evt2irq(0x0c00),
  68. evt2irq(0x0c00), evt2irq(0x0c00) },
  69. };
  70. static struct platform_device scif0_device = {
  71. .name = "sh-sci",
  72. .id = 0,
  73. .dev = {
  74. .platform_data = &scif0_platform_data,
  75. },
  76. };
  77. /* SCIFA1 */
  78. static struct plat_sci_port scif1_platform_data = {
  79. .mapbase = 0xe6c50000,
  80. .flags = UPF_BOOT_AUTOCONF,
  81. .scscr = SCSCR_RE | SCSCR_TE,
  82. .scbrr_algo_id = SCBRR_ALGO_4,
  83. .type = PORT_SCIFA,
  84. .irqs = { evt2irq(0x0c20), evt2irq(0x0c20),
  85. evt2irq(0x0c20), evt2irq(0x0c20) },
  86. };
  87. static struct platform_device scif1_device = {
  88. .name = "sh-sci",
  89. .id = 1,
  90. .dev = {
  91. .platform_data = &scif1_platform_data,
  92. },
  93. };
  94. /* SCIFA2 */
  95. static struct plat_sci_port scif2_platform_data = {
  96. .mapbase = 0xe6c60000,
  97. .flags = UPF_BOOT_AUTOCONF,
  98. .scscr = SCSCR_RE | SCSCR_TE,
  99. .scbrr_algo_id = SCBRR_ALGO_4,
  100. .type = PORT_SCIFA,
  101. .irqs = { evt2irq(0x0c40), evt2irq(0x0c40),
  102. evt2irq(0x0c40), evt2irq(0x0c40) },
  103. };
  104. static struct platform_device scif2_device = {
  105. .name = "sh-sci",
  106. .id = 2,
  107. .dev = {
  108. .platform_data = &scif2_platform_data,
  109. },
  110. };
  111. /* SCIFA3 */
  112. static struct plat_sci_port scif3_platform_data = {
  113. .mapbase = 0xe6c70000,
  114. .flags = UPF_BOOT_AUTOCONF,
  115. .scscr = SCSCR_RE | SCSCR_TE,
  116. .scbrr_algo_id = SCBRR_ALGO_4,
  117. .type = PORT_SCIFA,
  118. .irqs = { evt2irq(0x0c60), evt2irq(0x0c60),
  119. evt2irq(0x0c60), evt2irq(0x0c60) },
  120. };
  121. static struct platform_device scif3_device = {
  122. .name = "sh-sci",
  123. .id = 3,
  124. .dev = {
  125. .platform_data = &scif3_platform_data,
  126. },
  127. };
  128. /* SCIFA4 */
  129. static struct plat_sci_port scif4_platform_data = {
  130. .mapbase = 0xe6c80000,
  131. .flags = UPF_BOOT_AUTOCONF,
  132. .scscr = SCSCR_RE | SCSCR_TE,
  133. .scbrr_algo_id = SCBRR_ALGO_4,
  134. .type = PORT_SCIFA,
  135. .irqs = { evt2irq(0x0d20), evt2irq(0x0d20),
  136. evt2irq(0x0d20), evt2irq(0x0d20) },
  137. };
  138. static struct platform_device scif4_device = {
  139. .name = "sh-sci",
  140. .id = 4,
  141. .dev = {
  142. .platform_data = &scif4_platform_data,
  143. },
  144. };
  145. /* SCIFA5 */
  146. static struct plat_sci_port scif5_platform_data = {
  147. .mapbase = 0xe6cb0000,
  148. .flags = UPF_BOOT_AUTOCONF,
  149. .scscr = SCSCR_RE | SCSCR_TE,
  150. .scbrr_algo_id = SCBRR_ALGO_4,
  151. .type = PORT_SCIFA,
  152. .irqs = { evt2irq(0x0d40), evt2irq(0x0d40),
  153. evt2irq(0x0d40), evt2irq(0x0d40) },
  154. };
  155. static struct platform_device scif5_device = {
  156. .name = "sh-sci",
  157. .id = 5,
  158. .dev = {
  159. .platform_data = &scif5_platform_data,
  160. },
  161. };
  162. /* SCIFB */
  163. static struct plat_sci_port scif6_platform_data = {
  164. .mapbase = 0xe6c30000,
  165. .flags = UPF_BOOT_AUTOCONF,
  166. .scscr = SCSCR_RE | SCSCR_TE,
  167. .scbrr_algo_id = SCBRR_ALGO_4,
  168. .type = PORT_SCIFB,
  169. .irqs = { evt2irq(0x0d60), evt2irq(0x0d60),
  170. evt2irq(0x0d60), evt2irq(0x0d60) },
  171. };
  172. static struct platform_device scif6_device = {
  173. .name = "sh-sci",
  174. .id = 6,
  175. .dev = {
  176. .platform_data = &scif6_platform_data,
  177. },
  178. };
  179. /* CMT */
  180. static struct sh_timer_config cmt2_platform_data = {
  181. .name = "CMT2",
  182. .channel_offset = 0x40,
  183. .timer_bit = 5,
  184. .clockevent_rating = 125,
  185. .clocksource_rating = 125,
  186. };
  187. static struct resource cmt2_resources[] = {
  188. [0] = {
  189. .name = "CMT2",
  190. .start = 0xe6130040,
  191. .end = 0xe613004b,
  192. .flags = IORESOURCE_MEM,
  193. },
  194. [1] = {
  195. .start = evt2irq(0x0b80), /* CMT2 */
  196. .flags = IORESOURCE_IRQ,
  197. },
  198. };
  199. static struct platform_device cmt2_device = {
  200. .name = "sh_cmt",
  201. .id = 2,
  202. .dev = {
  203. .platform_data = &cmt2_platform_data,
  204. },
  205. .resource = cmt2_resources,
  206. .num_resources = ARRAY_SIZE(cmt2_resources),
  207. };
  208. /* TMU */
  209. static struct sh_timer_config tmu00_platform_data = {
  210. .name = "TMU00",
  211. .channel_offset = 0x4,
  212. .timer_bit = 0,
  213. .clockevent_rating = 200,
  214. };
  215. static struct resource tmu00_resources[] = {
  216. [0] = {
  217. .name = "TMU00",
  218. .start = 0xfff60008,
  219. .end = 0xfff60013,
  220. .flags = IORESOURCE_MEM,
  221. },
  222. [1] = {
  223. .start = intcs_evt2irq(0xe80), /* TMU_TUNI0 */
  224. .flags = IORESOURCE_IRQ,
  225. },
  226. };
  227. static struct platform_device tmu00_device = {
  228. .name = "sh_tmu",
  229. .id = 0,
  230. .dev = {
  231. .platform_data = &tmu00_platform_data,
  232. },
  233. .resource = tmu00_resources,
  234. .num_resources = ARRAY_SIZE(tmu00_resources),
  235. };
  236. static struct sh_timer_config tmu01_platform_data = {
  237. .name = "TMU01",
  238. .channel_offset = 0x10,
  239. .timer_bit = 1,
  240. .clocksource_rating = 200,
  241. };
  242. static struct resource tmu01_resources[] = {
  243. [0] = {
  244. .name = "TMU01",
  245. .start = 0xfff60014,
  246. .end = 0xfff6001f,
  247. .flags = IORESOURCE_MEM,
  248. },
  249. [1] = {
  250. .start = intcs_evt2irq(0xea0), /* TMU_TUNI1 */
  251. .flags = IORESOURCE_IRQ,
  252. },
  253. };
  254. static struct platform_device tmu01_device = {
  255. .name = "sh_tmu",
  256. .id = 1,
  257. .dev = {
  258. .platform_data = &tmu01_platform_data,
  259. },
  260. .resource = tmu01_resources,
  261. .num_resources = ARRAY_SIZE(tmu01_resources),
  262. };
  263. /* I2C */
  264. static struct resource iic0_resources[] = {
  265. [0] = {
  266. .name = "IIC0",
  267. .start = 0xFFF20000,
  268. .end = 0xFFF20425 - 1,
  269. .flags = IORESOURCE_MEM,
  270. },
  271. [1] = {
  272. .start = intcs_evt2irq(0xe00), /* IIC0_ALI0 */
  273. .end = intcs_evt2irq(0xe60), /* IIC0_DTEI0 */
  274. .flags = IORESOURCE_IRQ,
  275. },
  276. };
  277. static struct platform_device iic0_device = {
  278. .name = "i2c-sh_mobile",
  279. .id = 0, /* "i2c0" clock */
  280. .num_resources = ARRAY_SIZE(iic0_resources),
  281. .resource = iic0_resources,
  282. };
  283. static struct resource iic1_resources[] = {
  284. [0] = {
  285. .name = "IIC1",
  286. .start = 0xE6C20000,
  287. .end = 0xE6C20425 - 1,
  288. .flags = IORESOURCE_MEM,
  289. },