1 // SPDX-License-Identifier: GPL-2.0-only
3 * arch/arm/mach-spear3xx/spear320.c
5 * SPEAr320 machine source file
7 * Copyright (C) 2009-2012 ST Microelectronics
8 * Viresh Kumar <vireshk@kernel.org>
11 #define pr_fmt(fmt) "SPEAr320: " fmt
13 #include <linux/amba/pl022.h>
14 #include <linux/amba/pl08x.h>
15 #include <linux/amba/serial.h>
16 #include <linux/of_platform.h>
17 #include <asm/mach/arch.h>
18 #include <asm/mach/map.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)
27 /* DMAC platform data's slave info */
28 struct pl08x_channel_data spear320_dma_info
[] = {
34 .periph_buses
= PL08X_AHB1
,
40 .periph_buses
= PL08X_AHB1
,
46 .periph_buses
= PL08X_AHB1
,
52 .periph_buses
= PL08X_AHB1
,
58 .periph_buses
= PL08X_AHB1
,
64 .periph_buses
= PL08X_AHB1
,
70 .periph_buses
= PL08X_AHB1
,
76 .periph_buses
= PL08X_AHB1
,
82 .periph_buses
= PL08X_AHB1
,
84 .bus_id
= "from_jpeg",
88 .periph_buses
= PL08X_AHB1
,
94 .periph_buses
= PL08X_AHB2
,
100 .periph_buses
= PL08X_AHB2
,
106 .periph_buses
= PL08X_AHB2
,
112 .periph_buses
= PL08X_AHB2
,
114 .bus_id
= "uart1_rx",
118 .periph_buses
= PL08X_AHB2
,
120 .bus_id
= "uart1_tx",
124 .periph_buses
= PL08X_AHB2
,
126 .bus_id
= "uart2_rx",
130 .periph_buses
= PL08X_AHB2
,
132 .bus_id
= "uart2_tx",
136 .periph_buses
= PL08X_AHB2
,
142 .periph_buses
= PL08X_AHB2
,
148 .periph_buses
= PL08X_AHB2
,
154 .periph_buses
= PL08X_AHB2
,
160 .periph_buses
= PL08X_AHB2
,
166 .periph_buses
= PL08X_AHB2
,
172 .periph_buses
= PL08X_AHB2
,
174 .bus_id
= "rs485_rx",
178 .periph_buses
= PL08X_AHB2
,
180 .bus_id
= "rs485_tx",
184 .periph_buses
= PL08X_AHB2
,
188 static struct pl022_ssp_controller spear320_ssp_data
[] = {
192 .dma_filter
= pl08x_filter_id
,
193 .dma_tx_param
= "ssp1_tx",
194 .dma_rx_param
= "ssp1_rx",
198 .dma_filter
= pl08x_filter_id
,
199 .dma_tx_param
= "ssp2_tx",
200 .dma_rx_param
= "ssp2_rx",
204 static struct amba_pl011_data spear320_uart_data
[] = {
206 .dma_filter
= pl08x_filter_id
,
207 .dma_tx_param
= "uart1_tx",
208 .dma_rx_param
= "uart1_rx",
210 .dma_filter
= pl08x_filter_id
,
211 .dma_tx_param
= "uart2_tx",
212 .dma_rx_param
= "uart2_rx",
216 /* Add SPEAr310 auxdata to pass platform data */
217 static struct of_dev_auxdata spear320_auxdata_lookup
[] __initdata
= {
218 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE
, NULL
,
220 OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE
, NULL
,
222 OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP0_BASE
, NULL
,
223 &spear320_ssp_data
[0]),
224 OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP1_BASE
, NULL
,
225 &spear320_ssp_data
[1]),
226 OF_DEV_AUXDATA("arm,pl011", SPEAR320_UART1_BASE
, NULL
,
227 &spear320_uart_data
[0]),
228 OF_DEV_AUXDATA("arm,pl011", SPEAR320_UART2_BASE
, NULL
,
229 &spear320_uart_data
[1]),
233 static void __init
spear320_dt_init(void)
235 pl080_plat_data
.slave_channels
= spear320_dma_info
;
236 pl080_plat_data
.num_slave_channels
= ARRAY_SIZE(spear320_dma_info
);
238 of_platform_default_populate(NULL
, spear320_auxdata_lookup
, NULL
);
241 static const char * const spear320_dt_board_compat
[] = {
248 struct map_desc spear320_io_desc
[] __initdata
= {
250 .virtual = (unsigned long)VA_SPEAR320_SOC_CONFIG_BASE
,
251 .pfn
= __phys_to_pfn(SPEAR320_SOC_CONFIG_BASE
),
257 static void __init
spear320_map_io(void)
259 iotable_init(spear320_io_desc
, ARRAY_SIZE(spear320_io_desc
));
263 DT_MACHINE_START(SPEAR320_DT
, "ST SPEAr320 SoC with Flattened Device Tree")
264 .map_io
= spear320_map_io
,
265 .init_time
= spear3xx_timer_init
,
266 .init_machine
= spear320_dt_init
,
267 .restart
= spear_restart
,
268 .dt_compat
= spear320_dt_board_compat
,