xref: /linux/arch/arm/mach-spear/spear310.c (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * arch/arm/mach-spear3xx/spear310.c
4  *
5  * SPEAr310 machine source file
6  *
7  * Copyright (C) 2009-2012 ST Microelectronics
8  * Viresh Kumar <vireshk@kernel.org>
9  */
10 
11 #define pr_fmt(fmt) "SPEAr310: " fmt
12 
13 #include <linux/amba/pl08x.h>
14 #include <linux/amba/serial.h>
15 #include <linux/of_platform.h>
16 #include <asm/mach/arch.h>
17 #include "generic.h"
18 #include "spear.h"
19 
20 #define SPEAR310_UART1_BASE		UL(0xB2000000)
21 #define SPEAR310_UART2_BASE		UL(0xB2080000)
22 #define SPEAR310_UART3_BASE		UL(0xB2100000)
23 #define SPEAR310_UART4_BASE		UL(0xB2180000)
24 #define SPEAR310_UART5_BASE		UL(0xB2200000)
25 
26 /* DMAC platform data's slave info */
27 struct pl08x_channel_data spear310_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 = "i2c_rx",
54 		.min_signal = 10,
55 		.max_signal = 10,
56 		.muxval = 0,
57 		.periph_buses = PL08X_AHB1,
58 	}, {
59 		.bus_id = "i2c_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 = "uart1_rx",
90 		.min_signal = 0,
91 		.max_signal = 0,
92 		.muxval = 1,
93 		.periph_buses = PL08X_AHB1,
94 	}, {
95 		.bus_id = "uart1_tx",
96 		.min_signal = 1,
97 		.max_signal = 1,
98 		.muxval = 1,
99 		.periph_buses = PL08X_AHB1,
100 	}, {
101 		.bus_id = "uart2_rx",
102 		.min_signal = 2,
103 		.max_signal = 2,
104 		.muxval = 1,
105 		.periph_buses = PL08X_AHB1,
106 	}, {
107 		.bus_id = "uart2_tx",
108 		.min_signal = 3,
109 		.max_signal = 3,
110 		.muxval = 1,
111 		.periph_buses = PL08X_AHB1,
112 	}, {
113 		.bus_id = "uart3_rx",
114 		.min_signal = 4,
115 		.max_signal = 4,
116 		.muxval = 1,
117 		.periph_buses = PL08X_AHB1,
118 	}, {
119 		.bus_id = "uart3_tx",
120 		.min_signal = 5,
121 		.max_signal = 5,
122 		.muxval = 1,
123 		.periph_buses = PL08X_AHB1,
124 	}, {
125 		.bus_id = "uart4_rx",
126 		.min_signal = 6,
127 		.max_signal = 6,
128 		.muxval = 1,
129 		.periph_buses = PL08X_AHB1,
130 	}, {
131 		.bus_id = "uart4_tx",
132 		.min_signal = 7,
133 		.max_signal = 7,
134 		.muxval = 1,
135 		.periph_buses = PL08X_AHB1,
136 	}, {
137 		.bus_id = "uart5_rx",
138 		.min_signal = 8,
139 		.max_signal = 8,
140 		.muxval = 1,
141 		.periph_buses = PL08X_AHB1,
142 	}, {
143 		.bus_id = "uart5_tx",
144 		.min_signal = 9,
145 		.max_signal = 9,
146 		.muxval = 1,
147 		.periph_buses = PL08X_AHB1,
148 	}, {
149 		.bus_id = "ras5_rx",
150 		.min_signal = 10,
151 		.max_signal = 10,
152 		.muxval = 1,
153 		.periph_buses = PL08X_AHB1,
154 	}, {
155 		.bus_id = "ras5_tx",
156 		.min_signal = 11,
157 		.max_signal = 11,
158 		.muxval = 1,
159 		.periph_buses = PL08X_AHB1,
160 	}, {
161 		.bus_id = "ras6_rx",
162 		.min_signal = 12,
163 		.max_signal = 12,
164 		.muxval = 1,
165 		.periph_buses = PL08X_AHB1,
166 	}, {
167 		.bus_id = "ras6_tx",
168 		.min_signal = 13,
169 		.max_signal = 13,
170 		.muxval = 1,
171 		.periph_buses = PL08X_AHB1,
172 	}, {
173 		.bus_id = "ras7_rx",
174 		.min_signal = 14,
175 		.max_signal = 14,
176 		.muxval = 1,
177 		.periph_buses = PL08X_AHB1,
178 	}, {
179 		.bus_id = "ras7_tx",
180 		.min_signal = 15,
181 		.max_signal = 15,
182 		.muxval = 1,
183 		.periph_buses = PL08X_AHB1,
184 	},
185 };
186 
187 /* uart devices plat data */
188 static struct amba_pl011_data spear310_uart_data[] = {
189 	{
190 		.dma_filter = pl08x_filter_id,
191 		.dma_tx_param = "uart1_tx",
192 		.dma_rx_param = "uart1_rx",
193 	}, {
194 		.dma_filter = pl08x_filter_id,
195 		.dma_tx_param = "uart2_tx",
196 		.dma_rx_param = "uart2_rx",
197 	}, {
198 		.dma_filter = pl08x_filter_id,
199 		.dma_tx_param = "uart3_tx",
200 		.dma_rx_param = "uart3_rx",
201 	}, {
202 		.dma_filter = pl08x_filter_id,
203 		.dma_tx_param = "uart4_tx",
204 		.dma_rx_param = "uart4_rx",
205 	}, {
206 		.dma_filter = pl08x_filter_id,
207 		.dma_tx_param = "uart5_tx",
208 		.dma_rx_param = "uart5_rx",
209 	},
210 };
211 
212 /* Add SPEAr310 auxdata to pass platform data */
213 static struct of_dev_auxdata spear310_auxdata_lookup[] __initdata = {
214 	OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
215 			&pl022_plat_data),
216 	OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE, NULL,
217 			&pl080_plat_data),
218 	OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART1_BASE, NULL,
219 			&spear310_uart_data[0]),
220 	OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART2_BASE, NULL,
221 			&spear310_uart_data[1]),
222 	OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART3_BASE, NULL,
223 			&spear310_uart_data[2]),
224 	OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART4_BASE, NULL,
225 			&spear310_uart_data[3]),
226 	OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART5_BASE, NULL,
227 			&spear310_uart_data[4]),
228 	{}
229 };
230 
spear310_dt_init(void)231 static void __init spear310_dt_init(void)
232 {
233 	pl080_plat_data.slave_channels = spear310_dma_info;
234 	pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear310_dma_info);
235 
236 	of_platform_default_populate(NULL, spear310_auxdata_lookup, NULL);
237 }
238 
239 static const char * const spear310_dt_board_compat[] = {
240 	"st,spear310",
241 	"st,spear310-evb",
242 	NULL,
243 };
244 
spear310_map_io(void)245 static void __init spear310_map_io(void)
246 {
247 	spear3xx_map_io();
248 }
249 
250 DT_MACHINE_START(SPEAR310_DT, "ST SPEAr310 SoC with Flattened Device Tree")
251 	.map_io		=	spear310_map_io,
252 	.init_time	=	spear3xx_timer_init,
253 	.init_machine	=	spear310_dt_init,
254 	.restart	=	spear_restart,
255 	.dt_compat	=	spear310_dt_board_compat,
256 MACHINE_END
257