Merge tag 'nvme-for-4.18' of git://git.infradead.org/nvme
[sfrench/cifs-2.6.git] / arch / arm / mach-omap2 / board-generic.c
1 /*
2  * Copyright (C) 2005 Nokia Corporation
3  * Author: Paul Mundt <paul.mundt@nokia.com>
4  *
5  * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6  *
7  * Modified from the original mach-omap/omap2/board-generic.c did by Paul
8  * to support the OMAP2+ device tree boards with an unique board file.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation.
13  */
14 #include <linux/io.h>
15 #include <linux/of_irq.h>
16 #include <linux/of_platform.h>
17 #include <linux/irqdomain.h>
18
19 #include <asm/setup.h>
20 #include <asm/mach/arch.h>
21 #include <asm/system_info.h>
22
23 #include "common.h"
24
25 static const struct of_device_id omap_dt_match_table[] __initconst = {
26         { .compatible = "simple-bus", },
27         { .compatible = "ti,omap-infra", },
28         { }
29 };
30
31 static void __init __maybe_unused omap_generic_init(void)
32 {
33         pdata_quirks_init(omap_dt_match_table);
34         omap_soc_device_init();
35 }
36
37 #ifdef CONFIG_SOC_OMAP2420
38 static const char *const omap242x_boards_compat[] __initconst = {
39         "ti,omap2420",
40         NULL,
41 };
42
43 DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
44         .reserve        = omap_reserve,
45         .map_io         = omap242x_map_io,
46         .init_early     = omap2420_init_early,
47         .init_machine   = omap_generic_init,
48         .init_time      = omap_init_time,
49         .dt_compat      = omap242x_boards_compat,
50         .restart        = omap2xxx_restart,
51 MACHINE_END
52 #endif
53
54 #ifdef CONFIG_SOC_OMAP2430
55 static const char *const omap243x_boards_compat[] __initconst = {
56         "ti,omap2430",
57         NULL,
58 };
59
60 DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
61         .reserve        = omap_reserve,
62         .map_io         = omap243x_map_io,
63         .init_early     = omap2430_init_early,
64         .init_machine   = omap_generic_init,
65         .init_time      = omap_init_time,
66         .dt_compat      = omap243x_boards_compat,
67         .restart        = omap2xxx_restart,
68 MACHINE_END
69 #endif
70
71 #ifdef CONFIG_ARCH_OMAP3
72 /* Some boards need board name for legacy userspace in /proc/cpuinfo */
73 static const char *const n900_boards_compat[] __initconst = {
74         "nokia,omap3-n900",
75         NULL,
76 };
77
78 /* Set system_rev from atags */
79 static void __init rx51_set_system_rev(const struct tag *tags)
80 {
81         const struct tag *tag;
82
83         if (tags->hdr.tag != ATAG_CORE)
84                 return;
85
86         for_each_tag(tag, tags) {
87                 if (tag->hdr.tag == ATAG_REVISION) {
88                         system_rev = tag->u.revision.rev;
89                         break;
90                 }
91         }
92 }
93
94 /* Legacy userspace on Nokia N900 needs ATAGS exported in /proc/atags,
95  * save them while the data is still not overwritten
96  */
97 static void __init rx51_reserve(void)
98 {
99         const struct tag *tags = (const struct tag *)(PAGE_OFFSET + 0x100);
100
101         save_atags(tags);
102         rx51_set_system_rev(tags);
103         omap_reserve();
104 }
105
106 DT_MACHINE_START(OMAP3_N900_DT, "Nokia RX-51 board")
107         .reserve        = rx51_reserve,
108         .map_io         = omap3_map_io,
109         .init_early     = omap3430_init_early,
110         .init_machine   = omap_generic_init,
111         .init_late      = omap3_init_late,
112         .init_time      = omap_init_time,
113         .dt_compat      = n900_boards_compat,
114         .restart        = omap3xxx_restart,
115 MACHINE_END
116
117 /* Generic omap3 boards, most boards can use these */
118 static const char *const omap3_boards_compat[] __initconst = {
119         "ti,omap3430",
120         "ti,omap3",
121         NULL,
122 };
123
124 DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
125         .reserve        = omap_reserve,
126         .map_io         = omap3_map_io,
127         .init_early     = omap3430_init_early,
128         .init_machine   = omap_generic_init,
129         .init_late      = omap3_init_late,
130         .init_time      = omap_init_time,
131         .dt_compat      = omap3_boards_compat,
132         .restart        = omap3xxx_restart,
133 MACHINE_END
134
135 static const char *const omap36xx_boards_compat[] __initconst = {
136         "ti,omap3630",
137         "ti,omap36xx",
138         NULL,
139 };
140
141 DT_MACHINE_START(OMAP36XX_DT, "Generic OMAP36xx (Flattened Device Tree)")
142         .reserve        = omap_reserve,
143         .map_io         = omap3_map_io,
144         .init_early     = omap3630_init_early,
145         .init_machine   = omap_generic_init,
146         .init_late      = omap3_init_late,
147         .init_time      = omap_init_time,
148         .dt_compat      = omap36xx_boards_compat,
149         .restart        = omap3xxx_restart,
150 MACHINE_END
151
152 static const char *const omap3_gp_boards_compat[] __initconst = {
153         "ti,omap3-beagle",
154         "timll,omap3-devkit8000",
155         NULL,
156 };
157
158 DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)")
159         .reserve        = omap_reserve,
160         .map_io         = omap3_map_io,
161         .init_early     = omap3430_init_early,
162         .init_machine   = omap_generic_init,
163         .init_late      = omap3_init_late,
164         .init_time      = omap3_secure_sync32k_timer_init,
165         .dt_compat      = omap3_gp_boards_compat,
166         .restart        = omap3xxx_restart,
167 MACHINE_END
168
169 static const char *const am3517_boards_compat[] __initconst = {
170         "ti,am3517",
171         NULL,
172 };
173
174 DT_MACHINE_START(AM3517_DT, "Generic AM3517 (Flattened Device Tree)")
175         .reserve        = omap_reserve,
176         .map_io         = omap3_map_io,
177         .init_early     = am35xx_init_early,
178         .init_machine   = omap_generic_init,
179         .init_late      = omap3_init_late,
180         .init_time      = omap3_gptimer_timer_init,
181         .dt_compat      = am3517_boards_compat,
182         .restart        = omap3xxx_restart,
183 MACHINE_END
184 #endif
185
186 #ifdef CONFIG_SOC_TI81XX
187 static const char *const ti814x_boards_compat[] __initconst = {
188         "ti,dm8148",
189         "ti,dm814",
190         NULL,
191 };
192
193 DT_MACHINE_START(TI814X_DT, "Generic ti814x (Flattened Device Tree)")
194         .reserve        = omap_reserve,
195         .map_io         = ti81xx_map_io,
196         .init_early     = ti814x_init_early,
197         .init_machine   = omap_generic_init,
198         .init_late      = ti81xx_init_late,
199         .init_time      = omap3_gptimer_timer_init,
200         .dt_compat      = ti814x_boards_compat,
201         .restart        = ti81xx_restart,
202 MACHINE_END
203
204 static const char *const ti816x_boards_compat[] __initconst = {
205         "ti,dm8168",
206         "ti,dm816",
207         NULL,
208 };
209
210 DT_MACHINE_START(TI816X_DT, "Generic ti816x (Flattened Device Tree)")
211         .reserve        = omap_reserve,
212         .map_io         = ti81xx_map_io,
213         .init_early     = ti816x_init_early,
214         .init_machine   = omap_generic_init,
215         .init_late      = ti81xx_init_late,
216         .init_time      = omap3_gptimer_timer_init,
217         .dt_compat      = ti816x_boards_compat,
218         .restart        = ti81xx_restart,
219 MACHINE_END
220 #endif
221
222 #ifdef CONFIG_SOC_AM33XX
223 static const char *const am33xx_boards_compat[] __initconst = {
224         "ti,am33xx",
225         NULL,
226 };
227
228 DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
229         .reserve        = omap_reserve,
230         .map_io         = am33xx_map_io,
231         .init_early     = am33xx_init_early,
232         .init_machine   = omap_generic_init,
233         .init_late      = am33xx_init_late,
234         .init_time      = omap3_gptimer_timer_init,
235         .dt_compat      = am33xx_boards_compat,
236         .restart        = am33xx_restart,
237 MACHINE_END
238 #endif
239
240 #ifdef CONFIG_ARCH_OMAP4
241 static const char *const omap4_boards_compat[] __initconst = {
242         "ti,omap4460",
243         "ti,omap4430",
244         "ti,omap4",
245         NULL,
246 };
247
248 DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
249         .l2c_aux_val    = OMAP_L2C_AUX_CTRL,
250         .l2c_aux_mask   = 0xcf9fffff,
251         .l2c_write_sec  = omap4_l2c310_write_sec,
252         .reserve        = omap_reserve,
253         .smp            = smp_ops(omap4_smp_ops),
254         .map_io         = omap4_map_io,
255         .init_early     = omap4430_init_early,
256         .init_irq       = omap_gic_of_init,
257         .init_machine   = omap_generic_init,
258         .init_late      = omap4430_init_late,
259         .init_time      = omap4_local_timer_init,
260         .dt_compat      = omap4_boards_compat,
261         .restart        = omap44xx_restart,
262 MACHINE_END
263 #endif
264
265 #ifdef CONFIG_SOC_OMAP5
266 static const char *const omap5_boards_compat[] __initconst = {
267         "ti,omap5432",
268         "ti,omap5430",
269         "ti,omap5",
270         NULL,
271 };
272
273 DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
274 #if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE)
275         .dma_zone_size  = SZ_2G,
276 #endif
277         .reserve        = omap_reserve,
278         .smp            = smp_ops(omap4_smp_ops),
279         .map_io         = omap5_map_io,
280         .init_early     = omap5_init_early,
281         .init_irq       = omap_gic_of_init,
282         .init_machine   = omap_generic_init,
283         .init_late      = omap5_init_late,
284         .init_time      = omap5_realtime_timer_init,
285         .dt_compat      = omap5_boards_compat,
286         .restart        = omap44xx_restart,
287 MACHINE_END
288 #endif
289
290 #ifdef CONFIG_SOC_AM43XX
291 static const char *const am43_boards_compat[] __initconst = {
292         "ti,am4372",
293         "ti,am43",
294         NULL,
295 };
296
297 DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
298         .l2c_aux_val    = OMAP_L2C_AUX_CTRL,
299         .l2c_aux_mask   = 0xcf9fffff,
300         .l2c_write_sec  = omap4_l2c310_write_sec,
301         .map_io         = am33xx_map_io,
302         .init_early     = am43xx_init_early,
303         .init_late      = am43xx_init_late,
304         .init_irq       = omap_gic_of_init,
305         .init_machine   = omap_generic_init,
306         .init_time      = omap3_gptimer_timer_init,
307         .dt_compat      = am43_boards_compat,
308         .restart        = omap44xx_restart,
309 MACHINE_END
310 #endif
311
312 #ifdef CONFIG_SOC_DRA7XX
313 static const char *const dra74x_boards_compat[] __initconst = {
314         "ti,dra762",
315         "ti,am5728",
316         "ti,am5726",
317         "ti,dra742",
318         "ti,dra7",
319         NULL,
320 };
321
322 DT_MACHINE_START(DRA74X_DT, "Generic DRA74X (Flattened Device Tree)")
323 #if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE)
324         .dma_zone_size  = SZ_2G,
325 #endif
326         .reserve        = omap_reserve,
327         .smp            = smp_ops(omap4_smp_ops),
328         .map_io         = dra7xx_map_io,
329         .init_early     = dra7xx_init_early,
330         .init_late      = dra7xx_init_late,
331         .init_irq       = omap_gic_of_init,
332         .init_machine   = omap_generic_init,
333         .init_time      = omap5_realtime_timer_init,
334         .dt_compat      = dra74x_boards_compat,
335         .restart        = omap44xx_restart,
336 MACHINE_END
337
338 static const char *const dra72x_boards_compat[] __initconst = {
339         "ti,am5718",
340         "ti,am5716",
341         "ti,dra722",
342         "ti,dra718",
343         NULL,
344 };
345
346 DT_MACHINE_START(DRA72X_DT, "Generic DRA72X (Flattened Device Tree)")
347 #if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE)
348         .dma_zone_size  = SZ_2G,
349 #endif
350         .reserve        = omap_reserve,
351         .map_io         = dra7xx_map_io,
352         .init_early     = dra7xx_init_early,
353         .init_late      = dra7xx_init_late,
354         .init_irq       = omap_gic_of_init,
355         .init_machine   = omap_generic_init,
356         .init_time      = omap5_realtime_timer_init,
357         .dt_compat      = dra72x_boards_compat,
358         .restart        = omap44xx_restart,
359 MACHINE_END
360 #endif