diff options
author | Benoit Cousson <b-cousson@ti.com> | 2011-09-20 15:24:47 -0400 |
---|---|---|
committer | Benoit Cousson <b-cousson@ti.com> | 2011-10-04 16:27:04 -0400 |
commit | 8d61649ddf6707d89fc10028f9d1bd1a2ea37b4f (patch) | |
tree | 8119f4a494249ae3a2d448305b60ef7def835d78 /arch/arm/mach-omap2/board-generic.c | |
parent | 295e98c60b8cee05e02f0a055dbc12a08b0378c1 (diff) |
ARM: OMAP2+: board-generic: Add DT support to generic board
Re-cycle the original board-generic.c file to support Device Tree
for every OMAP2+ variants.
The current approach is an intermediate step before having only
one machine descriptor that will use some generic DT aware
functions.
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/board-generic.c')
-rw-r--r-- | arch/arm/mach-omap2/board-generic.c | 127 |
1 files changed, 84 insertions, 43 deletions
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index 5223898f50e4..62c6b2e8b5d7 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c | |||
@@ -1,76 +1,117 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/arm/mach-omap2/board-generic.c | ||
3 | * | ||
4 | * Copyright (C) 2005 Nokia Corporation | 2 | * Copyright (C) 2005 Nokia Corporation |
5 | * Author: Paul Mundt <paul.mundt@nokia.com> | 3 | * Author: Paul Mundt <paul.mundt@nokia.com> |
6 | * | 4 | * |
7 | * Modified from mach-omap/omap1/board-generic.c | 5 | * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ |
8 | * | 6 | * |
9 | * Code for generic OMAP2 board. Should work on many OMAP2 systems where | 7 | * Modified from the original mach-omap/omap2/board-generic.c did by Paul |
10 | * the bootloader passes the board-specific data to the kernel. | 8 | * to support the OMAP2+ device tree boards with an unique board file. |
11 | * Do not put any board specific code to this file; create a new machine | ||
12 | * type if you need custom low-level initializations. | ||
13 | * | 9 | * |
14 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
15 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
16 | * published by the Free Software Foundation. | 12 | * published by the Free Software Foundation. |
17 | */ | 13 | */ |
18 | 14 | ||
19 | #include <linux/kernel.h> | 15 | #include <linux/io.h> |
20 | #include <linux/init.h> | 16 | #include <linux/of_platform.h> |
21 | #include <linux/device.h> | 17 | #include <linux/irqdomain.h> |
22 | 18 | ||
23 | #include <mach/hardware.h> | 19 | #include <mach/hardware.h> |
24 | #include <asm/mach-types.h> | ||
25 | #include <asm/mach/arch.h> | 20 | #include <asm/mach/arch.h> |
26 | #include <asm/mach/map.h> | ||
27 | 21 | ||
28 | #include <mach/gpio.h> | ||
29 | #include <plat/usb.h> | ||
30 | #include <plat/board.h> | 22 | #include <plat/board.h> |
31 | #include <plat/common.h> | 23 | #include <plat/common.h> |
24 | #include <mach/omap4-common.h> | ||
25 | |||
32 | 26 | ||
33 | static struct omap_board_config_kernel generic_config[] = { | 27 | static struct of_device_id omap_dt_match_table[] __initdata = { |
28 | { .compatible = "simple-bus", }, | ||
29 | { .compatible = "ti,omap-infra", }, | ||
30 | { } | ||
34 | }; | 31 | }; |
35 | 32 | ||
36 | static void __init omap_generic_init_early(void) | 33 | static struct of_device_id intc_match[] __initdata = { |
37 | { | 34 | { .compatible = "ti,omap3-intc", }, |
38 | omap2_init_common_infrastructure(); | 35 | { .compatible = "arm,cortex-a9-gic", }, |
39 | } | 36 | { } |
37 | }; | ||
40 | 38 | ||
41 | static void __init omap_generic_init(void) | 39 | static void __init omap_generic_init(void) |
42 | { | 40 | { |
41 | struct device_node *node = of_find_matching_node(NULL, intc_match); | ||
42 | if (node) | ||
43 | irq_domain_add_simple(node, 0); | ||
44 | |||
43 | omap_serial_init(); | 45 | omap_serial_init(); |
44 | omap_sdrc_init(NULL, NULL); | 46 | omap_sdrc_init(NULL, NULL); |
45 | omap_board_config = generic_config; | ||
46 | omap_board_config_size = ARRAY_SIZE(generic_config); | ||
47 | } | ||
48 | 47 | ||
49 | static void __init omap_generic_map_io(void) | 48 | of_platform_populate(NULL, omap_dt_match_table, NULL, NULL); |
50 | { | ||
51 | if (cpu_is_omap242x()) { | ||
52 | omap2_set_globals_242x(); | ||
53 | omap242x_map_common_io(); | ||
54 | } else if (cpu_is_omap243x()) { | ||
55 | omap2_set_globals_243x(); | ||
56 | omap243x_map_common_io(); | ||
57 | } else if (cpu_is_omap34xx()) { | ||
58 | omap2_set_globals_3xxx(); | ||
59 | omap34xx_map_common_io(); | ||
60 | } else if (cpu_is_omap44xx()) { | ||
61 | omap2_set_globals_443x(); | ||
62 | omap44xx_map_common_io(); | ||
63 | } | ||
64 | } | 49 | } |
65 | 50 | ||
66 | /* XXX This machine entry name should be updated */ | 51 | #if defined(CONFIG_SOC_OMAP2420) |
67 | MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx") | 52 | static const char *omap242x_boards_compat[] __initdata = { |
68 | /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */ | 53 | "ti,omap2420", |
69 | .boot_params = 0x80000100, | 54 | NULL, |
55 | }; | ||
56 | |||
57 | DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)") | ||
58 | .reserve = omap_reserve, | ||
59 | .map_io = omap242x_map_io, | ||
60 | .init_early = omap2420_init_early, | ||
61 | .init_irq = omap2_init_irq, | ||
62 | .init_machine = omap_generic_init, | ||
63 | .timer = &omap2_timer, | ||
64 | .dt_compat = omap242x_boards_compat, | ||
65 | MACHINE_END | ||
66 | #endif | ||
67 | |||
68 | #if defined(CONFIG_SOC_OMAP2430) | ||
69 | static const char *omap243x_boards_compat[] __initdata = { | ||
70 | "ti,omap2430", | ||
71 | NULL, | ||
72 | }; | ||
73 | |||
74 | DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)") | ||
70 | .reserve = omap_reserve, | 75 | .reserve = omap_reserve, |
71 | .map_io = omap_generic_map_io, | 76 | .map_io = omap243x_map_io, |
72 | .init_early = omap_generic_init_early, | 77 | .init_early = omap2430_init_early, |
73 | .init_irq = omap2_init_irq, | 78 | .init_irq = omap2_init_irq, |
74 | .init_machine = omap_generic_init, | 79 | .init_machine = omap_generic_init, |
75 | .timer = &omap2_timer, | 80 | .timer = &omap2_timer, |
81 | .dt_compat = omap243x_boards_compat, | ||
82 | MACHINE_END | ||
83 | #endif | ||
84 | |||
85 | #if defined(CONFIG_ARCH_OMAP3) | ||
86 | static const char *omap3_boards_compat[] __initdata = { | ||
87 | "ti,omap3", | ||
88 | NULL, | ||
89 | }; | ||
90 | |||
91 | DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)") | ||
92 | .reserve = omap_reserve, | ||
93 | .map_io = omap3_map_io, | ||
94 | .init_early = omap3430_init_early, | ||
95 | .init_irq = omap3_init_irq, | ||
96 | .init_machine = omap_generic_init, | ||
97 | .timer = &omap3_timer, | ||
98 | .dt_compat = omap3_boards_compat, | ||
99 | MACHINE_END | ||
100 | #endif | ||
101 | |||
102 | #if defined(CONFIG_ARCH_OMAP4) | ||
103 | static const char *omap4_boards_compat[] __initdata = { | ||
104 | "ti,omap4", | ||
105 | NULL, | ||
106 | }; | ||
107 | |||
108 | DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)") | ||
109 | .reserve = omap_reserve, | ||
110 | .map_io = omap4_map_io, | ||
111 | .init_early = omap4430_init_early, | ||
112 | .init_irq = gic_init_irq, | ||
113 | .init_machine = omap_generic_init, | ||
114 | .timer = &omap4_timer, | ||
115 | .dt_compat = omap4_boards_compat, | ||
76 | MACHINE_END | 116 | MACHINE_END |
117 | #endif | ||