spear320.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. /*
  2. * arch/arm/mach-spear3xx/spear320.c
  3. *
  4. * SPEAr320 machine source file
  5. *
  6. * Copyright (C) 2009-2012 ST Microelectronics
  7. * Viresh Kumar <vireshk@kernel.org>
  8. *
  9. * This file is licensed under the terms of the GNU General Public
  10. * License version 2. This program is licensed "as is" without any
  11. * warranty of any kind, whether express or implied.
  12. */
  13. #define pr_fmt(fmt) "SPEAr320: " fmt
  14. #include <linux/amba/pl022.h>
  15. #include <linux/amba/pl08x.h>
  16. #include <linux/amba/serial.h>
  17. #include <linux/of_platform.h>
  18. #include <asm/mach/arch.h>
  19. #include <asm/mach/map.h>
  20. #include "generic.h"
  21. #include <mach/spear.h>
  22. #define SPEAR320_UART1_BASE UL(0xA3000000)
  23. #define SPEAR320_UART2_BASE UL(0xA4000000)
  24. #define SPEAR320_SSP0_BASE UL(0xA5000000)
  25. #define SPEAR320_SSP1_BASE UL(0xA6000000)
  26. /* DMAC platform data's slave info */
  27. struct pl08x_channel_data spear320_dma_info[] = {
  28. {
  29. .bus_id = "uart0_rx",
  30. .min_signal = 2,
  31. .max_signal = 2,
  32. .muxval = 0,
  33. .periph_buses = PL08X_AHB1,
  34. }, {
  35. .bus_id = "uart0_tx",
  36. .min_signal = 3,
  37. .max_signal = 3,
  38. .muxval = 0,
  39. .periph_buses = PL08X_AHB1,
  40. }, {
  41. .bus_id = "ssp0_rx",
  42. .min_signal = 8,
  43. .max_signal = 8,
  44. .muxval = 0,
  45. .periph_buses = PL08X_AHB1,
  46. }, {
  47. .bus_id = "ssp0_tx",
  48. .min_signal = 9,
  49. .max_signal = 9,
  50. .muxval = 0,
  51. .periph_buses = PL08X_AHB1,
  52. }, {
  53. .bus_id = "i2c0_rx",
  54. .min_signal = 10,
  55. .max_signal = 10,
  56. .muxval = 0,
  57. .periph_buses = PL08X_AHB1,
  58. }, {
  59. .bus_id = "i2c0_tx",
  60. .min_signal = 11,
  61. .max_signal = 11,
  62. .muxval = 0,
  63. .periph_buses = PL08X_AHB1,
  64. }, {
  65. .bus_id = "irda",
  66. .min_signal = 12,
  67. .max_signal = 12,
  68. .muxval = 0,
  69. .periph_buses = PL08X_AHB1,
  70. }, {
  71. .bus_id = "adc",
  72. .min_signal = 13,
  73. .max_signal = 13,
  74. .muxval = 0,
  75. .periph_buses = PL08X_AHB1,
  76. }, {
  77. .bus_id = "to_jpeg",
  78. .min_signal = 14,
  79. .max_signal = 14,
  80. .muxval = 0,
  81. .periph_buses = PL08X_AHB1,
  82. }, {
  83. .bus_id = "from_jpeg",
  84. .min_signal = 15,
  85. .max_signal = 15,
  86. .muxval = 0,
  87. .periph_buses = PL08X_AHB1,
  88. }, {
  89. .bus_id = "ssp1_rx",
  90. .min_signal = 0,
  91. .max_signal = 0,
  92. .muxval = 1,
  93. .periph_buses = PL08X_AHB2,
  94. }, {
  95. .bus_id = "ssp1_tx",
  96. .min_signal = 1,
  97. .max_signal = 1,
  98. .muxval = 1,
  99. .periph_buses = PL08X_AHB2,
  100. }, {
  101. .bus_id = "ssp2_rx",
  102. .min_signal = 2,
  103. .max_signal = 2,
  104. .muxval = 1,
  105. .periph_buses = PL08X_AHB2,
  106. }, {
  107. .bus_id = "ssp2_tx",
  108. .min_signal = 3,
  109. .max_signal = 3,
  110. .muxval = 1,
  111. .periph_buses = PL08X_AHB2,
  112. }, {
  113. .bus_id = "uart1_rx",
  114. .min_signal = 4,
  115. .max_signal = 4,
  116. .muxval = 1,
  117. .periph_buses = PL08X_AHB2,
  118. }, {
  119. .bus_id = "uart1_tx",
  120. .min_signal = 5,
  121. .max_signal = 5,
  122. .muxval = 1,
  123. .periph_buses = PL08X_AHB2,
  124. }, {
  125. .bus_id = "uart2_rx",
  126. .min_signal = 6,
  127. .max_signal = 6,
  128. .muxval = 1,
  129. .periph_buses = PL08X_AHB2,
  130. }, {
  131. .bus_id = "uart2_tx",
  132. .min_signal = 7,
  133. .max_signal = 7,
  134. .muxval = 1,
  135. .periph_buses = PL08X_AHB2,
  136. }, {
  137. .bus_id = "i2c1_rx",
  138. .min_signal = 8,
  139. .max_signal = 8,
  140. .muxval = 1,
  141. .periph_buses = PL08X_AHB2,
  142. }, {
  143. .bus_id = "i2c1_tx",
  144. .min_signal = 9,
  145. .max_signal = 9,
  146. .muxval = 1,
  147. .periph_buses = PL08X_AHB2,
  148. }, {
  149. .bus_id = "i2c2_rx",
  150. .min_signal = 10,
  151. .max_signal = 10,
  152. .muxval = 1,
  153. .periph_buses = PL08X_AHB2,
  154. }, {
  155. .bus_id = "i2c2_tx",
  156. .min_signal = 11,
  157. .max_signal = 11,
  158. .muxval = 1,
  159. .periph_buses = PL08X_AHB2,
  160. }, {
  161. .bus_id = "i2s_rx",
  162. .min_signal = 12,
  163. .max_signal = 12,
  164. .muxval = 1,
  165. .periph_buses = PL08X_AHB2,
  166. }, {
  167. .bus_id = "i2s_tx",
  168. .min_signal = 13,
  169. .max_signal = 13,
  170. .muxval = 1,
  171. .periph_buses = PL08X_AHB2,
  172. }, {
  173. .bus_id = "rs485_rx",
  174. .min_signal = 14,
  175. .max_signal = 14,
  176. .muxval = 1,
  177. .periph_buses = PL08X_AHB2,
  178. }, {
  179. .bus_id = "rs485_tx",
  180. .min_signal = 15,
  181. .max_signal = 15,
  182. .muxval = 1,
  183. .periph_buses = PL08X_AHB2,
  184. },
  185. };
  186. static struct pl022_ssp_controller spear320_ssp_data[] = {
  187. {
  188. .bus_id = 1,
  189. .enable_dma = 1,
  190. .dma_filter = pl08x_filter_id,
  191. .dma_tx_param = "ssp1_tx",
  192. .dma_rx_param = "ssp1_rx",
  193. .num_chipselect = 2,
  194. }, {
  195. .bus_id = 2,
  196. .enable_dma = 1,
  197. .dma_filter = pl08x_filter_id,
  198. .dma_tx_param = "ssp2_tx",
  199. .dma_rx_param = "ssp2_rx",
  200. .num_chipselect = 2,
  201. }
  202. };
  203. static struct amba_pl011_data spear320_uart_data[] = {
  204. {
  205. .dma_filter = pl08x_filter_id,
  206. .dma_tx_param = "uart1_tx",
  207. .dma_rx_param = "uart1_rx",
  208. }, {
  209. .dma_filter = pl08x_filter_id,
  210. .dma_tx_param = "uart2_tx",
  211. .dma_rx_param = "uart2_rx",
  212. },
  213. };
  214. /* Add SPEAr310 auxdata to pass platform data */
  215. static struct of_dev_auxdata spear320_auxdata_lookup[] __initdata = {
  216. OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
  217. &pl022_plat_data),
  218. OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE, NULL,
  219. &pl080_plat_data),
  220. OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP0_BASE, NULL,
  221. &spear320_ssp_data[0]),
  222. OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP1_BASE, NULL,
  223. &spear320_ssp_data[1]),
  224. OF_DEV_AUXDATA("arm,pl011", SPEAR320_UART1_BASE, NULL,
  225. &spear320_uart_data[0]),
  226. OF_DEV_AUXDATA("arm,pl011", SPEAR320_UART2_BASE, NULL,
  227. &spear320_uart_data[1]),
  228. {}
  229. };
  230. static void __init spear320_dt_init(void)
  231. {
  232. pl080_plat_data.slave_channels = spear320_dma_info;
  233. pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear320_dma_info);
  234. of_platform_default_populate(NULL, spear320_auxdata_lookup, NULL);
  235. }
  236. static const char * const spear320_dt_board_compat[] = {
  237. "st,spear320",
  238. "st,spear320-evb",
  239. "st,spear320-hmi",
  240. NULL,
  241. };
  242. struct map_desc spear320_io_desc[] __initdata = {
  243. {
  244. .virtual = (unsigned long)VA_SPEAR320_SOC_CONFIG_BASE,
  245. .pfn = __phys_to_pfn(SPEAR320_SOC_CONFIG_BASE),
  246. .length = SZ_16M,
  247. .type = MT_DEVICE
  248. },
  249. };
  250. static void __init spear320_map_io(void)
  251. {
  252. iotable_init(spear320_io_desc, ARRAY_SIZE(spear320_io_desc));
  253. spear3xx_map_io();
  254. }
  255. DT_MACHINE_START(SPEAR320_DT, "ST SPEAr320 SoC with Flattened Device Tree")
  256. .map_io = spear320_map_io,
  257. .init_time = spear3xx_timer_init,
  258. .init_machine = spear320_dt_init,
  259. .restart = spear_restart,
  260. .dt_compat = spear320_dt_board_compat,
  261. MACHINE_END