liquidLevelDataOperation.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. /*
  2. * R8A7740 processor support
  3. *
  4. * Copyright (C) 2011 Renesas Solutions Corp.
  5. * Copyright (C) 2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
  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/delay.h>
  21. #include <linux/dma-mapping.h>
  22. #include <linux/kernel.h>
  23. #include <linux/init.h>
  24. #include <linux/io.h>
  25. #include <linux/platform_device.h>
  26. #include <linux/of_platform.h>
  27. #include <linux/serial_sci.h>
  28. #include <linux/sh_dma.h>
  29. #include <linux/sh_timer.h>
  30. #include <linux/dma-mapping.h>
  31. #include <mach/dma-register.h>
  32. #include <mach/r8a7740.h>
  33. #include <mach/pm-rmobile.h>
  34. #include <mach/common.h>
  35. #include <mach/irqs.h>
  36. #include <asm/mach-types.h>
  37. #include <asm/mach/map.h>
  38. #include <asm/mach/arch.h>
  39. #include <asm/mach/time.h>
  40. static struct map_desc r8a7740_io_desc[] __initdata = {
  41. /*
  42. * for CPGA/INTC/PFC
  43. * 0xe6000000-0xefffffff -> 0xe6000000-0xefffffff
  44. */
  45. {
  46. .virtual = 0xe6000000,
  47. .pfn = __phys_to_pfn(0xe6000000),
  48. .length = 160 << 20,
  49. .type = MT_DEVICE_NONSHARED
  50. },
  51. #ifdef CONFIG_CACHE_L2X0
  52. /*
  53. * for l2x0_init()
  54. * 0xf0100000-0xf0101000 -> 0xf0002000-0xf0003000
  55. */
  56. {
  57. .virtual = 0xf0002000,
  58. .pfn = __phys_to_pfn(0xf0100000),
  59. .length = PAGE_SIZE,
  60. .type = MT_DEVICE_NONSHARED
  61. },
  62. #endif
  63. };
  64. void __init r8a7740_map_io(void)
  65. {
  66. iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc));
  67. }
  68. /* SCIFA0 */
  69. static struct plat_sci_port scif0_platform_data = {
  70. .mapbase = 0xe6c40000,
  71. .flags = UPF_BOOT_AUTOCONF,
  72. .scscr = SCSCR_RE | SCSCR_TE,
  73. .scbrr_algo_id = SCBRR_ALGO_4,
  74. .type = PORT_SCIFA,
  75. .irqs = SCIx_IRQ_MUXED(evt2irq(0x0c00)),
  76. };
  77. static struct platform_device scif0_device = {
  78. .name = "sh-sci",
  79. .id = 0,
  80. .dev = {
  81. .platform_data = &scif0_platform_data,
  82. },
  83. };
  84. /* SCIFA1 */
  85. static struct plat_sci_port scif1_platform_data = {
  86. .mapbase = 0xe6c50000,
  87. .flags = UPF_BOOT_AUTOCONF,
  88. .scscr = SCSCR_RE | SCSCR_TE,
  89. .scbrr_algo_id = SCBRR_ALGO_4,
  90. .type = PORT_SCIFA,
  91. .irqs = SCIx_IRQ_MUXED(evt2irq(0x0c20)),
  92. };
  93. static struct platform_device scif1_device = {
  94. .name = "sh-sci",
  95. .id = 1,
  96. .dev = {
  97. .platform_data = &scif1_platform_data,
  98. },
  99. };
  100. /* SCIFA2 */
  101. static struct plat_sci_port scif2_platform_data = {
  102. .mapbase = 0xe6c60000,
  103. .flags = UPF_BOOT_AUTOCONF,
  104. .scscr = SCSCR_RE | SCSCR_TE,
  105. .scbrr_algo_id = SCBRR_ALGO_4,
  106. .type = PORT_SCIFA,
  107. .irqs = SCIx_IRQ_MUXED(evt2irq(0x0c40)),
  108. };
  109. static struct platform_device scif2_device = {
  110. .name = "sh-sci",
  111. .id = 2,
  112. .dev = {
  113. .platform_data = &scif2_platform_data,
  114. },
  115. };
  116. /* SCIFA3 */
  117. static struct plat_sci_port scif3_platform_data = {
  118. .mapbase = 0xe6c70000,
  119. .flags = UPF_BOOT_AUTOCONF,
  120. .scscr = SCSCR_RE | SCSCR_TE,
  121. .scbrr_algo_id = SCBRR_ALGO_4,
  122. .type = PORT_SCIFA,
  123. .irqs = SCIx_IRQ_MUXED(evt2irq(0x0c60)),
  124. };
  125. static struct platform_device scif3_device = {
  126. .name = "sh-sci",
  127. .id = 3,
  128. .dev = {
  129. .platform_data = &scif3_platform_data,
  130. },
  131. };
  132. /* SCIFA4 */
  133. static struct plat_sci_port scif4_platform_data = {
  134. .mapbase = 0xe6c80000,
  135. .flags = UPF_BOOT_AUTOCONF,
  136. .scscr = SCSCR_RE | SCSCR_TE,
  137. .scbrr_algo_id = SCBRR_ALGO_4,
  138. .type = PORT_SCIFA,
  139. .irqs = SCIx_IRQ_MUXED(evt2irq(0x0d20)),
  140. };
  141. static struct platform_device scif4_device = {
  142. .name = "sh-sci",
  143. .id = 4,
  144. .dev = {
  145. .platform_data = &scif4_platform_data,
  146. },
  147. };
  148. /* SCIFA5 */
  149. static struct plat_sci_port scif5_platform_data = {
  150. .mapbase = 0xe6cb0000,
  151. .flags = UPF_BOOT_AUTOCONF,
  152. .scscr = SCSCR_RE | SCSCR_TE,
  153. .scbrr_algo_id = SCBRR_ALGO_4,
  154. .type = PORT_SCIFA,
  155. .irqs = SCIx_IRQ_MUXED(evt2irq(0x0d40)),
  156. };
  157. static struct platform_device scif5_device = {
  158. .name = "sh-sci",
  159. .id = 5,
  160. .dev = {
  161. .platform_data = &scif5_platform_data,
  162. },
  163. };
  164. /* SCIFA6 */
  165. static struct plat_sci_port scif6_platform_data = {
  166. .mapbase = 0xe6cc0000,
  167. .flags = UPF_BOOT_AUTOCONF,
  168. .scscr = SCSCR_RE | SCSCR_TE,
  169. .scbrr_algo_id = SCBRR_ALGO_4,
  170. .type = PORT_SCIFA,
  171. .irqs = SCIx_IRQ_MUXED(evt2irq(0x04c0)),
  172. };
  173. static struct platform_device scif6_device = {
  174. .name = "sh-sci",
  175. .id = 6,
  176. .dev = {
  177. .platform_data = &scif6_platform_data,
  178. },
  179. };
  180. /* SCIFA7 */
  181. static struct plat_sci_port scif7_platform_data = {
  182. .mapbase = 0xe6cd0000,
  183. .flags = UPF_BOOT_AUTOCONF,
  184. .scscr = SCSCR_RE | SCSCR_TE,
  185. .scbrr_algo_id = SCBRR_ALGO_4,
  186. .type = PORT_SCIFA,
  187. .irqs = SCIx_IRQ_MUXED(evt2irq(0x04e0)),
  188. };
  189. static struct platform_device scif7_device = {
  190. .name = "sh-sci",
  191. .id = 7,
  192. .dev = {
  193. .platform_data = &scif7_platform_data,
  194. },
  195. };
  196. /* SCIFB */
  197. static struct plat_sci_port scifb_platform_data = {
  198. .mapbase = 0xe6c30000,
  199. .flags = UPF_BOOT_AUTOCONF,
  200. .scscr = SCSCR_RE | SCSCR_TE,
  201. .scbrr_algo_id = SCBRR_ALGO_4,
  202. .type = PORT_SCIFB,
  203. .irqs = SCIx_IRQ_MUXED(evt2irq(0x0d60)),
  204. };
  205. static struct platform_device scifb_device = {
  206. .name = "sh-sci",
  207. .id = 8,
  208. .dev = {
  209. .platform_data = &scifb_platform_data,
  210. },
  211. };
  212. /* CMT */
  213. static struct sh_timer_config cmt10_platform_data = {
  214. .name = "CMT10",
  215. .channel_offset = 0x10,
  216. .timer_bit = 0,
  217. .clockevent_rating = 125,
  218. .clocksource_rating = 125,
  219. };
  220. static struct resource cmt10_resources[] = {
  221. [0] = {
  222. .name = "CMT10",
  223. .start = 0xe6138010,
  224. .end = 0xe613801b,
  225. .flags = IORESOURCE_MEM,
  226. },
  227. [1] = {
  228. .start = evt2irq(0x0b00),
  229. .flags = IORESOURCE_IRQ,
  230. },
  231. };
  232. static struct platform_device cmt10_device = {
  233. .name = "sh_cmt",
  234. .id = 10,
  235. .dev = {
  236. .platform_data = &cmt10_platform_data,