aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap
diff options
context:
space:
mode:
authorTarun Kanti DebBarma <tarun.kanti@ti.com>2011-09-20 07:30:17 -0400
committerTony Lindgren <tony@atomide.com>2011-09-21 18:50:31 -0400
commit97933d6ced601de013f17ad3f589e72cf2266bba (patch)
tree429e5afed768920acbd9661e5bc81eab24a2323e /arch/arm/plat-omap
parent318c3e15cd55c73a26ae22a65a8183655b3003f9 (diff)
ARM: OMAP1: dmtimer: conversion to platform devices
Convert OMAP1 dmtimers into a platform devices and then registers with device model framework so that it can be bound to corresponding driver. Signed-off-by: Thara Gopinath <thara@ti.com> Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com> Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Acked-by: Cousson, Benoit <b-cousson@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r--arch/arm/plat-omap/dmtimer.c56
-rw-r--r--arch/arm/plat-omap/include/plat/dmtimer.h8
2 files changed, 20 insertions, 44 deletions
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index e23b7cf2b219..571c14b36497 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -3,6 +3,12 @@
3 * 3 *
4 * OMAP Dual-Mode Timers 4 * OMAP Dual-Mode Timers
5 * 5 *
6 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
7 * Tarun Kanti DebBarma <tarun.kanti@ti.com>
8 * Thara Gopinath <thara@ti.com>
9 *
10 * dmtimer adaptation to platform_driver.
11 *
6 * Copyright (C) 2005 Nokia Corporation 12 * Copyright (C) 2005 Nokia Corporation
7 * OMAP2 support by Juha Yrjola 13 * OMAP2 support by Juha Yrjola
8 * API improvements and OMAP2 clock framework support by Timo Teras 14 * API improvements and OMAP2 clock framework support by Timo Teras
@@ -43,25 +49,6 @@
43 49
44static int dm_timer_count; 50static int dm_timer_count;
45 51
46#ifdef CONFIG_ARCH_OMAP1
47static struct omap_dm_timer omap1_dm_timers[] = {
48 { .phys_base = 0xfffb1400, .irq = INT_1610_GPTIMER1 },
49 { .phys_base = 0xfffb1c00, .irq = INT_1610_GPTIMER2 },
50 { .phys_base = 0xfffb2400, .irq = INT_1610_GPTIMER3 },
51 { .phys_base = 0xfffb2c00, .irq = INT_1610_GPTIMER4 },
52 { .phys_base = 0xfffb3400, .irq = INT_1610_GPTIMER5 },
53 { .phys_base = 0xfffb3c00, .irq = INT_1610_GPTIMER6 },
54 { .phys_base = 0xfffb7400, .irq = INT_1610_GPTIMER7 },
55 { .phys_base = 0xfffbd400, .irq = INT_1610_GPTIMER8 },
56};
57
58static const int omap1_dm_timer_count = ARRAY_SIZE(omap1_dm_timers);
59
60#else
61#define omap1_dm_timers NULL
62#define omap1_dm_timer_count 0
63#endif /* CONFIG_ARCH_OMAP1 */
64
65#ifdef CONFIG_ARCH_OMAP2 52#ifdef CONFIG_ARCH_OMAP2
66static struct omap_dm_timer omap2_dm_timers[] = { 53static struct omap_dm_timer omap2_dm_timers[] = {
67 { .phys_base = 0x48028000, .irq = INT_24XX_GPTIMER1 }, 54 { .phys_base = 0x48028000, .irq = INT_24XX_GPTIMER1 },
@@ -410,35 +397,20 @@ void omap_dm_timer_stop(struct omap_dm_timer *timer)
410} 397}
411EXPORT_SYMBOL_GPL(omap_dm_timer_stop); 398EXPORT_SYMBOL_GPL(omap_dm_timer_stop);
412 399
413#ifdef CONFIG_ARCH_OMAP1
414
415int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
416{
417 int n = (timer - dm_timers) << 1;
418 u32 l;
419
420 l = omap_readl(MOD_CONF_CTRL_1) & ~(0x03 << n);
421 l |= source << n;
422 omap_writel(l, MOD_CONF_CTRL_1);
423
424 return 0;
425}
426EXPORT_SYMBOL_GPL(omap_dm_timer_set_source);
427
428#else
429
430int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) 400int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
431{ 401{
432 if (source < 0 || source >= 3) 402 if (source < 0 || source >= 3)
433 return -EINVAL; 403 return -EINVAL;
434 404
405#ifdef CONFIG_ARCH_OMAP2PLUS
435 return __omap_dm_timer_set_source(timer->fclk, 406 return __omap_dm_timer_set_source(timer->fclk,
436 dm_source_clocks[source]); 407 dm_source_clocks[source]);
408#else
409 return 0;
410#endif
437} 411}
438EXPORT_SYMBOL_GPL(omap_dm_timer_set_source); 412EXPORT_SYMBOL_GPL(omap_dm_timer_set_source);
439 413
440#endif
441
442void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, 414void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
443 unsigned int load) 415 unsigned int load)
444{ 416{
@@ -582,16 +554,12 @@ static int __init omap_dm_timer_init(void)
582 struct omap_dm_timer *timer; 554 struct omap_dm_timer *timer;
583 int i, map_size = SZ_8K; /* Module 4KB + L4 4KB except on omap1 */ 555 int i, map_size = SZ_8K; /* Module 4KB + L4 4KB except on omap1 */
584 556
585 if (!(cpu_is_omap16xx() || cpu_class_is_omap2())) 557 if (!cpu_class_is_omap2())
586 return -ENODEV; 558 return -ENODEV;
587 559
588 spin_lock_init(&dm_timer_lock); 560 spin_lock_init(&dm_timer_lock);
589 561
590 if (cpu_class_is_omap1()) { 562 if (cpu_is_omap24xx()) {
591 dm_timers = omap1_dm_timers;
592 dm_timer_count = omap1_dm_timer_count;
593 map_size = SZ_2K;
594 } else if (cpu_is_omap24xx()) {
595 dm_timers = omap2_dm_timers; 563 dm_timers = omap2_dm_timers;
596 dm_timer_count = omap2_dm_timer_count; 564 dm_timer_count = omap2_dm_timer_count;
597 dm_source_names = omap2_dm_source_names; 565 dm_source_names = omap2_dm_source_names;
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index ad554d36866d..1751751862da 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -35,6 +35,7 @@
35#include <linux/clk.h> 35#include <linux/clk.h>
36#include <linux/delay.h> 36#include <linux/delay.h>
37#include <linux/io.h> 37#include <linux/io.h>
38#include <linux/platform_device.h>
38 39
39#ifndef __ASM_ARCH_DMTIMER_H 40#ifndef __ASM_ARCH_DMTIMER_H
40#define __ASM_ARCH_DMTIMER_H 41#define __ASM_ARCH_DMTIMER_H
@@ -62,6 +63,12 @@
62struct omap_dm_timer; 63struct omap_dm_timer;
63struct clk; 64struct clk;
64 65
66struct dmtimer_platform_data {
67 int (*set_timer_src)(struct platform_device *pdev, int source);
68 int timer_ip_version;
69 u32 needs_manual_reset:1;
70};
71
65struct omap_dm_timer *omap_dm_timer_request(void); 72struct omap_dm_timer *omap_dm_timer_request(void);
66struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id); 73struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id);
67void omap_dm_timer_free(struct omap_dm_timer *timer); 74void omap_dm_timer_free(struct omap_dm_timer *timer);
@@ -228,6 +235,7 @@ struct omap_dm_timer {
228 unsigned reserved:1; 235 unsigned reserved:1;
229 unsigned enabled:1; 236 unsigned enabled:1;
230 unsigned posted:1; 237 unsigned posted:1;
238 struct platform_device *pdev;
231}; 239};
232 240
233extern u32 sys_timer_reserved; 241extern u32 sys_timer_reserved;