2 * arch/arm/mach-spear6xx/spear6xx.c
4 * SPEAr6XX machines common source file
6 * Copyright (C) 2009 ST Microelectronics
7 * Rajeev Kumar<rajeev-dlh.kumar@st.com>
9 * Copyright 2012 Stefan Roese <sr@denx.de>
11 * This file is licensed under the terms of the GNU General Public
12 * License version 2. This program is licensed "as is" without any
13 * warranty of any kind, whether express or implied.
16 #include <linux/amba/pl08x.h>
17 #include <linux/clk.h>
18 #include <linux/err.h>
20 #include <linux/of_address.h>
21 #include <linux/of_platform.h>
22 #include <linux/amba/pl080.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach/time.h>
25 #include <asm/mach/map.h>
28 #include <mach/spear.h>
29 #include <mach/misc_regs.h>
31 /* dmac device registration */
32 static struct pl08x_channel_data spear600_dma_info
[] = {
38 .periph_buses
= PL08X_AHB1
,
44 .periph_buses
= PL08X_AHB1
,
50 .periph_buses
= PL08X_AHB1
,
56 .periph_buses
= PL08X_AHB1
,
62 .periph_buses
= PL08X_AHB1
,
68 .periph_buses
= PL08X_AHB1
,
74 .periph_buses
= PL08X_AHB2
,
80 .periph_buses
= PL08X_AHB2
,
86 .periph_buses
= PL08X_AHB1
,
92 .periph_buses
= PL08X_AHB1
,
98 .periph_buses
= PL08X_AHB1
,
104 .periph_buses
= PL08X_AHB1
,
110 .periph_buses
= PL08X_AHB1
,
116 .periph_buses
= PL08X_AHB2
,
122 .periph_buses
= PL08X_AHB1
,
124 .bus_id
= "from_jpeg",
128 .periph_buses
= PL08X_AHB1
,
134 .periph_buses
= PL08X_AHB1
,
140 .periph_buses
= PL08X_AHB1
,
146 .periph_buses
= PL08X_AHB1
,
152 .periph_buses
= PL08X_AHB1
,
158 .periph_buses
= PL08X_AHB1
,
164 .periph_buses
= PL08X_AHB1
,
170 .periph_buses
= PL08X_AHB1
,
176 .periph_buses
= PL08X_AHB1
,
182 .periph_buses
= PL08X_AHB1
,
188 .periph_buses
= PL08X_AHB1
,
194 .periph_buses
= PL08X_AHB1
,
200 .periph_buses
= PL08X_AHB1
,
206 .periph_buses
= PL08X_AHB1
,
212 .periph_buses
= PL08X_AHB1
,
218 .periph_buses
= PL08X_AHB1
,
224 .periph_buses
= PL08X_AHB1
,
230 .periph_buses
= PL08X_AHB2
,
236 .periph_buses
= PL08X_AHB2
,
242 .periph_buses
= PL08X_AHB2
,
248 .periph_buses
= PL08X_AHB2
,
254 .periph_buses
= PL08X_AHB2
,
260 .periph_buses
= PL08X_AHB2
,
266 .periph_buses
= PL08X_AHB2
,
272 .periph_buses
= PL08X_AHB2
,
278 .periph_buses
= PL08X_AHB2
,
284 .periph_buses
= PL08X_AHB2
,
290 .periph_buses
= PL08X_AHB2
,
296 .periph_buses
= PL08X_AHB2
,
302 .periph_buses
= PL08X_AHB2
,
308 .periph_buses
= PL08X_AHB2
,
314 .periph_buses
= PL08X_AHB2
,
320 .periph_buses
= PL08X_AHB2
,
324 static struct pl08x_platform_data spear6xx_pl080_plat_data
= {
328 (PL080_BSIZE_16
<< PL080_CONTROL_SB_SIZE_SHIFT
| \
329 PL080_BSIZE_16
<< PL080_CONTROL_DB_SIZE_SHIFT
| \
330 PL080_WIDTH_32BIT
<< PL080_CONTROL_SWIDTH_SHIFT
| \
331 PL080_WIDTH_32BIT
<< PL080_CONTROL_DWIDTH_SHIFT
| \
332 PL080_CONTROL_PROT_BUFF
| PL080_CONTROL_PROT_CACHE
| \
333 PL080_CONTROL_PROT_SYS
),
335 .lli_buses
= PL08X_AHB1
,
336 .mem_buses
= PL08X_AHB1
,
337 .get_xfer_signal
= pl080_get_signal
,
338 .put_xfer_signal
= pl080_put_signal
,
339 .slave_channels
= spear600_dma_info
,
340 .num_slave_channels
= ARRAY_SIZE(spear600_dma_info
),
344 * Following will create 16MB static virtual/physical mappings
346 * 0xF0000000 0xF0000000
347 * 0xF1000000 0xF1000000
348 * 0xD0000000 0xFD000000
349 * 0xFC000000 0xFC000000
351 struct map_desc spear6xx_io_desc
[] __initdata
= {
353 .virtual = (unsigned long)VA_SPEAR6XX_ML_CPU_BASE
,
354 .pfn
= __phys_to_pfn(SPEAR_ICM3_ML1_2_BASE
),
355 .length
= 2 * SZ_16M
,
358 .virtual = (unsigned long)VA_SPEAR_ICM1_2_BASE
,
359 .pfn
= __phys_to_pfn(SPEAR_ICM1_2_BASE
),
363 .virtual = (unsigned long)VA_SPEAR_ICM3_SMI_CTRL_BASE
,
364 .pfn
= __phys_to_pfn(SPEAR_ICM3_SMI_CTRL_BASE
),
370 /* This will create static memory mapping for selected devices */
371 void __init
spear6xx_map_io(void)
373 iotable_init(spear6xx_io_desc
, ARRAY_SIZE(spear6xx_io_desc
));
376 void __init
spear6xx_timer_init(void)
378 char pclk_name
[] = "pll3_clk";
379 struct clk
*gpt_clk
, *pclk
;
381 spear6xx_clk_init(MISC_BASE
);
383 /* get the system timer clock */
384 gpt_clk
= clk_get_sys("gpt0", NULL
);
385 if (IS_ERR(gpt_clk
)) {
386 pr_err("%s:couldn't get clk for gpt\n", __func__
);
390 /* get the suitable parent clock for timer*/
391 pclk
= clk_get(NULL
, pclk_name
);
393 pr_err("%s:couldn't get %s as parent for gpt\n",
394 __func__
, pclk_name
);
398 clk_set_parent(gpt_clk
, pclk
);
402 spear_setup_of_timer();
405 /* Add auxdata to pass platform data */
406 struct of_dev_auxdata spear6xx_auxdata_lookup
[] __initdata
= {
407 OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE
, NULL
,
408 &spear6xx_pl080_plat_data
),
412 static void __init
spear600_dt_init(void)
414 of_platform_populate(NULL
, of_default_bus_match_table
,
415 spear6xx_auxdata_lookup
, NULL
);
418 static const char *spear600_dt_board_compat
[] = {
423 DT_MACHINE_START(SPEAR600_DT
, "ST SPEAr600 (Flattened Device Tree)")
424 .map_io
= spear6xx_map_io
,
425 .init_time
= spear6xx_timer_init
,
426 .init_machine
= spear600_dt_init
,
427 .restart
= spear_restart
,
428 .dt_compat
= spear600_dt_board_compat
,