1 // SPDX-License-Identifier: GPL-2.0-only
3 * arch/arm/mach-spear6xx/spear6xx.c
5 * SPEAr6XX machines common source file
7 * Copyright (C) 2009 ST Microelectronics
8 * Rajeev Kumar<rajeev-dlh.kumar@st.com>
10 * Copyright 2012 Stefan Roese <sr@denx.de>
13 #include <linux/amba/pl08x.h>
14 #include <linux/clk.h>
15 #include <linux/clk/spear.h>
16 #include <linux/err.h>
18 #include <linux/of_address.h>
19 #include <linux/of_platform.h>
20 #include <linux/amba/pl080.h>
21 #include <asm/mach/arch.h>
22 #include <asm/mach/time.h>
23 #include <asm/mach/map.h>
27 #include "misc_regs.h"
29 /* dmac device registration */
30 static struct pl08x_channel_data spear600_dma_info
[] = {
36 .periph_buses
= PL08X_AHB1
,
42 .periph_buses
= PL08X_AHB1
,
48 .periph_buses
= PL08X_AHB1
,
54 .periph_buses
= PL08X_AHB1
,
60 .periph_buses
= PL08X_AHB1
,
66 .periph_buses
= PL08X_AHB1
,
72 .periph_buses
= PL08X_AHB2
,
78 .periph_buses
= PL08X_AHB2
,
84 .periph_buses
= PL08X_AHB1
,
90 .periph_buses
= PL08X_AHB1
,
96 .periph_buses
= PL08X_AHB1
,
102 .periph_buses
= PL08X_AHB1
,
108 .periph_buses
= PL08X_AHB1
,
114 .periph_buses
= PL08X_AHB2
,
120 .periph_buses
= PL08X_AHB1
,
122 .bus_id
= "from_jpeg",
126 .periph_buses
= PL08X_AHB1
,
132 .periph_buses
= PL08X_AHB1
,
138 .periph_buses
= PL08X_AHB1
,
144 .periph_buses
= PL08X_AHB1
,
150 .periph_buses
= PL08X_AHB1
,
156 .periph_buses
= PL08X_AHB1
,
162 .periph_buses
= PL08X_AHB1
,
168 .periph_buses
= PL08X_AHB1
,
174 .periph_buses
= PL08X_AHB1
,
180 .periph_buses
= PL08X_AHB1
,
186 .periph_buses
= PL08X_AHB1
,
192 .periph_buses
= PL08X_AHB1
,
198 .periph_buses
= PL08X_AHB1
,
204 .periph_buses
= PL08X_AHB1
,
210 .periph_buses
= PL08X_AHB1
,
216 .periph_buses
= PL08X_AHB1
,
222 .periph_buses
= PL08X_AHB1
,
228 .periph_buses
= PL08X_AHB2
,
234 .periph_buses
= PL08X_AHB2
,
240 .periph_buses
= PL08X_AHB2
,
246 .periph_buses
= PL08X_AHB2
,
252 .periph_buses
= PL08X_AHB2
,
258 .periph_buses
= PL08X_AHB2
,
264 .periph_buses
= PL08X_AHB2
,
270 .periph_buses
= PL08X_AHB2
,
276 .periph_buses
= PL08X_AHB2
,
282 .periph_buses
= PL08X_AHB2
,
288 .periph_buses
= PL08X_AHB2
,
294 .periph_buses
= PL08X_AHB2
,
300 .periph_buses
= PL08X_AHB2
,
306 .periph_buses
= PL08X_AHB2
,
312 .periph_buses
= PL08X_AHB2
,
318 .periph_buses
= PL08X_AHB2
,
322 static struct pl08x_platform_data spear6xx_pl080_plat_data
= {
323 .memcpy_burst_size
= PL08X_BURST_SZ_16
,
324 .memcpy_bus_width
= PL08X_BUS_WIDTH_32_BITS
,
325 .memcpy_prot_buff
= true,
326 .memcpy_prot_cache
= true,
327 .lli_buses
= PL08X_AHB1
,
328 .mem_buses
= PL08X_AHB1
,
329 .get_xfer_signal
= pl080_get_signal
,
330 .put_xfer_signal
= pl080_put_signal
,
331 .slave_channels
= spear600_dma_info
,
332 .num_slave_channels
= ARRAY_SIZE(spear600_dma_info
),
336 * Following will create 16MB static virtual/physical mappings
338 * 0xF0000000 0xF0000000
339 * 0xF1000000 0xF1000000
340 * 0xD0000000 0xFD000000
341 * 0xFC000000 0xFC000000
343 static struct map_desc spear6xx_io_desc
[] __initdata
= {
345 .virtual = (unsigned long)VA_SPEAR6XX_ML_CPU_BASE
,
346 .pfn
= __phys_to_pfn(SPEAR_ICM3_ML1_2_BASE
),
347 .length
= 2 * SZ_16M
,
350 .virtual = (unsigned long)VA_SPEAR_ICM1_2_BASE
,
351 .pfn
= __phys_to_pfn(SPEAR_ICM1_2_BASE
),
355 .virtual = (unsigned long)VA_SPEAR_ICM3_SMI_CTRL_BASE
,
356 .pfn
= __phys_to_pfn(SPEAR_ICM3_SMI_CTRL_BASE
),
362 /* This will create static memory mapping for selected devices */
363 static void __init
spear6xx_map_io(void)
365 iotable_init(spear6xx_io_desc
, ARRAY_SIZE(spear6xx_io_desc
));
368 static void __init
spear6xx_timer_init(void)
370 char pclk_name
[] = "pll3_clk";
371 struct clk
*gpt_clk
, *pclk
;
373 spear6xx_clk_init(MISC_BASE
);
375 /* get the system timer clock */
376 gpt_clk
= clk_get_sys("gpt0", NULL
);
377 if (IS_ERR(gpt_clk
)) {
378 pr_err("%s:couldn't get clk for gpt\n", __func__
);
382 /* get the suitable parent clock for timer*/
383 pclk
= clk_get(NULL
, pclk_name
);
385 pr_err("%s:couldn't get %s as parent for gpt\n",
386 __func__
, pclk_name
);
390 clk_set_parent(gpt_clk
, pclk
);
394 spear_setup_of_timer();
397 /* Add auxdata to pass platform data */
398 static struct of_dev_auxdata spear6xx_auxdata_lookup
[] __initdata
= {
399 OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE
, NULL
,
400 &spear6xx_pl080_plat_data
),
404 static void __init
spear600_dt_init(void)
406 of_platform_default_populate(NULL
, spear6xx_auxdata_lookup
, NULL
);
409 static const char *spear600_dt_board_compat
[] = {
414 DT_MACHINE_START(SPEAR600_DT
, "ST SPEAr600 (Flattened Device Tree)")
415 .map_io
= spear6xx_map_io
,
416 .init_time
= spear6xx_timer_init
,
417 .init_machine
= spear600_dt_init
,
418 .restart
= spear_restart
,
419 .dt_compat
= spear600_dt_board_compat
,