aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/Kconfig8
-rw-r--r--arch/arm/mach-omap2/board-generic.c156
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c4
-rw-r--r--arch/arm/mach-omap2/devices.c51
-rw-r--r--arch/arm/mach-omap2/display.c11
-rw-r--r--arch/arm/mach-omap2/dma.c11
-rw-r--r--arch/arm/mach-omap2/gpio.c12
-rw-r--r--arch/arm/mach-omap2/hsmmc.c18
-rw-r--r--arch/arm/mach-omap2/hwspinlock.c12
-rw-r--r--arch/arm/mach-omap2/mcbsp.c11
-rw-r--r--arch/arm/mach-omap2/omap_l3_noc.c25
-rw-r--r--arch/arm/mach-omap2/pm.c72
-rw-r--r--arch/arm/mach-omap2/serial.c25
-rw-r--r--arch/arm/mach-omap2/sr_device.c11
-rw-r--r--arch/arm/mach-omap2/usb-musb.c11
15 files changed, 186 insertions, 252 deletions
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 57b66d590c52..e0a318df95bc 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -106,9 +106,13 @@ comment "OMAP Board Type"
106 depends on ARCH_OMAP2PLUS 106 depends on ARCH_OMAP2PLUS
107 107
108config MACH_OMAP_GENERIC 108config MACH_OMAP_GENERIC
109 bool "Generic OMAP board" 109 bool "Generic OMAP2+ board"
110 depends on ARCH_OMAP2 110 depends on ARCH_OMAP2PLUS
111 select USE_OF
111 default y 112 default y
113 help
114 Support for generic TI OMAP2+ boards using Flattened Device Tree.
115 More information at Documentation/devicetree
112 116
113config MACH_OMAP2_TUSB6010 117config MACH_OMAP2_TUSB6010
114 bool 118 bool
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 5223898f50e4..d9ccb9d98e15 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -1,76 +1,154 @@
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>
18#include <linux/i2c/twl.h>
22 19
23#include <mach/hardware.h> 20#include <mach/hardware.h>
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27 22
28#include <mach/gpio.h>
29#include <plat/usb.h>
30#include <plat/board.h> 23#include <plat/board.h>
31#include <plat/common.h> 24#include <plat/common.h>
25#include <mach/omap4-common.h>
26#include "common-board-devices.h"
27
28/*
29 * XXX: Still needed to boot until the i2c & twl driver is adapted to
30 * device-tree
31 */
32static struct twl4030_platform_data sdp4430_twldata = {
33 .irq_base = TWL6030_IRQ_BASE,
34 .irq_end = TWL6030_IRQ_END,
35};
32 36
33static struct omap_board_config_kernel generic_config[] = { 37static void __init omap4_i2c_init(void)
38{
39 omap4_pmic_init("twl6030", &sdp4430_twldata);
40}
41
42static struct twl4030_platform_data beagle_twldata = {
43 .irq_base = TWL4030_IRQ_BASE,
44 .irq_end = TWL4030_IRQ_END,
34}; 45};
35 46
36static void __init omap_generic_init_early(void) 47static void __init omap3_i2c_init(void)
37{ 48{
38 omap2_init_common_infrastructure(); 49 omap3_pmic_init("twl4030", &beagle_twldata);
39} 50}
40 51
52static struct of_device_id omap_dt_match_table[] __initdata = {
53 { .compatible = "simple-bus", },
54 { .compatible = "ti,omap-infra", },
55 { }
56};
57
58static struct of_device_id intc_match[] __initdata = {
59 { .compatible = "ti,omap3-intc", },
60 { .compatible = "arm,cortex-a9-gic", },
61 { }
62};
63
41static void __init omap_generic_init(void) 64static void __init omap_generic_init(void)
42{ 65{
66 struct device_node *node = of_find_matching_node(NULL, intc_match);
67 if (node)
68 irq_domain_add_simple(node, 0);
69
43 omap_serial_init(); 70 omap_serial_init();
44 omap_sdrc_init(NULL, NULL); 71 omap_sdrc_init(NULL, NULL);
45 omap_board_config = generic_config; 72
46 omap_board_config_size = ARRAY_SIZE(generic_config); 73 of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
47} 74}
48 75
49static void __init omap_generic_map_io(void) 76static void __init omap4_init(void)
50{ 77{
51 if (cpu_is_omap242x()) { 78 omap4_i2c_init();
52 omap2_set_globals_242x(); 79 omap_generic_init();
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} 80}
65 81
66/* XXX This machine entry name should be updated */ 82static void __init omap3_init(void)
67MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx") 83{
68 /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */ 84 omap3_i2c_init();
69 .boot_params = 0x80000100, 85 omap_generic_init();
86}
87
88#if defined(CONFIG_SOC_OMAP2420)
89static const char *omap242x_boards_compat[] __initdata = {
90 "ti,omap2420",
91 NULL,
92};
93
94DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
70 .reserve = omap_reserve, 95 .reserve = omap_reserve,
71 .map_io = omap_generic_map_io, 96 .map_io = omap242x_map_io,
72 .init_early = omap_generic_init_early, 97 .init_early = omap2420_init_early,
73 .init_irq = omap2_init_irq, 98 .init_irq = omap2_init_irq,
74 .init_machine = omap_generic_init, 99 .init_machine = omap_generic_init,
75 .timer = &omap2_timer, 100 .timer = &omap2_timer,
101 .dt_compat = omap242x_boards_compat,
102MACHINE_END
103#endif
104
105#if defined(CONFIG_SOC_OMAP2430)
106static const char *omap243x_boards_compat[] __initdata = {
107 "ti,omap2430",
108 NULL,
109};
110
111DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
112 .reserve = omap_reserve,
113 .map_io = omap243x_map_io,
114 .init_early = omap2430_init_early,
115 .init_irq = omap2_init_irq,
116 .init_machine = omap_generic_init,
117 .timer = &omap2_timer,
118 .dt_compat = omap243x_boards_compat,
119MACHINE_END
120#endif
121
122#if defined(CONFIG_ARCH_OMAP3)
123static const char *omap3_boards_compat[] __initdata = {
124 "ti,omap3",
125 NULL,
126};
127
128DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
129 .reserve = omap_reserve,
130 .map_io = omap3_map_io,
131 .init_early = omap3430_init_early,
132 .init_irq = omap3_init_irq,
133 .init_machine = omap3_init,
134 .timer = &omap3_timer,
135 .dt_compat = omap3_boards_compat,
136MACHINE_END
137#endif
138
139#if defined(CONFIG_ARCH_OMAP4)
140static const char *omap4_boards_compat[] __initdata = {
141 "ti,omap4",
142 NULL,
143};
144
145DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
146 .reserve = omap_reserve,
147 .map_io = omap4_map_io,
148 .init_early = omap4430_init_early,
149 .init_irq = gic_init_irq,
150 .init_machine = omap4_init,
151 .timer = &omap4_timer,
152 .dt_compat = omap4_boards_compat,
76MACHINE_END 153MACHINE_END
154#endif
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index e085371eb494..4a5d75f11610 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -486,8 +486,8 @@ static void __init beagle_opp_init(void)
486 if (cpu_is_omap3630()) { 486 if (cpu_is_omap3630()) {
487 struct device *mpu_dev, *iva_dev; 487 struct device *mpu_dev, *iva_dev;
488 488
489 mpu_dev = omap2_get_mpuss_device(); 489 mpu_dev = omap_device_get_by_hwmod_name("mpu");
490 iva_dev = omap2_get_iva_device(); 490 iva_dev = omap_device_get_by_hwmod_name("iva");
491 491
492 if (!mpu_dev || !iva_dev) { 492 if (!mpu_dev || !iva_dev) {
493 pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n", 493 pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n",
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 10adf66be7ba..0f8e0eb18166 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -16,6 +16,7 @@
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/of.h>
19 20
20#include <mach/hardware.h> 21#include <mach/hardware.h>
21#include <mach/irqs.h> 22#include <mach/irqs.h>
@@ -77,6 +78,10 @@ static int __init omap4_l3_init(void)
77 struct platform_device *pdev; 78 struct platform_device *pdev;
78 char oh_name[L3_MODULES_MAX_LEN]; 79 char oh_name[L3_MODULES_MAX_LEN];
79 80
81 /* If dtb is there, the devices will be created dynamically */
82 if (of_have_populated_dt())
83 return -ENODEV;
84
80 /* 85 /*
81 * To avoid code running on other OMAPs in 86 * To avoid code running on other OMAPs in
82 * multi-omap builds 87 * multi-omap builds
@@ -221,14 +226,6 @@ static inline void omap_init_camera(void)
221#endif 226#endif
222} 227}
223 228
224struct omap_device_pm_latency omap_keyboard_latency[] = {
225 {
226 .deactivate_func = omap_device_idle_hwmods,
227 .activate_func = omap_device_enable_hwmods,
228 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
229 },
230};
231
232int __init omap4_keyboard_init(struct omap4_keypad_platform_data 229int __init omap4_keyboard_init(struct omap4_keypad_platform_data
233 *sdp4430_keypad_data, struct omap_board_data *bdata) 230 *sdp4430_keypad_data, struct omap_board_data *bdata)
234{ 231{
@@ -248,9 +245,7 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
248 keypad_data = sdp4430_keypad_data; 245 keypad_data = sdp4430_keypad_data;
249 246
250 pdev = omap_device_build(name, id, oh, keypad_data, 247 pdev = omap_device_build(name, id, oh, keypad_data,
251 sizeof(struct omap4_keypad_platform_data), 248 sizeof(struct omap4_keypad_platform_data), NULL, 0, 0);
252 omap_keyboard_latency,
253 ARRAY_SIZE(omap_keyboard_latency), 0);
254 249
255 if (IS_ERR(pdev)) { 250 if (IS_ERR(pdev)) {
256 WARN(1, "Can't build omap_device for %s:%s.\n", 251 WARN(1, "Can't build omap_device for %s:%s.\n",
@@ -263,14 +258,6 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
263} 258}
264 259
265#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE) 260#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
266static struct omap_device_pm_latency mbox_latencies[] = {
267 [0] = {
268 .activate_func = omap_device_enable_hwmods,
269 .deactivate_func = omap_device_idle_hwmods,
270 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
271 },
272};
273
274static inline void omap_init_mbox(void) 261static inline void omap_init_mbox(void)
275{ 262{
276 struct omap_hwmod *oh; 263 struct omap_hwmod *oh;
@@ -282,8 +269,7 @@ static inline void omap_init_mbox(void)
282 return; 269 return;
283 } 270 }
284 271
285 pdev = omap_device_build("omap-mailbox", -1, oh, NULL, 0, 272 pdev = omap_device_build("omap-mailbox", -1, oh, NULL, 0, NULL, 0, 0);
286 mbox_latencies, ARRAY_SIZE(mbox_latencies), 0);
287 WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n", 273 WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n",
288 __func__, PTR_ERR(pdev)); 274 __func__, PTR_ERR(pdev));
289} 275}
@@ -334,14 +320,6 @@ static inline void omap_init_audio(void) {}
334 320
335#include <plat/mcspi.h> 321#include <plat/mcspi.h>
336 322
337struct omap_device_pm_latency omap_mcspi_latency[] = {
338 [0] = {
339 .deactivate_func = omap_device_idle_hwmods,
340 .activate_func = omap_device_enable_hwmods,
341 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
342 },
343};
344
345static int omap_mcspi_init(struct omap_hwmod *oh, void *unused) 323static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
346{ 324{
347 struct platform_device *pdev; 325 struct platform_device *pdev;
@@ -372,8 +350,7 @@ static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
372 350
373 spi_num++; 351 spi_num++;
374 pdev = omap_device_build(name, spi_num, oh, pdata, 352 pdev = omap_device_build(name, spi_num, oh, pdata,
375 sizeof(*pdata), omap_mcspi_latency, 353 sizeof(*pdata), NULL, 0, 0);
376 ARRAY_SIZE(omap_mcspi_latency), 0);
377 WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n", 354 WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
378 name, oh->name); 355 name, oh->name);
379 kfree(pdata); 356 kfree(pdata);
@@ -698,14 +675,6 @@ static int __init omap2_init_devices(void)
698arch_initcall(omap2_init_devices); 675arch_initcall(omap2_init_devices);
699 676
700#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE) 677#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
701static struct omap_device_pm_latency omap_wdt_latency[] = {
702 [0] = {
703 .deactivate_func = omap_device_idle_hwmods,
704 .activate_func = omap_device_enable_hwmods,
705 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
706 },
707};
708
709static int __init omap_init_wdt(void) 678static int __init omap_init_wdt(void)
710{ 679{
711 int id = -1; 680 int id = -1;
@@ -723,9 +692,7 @@ static int __init omap_init_wdt(void)
723 return -EINVAL; 692 return -EINVAL;
724 } 693 }
725 694
726 pdev = omap_device_build(dev_name, id, oh, NULL, 0, 695 pdev = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0);
727 omap_wdt_latency,
728 ARRAY_SIZE(omap_wdt_latency), 0);
729 WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n", 696 WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
730 dev_name, oh->name); 697 dev_name, oh->name);
731 return 0; 698 return 0;
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 18693f6de041..8ad0a2f0367d 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -35,14 +35,6 @@ static struct platform_device omap_display_device = {
35 }, 35 },
36}; 36};
37 37
38static struct omap_device_pm_latency omap_dss_latency[] = {
39 [0] = {
40 .deactivate_func = omap_device_idle_hwmods,
41 .activate_func = omap_device_enable_hwmods,
42 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
43 },
44};
45
46struct omap_dss_hwmod_data { 38struct omap_dss_hwmod_data {
47 const char *oh_name; 39 const char *oh_name;
48 const char *dev_name; 40 const char *dev_name;
@@ -111,8 +103,7 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
111 pdev = omap_device_build(curr_dss_hwmod[i].dev_name, 103 pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
112 curr_dss_hwmod[i].id, oh, &pdata, 104 curr_dss_hwmod[i].id, oh, &pdata,
113 sizeof(struct omap_display_platform_data), 105 sizeof(struct omap_display_platform_data),
114 omap_dss_latency, 106 NULL, 0, 0);
115 ARRAY_SIZE(omap_dss_latency), 0);
116 107
117 if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n", 108 if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n",
118 curr_dss_hwmod[i].oh_name)) 109 curr_dss_hwmod[i].oh_name))
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
index ae8cb3fb1830..a59a45a0096e 100644
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -87,14 +87,6 @@ static u16 reg_map[] = {
87 [CCDN] = 0xd8, 87 [CCDN] = 0xd8,
88}; 88};
89 89
90static struct omap_device_pm_latency omap2_dma_latency[] = {
91 {
92 .deactivate_func = omap_device_idle_hwmods,
93 .activate_func = omap_device_enable_hwmods,
94 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
95 },
96};
97
98static void __iomem *dma_base; 90static void __iomem *dma_base;
99static inline void dma_write(u32 val, int reg, int lch) 91static inline void dma_write(u32 val, int reg, int lch)
100{ 92{
@@ -258,8 +250,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
258 250
259 p->errata = configure_dma_errata(); 251 p->errata = configure_dma_errata();
260 252
261 pdev = omap_device_build(name, 0, oh, p, sizeof(*p), 253 pdev = omap_device_build(name, 0, oh, p, sizeof(*p), NULL, 0, 0);
262 omap2_dma_latency, ARRAY_SIZE(omap2_dma_latency), 0);
263 kfree(p); 254 kfree(p);
264 if (IS_ERR(pdev)) { 255 if (IS_ERR(pdev)) {
265 pr_err("%s: Can't build omap_device for %s:%s.\n", 256 pr_err("%s: Can't build omap_device for %s:%s.\n",
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 652ccc574196..8cbfbc2918ce 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -24,14 +24,6 @@
24#include <plat/omap_hwmod.h> 24#include <plat/omap_hwmod.h>
25#include <plat/omap_device.h> 25#include <plat/omap_device.h>
26 26
27static struct omap_device_pm_latency omap_gpio_latency[] = {
28 [0] = {
29 .deactivate_func = omap_device_idle_hwmods,
30 .activate_func = omap_device_enable_hwmods,
31 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
32 },
33};
34
35static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) 27static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
36{ 28{
37 struct platform_device *pdev; 29 struct platform_device *pdev;
@@ -108,9 +100,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
108 } 100 }
109 101
110 pdev = omap_device_build(name, id - 1, oh, pdata, 102 pdev = omap_device_build(name, id - 1, oh, pdata,
111 sizeof(*pdata), omap_gpio_latency, 103 sizeof(*pdata), NULL, 0, false);
112 ARRAY_SIZE(omap_gpio_latency),
113 false);
114 kfree(pdata); 104 kfree(pdata);
115 105
116 if (IS_ERR(pdev)) { 106 if (IS_ERR(pdev)) {
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 2dc002a388b3..77085847e4e7 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -409,31 +409,17 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
409 return 0; 409 return 0;
410} 410}
411 411
412static struct omap_device_pm_latency omap_hsmmc_latency[] = {
413 [0] = {
414 .deactivate_func = omap_device_idle_hwmods,
415 .activate_func = omap_device_enable_hwmods,
416 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
417 },
418 /*
419 * XXX There should also be an entry here to power off/on the
420 * MMC regulators/PBIAS cells, etc.
421 */
422};
423
424#define MAX_OMAP_MMC_HWMOD_NAME_LEN 16 412#define MAX_OMAP_MMC_HWMOD_NAME_LEN 16
425 413
426void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr) 414void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
427{ 415{
428 struct omap_hwmod *oh; 416 struct omap_hwmod *oh;
429 struct platform_device *pdev; 417 struct platform_device *pdev;
430 struct omap_device_pm_latency *ohl;
431 char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN]; 418 char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN];
432 struct omap_mmc_platform_data *mmc_data; 419 struct omap_mmc_platform_data *mmc_data;
433 struct omap_mmc_dev_attr *mmc_dev_attr; 420 struct omap_mmc_dev_attr *mmc_dev_attr;
434 char *name; 421 char *name;
435 int l; 422 int l;
436 int ohl_cnt = 0;
437 423
438 mmc_data = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL); 424 mmc_data = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL);
439 if (!mmc_data) { 425 if (!mmc_data) {
@@ -448,8 +434,6 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
448 omap_hsmmc_mux(mmc_data, (ctrl_nr - 1)); 434 omap_hsmmc_mux(mmc_data, (ctrl_nr - 1));
449 435
450 name = "omap_hsmmc"; 436 name = "omap_hsmmc";
451 ohl = omap_hsmmc_latency;
452 ohl_cnt = ARRAY_SIZE(omap_hsmmc_latency);
453 437
454 l = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN, 438 l = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN,
455 "mmc%d", ctrl_nr); 439 "mmc%d", ctrl_nr);
@@ -468,7 +452,7 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
468 } 452 }
469 453
470 pdev = omap_device_build(name, ctrl_nr - 1, oh, mmc_data, 454 pdev = omap_device_build(name, ctrl_nr - 1, oh, mmc_data,
471 sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false); 455 sizeof(struct omap_mmc_platform_data), NULL, 0, false);
472 if (IS_ERR(pdev)) { 456 if (IS_ERR(pdev)) {
473 WARN(1, "Can't build omap_device for %s:%s.\n", name, oh->name); 457 WARN(1, "Can't build omap_device for %s:%s.\n", name, oh->name);
474 kfree(mmc_data->slots[0].name); 458 kfree(mmc_data->slots[0].name);
diff --git a/arch/arm/mach-omap2/hwspinlock.c b/arch/arm/mach-omap2/hwspinlock.c
index 0b3ae9d9c3b3..36e21091b06a 100644
--- a/arch/arm/mach-omap2/hwspinlock.c
+++ b/arch/arm/mach-omap2/hwspinlock.c
@@ -23,14 +23,6 @@
23#include <plat/omap_hwmod.h> 23#include <plat/omap_hwmod.h>
24#include <plat/omap_device.h> 24#include <plat/omap_device.h>
25 25
26struct omap_device_pm_latency omap_spinlock_latency[] = {
27 {
28 .deactivate_func = omap_device_idle_hwmods,
29 .activate_func = omap_device_enable_hwmods,
30 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
31 }
32};
33
34int __init hwspinlocks_init(void) 26int __init hwspinlocks_init(void)
35{ 27{
36 int retval = 0; 28 int retval = 0;
@@ -48,9 +40,7 @@ int __init hwspinlocks_init(void)
48 if (oh == NULL) 40 if (oh == NULL)
49 return -EINVAL; 41 return -EINVAL;
50 42
51 pdev = omap_device_build(dev_name, 0, oh, NULL, 0, 43 pdev = omap_device_build(dev_name, 0, oh, NULL, 0, NULL, 0, false);
52 omap_spinlock_latency,
53 ARRAY_SIZE(omap_spinlock_latency), false);
54 if (IS_ERR(pdev)) { 44 if (IS_ERR(pdev)) {
55 pr_err("Can't build omap_device for %s:%s\n", dev_name, 45 pr_err("Can't build omap_device for %s:%s\n", dev_name,
56 oh_name); 46 oh_name);
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 5063f253c4b9..292eee3be15f 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -122,14 +122,6 @@ static int omap3_enable_st_clock(unsigned int id, bool enable)
122 return 0; 122 return 0;
123} 123}
124 124
125struct omap_device_pm_latency omap2_mcbsp_latency[] = {
126 {
127 .deactivate_func = omap_device_idle_hwmods,
128 .activate_func = omap_device_enable_hwmods,
129 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
130 },
131};
132
133static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused) 125static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
134{ 126{
135 int id, count = 1; 127 int id, count = 1;
@@ -175,8 +167,7 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
175 count++; 167 count++;
176 } 168 }
177 pdev = omap_device_build_ss(name, id, oh_device, count, pdata, 169 pdev = omap_device_build_ss(name, id, oh_device, count, pdata,
178 sizeof(*pdata), omap2_mcbsp_latency, 170 sizeof(*pdata), NULL, 0, false);
179 ARRAY_SIZE(omap2_mcbsp_latency), false);
180 kfree(pdata); 171 kfree(pdata);
181 if (IS_ERR(pdev)) { 172 if (IS_ERR(pdev)) {
182 pr_err("%s: Can't build omap_device for %s:%s.\n", __func__, 173 pr_err("%s: Can't build omap_device for %s:%s.\n", __func__,
diff --git a/arch/arm/mach-omap2/omap_l3_noc.c b/arch/arm/mach-omap2/omap_l3_noc.c
index 07a3d3ede768..c8b1bef92e5a 100644
--- a/arch/arm/mach-omap2/omap_l3_noc.c
+++ b/arch/arm/mach-omap2/omap_l3_noc.c
@@ -127,7 +127,7 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3)
127 return IRQ_HANDLED; 127 return IRQ_HANDLED;
128} 128}
129 129
130static int __init omap4_l3_probe(struct platform_device *pdev) 130static int __devinit omap4_l3_probe(struct platform_device *pdev)
131{ 131{
132 static struct omap4_l3 *l3; 132 static struct omap4_l3 *l3;
133 struct resource *res; 133 struct resource *res;
@@ -218,7 +218,7 @@ err0:
218 return ret; 218 return ret;
219} 219}
220 220
221static int __exit omap4_l3_remove(struct platform_device *pdev) 221static int __devexit omap4_l3_remove(struct platform_device *pdev)
222{ 222{
223 struct omap4_l3 *l3 = platform_get_drvdata(pdev); 223 struct omap4_l3 *l3 = platform_get_drvdata(pdev);
224 224
@@ -232,16 +232,29 @@ static int __exit omap4_l3_remove(struct platform_device *pdev)
232 return 0; 232 return 0;
233} 233}
234 234
235#if defined(CONFIG_OF)
236static const struct of_device_id l3_noc_match[] = {
237 {.compatible = "ti,omap4-l3-noc", },
238 {},
239}
240MODULE_DEVICE_TABLE(of, l3_noc_match);
241#else
242#define l3_noc_match NULL
243#endif
244
235static struct platform_driver omap4_l3_driver = { 245static struct platform_driver omap4_l3_driver = {
236 .remove = __exit_p(omap4_l3_remove), 246 .probe = omap4_l3_probe,
237 .driver = { 247 .remove = __devexit_p(omap4_l3_remove),
238 .name = "omap_l3_noc", 248 .driver = {
249 .name = "omap_l3_noc",
250 .owner = THIS_MODULE,
251 .of_match_table = l3_noc_match,
239 }, 252 },
240}; 253};
241 254
242static int __init omap4_l3_init(void) 255static int __init omap4_l3_init(void)
243{ 256{
244 return platform_driver_probe(&omap4_l3_driver, omap4_l3_probe); 257 return platform_driver_register(&omap4_l3_driver);
245} 258}
246postcore_initcall_sync(omap4_l3_init); 259postcore_initcall_sync(omap4_l3_init);
247 260
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 0844e2ecfb4a..2ab7a9e17fe2 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -26,38 +26,7 @@
26 26
27static struct omap_device_pm_latency *pm_lats; 27static struct omap_device_pm_latency *pm_lats;
28 28
29static struct device *mpu_dev; 29static int _init_omap_device(char *name)
30static struct device *iva_dev;
31static struct device *l3_dev;
32static struct device *dsp_dev;
33
34struct device *omap2_get_mpuss_device(void)
35{
36 WARN_ON_ONCE(!mpu_dev);
37 return mpu_dev;
38}
39
40struct device *omap2_get_iva_device(void)
41{
42 WARN_ON_ONCE(!iva_dev);
43 return iva_dev;
44}
45
46struct device *omap2_get_l3_device(void)
47{
48 WARN_ON_ONCE(!l3_dev);
49 return l3_dev;
50}
51
52struct device *omap4_get_dsp_device(void)
53{
54 WARN_ON_ONCE(!dsp_dev);
55 return dsp_dev;
56}
57EXPORT_SYMBOL(omap4_get_dsp_device);
58
59/* static int _init_omap_device(struct omap_hwmod *oh, void *user) */
60static int _init_omap_device(char *name, struct device **new_dev)
61{ 30{
62 struct omap_hwmod *oh; 31 struct omap_hwmod *oh;
63 struct platform_device *pdev; 32 struct platform_device *pdev;
@@ -72,8 +41,6 @@ static int _init_omap_device(char *name, struct device **new_dev)
72 __func__, name)) 41 __func__, name))
73 return -ENODEV; 42 return -ENODEV;
74 43
75 *new_dev = &pdev->dev;
76
77 return 0; 44 return 0;
78} 45}
79 46
@@ -82,16 +49,16 @@ static int _init_omap_device(char *name, struct device **new_dev)
82 */ 49 */
83static void omap2_init_processor_devices(void) 50static void omap2_init_processor_devices(void)
84{ 51{
85 _init_omap_device("mpu", &mpu_dev); 52 _init_omap_device("mpu");
86 if (omap3_has_iva()) 53 if (omap3_has_iva())
87 _init_omap_device("iva", &iva_dev); 54 _init_omap_device("iva");
88 55
89 if (cpu_is_omap44xx()) { 56 if (cpu_is_omap44xx()) {
90 _init_omap_device("l3_main_1", &l3_dev); 57 _init_omap_device("l3_main_1");
91 _init_omap_device("dsp", &dsp_dev); 58 _init_omap_device("dsp");
92 _init_omap_device("iva", &iva_dev); 59 _init_omap_device("iva");
93 } else { 60 } else {
94 _init_omap_device("l3_main", &l3_dev); 61 _init_omap_device("l3_main");
95 } 62 }
96} 63}
97 64
@@ -169,18 +136,26 @@ err:
169 * in the opp entry 136 * in the opp entry
170 */ 137 */
171static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, 138static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
172 struct device *dev) 139 const char *oh_name)
173{ 140{
174 struct voltagedomain *voltdm; 141 struct voltagedomain *voltdm;
175 struct clk *clk; 142 struct clk *clk;
176 struct opp *opp; 143 struct opp *opp;
177 unsigned long freq, bootup_volt; 144 unsigned long freq, bootup_volt;
145 struct device *dev;
178 146
179 if (!vdd_name || !clk_name || !dev) { 147 if (!vdd_name || !clk_name || !oh_name) {
180 pr_err("%s: invalid parameters\n", __func__); 148 pr_err("%s: invalid parameters\n", __func__);
181 goto exit; 149 goto exit;
182 } 150 }
183 151
152 dev = omap_device_get_by_hwmod_name(oh_name);
153 if (IS_ERR(dev)) {
154 pr_err("%s: Unable to get dev pointer for hwmod %s\n",
155 __func__, oh_name);
156 goto exit;
157 }
158
184 voltdm = voltdm_lookup(vdd_name); 159 voltdm = voltdm_lookup(vdd_name);
185 if (IS_ERR(voltdm)) { 160 if (IS_ERR(voltdm)) {
186 pr_err("%s: unable to get vdd pointer for vdd_%s\n", 161 pr_err("%s: unable to get vdd pointer for vdd_%s\n",
@@ -224,8 +199,8 @@ static void __init omap3_init_voltages(void)
224 if (!cpu_is_omap34xx()) 199 if (!cpu_is_omap34xx())
225 return; 200 return;
226 201
227 omap2_set_init_voltage("mpu_iva", "dpll1_ck", mpu_dev); 202 omap2_set_init_voltage("mpu_iva", "dpll1_ck", "mpu");
228 omap2_set_init_voltage("core", "l3_ick", l3_dev); 203 omap2_set_init_voltage("core", "l3_ick", "l3_main");
229} 204}
230 205
231static void __init omap4_init_voltages(void) 206static void __init omap4_init_voltages(void)
@@ -233,14 +208,15 @@ static void __init omap4_init_voltages(void)
233 if (!cpu_is_omap44xx()) 208 if (!cpu_is_omap44xx())
234 return; 209 return;
235 210
236 omap2_set_init_voltage("mpu", "dpll_mpu_ck", mpu_dev); 211 omap2_set_init_voltage("mpu", "dpll_mpu_ck", "mpu");
237 omap2_set_init_voltage("core", "l3_div_ck", l3_dev); 212 omap2_set_init_voltage("core", "l3_div_ck", "l3_main_1");
238 omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", iva_dev); 213 omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva");
239} 214}
240 215
241static int __init omap2_common_pm_init(void) 216static int __init omap2_common_pm_init(void)
242{ 217{
243 omap2_init_processor_devices(); 218 if (!of_have_populated_dt())
219 omap2_init_processor_devices();
244 omap_pm_if_init(); 220 omap_pm_if_init();
245 221
246 return 0; 222 return 0;
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 3d1c1d393f8f..9992dbfdfdb3 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -107,28 +107,6 @@ struct omap_uart_state {
107static LIST_HEAD(uart_list); 107static LIST_HEAD(uart_list);
108static u8 num_uarts; 108static u8 num_uarts;
109 109
110static int uart_idle_hwmod(struct omap_device *od)
111{
112 omap_hwmod_idle(od->hwmods[0]);
113
114 return 0;
115}
116
117static int uart_enable_hwmod(struct omap_device *od)
118{
119 omap_hwmod_enable(od->hwmods[0]);
120
121 return 0;
122}
123
124static struct omap_device_pm_latency omap_uart_latency[] = {
125 {
126 .deactivate_func = uart_idle_hwmod,
127 .activate_func = uart_enable_hwmod,
128 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
129 },
130};
131
132static inline unsigned int __serial_read_reg(struct uart_port *up, 110static inline unsigned int __serial_read_reg(struct uart_port *up,
133 int offset) 111 int offset)
134{ 112{
@@ -800,8 +778,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
800 return; 778 return;
801 779
802 pdev = omap_device_build(name, uart->num, oh, pdata, pdata_size, 780 pdev = omap_device_build(name, uart->num, oh, pdata, pdata_size,
803 omap_uart_latency, 781 NULL, 0, false);
804 ARRAY_SIZE(omap_uart_latency), false);
805 WARN(IS_ERR(pdev), "Could not build omap_device for %s: %s.\n", 782 WARN(IS_ERR(pdev), "Could not build omap_device for %s: %s.\n",
806 name, oh->name); 783 name, oh->name);
807 784
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index eba9f9a8ab65..9f43fcc05d3e 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -31,14 +31,6 @@
31 31
32static bool sr_enable_on_init; 32static bool sr_enable_on_init;
33 33
34static struct omap_device_pm_latency omap_sr_latency[] = {
35 {
36 .deactivate_func = omap_device_idle_hwmods,
37 .activate_func = omap_device_enable_hwmods,
38 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST
39 },
40};
41
42/* Read EFUSE values from control registers for OMAP3430 */ 34/* Read EFUSE values from control registers for OMAP3430 */
43static void __init sr_set_nvalues(struct omap_volt_data *volt_data, 35static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
44 struct omap_sr_data *sr_data) 36 struct omap_sr_data *sr_data)
@@ -121,8 +113,7 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
121 sr_data->enable_on_init = sr_enable_on_init; 113 sr_data->enable_on_init = sr_enable_on_init;
122 114
123 pdev = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data), 115 pdev = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data),
124 omap_sr_latency, 116 NULL, 0, 0);
125 ARRAY_SIZE(omap_sr_latency), 0);
126 if (IS_ERR(pdev)) 117 if (IS_ERR(pdev))
127 pr_warning("%s: Could not build omap_device for %s: %s.\n\n", 118 pr_warning("%s: Could not build omap_device for %s: %s.\n\n",
128 __func__, name, oh->name); 119 __func__, name, oh->name);
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index d86af3cda8c7..47fb5d607630 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -60,14 +60,6 @@ static struct musb_hdrc_platform_data musb_plat = {
60 60
61static u64 musb_dmamask = DMA_BIT_MASK(32); 61static u64 musb_dmamask = DMA_BIT_MASK(32);
62 62
63static struct omap_device_pm_latency omap_musb_latency[] = {
64 {
65 .deactivate_func = omap_device_idle_hwmods,
66 .activate_func = omap_device_enable_hwmods,
67 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
68 },
69};
70
71static void usb_musb_mux_init(struct omap_musb_board_data *board_data) 63static void usb_musb_mux_init(struct omap_musb_board_data *board_data)
72{ 64{
73 switch (board_data->interface_type) { 65 switch (board_data->interface_type) {
@@ -150,8 +142,7 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
150 return; 142 return;
151 143
152 pdev = omap_device_build(name, bus_id, oh, &musb_plat, 144 pdev = omap_device_build(name, bus_id, oh, &musb_plat,
153 sizeof(musb_plat), omap_musb_latency, 145 sizeof(musb_plat), NULL, 0, false);
154 ARRAY_SIZE(omap_musb_latency), false);
155 if (IS_ERR(pdev)) { 146 if (IS_ERR(pdev)) {
156 pr_err("Could not build omap_device for %s %s\n", 147 pr_err("Could not build omap_device for %s %s\n",
157 name, oh_name); 148 name, oh_name);