xref: /openbmc/linux/arch/arm/mach-spear/spear6xx.c (revision d7cabeed)
1a7ed099fSArnd Bergmann /*
2a7ed099fSArnd Bergmann  * arch/arm/mach-spear6xx/spear6xx.c
3a7ed099fSArnd Bergmann  *
4a7ed099fSArnd Bergmann  * SPEAr6XX machines common source file
5a7ed099fSArnd Bergmann  *
6a7ed099fSArnd Bergmann  * Copyright (C) 2009 ST Microelectronics
7a7ed099fSArnd Bergmann  * Rajeev Kumar<rajeev-dlh.kumar@st.com>
8a7ed099fSArnd Bergmann  *
9a7ed099fSArnd Bergmann  * Copyright 2012 Stefan Roese <sr@denx.de>
10a7ed099fSArnd Bergmann  *
11a7ed099fSArnd Bergmann  * This file is licensed under the terms of the GNU General Public
12a7ed099fSArnd Bergmann  * License version 2. This program is licensed "as is" without any
13a7ed099fSArnd Bergmann  * warranty of any kind, whether express or implied.
14a7ed099fSArnd Bergmann  */
15a7ed099fSArnd Bergmann 
16a7ed099fSArnd Bergmann #include <linux/amba/pl08x.h>
17a7ed099fSArnd Bergmann #include <linux/clk.h>
18a7ed099fSArnd Bergmann #include <linux/err.h>
19a7ed099fSArnd Bergmann #include <linux/irqchip.h>
20a7ed099fSArnd Bergmann #include <linux/of.h>
21a7ed099fSArnd Bergmann #include <linux/of_address.h>
22a7ed099fSArnd Bergmann #include <linux/of_platform.h>
23a7ed099fSArnd Bergmann #include <linux/amba/pl080.h>
24a7ed099fSArnd Bergmann #include <asm/mach/arch.h>
25a7ed099fSArnd Bergmann #include <asm/mach/time.h>
26a7ed099fSArnd Bergmann #include <asm/mach/map.h>
272b9c613cSArnd Bergmann #include "pl080.h"
282b9c613cSArnd Bergmann #include "generic.h"
29a7ed099fSArnd Bergmann #include <mach/spear.h>
30d9909ebeSArnd Bergmann #include <mach/misc_regs.h>
31a7ed099fSArnd Bergmann 
32a7ed099fSArnd Bergmann /* dmac device registration */
33a7ed099fSArnd Bergmann static struct pl08x_channel_data spear600_dma_info[] = {
34a7ed099fSArnd Bergmann 	{
35a7ed099fSArnd Bergmann 		.bus_id = "ssp1_rx",
36a7ed099fSArnd Bergmann 		.min_signal = 0,
37a7ed099fSArnd Bergmann 		.max_signal = 0,
38a7ed099fSArnd Bergmann 		.muxval = 0,
39a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
40a7ed099fSArnd Bergmann 	}, {
41a7ed099fSArnd Bergmann 		.bus_id = "ssp1_tx",
42a7ed099fSArnd Bergmann 		.min_signal = 1,
43a7ed099fSArnd Bergmann 		.max_signal = 1,
44a7ed099fSArnd Bergmann 		.muxval = 0,
45a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
46a7ed099fSArnd Bergmann 	}, {
47a7ed099fSArnd Bergmann 		.bus_id = "uart0_rx",
48a7ed099fSArnd Bergmann 		.min_signal = 2,
49a7ed099fSArnd Bergmann 		.max_signal = 2,
50a7ed099fSArnd Bergmann 		.muxval = 0,
51a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
52a7ed099fSArnd Bergmann 	}, {
53a7ed099fSArnd Bergmann 		.bus_id = "uart0_tx",
54a7ed099fSArnd Bergmann 		.min_signal = 3,
55a7ed099fSArnd Bergmann 		.max_signal = 3,
56a7ed099fSArnd Bergmann 		.muxval = 0,
57a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
58a7ed099fSArnd Bergmann 	}, {
59a7ed099fSArnd Bergmann 		.bus_id = "uart1_rx",
60a7ed099fSArnd Bergmann 		.min_signal = 4,
61a7ed099fSArnd Bergmann 		.max_signal = 4,
62a7ed099fSArnd Bergmann 		.muxval = 0,
63a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
64a7ed099fSArnd Bergmann 	}, {
65a7ed099fSArnd Bergmann 		.bus_id = "uart1_tx",
66a7ed099fSArnd Bergmann 		.min_signal = 5,
67a7ed099fSArnd Bergmann 		.max_signal = 5,
68a7ed099fSArnd Bergmann 		.muxval = 0,
69a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
70a7ed099fSArnd Bergmann 	}, {
71a7ed099fSArnd Bergmann 		.bus_id = "ssp2_rx",
72a7ed099fSArnd Bergmann 		.min_signal = 6,
73a7ed099fSArnd Bergmann 		.max_signal = 6,
74a7ed099fSArnd Bergmann 		.muxval = 0,
75a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
76a7ed099fSArnd Bergmann 	}, {
77a7ed099fSArnd Bergmann 		.bus_id = "ssp2_tx",
78a7ed099fSArnd Bergmann 		.min_signal = 7,
79a7ed099fSArnd Bergmann 		.max_signal = 7,
80a7ed099fSArnd Bergmann 		.muxval = 0,
81a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
82a7ed099fSArnd Bergmann 	}, {
83a7ed099fSArnd Bergmann 		.bus_id = "ssp0_rx",
84a7ed099fSArnd Bergmann 		.min_signal = 8,
85a7ed099fSArnd Bergmann 		.max_signal = 8,
86a7ed099fSArnd Bergmann 		.muxval = 0,
87a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
88a7ed099fSArnd Bergmann 	}, {
89a7ed099fSArnd Bergmann 		.bus_id = "ssp0_tx",
90a7ed099fSArnd Bergmann 		.min_signal = 9,
91a7ed099fSArnd Bergmann 		.max_signal = 9,
92a7ed099fSArnd Bergmann 		.muxval = 0,
93a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
94a7ed099fSArnd Bergmann 	}, {
95a7ed099fSArnd Bergmann 		.bus_id = "i2c_rx",
96a7ed099fSArnd Bergmann 		.min_signal = 10,
97a7ed099fSArnd Bergmann 		.max_signal = 10,
98a7ed099fSArnd Bergmann 		.muxval = 0,
99a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
100a7ed099fSArnd Bergmann 	}, {
101a7ed099fSArnd Bergmann 		.bus_id = "i2c_tx",
102a7ed099fSArnd Bergmann 		.min_signal = 11,
103a7ed099fSArnd Bergmann 		.max_signal = 11,
104a7ed099fSArnd Bergmann 		.muxval = 0,
105a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
106a7ed099fSArnd Bergmann 	}, {
107a7ed099fSArnd Bergmann 		.bus_id = "irda",
108a7ed099fSArnd Bergmann 		.min_signal = 12,
109a7ed099fSArnd Bergmann 		.max_signal = 12,
110a7ed099fSArnd Bergmann 		.muxval = 0,
111a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
112a7ed099fSArnd Bergmann 	}, {
113a7ed099fSArnd Bergmann 		.bus_id = "adc",
114a7ed099fSArnd Bergmann 		.min_signal = 13,
115a7ed099fSArnd Bergmann 		.max_signal = 13,
116a7ed099fSArnd Bergmann 		.muxval = 0,
117a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
118a7ed099fSArnd Bergmann 	}, {
119a7ed099fSArnd Bergmann 		.bus_id = "to_jpeg",
120a7ed099fSArnd Bergmann 		.min_signal = 14,
121a7ed099fSArnd Bergmann 		.max_signal = 14,
122a7ed099fSArnd Bergmann 		.muxval = 0,
123a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
124a7ed099fSArnd Bergmann 	}, {
125a7ed099fSArnd Bergmann 		.bus_id = "from_jpeg",
126a7ed099fSArnd Bergmann 		.min_signal = 15,
127a7ed099fSArnd Bergmann 		.max_signal = 15,
128a7ed099fSArnd Bergmann 		.muxval = 0,
129a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
130a7ed099fSArnd Bergmann 	}, {
131a7ed099fSArnd Bergmann 		.bus_id = "ras0_rx",
132a7ed099fSArnd Bergmann 		.min_signal = 0,
133a7ed099fSArnd Bergmann 		.max_signal = 0,
134a7ed099fSArnd Bergmann 		.muxval = 1,
135a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
136a7ed099fSArnd Bergmann 	}, {
137a7ed099fSArnd Bergmann 		.bus_id = "ras0_tx",
138a7ed099fSArnd Bergmann 		.min_signal = 1,
139a7ed099fSArnd Bergmann 		.max_signal = 1,
140a7ed099fSArnd Bergmann 		.muxval = 1,
141a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
142a7ed099fSArnd Bergmann 	}, {
143a7ed099fSArnd Bergmann 		.bus_id = "ras1_rx",
144a7ed099fSArnd Bergmann 		.min_signal = 2,
145a7ed099fSArnd Bergmann 		.max_signal = 2,
146a7ed099fSArnd Bergmann 		.muxval = 1,
147a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
148a7ed099fSArnd Bergmann 	}, {
149a7ed099fSArnd Bergmann 		.bus_id = "ras1_tx",
150a7ed099fSArnd Bergmann 		.min_signal = 3,
151a7ed099fSArnd Bergmann 		.max_signal = 3,
152a7ed099fSArnd Bergmann 		.muxval = 1,
153a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
154a7ed099fSArnd Bergmann 	}, {
155a7ed099fSArnd Bergmann 		.bus_id = "ras2_rx",
156a7ed099fSArnd Bergmann 		.min_signal = 4,
157a7ed099fSArnd Bergmann 		.max_signal = 4,
158a7ed099fSArnd Bergmann 		.muxval = 1,
159a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
160a7ed099fSArnd Bergmann 	}, {
161a7ed099fSArnd Bergmann 		.bus_id = "ras2_tx",
162a7ed099fSArnd Bergmann 		.min_signal = 5,
163a7ed099fSArnd Bergmann 		.max_signal = 5,
164a7ed099fSArnd Bergmann 		.muxval = 1,
165a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
166a7ed099fSArnd Bergmann 	}, {
167a7ed099fSArnd Bergmann 		.bus_id = "ras3_rx",
168a7ed099fSArnd Bergmann 		.min_signal = 6,
169a7ed099fSArnd Bergmann 		.max_signal = 6,
170a7ed099fSArnd Bergmann 		.muxval = 1,
171a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
172a7ed099fSArnd Bergmann 	}, {
173a7ed099fSArnd Bergmann 		.bus_id = "ras3_tx",
174a7ed099fSArnd Bergmann 		.min_signal = 7,
175a7ed099fSArnd Bergmann 		.max_signal = 7,
176a7ed099fSArnd Bergmann 		.muxval = 1,
177a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
178a7ed099fSArnd Bergmann 	}, {
179a7ed099fSArnd Bergmann 		.bus_id = "ras4_rx",
180a7ed099fSArnd Bergmann 		.min_signal = 8,
181a7ed099fSArnd Bergmann 		.max_signal = 8,
182a7ed099fSArnd Bergmann 		.muxval = 1,
183a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
184a7ed099fSArnd Bergmann 	}, {
185a7ed099fSArnd Bergmann 		.bus_id = "ras4_tx",
186a7ed099fSArnd Bergmann 		.min_signal = 9,
187a7ed099fSArnd Bergmann 		.max_signal = 9,
188a7ed099fSArnd Bergmann 		.muxval = 1,
189a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
190a7ed099fSArnd Bergmann 	}, {
191a7ed099fSArnd Bergmann 		.bus_id = "ras5_rx",
192a7ed099fSArnd Bergmann 		.min_signal = 10,
193a7ed099fSArnd Bergmann 		.max_signal = 10,
194a7ed099fSArnd Bergmann 		.muxval = 1,
195a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
196a7ed099fSArnd Bergmann 	}, {
197a7ed099fSArnd Bergmann 		.bus_id = "ras5_tx",
198a7ed099fSArnd Bergmann 		.min_signal = 11,
199a7ed099fSArnd Bergmann 		.max_signal = 11,
200a7ed099fSArnd Bergmann 		.muxval = 1,
201a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
202a7ed099fSArnd Bergmann 	}, {
203a7ed099fSArnd Bergmann 		.bus_id = "ras6_rx",
204a7ed099fSArnd Bergmann 		.min_signal = 12,
205a7ed099fSArnd Bergmann 		.max_signal = 12,
206a7ed099fSArnd Bergmann 		.muxval = 1,
207a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
208a7ed099fSArnd Bergmann 	}, {
209a7ed099fSArnd Bergmann 		.bus_id = "ras6_tx",
210a7ed099fSArnd Bergmann 		.min_signal = 13,
211a7ed099fSArnd Bergmann 		.max_signal = 13,
212a7ed099fSArnd Bergmann 		.muxval = 1,
213a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
214a7ed099fSArnd Bergmann 	}, {
215a7ed099fSArnd Bergmann 		.bus_id = "ras7_rx",
216a7ed099fSArnd Bergmann 		.min_signal = 14,
217a7ed099fSArnd Bergmann 		.max_signal = 14,
218a7ed099fSArnd Bergmann 		.muxval = 1,
219a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
220a7ed099fSArnd Bergmann 	}, {
221a7ed099fSArnd Bergmann 		.bus_id = "ras7_tx",
222a7ed099fSArnd Bergmann 		.min_signal = 15,
223a7ed099fSArnd Bergmann 		.max_signal = 15,
224a7ed099fSArnd Bergmann 		.muxval = 1,
225a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB1,
226a7ed099fSArnd Bergmann 	}, {
227a7ed099fSArnd Bergmann 		.bus_id = "ext0_rx",
228a7ed099fSArnd Bergmann 		.min_signal = 0,
229a7ed099fSArnd Bergmann 		.max_signal = 0,
230a7ed099fSArnd Bergmann 		.muxval = 2,
231a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
232a7ed099fSArnd Bergmann 	}, {
233a7ed099fSArnd Bergmann 		.bus_id = "ext0_tx",
234a7ed099fSArnd Bergmann 		.min_signal = 1,
235a7ed099fSArnd Bergmann 		.max_signal = 1,
236a7ed099fSArnd Bergmann 		.muxval = 2,
237a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
238a7ed099fSArnd Bergmann 	}, {
239a7ed099fSArnd Bergmann 		.bus_id = "ext1_rx",
240a7ed099fSArnd Bergmann 		.min_signal = 2,
241a7ed099fSArnd Bergmann 		.max_signal = 2,
242a7ed099fSArnd Bergmann 		.muxval = 2,
243a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
244a7ed099fSArnd Bergmann 	}, {
245a7ed099fSArnd Bergmann 		.bus_id = "ext1_tx",
246a7ed099fSArnd Bergmann 		.min_signal = 3,
247a7ed099fSArnd Bergmann 		.max_signal = 3,
248a7ed099fSArnd Bergmann 		.muxval = 2,
249a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
250a7ed099fSArnd Bergmann 	}, {
251a7ed099fSArnd Bergmann 		.bus_id = "ext2_rx",
252a7ed099fSArnd Bergmann 		.min_signal = 4,
253a7ed099fSArnd Bergmann 		.max_signal = 4,
254a7ed099fSArnd Bergmann 		.muxval = 2,
255a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
256a7ed099fSArnd Bergmann 	}, {
257a7ed099fSArnd Bergmann 		.bus_id = "ext2_tx",
258a7ed099fSArnd Bergmann 		.min_signal = 5,
259a7ed099fSArnd Bergmann 		.max_signal = 5,
260a7ed099fSArnd Bergmann 		.muxval = 2,
261a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
262a7ed099fSArnd Bergmann 	}, {
263a7ed099fSArnd Bergmann 		.bus_id = "ext3_rx",
264a7ed099fSArnd Bergmann 		.min_signal = 6,
265a7ed099fSArnd Bergmann 		.max_signal = 6,
266a7ed099fSArnd Bergmann 		.muxval = 2,
267a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
268a7ed099fSArnd Bergmann 	}, {
269a7ed099fSArnd Bergmann 		.bus_id = "ext3_tx",
270a7ed099fSArnd Bergmann 		.min_signal = 7,
271a7ed099fSArnd Bergmann 		.max_signal = 7,
272a7ed099fSArnd Bergmann 		.muxval = 2,
273a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
274a7ed099fSArnd Bergmann 	}, {
275a7ed099fSArnd Bergmann 		.bus_id = "ext4_rx",
276a7ed099fSArnd Bergmann 		.min_signal = 8,
277a7ed099fSArnd Bergmann 		.max_signal = 8,
278a7ed099fSArnd Bergmann 		.muxval = 2,
279a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
280a7ed099fSArnd Bergmann 	}, {
281a7ed099fSArnd Bergmann 		.bus_id = "ext4_tx",
282a7ed099fSArnd Bergmann 		.min_signal = 9,
283a7ed099fSArnd Bergmann 		.max_signal = 9,
284a7ed099fSArnd Bergmann 		.muxval = 2,
285a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
286a7ed099fSArnd Bergmann 	}, {
287a7ed099fSArnd Bergmann 		.bus_id = "ext5_rx",
288a7ed099fSArnd Bergmann 		.min_signal = 10,
289a7ed099fSArnd Bergmann 		.max_signal = 10,
290a7ed099fSArnd Bergmann 		.muxval = 2,
291a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
292a7ed099fSArnd Bergmann 	}, {
293a7ed099fSArnd Bergmann 		.bus_id = "ext5_tx",
294a7ed099fSArnd Bergmann 		.min_signal = 11,
295a7ed099fSArnd Bergmann 		.max_signal = 11,
296a7ed099fSArnd Bergmann 		.muxval = 2,
297a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
298a7ed099fSArnd Bergmann 	}, {
299a7ed099fSArnd Bergmann 		.bus_id = "ext6_rx",
300a7ed099fSArnd Bergmann 		.min_signal = 12,
301a7ed099fSArnd Bergmann 		.max_signal = 12,
302a7ed099fSArnd Bergmann 		.muxval = 2,
303a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
304a7ed099fSArnd Bergmann 	}, {
305a7ed099fSArnd Bergmann 		.bus_id = "ext6_tx",
306a7ed099fSArnd Bergmann 		.min_signal = 13,
307a7ed099fSArnd Bergmann 		.max_signal = 13,
308a7ed099fSArnd Bergmann 		.muxval = 2,
309a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
310a7ed099fSArnd Bergmann 	}, {
311a7ed099fSArnd Bergmann 		.bus_id = "ext7_rx",
312a7ed099fSArnd Bergmann 		.min_signal = 14,
313a7ed099fSArnd Bergmann 		.max_signal = 14,
314a7ed099fSArnd Bergmann 		.muxval = 2,
315a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
316a7ed099fSArnd Bergmann 	}, {
317a7ed099fSArnd Bergmann 		.bus_id = "ext7_tx",
318a7ed099fSArnd Bergmann 		.min_signal = 15,
319a7ed099fSArnd Bergmann 		.max_signal = 15,
320a7ed099fSArnd Bergmann 		.muxval = 2,
321a7ed099fSArnd Bergmann 		.periph_buses = PL08X_AHB2,
322a7ed099fSArnd Bergmann 	},
323a7ed099fSArnd Bergmann };
324a7ed099fSArnd Bergmann 
325553e7f75SArnd Bergmann static struct pl08x_platform_data spear6xx_pl080_plat_data = {
326a7ed099fSArnd Bergmann 	.memcpy_channel = {
327a7ed099fSArnd Bergmann 		.bus_id = "memcpy",
328a7ed099fSArnd Bergmann 		.cctl_memcpy =
329a7ed099fSArnd Bergmann 			(PL080_BSIZE_16 << PL080_CONTROL_SB_SIZE_SHIFT | \
330a7ed099fSArnd Bergmann 			PL080_BSIZE_16 << PL080_CONTROL_DB_SIZE_SHIFT | \
331a7ed099fSArnd Bergmann 			PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT | \
332a7ed099fSArnd Bergmann 			PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT | \
333a7ed099fSArnd Bergmann 			PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE | \
334a7ed099fSArnd Bergmann 			PL080_CONTROL_PROT_SYS),
335a7ed099fSArnd Bergmann 	},
336a7ed099fSArnd Bergmann 	.lli_buses = PL08X_AHB1,
337a7ed099fSArnd Bergmann 	.mem_buses = PL08X_AHB1,
338d7cabeedSMark Brown 	.get_xfer_signal = pl080_get_signal,
339d7cabeedSMark Brown 	.put_xfer_signal = pl080_put_signal,
340a7ed099fSArnd Bergmann 	.slave_channels = spear600_dma_info,
341a7ed099fSArnd Bergmann 	.num_slave_channels = ARRAY_SIZE(spear600_dma_info),
342a7ed099fSArnd Bergmann };
343a7ed099fSArnd Bergmann 
344a7ed099fSArnd Bergmann /*
345a7ed099fSArnd Bergmann  * Following will create 16MB static virtual/physical mappings
346a7ed099fSArnd Bergmann  * PHYSICAL		VIRTUAL
347a7ed099fSArnd Bergmann  * 0xF0000000		0xF0000000
348a7ed099fSArnd Bergmann  * 0xF1000000		0xF1000000
349a7ed099fSArnd Bergmann  * 0xD0000000		0xFD000000
350a7ed099fSArnd Bergmann  * 0xFC000000		0xFC000000
351a7ed099fSArnd Bergmann  */
352a7ed099fSArnd Bergmann struct map_desc spear6xx_io_desc[] __initdata = {
353a7ed099fSArnd Bergmann 	{
354d9909ebeSArnd Bergmann 		.virtual	= (unsigned long)VA_SPEAR6XX_ML_CPU_BASE,
355a7ed099fSArnd Bergmann 		.pfn		= __phys_to_pfn(SPEAR_ICM3_ML1_2_BASE),
356a7ed099fSArnd Bergmann 		.length		= 2 * SZ_16M,
357a7ed099fSArnd Bergmann 		.type		= MT_DEVICE
358a7ed099fSArnd Bergmann 	},	{
359d9909ebeSArnd Bergmann 		.virtual	= (unsigned long)VA_SPEAR_ICM1_2_BASE,
360a7ed099fSArnd Bergmann 		.pfn		= __phys_to_pfn(SPEAR_ICM1_2_BASE),
361a7ed099fSArnd Bergmann 		.length		= SZ_16M,
362a7ed099fSArnd Bergmann 		.type		= MT_DEVICE
363a7ed099fSArnd Bergmann 	}, {
364d9909ebeSArnd Bergmann 		.virtual	= (unsigned long)VA_SPEAR_ICM3_SMI_CTRL_BASE,
365a7ed099fSArnd Bergmann 		.pfn		= __phys_to_pfn(SPEAR_ICM3_SMI_CTRL_BASE),
366a7ed099fSArnd Bergmann 		.length		= SZ_16M,
367a7ed099fSArnd Bergmann 		.type		= MT_DEVICE
368a7ed099fSArnd Bergmann 	},
369a7ed099fSArnd Bergmann };
370a7ed099fSArnd Bergmann 
371a7ed099fSArnd Bergmann /* This will create static memory mapping for selected devices */
372a7ed099fSArnd Bergmann void __init spear6xx_map_io(void)
373a7ed099fSArnd Bergmann {
374a7ed099fSArnd Bergmann 	iotable_init(spear6xx_io_desc, ARRAY_SIZE(spear6xx_io_desc));
375a7ed099fSArnd Bergmann }
376a7ed099fSArnd Bergmann 
377a7ed099fSArnd Bergmann void __init spear6xx_timer_init(void)
378a7ed099fSArnd Bergmann {
379a7ed099fSArnd Bergmann 	char pclk_name[] = "pll3_clk";
380a7ed099fSArnd Bergmann 	struct clk *gpt_clk, *pclk;
381a7ed099fSArnd Bergmann 
382d9909ebeSArnd Bergmann 	spear6xx_clk_init(MISC_BASE);
383a7ed099fSArnd Bergmann 
384a7ed099fSArnd Bergmann 	/* get the system timer clock */
385a7ed099fSArnd Bergmann 	gpt_clk = clk_get_sys("gpt0", NULL);
386a7ed099fSArnd Bergmann 	if (IS_ERR(gpt_clk)) {
387a7ed099fSArnd Bergmann 		pr_err("%s:couldn't get clk for gpt\n", __func__);
388a7ed099fSArnd Bergmann 		BUG();
389a7ed099fSArnd Bergmann 	}
390a7ed099fSArnd Bergmann 
391a7ed099fSArnd Bergmann 	/* get the suitable parent clock for timer*/
392a7ed099fSArnd Bergmann 	pclk = clk_get(NULL, pclk_name);
393a7ed099fSArnd Bergmann 	if (IS_ERR(pclk)) {
394a7ed099fSArnd Bergmann 		pr_err("%s:couldn't get %s as parent for gpt\n",
395a7ed099fSArnd Bergmann 				__func__, pclk_name);
396a7ed099fSArnd Bergmann 		BUG();
397a7ed099fSArnd Bergmann 	}
398a7ed099fSArnd Bergmann 
399a7ed099fSArnd Bergmann 	clk_set_parent(gpt_clk, pclk);
400a7ed099fSArnd Bergmann 	clk_put(gpt_clk);
401a7ed099fSArnd Bergmann 	clk_put(pclk);
402a7ed099fSArnd Bergmann 
403a7ed099fSArnd Bergmann 	spear_setup_of_timer();
404a7ed099fSArnd Bergmann }
405a7ed099fSArnd Bergmann 
406a7ed099fSArnd Bergmann /* Add auxdata to pass platform data */
407a7ed099fSArnd Bergmann struct of_dev_auxdata spear6xx_auxdata_lookup[] __initdata = {
408a7ed099fSArnd Bergmann 	OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE, NULL,
409553e7f75SArnd Bergmann 			&spear6xx_pl080_plat_data),
410a7ed099fSArnd Bergmann 	{}
411a7ed099fSArnd Bergmann };
412a7ed099fSArnd Bergmann 
413a7ed099fSArnd Bergmann static void __init spear600_dt_init(void)
414a7ed099fSArnd Bergmann {
415a7ed099fSArnd Bergmann 	of_platform_populate(NULL, of_default_bus_match_table,
416a7ed099fSArnd Bergmann 			spear6xx_auxdata_lookup, NULL);
417a7ed099fSArnd Bergmann }
418a7ed099fSArnd Bergmann 
419a7ed099fSArnd Bergmann static const char *spear600_dt_board_compat[] = {
420a7ed099fSArnd Bergmann 	"st,spear600",
421a7ed099fSArnd Bergmann 	NULL
422a7ed099fSArnd Bergmann };
423a7ed099fSArnd Bergmann 
424a7ed099fSArnd Bergmann DT_MACHINE_START(SPEAR600_DT, "ST SPEAr600 (Flattened Device Tree)")
425a7ed099fSArnd Bergmann 	.map_io		=	spear6xx_map_io,
426a7ed099fSArnd Bergmann 	.init_irq	=	irqchip_init,
427a7ed099fSArnd Bergmann 	.init_time	=	spear6xx_timer_init,
428a7ed099fSArnd Bergmann 	.init_machine	=	spear600_dt_init,
429a7ed099fSArnd Bergmann 	.restart	=	spear_restart,
430a7ed099fSArnd Bergmann 	.dt_compat	=	spear600_dt_board_compat,
431a7ed099fSArnd Bergmann MACHINE_END
432