1*0fdebc5eSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
2a7ed099fSArnd Bergmann /*
3a7ed099fSArnd Bergmann * arch/arm/mach-spear3xx/spear310.c
4a7ed099fSArnd Bergmann *
5a7ed099fSArnd Bergmann * SPEAr310 machine source file
6a7ed099fSArnd Bergmann *
7a7ed099fSArnd Bergmann * Copyright (C) 2009-2012 ST Microelectronics
8da89947bSViresh Kumar * Viresh Kumar <vireshk@kernel.org>
9a7ed099fSArnd Bergmann */
10a7ed099fSArnd Bergmann
11a7ed099fSArnd Bergmann #define pr_fmt(fmt) "SPEAr310: " fmt
12a7ed099fSArnd Bergmann
13a7ed099fSArnd Bergmann #include <linux/amba/pl08x.h>
14a7ed099fSArnd Bergmann #include <linux/amba/serial.h>
15a7ed099fSArnd Bergmann #include <linux/of_platform.h>
16a7ed099fSArnd Bergmann #include <asm/mach/arch.h>
172b9c613cSArnd Bergmann #include "generic.h"
18c164620aSArnd Bergmann #include "spear.h"
19a7ed099fSArnd Bergmann
20a7ed099fSArnd Bergmann #define SPEAR310_UART1_BASE UL(0xB2000000)
21a7ed099fSArnd Bergmann #define SPEAR310_UART2_BASE UL(0xB2080000)
22a7ed099fSArnd Bergmann #define SPEAR310_UART3_BASE UL(0xB2100000)
23a7ed099fSArnd Bergmann #define SPEAR310_UART4_BASE UL(0xB2180000)
24a7ed099fSArnd Bergmann #define SPEAR310_UART5_BASE UL(0xB2200000)
25a7ed099fSArnd Bergmann
26a7ed099fSArnd Bergmann /* DMAC platform data's slave info */
27a7ed099fSArnd Bergmann struct pl08x_channel_data spear310_dma_info[] = {
28a7ed099fSArnd Bergmann {
29a7ed099fSArnd Bergmann .bus_id = "uart0_rx",
30a7ed099fSArnd Bergmann .min_signal = 2,
31a7ed099fSArnd Bergmann .max_signal = 2,
32a7ed099fSArnd Bergmann .muxval = 0,
33a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
34a7ed099fSArnd Bergmann }, {
35a7ed099fSArnd Bergmann .bus_id = "uart0_tx",
36a7ed099fSArnd Bergmann .min_signal = 3,
37a7ed099fSArnd Bergmann .max_signal = 3,
38a7ed099fSArnd Bergmann .muxval = 0,
39a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
40a7ed099fSArnd Bergmann }, {
41a7ed099fSArnd Bergmann .bus_id = "ssp0_rx",
42a7ed099fSArnd Bergmann .min_signal = 8,
43a7ed099fSArnd Bergmann .max_signal = 8,
44a7ed099fSArnd Bergmann .muxval = 0,
45a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
46a7ed099fSArnd Bergmann }, {
47a7ed099fSArnd Bergmann .bus_id = "ssp0_tx",
48a7ed099fSArnd Bergmann .min_signal = 9,
49a7ed099fSArnd Bergmann .max_signal = 9,
50a7ed099fSArnd Bergmann .muxval = 0,
51a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
52a7ed099fSArnd Bergmann }, {
53a7ed099fSArnd Bergmann .bus_id = "i2c_rx",
54a7ed099fSArnd Bergmann .min_signal = 10,
55a7ed099fSArnd Bergmann .max_signal = 10,
56a7ed099fSArnd Bergmann .muxval = 0,
57a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
58a7ed099fSArnd Bergmann }, {
59a7ed099fSArnd Bergmann .bus_id = "i2c_tx",
60a7ed099fSArnd Bergmann .min_signal = 11,
61a7ed099fSArnd Bergmann .max_signal = 11,
62a7ed099fSArnd Bergmann .muxval = 0,
63a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
64a7ed099fSArnd Bergmann }, {
65a7ed099fSArnd Bergmann .bus_id = "irda",
66a7ed099fSArnd Bergmann .min_signal = 12,
67a7ed099fSArnd Bergmann .max_signal = 12,
68a7ed099fSArnd Bergmann .muxval = 0,
69a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
70a7ed099fSArnd Bergmann }, {
71a7ed099fSArnd Bergmann .bus_id = "adc",
72a7ed099fSArnd Bergmann .min_signal = 13,
73a7ed099fSArnd Bergmann .max_signal = 13,
74a7ed099fSArnd Bergmann .muxval = 0,
75a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
76a7ed099fSArnd Bergmann }, {
77a7ed099fSArnd Bergmann .bus_id = "to_jpeg",
78a7ed099fSArnd Bergmann .min_signal = 14,
79a7ed099fSArnd Bergmann .max_signal = 14,
80a7ed099fSArnd Bergmann .muxval = 0,
81a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
82a7ed099fSArnd Bergmann }, {
83a7ed099fSArnd Bergmann .bus_id = "from_jpeg",
84a7ed099fSArnd Bergmann .min_signal = 15,
85a7ed099fSArnd Bergmann .max_signal = 15,
86a7ed099fSArnd Bergmann .muxval = 0,
87a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
88a7ed099fSArnd Bergmann }, {
89a7ed099fSArnd Bergmann .bus_id = "uart1_rx",
90a7ed099fSArnd Bergmann .min_signal = 0,
91a7ed099fSArnd Bergmann .max_signal = 0,
92a7ed099fSArnd Bergmann .muxval = 1,
93a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
94a7ed099fSArnd Bergmann }, {
95a7ed099fSArnd Bergmann .bus_id = "uart1_tx",
96a7ed099fSArnd Bergmann .min_signal = 1,
97a7ed099fSArnd Bergmann .max_signal = 1,
98a7ed099fSArnd Bergmann .muxval = 1,
99a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
100a7ed099fSArnd Bergmann }, {
101a7ed099fSArnd Bergmann .bus_id = "uart2_rx",
102a7ed099fSArnd Bergmann .min_signal = 2,
103a7ed099fSArnd Bergmann .max_signal = 2,
104a7ed099fSArnd Bergmann .muxval = 1,
105a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
106a7ed099fSArnd Bergmann }, {
107a7ed099fSArnd Bergmann .bus_id = "uart2_tx",
108a7ed099fSArnd Bergmann .min_signal = 3,
109a7ed099fSArnd Bergmann .max_signal = 3,
110a7ed099fSArnd Bergmann .muxval = 1,
111a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
112a7ed099fSArnd Bergmann }, {
113a7ed099fSArnd Bergmann .bus_id = "uart3_rx",
114a7ed099fSArnd Bergmann .min_signal = 4,
115a7ed099fSArnd Bergmann .max_signal = 4,
116a7ed099fSArnd Bergmann .muxval = 1,
117a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
118a7ed099fSArnd Bergmann }, {
119a7ed099fSArnd Bergmann .bus_id = "uart3_tx",
120a7ed099fSArnd Bergmann .min_signal = 5,
121a7ed099fSArnd Bergmann .max_signal = 5,
122a7ed099fSArnd Bergmann .muxval = 1,
123a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
124a7ed099fSArnd Bergmann }, {
125a7ed099fSArnd Bergmann .bus_id = "uart4_rx",
126a7ed099fSArnd Bergmann .min_signal = 6,
127a7ed099fSArnd Bergmann .max_signal = 6,
128a7ed099fSArnd Bergmann .muxval = 1,
129a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
130a7ed099fSArnd Bergmann }, {
131a7ed099fSArnd Bergmann .bus_id = "uart4_tx",
132a7ed099fSArnd Bergmann .min_signal = 7,
133a7ed099fSArnd Bergmann .max_signal = 7,
134a7ed099fSArnd Bergmann .muxval = 1,
135a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
136a7ed099fSArnd Bergmann }, {
137a7ed099fSArnd Bergmann .bus_id = "uart5_rx",
138a7ed099fSArnd Bergmann .min_signal = 8,
139a7ed099fSArnd Bergmann .max_signal = 8,
140a7ed099fSArnd Bergmann .muxval = 1,
141a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
142a7ed099fSArnd Bergmann }, {
143a7ed099fSArnd Bergmann .bus_id = "uart5_tx",
144a7ed099fSArnd Bergmann .min_signal = 9,
145a7ed099fSArnd Bergmann .max_signal = 9,
146a7ed099fSArnd Bergmann .muxval = 1,
147a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
148a7ed099fSArnd Bergmann }, {
149a7ed099fSArnd Bergmann .bus_id = "ras5_rx",
150a7ed099fSArnd Bergmann .min_signal = 10,
151a7ed099fSArnd Bergmann .max_signal = 10,
152a7ed099fSArnd Bergmann .muxval = 1,
153a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
154a7ed099fSArnd Bergmann }, {
155a7ed099fSArnd Bergmann .bus_id = "ras5_tx",
156a7ed099fSArnd Bergmann .min_signal = 11,
157a7ed099fSArnd Bergmann .max_signal = 11,
158a7ed099fSArnd Bergmann .muxval = 1,
159a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
160a7ed099fSArnd Bergmann }, {
161a7ed099fSArnd Bergmann .bus_id = "ras6_rx",
162a7ed099fSArnd Bergmann .min_signal = 12,
163a7ed099fSArnd Bergmann .max_signal = 12,
164a7ed099fSArnd Bergmann .muxval = 1,
165a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
166a7ed099fSArnd Bergmann }, {
167a7ed099fSArnd Bergmann .bus_id = "ras6_tx",
168a7ed099fSArnd Bergmann .min_signal = 13,
169a7ed099fSArnd Bergmann .max_signal = 13,
170a7ed099fSArnd Bergmann .muxval = 1,
171a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
172a7ed099fSArnd Bergmann }, {
173a7ed099fSArnd Bergmann .bus_id = "ras7_rx",
174a7ed099fSArnd Bergmann .min_signal = 14,
175a7ed099fSArnd Bergmann .max_signal = 14,
176a7ed099fSArnd Bergmann .muxval = 1,
177a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
178a7ed099fSArnd Bergmann }, {
179a7ed099fSArnd Bergmann .bus_id = "ras7_tx",
180a7ed099fSArnd Bergmann .min_signal = 15,
181a7ed099fSArnd Bergmann .max_signal = 15,
182a7ed099fSArnd Bergmann .muxval = 1,
183a7ed099fSArnd Bergmann .periph_buses = PL08X_AHB1,
184a7ed099fSArnd Bergmann },
185a7ed099fSArnd Bergmann };
186a7ed099fSArnd Bergmann
187a7ed099fSArnd Bergmann /* uart devices plat data */
188a7ed099fSArnd Bergmann static struct amba_pl011_data spear310_uart_data[] = {
189a7ed099fSArnd Bergmann {
190a7ed099fSArnd Bergmann .dma_filter = pl08x_filter_id,
191a7ed099fSArnd Bergmann .dma_tx_param = "uart1_tx",
192a7ed099fSArnd Bergmann .dma_rx_param = "uart1_rx",
193a7ed099fSArnd Bergmann }, {
194a7ed099fSArnd Bergmann .dma_filter = pl08x_filter_id,
195a7ed099fSArnd Bergmann .dma_tx_param = "uart2_tx",
196a7ed099fSArnd Bergmann .dma_rx_param = "uart2_rx",
197a7ed099fSArnd Bergmann }, {
198a7ed099fSArnd Bergmann .dma_filter = pl08x_filter_id,
199a7ed099fSArnd Bergmann .dma_tx_param = "uart3_tx",
200a7ed099fSArnd Bergmann .dma_rx_param = "uart3_rx",
201a7ed099fSArnd Bergmann }, {
202a7ed099fSArnd Bergmann .dma_filter = pl08x_filter_id,
203a7ed099fSArnd Bergmann .dma_tx_param = "uart4_tx",
204a7ed099fSArnd Bergmann .dma_rx_param = "uart4_rx",
205a7ed099fSArnd Bergmann }, {
206a7ed099fSArnd Bergmann .dma_filter = pl08x_filter_id,
207a7ed099fSArnd Bergmann .dma_tx_param = "uart5_tx",
208a7ed099fSArnd Bergmann .dma_rx_param = "uart5_rx",
209a7ed099fSArnd Bergmann },
210a7ed099fSArnd Bergmann };
211a7ed099fSArnd Bergmann
212a7ed099fSArnd Bergmann /* Add SPEAr310 auxdata to pass platform data */
213a7ed099fSArnd Bergmann static struct of_dev_auxdata spear310_auxdata_lookup[] __initdata = {
214a7ed099fSArnd Bergmann OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
215a7ed099fSArnd Bergmann &pl022_plat_data),
216a7ed099fSArnd Bergmann OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE, NULL,
217a7ed099fSArnd Bergmann &pl080_plat_data),
218a7ed099fSArnd Bergmann OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART1_BASE, NULL,
219a7ed099fSArnd Bergmann &spear310_uart_data[0]),
220a7ed099fSArnd Bergmann OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART2_BASE, NULL,
221a7ed099fSArnd Bergmann &spear310_uart_data[1]),
222a7ed099fSArnd Bergmann OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART3_BASE, NULL,
223a7ed099fSArnd Bergmann &spear310_uart_data[2]),
224a7ed099fSArnd Bergmann OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART4_BASE, NULL,
225a7ed099fSArnd Bergmann &spear310_uart_data[3]),
226a7ed099fSArnd Bergmann OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART5_BASE, NULL,
227a7ed099fSArnd Bergmann &spear310_uart_data[4]),
228a7ed099fSArnd Bergmann {}
229a7ed099fSArnd Bergmann };
230a7ed099fSArnd Bergmann
spear310_dt_init(void)231a7ed099fSArnd Bergmann static void __init spear310_dt_init(void)
232a7ed099fSArnd Bergmann {
233a7ed099fSArnd Bergmann pl080_plat_data.slave_channels = spear310_dma_info;
234a7ed099fSArnd Bergmann pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear310_dma_info);
235a7ed099fSArnd Bergmann
236435ebcbcSKefeng Wang of_platform_default_populate(NULL, spear310_auxdata_lookup, NULL);
237a7ed099fSArnd Bergmann }
238a7ed099fSArnd Bergmann
239a7ed099fSArnd Bergmann static const char * const spear310_dt_board_compat[] = {
240a7ed099fSArnd Bergmann "st,spear310",
241a7ed099fSArnd Bergmann "st,spear310-evb",
242a7ed099fSArnd Bergmann NULL,
243a7ed099fSArnd Bergmann };
244a7ed099fSArnd Bergmann
spear310_map_io(void)245a7ed099fSArnd Bergmann static void __init spear310_map_io(void)
246a7ed099fSArnd Bergmann {
247a7ed099fSArnd Bergmann spear3xx_map_io();
248a7ed099fSArnd Bergmann }
249a7ed099fSArnd Bergmann
250a7ed099fSArnd Bergmann DT_MACHINE_START(SPEAR310_DT, "ST SPEAr310 SoC with Flattened Device Tree")
251a7ed099fSArnd Bergmann .map_io = spear310_map_io,
252a7ed099fSArnd Bergmann .init_time = spear3xx_timer_init,
253a7ed099fSArnd Bergmann .init_machine = spear310_dt_init,
254a7ed099fSArnd Bergmann .restart = spear_restart,
255a7ed099fSArnd Bergmann .dt_compat = spear310_dt_board_compat,
256a7ed099fSArnd Bergmann MACHINE_END
257