xref: /openbmc/linux/arch/arm/mach-spear/spear300.c (revision 31354121)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * arch/arm/mach-spear3xx/spear300.c
4  *
5  * SPEAr300 machine source file
6  *
7  * Copyright (C) 2009-2012 ST Microelectronics
8  * Viresh Kumar <vireshk@kernel.org>
9  */
10 
11 #define pr_fmt(fmt) "SPEAr300: " fmt
12 
13 #include <linux/amba/pl08x.h>
14 #include <linux/of_platform.h>
15 #include <asm/mach/arch.h>
16 #include "generic.h"
17 #include "spear.h"
18 
19 /* DMAC platform data's slave info */
20 struct pl08x_channel_data spear300_dma_info[] = {
21 	{
22 		.bus_id = "uart0_rx",
23 		.min_signal = 2,
24 		.max_signal = 2,
25 		.muxval = 0,
26 		.periph_buses = PL08X_AHB1,
27 	}, {
28 		.bus_id = "uart0_tx",
29 		.min_signal = 3,
30 		.max_signal = 3,
31 		.muxval = 0,
32 		.periph_buses = PL08X_AHB1,
33 	}, {
34 		.bus_id = "ssp0_rx",
35 		.min_signal = 8,
36 		.max_signal = 8,
37 		.muxval = 0,
38 		.periph_buses = PL08X_AHB1,
39 	}, {
40 		.bus_id = "ssp0_tx",
41 		.min_signal = 9,
42 		.max_signal = 9,
43 		.muxval = 0,
44 		.periph_buses = PL08X_AHB1,
45 	}, {
46 		.bus_id = "i2c_rx",
47 		.min_signal = 10,
48 		.max_signal = 10,
49 		.muxval = 0,
50 		.periph_buses = PL08X_AHB1,
51 	}, {
52 		.bus_id = "i2c_tx",
53 		.min_signal = 11,
54 		.max_signal = 11,
55 		.muxval = 0,
56 		.periph_buses = PL08X_AHB1,
57 	}, {
58 		.bus_id = "irda",
59 		.min_signal = 12,
60 		.max_signal = 12,
61 		.muxval = 0,
62 		.periph_buses = PL08X_AHB1,
63 	}, {
64 		.bus_id = "adc",
65 		.min_signal = 13,
66 		.max_signal = 13,
67 		.muxval = 0,
68 		.periph_buses = PL08X_AHB1,
69 	}, {
70 		.bus_id = "to_jpeg",
71 		.min_signal = 14,
72 		.max_signal = 14,
73 		.muxval = 0,
74 		.periph_buses = PL08X_AHB1,
75 	}, {
76 		.bus_id = "from_jpeg",
77 		.min_signal = 15,
78 		.max_signal = 15,
79 		.muxval = 0,
80 		.periph_buses = PL08X_AHB1,
81 	}, {
82 		.bus_id = "ras0_rx",
83 		.min_signal = 0,
84 		.max_signal = 0,
85 		.muxval = 1,
86 		.periph_buses = PL08X_AHB1,
87 	}, {
88 		.bus_id = "ras0_tx",
89 		.min_signal = 1,
90 		.max_signal = 1,
91 		.muxval = 1,
92 		.periph_buses = PL08X_AHB1,
93 	}, {
94 		.bus_id = "ras1_rx",
95 		.min_signal = 2,
96 		.max_signal = 2,
97 		.muxval = 1,
98 		.periph_buses = PL08X_AHB1,
99 	}, {
100 		.bus_id = "ras1_tx",
101 		.min_signal = 3,
102 		.max_signal = 3,
103 		.muxval = 1,
104 		.periph_buses = PL08X_AHB1,
105 	}, {
106 		.bus_id = "ras2_rx",
107 		.min_signal = 4,
108 		.max_signal = 4,
109 		.muxval = 1,
110 		.periph_buses = PL08X_AHB1,
111 	}, {
112 		.bus_id = "ras2_tx",
113 		.min_signal = 5,
114 		.max_signal = 5,
115 		.muxval = 1,
116 		.periph_buses = PL08X_AHB1,
117 	}, {
118 		.bus_id = "ras3_rx",
119 		.min_signal = 6,
120 		.max_signal = 6,
121 		.muxval = 1,
122 		.periph_buses = PL08X_AHB1,
123 	}, {
124 		.bus_id = "ras3_tx",
125 		.min_signal = 7,
126 		.max_signal = 7,
127 		.muxval = 1,
128 		.periph_buses = PL08X_AHB1,
129 	}, {
130 		.bus_id = "ras4_rx",
131 		.min_signal = 8,
132 		.max_signal = 8,
133 		.muxval = 1,
134 		.periph_buses = PL08X_AHB1,
135 	}, {
136 		.bus_id = "ras4_tx",
137 		.min_signal = 9,
138 		.max_signal = 9,
139 		.muxval = 1,
140 		.periph_buses = PL08X_AHB1,
141 	}, {
142 		.bus_id = "ras5_rx",
143 		.min_signal = 10,
144 		.max_signal = 10,
145 		.muxval = 1,
146 		.periph_buses = PL08X_AHB1,
147 	}, {
148 		.bus_id = "ras5_tx",
149 		.min_signal = 11,
150 		.max_signal = 11,
151 		.muxval = 1,
152 		.periph_buses = PL08X_AHB1,
153 	}, {
154 		.bus_id = "ras6_rx",
155 		.min_signal = 12,
156 		.max_signal = 12,
157 		.muxval = 1,
158 		.periph_buses = PL08X_AHB1,
159 	}, {
160 		.bus_id = "ras6_tx",
161 		.min_signal = 13,
162 		.max_signal = 13,
163 		.muxval = 1,
164 		.periph_buses = PL08X_AHB1,
165 	}, {
166 		.bus_id = "ras7_rx",
167 		.min_signal = 14,
168 		.max_signal = 14,
169 		.muxval = 1,
170 		.periph_buses = PL08X_AHB1,
171 	}, {
172 		.bus_id = "ras7_tx",
173 		.min_signal = 15,
174 		.max_signal = 15,
175 		.muxval = 1,
176 		.periph_buses = PL08X_AHB1,
177 	},
178 };
179 
180 /* Add SPEAr300 auxdata to pass platform data */
181 static struct of_dev_auxdata spear300_auxdata_lookup[] __initdata = {
182 	OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
183 			&pl022_plat_data),
184 	OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE, NULL,
185 			&pl080_plat_data),
186 	{}
187 };
188 
189 static void __init spear300_dt_init(void)
190 {
191 	pl080_plat_data.slave_channels = spear300_dma_info;
192 	pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear300_dma_info);
193 
194 	of_platform_default_populate(NULL, spear300_auxdata_lookup, NULL);
195 }
196 
197 static const char * const spear300_dt_board_compat[] = {
198 	"st,spear300",
199 	"st,spear300-evb",
200 	NULL,
201 };
202 
203 static void __init spear300_map_io(void)
204 {
205 	spear3xx_map_io();
206 }
207 
208 DT_MACHINE_START(SPEAR300_DT, "ST SPEAr300 SoC with Flattened Device Tree")
209 	.map_io		=	spear300_map_io,
210 	.init_time	=	spear3xx_timer_init,
211 	.init_machine	=	spear300_dt_init,
212 	.restart	=	spear_restart,
213 	.dt_compat	=	spear300_dt_board_compat,
214 MACHINE_END
215