2 * arch/arm/mach-spear3xx/spear320.c
4 * SPEAr320 machine source file
6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com>
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
14 #define pr_fmt(fmt) "SPEAr320: " fmt
16 #include <linux/amba/pl022.h>
17 #include <linux/amba/pl08x.h>
18 #include <linux/amba/serial.h>
19 #include <linux/of_platform.h>
20 #include <asm/hardware/vic.h>
21 #include <asm/mach/arch.h>
22 #include <mach/generic.h>
23 #include <mach/spear.h>
25 #define SPEAR320_UART1_BASE UL(0xA3000000)
26 #define SPEAR320_UART2_BASE UL(0xA4000000)
27 #define SPEAR320_SSP0_BASE UL(0xA5000000)
28 #define SPEAR320_SSP1_BASE UL(0xA6000000)
30 /* DMAC platform data's slave info */
31 struct pl08x_channel_data spear320_dma_info
[] = {
37 .periph_buses
= PL08X_AHB1
,
43 .periph_buses
= PL08X_AHB1
,
49 .periph_buses
= PL08X_AHB1
,
55 .periph_buses
= PL08X_AHB1
,
61 .periph_buses
= PL08X_AHB1
,
67 .periph_buses
= PL08X_AHB1
,
73 .periph_buses
= PL08X_AHB1
,
79 .periph_buses
= PL08X_AHB1
,
85 .periph_buses
= PL08X_AHB1
,
87 .bus_id
= "from_jpeg",
91 .periph_buses
= PL08X_AHB1
,
97 .periph_buses
= PL08X_AHB2
,
103 .periph_buses
= PL08X_AHB2
,
109 .periph_buses
= PL08X_AHB2
,
115 .periph_buses
= PL08X_AHB2
,
117 .bus_id
= "uart1_rx",
121 .periph_buses
= PL08X_AHB2
,
123 .bus_id
= "uart1_tx",
127 .periph_buses
= PL08X_AHB2
,
129 .bus_id
= "uart2_rx",
133 .periph_buses
= PL08X_AHB2
,
135 .bus_id
= "uart2_tx",
139 .periph_buses
= PL08X_AHB2
,
145 .periph_buses
= PL08X_AHB2
,
151 .periph_buses
= PL08X_AHB2
,
157 .periph_buses
= PL08X_AHB2
,
163 .periph_buses
= PL08X_AHB2
,
169 .periph_buses
= PL08X_AHB2
,
175 .periph_buses
= PL08X_AHB2
,
177 .bus_id
= "rs485_rx",
181 .periph_buses
= PL08X_AHB2
,
183 .bus_id
= "rs485_tx",
187 .periph_buses
= PL08X_AHB2
,
191 static struct pl022_ssp_controller spear320_ssp_data
[] = {
195 .dma_filter
= pl08x_filter_id
,
196 .dma_tx_param
= "ssp1_tx",
197 .dma_rx_param
= "ssp1_rx",
202 .dma_filter
= pl08x_filter_id
,
203 .dma_tx_param
= "ssp2_tx",
204 .dma_rx_param
= "ssp2_rx",
209 static struct amba_pl011_data spear320_uart_data
[] = {
211 .dma_filter
= pl08x_filter_id
,
212 .dma_tx_param
= "uart1_tx",
213 .dma_rx_param
= "uart1_rx",
215 .dma_filter
= pl08x_filter_id
,
216 .dma_tx_param
= "uart2_tx",
217 .dma_rx_param
= "uart2_rx",
221 /* Add SPEAr310 auxdata to pass platform data */
222 static struct of_dev_auxdata spear320_auxdata_lookup
[] __initdata
= {
223 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE
, NULL
,
225 OF_DEV_AUXDATA("arm,pl080", SPEAR3XX_ICM3_DMA_BASE
, NULL
,
227 OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP0_BASE
, NULL
,
228 &spear320_ssp_data
[0]),
229 OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP1_BASE
, NULL
,
230 &spear320_ssp_data
[1]),
231 OF_DEV_AUXDATA("arm,pl011", SPEAR320_UART1_BASE
, NULL
,
232 &spear320_uart_data
[0]),
233 OF_DEV_AUXDATA("arm,pl011", SPEAR320_UART2_BASE
, NULL
,
234 &spear320_uart_data
[1]),
238 static void __init
spear320_dt_init(void)
240 pl080_plat_data
.slave_channels
= spear320_dma_info
;
241 pl080_plat_data
.num_slave_channels
= ARRAY_SIZE(spear320_dma_info
);
243 of_platform_populate(NULL
, of_default_bus_match_table
,
244 spear320_auxdata_lookup
, NULL
);
247 static const char * const spear320_dt_board_compat
[] = {
254 struct map_desc spear320_io_desc
[] __initdata
= {
256 .virtual = VA_SPEAR320_SOC_CONFIG_BASE
,
257 .pfn
= __phys_to_pfn(SPEAR320_SOC_CONFIG_BASE
),
263 static void __init
spear320_map_io(void)
265 iotable_init(spear320_io_desc
, ARRAY_SIZE(spear320_io_desc
));
269 DT_MACHINE_START(SPEAR320_DT
, "ST SPEAr320 SoC with Flattened Device Tree")
270 .map_io
= spear320_map_io
,
271 .init_irq
= spear3xx_dt_init_irq
,
272 .handle_irq
= vic_handle_irq
,
273 .init_time
= spear3xx_timer_init
,
274 .init_machine
= spear320_dt_init
,
275 .restart
= spear_restart
,
276 .dt_compat
= spear320_dt_board_compat
,