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