diff options
author | Varadarajan, Charulatha <charu@ti.com> | 2010-09-23 10:32:42 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2010-09-29 15:21:57 -0400 |
commit | f2ce62312650211f6cf665cd6dc519c334c4071e (patch) | |
tree | 37c52a98bf3e19f6658d4ce4fbfaf6fce0cfc85c /arch/arm | |
parent | 92b18d1cf1335a468d4014c4fdb1eb720e77526f (diff) |
OMAP: WDT: Split OMAP1 and OMAP2PLUS device registration
This patch splits omap_init_wdt() into separate omap_init_wdt()
functions under mach-omap1 and mach-omap2 and set them up with
subsys_initcall.
Also it uses omap_device_build() API instead of
platform_device_register() for watchdog timer device registration
for OMAP2plus chips.
For OMAP2plus chips, the device specific data defined in centralized
hwmod database will be used.
Signed-off-by: Charulatha V <charu@ti.com>
Acked-by: Cousson, Benoit <b-cousson@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap1/devices.c | 27 | ||||
-rw-r--r-- | arch/arm/mach-omap2/devices.c | 39 | ||||
-rw-r--r-- | arch/arm/plat-omap/devices.c | 41 |
3 files changed, 66 insertions, 41 deletions
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c index aa0725608fb1..a919366a90dd 100644 --- a/arch/arm/mach-omap1/devices.c +++ b/arch/arm/mach-omap1/devices.c | |||
@@ -232,3 +232,30 @@ static int __init omap1_init_devices(void) | |||
232 | } | 232 | } |
233 | arch_initcall(omap1_init_devices); | 233 | arch_initcall(omap1_init_devices); |
234 | 234 | ||
235 | #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE) | ||
236 | |||
237 | static struct resource wdt_resources[] = { | ||
238 | { | ||
239 | .start = 0xfffeb000, | ||
240 | .end = 0xfffeb07F, | ||
241 | .flags = IORESOURCE_MEM, | ||
242 | }, | ||
243 | }; | ||
244 | |||
245 | static struct platform_device omap_wdt_device = { | ||
246 | .name = "omap_wdt", | ||
247 | .id = -1, | ||
248 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
249 | .resource = wdt_resources, | ||
250 | }; | ||
251 | |||
252 | static int __init omap_init_wdt(void) | ||
253 | { | ||
254 | if (!cpu_is_omap16xx()) | ||
255 | return; | ||
256 | |||
257 | platform_device_register(&omap_wdt_device); | ||
258 | return 0; | ||
259 | } | ||
260 | subsys_initcall(omap_init_wdt); | ||
261 | #endif | ||
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 9e5d51bee94a..8e2f0aa310b5 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
18 | #include <linux/err.h> | ||
18 | 19 | ||
19 | #include <mach/hardware.h> | 20 | #include <mach/hardware.h> |
20 | #include <mach/irqs.h> | 21 | #include <mach/irqs.h> |
@@ -28,6 +29,8 @@ | |||
28 | #include <mach/gpio.h> | 29 | #include <mach/gpio.h> |
29 | #include <plat/mmc.h> | 30 | #include <plat/mmc.h> |
30 | #include <plat/dma.h> | 31 | #include <plat/dma.h> |
32 | #include <plat/omap_hwmod.h> | ||
33 | #include <plat/omap_device.h> | ||
31 | 34 | ||
32 | #include "mux.h" | 35 | #include "mux.h" |
33 | 36 | ||
@@ -932,3 +935,39 @@ static int __init omap2_init_devices(void) | |||
932 | return 0; | 935 | return 0; |
933 | } | 936 | } |
934 | arch_initcall(omap2_init_devices); | 937 | arch_initcall(omap2_init_devices); |
938 | |||
939 | #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE) | ||
940 | struct omap_device_pm_latency omap_wdt_latency[] = { | ||
941 | [0] = { | ||
942 | .deactivate_func = omap_device_idle_hwmods, | ||
943 | .activate_func = omap_device_enable_hwmods, | ||
944 | .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, | ||
945 | }, | ||
946 | }; | ||
947 | |||
948 | static int __init omap_init_wdt(void) | ||
949 | { | ||
950 | int id = -1; | ||
951 | struct omap_device *od; | ||
952 | struct omap_hwmod *oh; | ||
953 | char *oh_name = "wd_timer2"; | ||
954 | char *dev_name = "omap_wdt"; | ||
955 | |||
956 | if (!cpu_class_is_omap2()) | ||
957 | return 0; | ||
958 | |||
959 | oh = omap_hwmod_lookup(oh_name); | ||
960 | if (!oh) { | ||
961 | pr_err("Could not look up wd_timer%d hwmod\n", id); | ||
962 | return -EINVAL; | ||
963 | } | ||
964 | |||
965 | od = omap_device_build(dev_name, id, oh, NULL, 0, | ||
966 | omap_wdt_latency, | ||
967 | ARRAY_SIZE(omap_wdt_latency), 0); | ||
968 | WARN(IS_ERR(od), "Cant build omap_device for %s:%s.\n", | ||
969 | dev_name, oh->name); | ||
970 | return 0; | ||
971 | } | ||
972 | subsys_initcall(omap_init_wdt); | ||
973 | #endif | ||
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c index d1920be7833b..8e88e0e5d524 100644 --- a/arch/arm/plat-omap/devices.c +++ b/arch/arm/plat-omap/devices.c | |||
@@ -232,46 +232,6 @@ static void omap_init_uwire(void) | |||
232 | static inline void omap_init_uwire(void) {} | 232 | static inline void omap_init_uwire(void) {} |
233 | #endif | 233 | #endif |
234 | 234 | ||
235 | /*-------------------------------------------------------------------------*/ | ||
236 | |||
237 | #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE) | ||
238 | |||
239 | static struct resource wdt_resources[] = { | ||
240 | { | ||
241 | .flags = IORESOURCE_MEM, | ||
242 | }, | ||
243 | }; | ||
244 | |||
245 | static struct platform_device omap_wdt_device = { | ||
246 | .name = "omap_wdt", | ||
247 | .id = -1, | ||
248 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
249 | .resource = wdt_resources, | ||
250 | }; | ||
251 | |||
252 | static void omap_init_wdt(void) | ||
253 | { | ||
254 | if (cpu_is_omap16xx()) | ||
255 | wdt_resources[0].start = 0xfffeb000; | ||
256 | else if (cpu_is_omap2420()) | ||
257 | wdt_resources[0].start = 0x48022000; /* WDT2 */ | ||
258 | else if (cpu_is_omap2430()) | ||
259 | wdt_resources[0].start = 0x49016000; /* WDT2 */ | ||
260 | else if (cpu_is_omap343x()) | ||
261 | wdt_resources[0].start = 0x48314000; /* WDT2 */ | ||
262 | else if (cpu_is_omap44xx()) | ||
263 | wdt_resources[0].start = 0x4a314000; | ||
264 | else | ||
265 | return; | ||
266 | |||
267 | wdt_resources[0].end = wdt_resources[0].start + 0x4f; | ||
268 | |||
269 | (void) platform_device_register(&omap_wdt_device); | ||
270 | } | ||
271 | #else | ||
272 | static inline void omap_init_wdt(void) {} | ||
273 | #endif | ||
274 | |||
275 | /* | 235 | /* |
276 | * This gets called after board-specific INIT_MACHINE, and initializes most | 236 | * This gets called after board-specific INIT_MACHINE, and initializes most |
277 | * on-chip peripherals accessible on this board (except for few like USB): | 237 | * on-chip peripherals accessible on this board (except for few like USB): |
@@ -300,7 +260,6 @@ static int __init omap_init_devices(void) | |||
300 | omap_init_rng(); | 260 | omap_init_rng(); |
301 | omap_init_mcpdm(); | 261 | omap_init_mcpdm(); |
302 | omap_init_uwire(); | 262 | omap_init_uwire(); |
303 | omap_init_wdt(); | ||
304 | return 0; | 263 | return 0; |
305 | } | 264 | } |
306 | arch_initcall(omap_init_devices); | 265 | arch_initcall(omap_init_devices); |