blob: bf634b32a930c2d8b6eb54749a4e3a0c39f5e995 [file] [log] [blame]
viresh kumarbc4e8142010-04-01 12:30:58 +01001/*
2 * arch/arm/mach-spear3xx/spear320.c
3 *
4 * SPEAr320 machine source file
5 *
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +05306 * Copyright (C) 2009-2012 ST Microelectronics
Viresh Kumar10d89352012-06-20 12:53:02 -07007 * Viresh Kumar <viresh.linux@gmail.com>
viresh kumarbc4e8142010-04-01 12:30:58 +01008 *
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.
12 */
13
Viresh Kumar5fb00f92012-03-26 10:39:43 +053014#define pr_fmt(fmt) "SPEAr320: " fmt
15
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +053016#include <linux/amba/pl022.h>
17#include <linux/amba/pl08x.h>
18#include <linux/amba/serial.h>
19#include <linux/of_platform.h>
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +053020#include <asm/mach/arch.h>
Arnd Bergmann54475212013-03-12 17:00:03 +010021#include <asm/mach/map.h>
Arnd Bergmann2b9c6132012-12-02 15:49:04 +010022#include "generic.h"
Viresh Kumar5df33a62012-04-10 09:02:35 +053023#include <mach/spear.h>
viresh kumarbc4e8142010-04-01 12:30:58 +010024
Arnd Bergmann5019f0b2012-04-11 17:30:11 +000025#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)
Arnd Bergmann5019f0b2012-04-11 17:30:11 +000029
Viresh Kumar0b7ee712012-03-26 10:29:23 +053030/* DMAC platform data's slave info */
31struct pl08x_channel_data spear320_dma_info[] = {
32 {
33 .bus_id = "uart0_rx",
34 .min_signal = 2,
35 .max_signal = 2,
36 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053037 .periph_buses = PL08X_AHB1,
38 }, {
39 .bus_id = "uart0_tx",
40 .min_signal = 3,
41 .max_signal = 3,
42 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053043 .periph_buses = PL08X_AHB1,
44 }, {
45 .bus_id = "ssp0_rx",
46 .min_signal = 8,
47 .max_signal = 8,
48 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053049 .periph_buses = PL08X_AHB1,
50 }, {
51 .bus_id = "ssp0_tx",
52 .min_signal = 9,
53 .max_signal = 9,
54 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053055 .periph_buses = PL08X_AHB1,
56 }, {
57 .bus_id = "i2c0_rx",
58 .min_signal = 10,
59 .max_signal = 10,
60 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053061 .periph_buses = PL08X_AHB1,
62 }, {
63 .bus_id = "i2c0_tx",
64 .min_signal = 11,
65 .max_signal = 11,
66 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053067 .periph_buses = PL08X_AHB1,
68 }, {
69 .bus_id = "irda",
70 .min_signal = 12,
71 .max_signal = 12,
72 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053073 .periph_buses = PL08X_AHB1,
74 }, {
75 .bus_id = "adc",
76 .min_signal = 13,
77 .max_signal = 13,
78 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053079 .periph_buses = PL08X_AHB1,
80 }, {
81 .bus_id = "to_jpeg",
82 .min_signal = 14,
83 .max_signal = 14,
84 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053085 .periph_buses = PL08X_AHB1,
86 }, {
87 .bus_id = "from_jpeg",
88 .min_signal = 15,
89 .max_signal = 15,
90 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053091 .periph_buses = PL08X_AHB1,
92 }, {
93 .bus_id = "ssp1_rx",
94 .min_signal = 0,
95 .max_signal = 0,
96 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053097 .periph_buses = PL08X_AHB2,
98 }, {
99 .bus_id = "ssp1_tx",
100 .min_signal = 1,
101 .max_signal = 1,
102 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530103 .periph_buses = PL08X_AHB2,
104 }, {
105 .bus_id = "ssp2_rx",
106 .min_signal = 2,
107 .max_signal = 2,
108 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530109 .periph_buses = PL08X_AHB2,
110 }, {
111 .bus_id = "ssp2_tx",
112 .min_signal = 3,
113 .max_signal = 3,
114 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530115 .periph_buses = PL08X_AHB2,
116 }, {
117 .bus_id = "uart1_rx",
118 .min_signal = 4,
119 .max_signal = 4,
120 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530121 .periph_buses = PL08X_AHB2,
122 }, {
123 .bus_id = "uart1_tx",
124 .min_signal = 5,
125 .max_signal = 5,
126 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530127 .periph_buses = PL08X_AHB2,
128 }, {
129 .bus_id = "uart2_rx",
130 .min_signal = 6,
131 .max_signal = 6,
132 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530133 .periph_buses = PL08X_AHB2,
134 }, {
135 .bus_id = "uart2_tx",
136 .min_signal = 7,
137 .max_signal = 7,
138 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530139 .periph_buses = PL08X_AHB2,
140 }, {
141 .bus_id = "i2c1_rx",
142 .min_signal = 8,
143 .max_signal = 8,
144 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530145 .periph_buses = PL08X_AHB2,
146 }, {
147 .bus_id = "i2c1_tx",
148 .min_signal = 9,
149 .max_signal = 9,
150 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530151 .periph_buses = PL08X_AHB2,
152 }, {
153 .bus_id = "i2c2_rx",
154 .min_signal = 10,
155 .max_signal = 10,
156 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530157 .periph_buses = PL08X_AHB2,
158 }, {
159 .bus_id = "i2c2_tx",
160 .min_signal = 11,
161 .max_signal = 11,
162 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530163 .periph_buses = PL08X_AHB2,
164 }, {
165 .bus_id = "i2s_rx",
166 .min_signal = 12,
167 .max_signal = 12,
168 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530169 .periph_buses = PL08X_AHB2,
170 }, {
171 .bus_id = "i2s_tx",
172 .min_signal = 13,
173 .max_signal = 13,
174 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530175 .periph_buses = PL08X_AHB2,
176 }, {
177 .bus_id = "rs485_rx",
178 .min_signal = 14,
179 .max_signal = 14,
180 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530181 .periph_buses = PL08X_AHB2,
182 }, {
183 .bus_id = "rs485_tx",
184 .min_signal = 15,
185 .max_signal = 15,
186 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530187 .periph_buses = PL08X_AHB2,
188 },
189};
viresh kumarc2c07832011-03-07 05:57:05 +0100190
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530191static struct pl022_ssp_controller spear320_ssp_data[] = {
192 {
193 .bus_id = 1,
194 .enable_dma = 1,
195 .dma_filter = pl08x_filter_id,
196 .dma_tx_param = "ssp1_tx",
197 .dma_rx_param = "ssp1_rx",
198 .num_chipselect = 2,
199 }, {
200 .bus_id = 2,
201 .enable_dma = 1,
202 .dma_filter = pl08x_filter_id,
203 .dma_tx_param = "ssp2_tx",
204 .dma_rx_param = "ssp2_rx",
205 .num_chipselect = 2,
206 }
207};
208
209static struct amba_pl011_data spear320_uart_data[] = {
210 {
211 .dma_filter = pl08x_filter_id,
212 .dma_tx_param = "uart1_tx",
213 .dma_rx_param = "uart1_rx",
214 }, {
215 .dma_filter = pl08x_filter_id,
216 .dma_tx_param = "uart2_tx",
217 .dma_rx_param = "uart2_rx",
218 },
219};
220
221/* Add SPEAr310 auxdata to pass platform data */
222static struct of_dev_auxdata spear320_auxdata_lookup[] __initdata = {
223 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
224 &pl022_plat_data),
Arnd Bergmannd42799b2012-12-02 14:45:27 +0100225 OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE, NULL,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530226 &pl080_plat_data),
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530227 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]),
235 {}
236};
237
238static void __init spear320_dt_init(void)
viresh kumarbc4e8142010-04-01 12:30:58 +0100239{
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530240 pl080_plat_data.slave_channels = spear320_dma_info;
241 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear320_dma_info);
242
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530243 of_platform_populate(NULL, of_default_bus_match_table,
244 spear320_auxdata_lookup, NULL);
viresh kumar70f4c0b2010-04-01 12:31:29 +0100245}
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530246
247static const char * const spear320_dt_board_compat[] = {
248 "st,spear320",
249 "st,spear320-evb",
Shiraz Hashime2eb6912012-08-09 04:50:11 +0530250 "st,spear320-hmi",
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530251 NULL,
252};
253
Arnd Bergmann66a28862012-05-14 17:31:45 +0200254struct map_desc spear320_io_desc[] __initdata = {
255 {
Arnd Bergmannd9909eb2012-12-02 17:59:57 +0100256 .virtual = (unsigned long)VA_SPEAR320_SOC_CONFIG_BASE,
Arnd Bergmann66a28862012-05-14 17:31:45 +0200257 .pfn = __phys_to_pfn(SPEAR320_SOC_CONFIG_BASE),
258 .length = SZ_16M,
259 .type = MT_DEVICE
260 },
261};
262
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530263static void __init spear320_map_io(void)
264{
Arnd Bergmann66a28862012-05-14 17:31:45 +0200265 iotable_init(spear320_io_desc, ARRAY_SIZE(spear320_io_desc));
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530266 spear3xx_map_io();
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530267}
268
269DT_MACHINE_START(SPEAR320_DT, "ST SPEAr320 SoC with Flattened Device Tree")
270 .map_io = spear320_map_io,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700271 .init_time = spear3xx_timer_init,
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530272 .init_machine = spear320_dt_init,
273 .restart = spear_restart,
274 .dt_compat = spear320_dt_board_compat,
275MACHINE_END