From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v16 08/12] OMAP: dmtimer: do remaining initialization in probe
Date: Wed, 21 Sep 2011 18:00:05 -0700 [thread overview]
Message-ID: <20110922010005.GO2937@atomide.com> (raw)
In-Reply-To: <1316518227-28116-9-git-send-email-tarun.kanti@ti.com>
* Tarun Kanti DebBarma <tarun.kanti@ti.com> [110920 03:57]:
> @@ -514,10 +514,23 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
> timer->irq = irq->start;
> timer->pdev = pdev;
>
> - /* Skip pm_runtime_enable for OMAP1 */
> - if (!pdata->needs_manual_reset) {
> - pm_runtime_enable(&pdev->dev);
> - pm_runtime_irq_safe(&pdev->dev);
> +/*
> + * sys_timer_reserved is not defined for OMAP1.
> + * Use the macro to avoid compilation error on OMAP1.
> + */
> +#if defined(CONFIG_ARCH_OMAP2PLUS)
> + pm_runtime_enable(&pdev->dev);
> + pm_runtime_irq_safe(&pdev->dev);
> + /* Mark clocksource and clockevent timers as reserved */
> + if ((sys_timer_reserved >> (pdev->id - 1)) & 0x1)
> + timer->reserved = 1;
> +#endif
> +
> + if (!timer->reserved) {
> + pm_runtime_get_sync(&pdev->dev);
> + __omap_dm_timer_init_regs(timer);
> + timer->tidr = __raw_readl(timer->io_base);
> + pm_runtime_put(&pdev->dev);
> }
>
> /* add the timer element to the list */
This all should not be necessary. We can pass the reserved flag
in pdata. Let's replace this one with the patch below.
Regards,
Tony
From: Tony Lindgren <tony@atomide.com>
Date: Wed, 21 Sep 2011 16:38:51 -0700
Subject: [PATCH] ARM: OMAP: dmtimer: skip reserved timers
Pass the reserved flag in pdata and use it. We can
now make sys_timer_reserved static to mach-omap2/timer.c.
Signed-off-by: Tony Lindgren <tony@atomide.com>
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 9c2f588..f1e3ec1 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -69,7 +69,7 @@
/* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
#define MAX_GPTIMER_ID 12
-u32 sys_timer_reserved;
+static u32 sys_timer_reserved;
/* Clockevent code */
@@ -463,6 +463,10 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
pdata->set_timer_src = omap2_dm_timer_set_src;
pdata->timer_ip_version = oh->class->rev;
+ /* Mark clocksource and clockevent timers as reserved */
+ if ((sys_timer_reserved >> (id - 1)) & 0x1)
+ pdata->reserved = 1;
+
od = omap_device_build(name, id, oh, pdata, sizeof(*pdata),
omap2_dmtimer_latency,
ARRAY_SIZE(omap2_dmtimer_latency),
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index ac904c2..c8df3c3 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -509,6 +509,7 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
timer->id = pdev->id;
timer->irq = irq->start;
+ timer->reserved = pdata->reserved;
timer->pdev = pdev;
/* Skip pm_runtime_enable for OMAP1 */
@@ -517,6 +518,12 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
pm_runtime_irq_safe(&pdev->dev);
}
+ if (!timer->reserved) {
+ pm_runtime_get_sync(&pdev->dev);
+ __omap_dm_timer_init_regs(timer);
+ pm_runtime_put(&pdev->dev);
+ }
+
/* add the timer element to the list */
spin_lock_irqsave(&dm_timer_lock, flags);
list_add_tail(&timer->node, &omap_timer_list);
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index 4e3a326..29764c3 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -77,6 +77,7 @@ struct dmtimer_platform_data {
int (*set_timer_src)(struct platform_device *pdev, int source);
int timer_ip_version;
u32 needs_manual_reset:1;
+ bool reserved;
};
struct omap_dm_timer *omap_dm_timer_request(void);
@@ -248,7 +249,6 @@ struct omap_dm_timer {
struct list_head node;
};
-extern u32 sys_timer_reserved;
int omap_dm_timer_prepare(struct omap_dm_timer *timer);
static inline u32 __omap_dm_timer_read(struct omap_dm_timer *timer, u32 reg,
next prev parent reply other threads:[~2011-09-22 1:00 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-20 11:30 [PATCH v16 00/12] OMAP: dmtimer: adaptation to platform_driver Tarun Kanti DebBarma
2011-09-20 11:30 ` [PATCH v16 01/12] OMAP2+: dmtimer: add device names to flck nodes Tarun Kanti DebBarma
2011-09-22 1:00 ` Tony Lindgren
2011-09-22 5:58 ` DebBarma, Tarun Kanti
2011-09-20 11:30 ` [PATCH v16 02/12] OMAP1: dmtimer: conversion to platform devices Tarun Kanti DebBarma
2011-09-20 11:30 ` [PATCH v16 03/12] OMAP2+: dmtimer: convert " Tarun Kanti DebBarma
2011-09-20 11:30 ` [PATCH v16 04/12] OMAP: dmtimer: platform driver Tarun Kanti DebBarma
2011-09-20 11:30 ` [PATCH v16 05/12] OMAP: dmtimer: switch-over to platform device driver Tarun Kanti DebBarma
2011-09-22 1:00 ` Tony Lindgren
2011-09-22 5:57 ` DebBarma, Tarun Kanti
2011-09-20 11:30 ` [PATCH v16 06/12] OMAP: dmtimer: pm_runtime support Tarun Kanti DebBarma
2011-09-20 11:30 ` [PATCH v16 07/12] OMAP: dmtimer: add timeout to low-level routines Tarun Kanti DebBarma
2011-09-22 1:00 ` Tony Lindgren
2011-09-22 5:53 ` DebBarma, Tarun Kanti
2011-09-20 11:30 ` [PATCH v16 08/12] OMAP: dmtimer: do remaining initialization in probe Tarun Kanti DebBarma
2011-09-22 1:00 ` Tony Lindgren [this message]
2011-09-22 6:05 ` DebBarma, Tarun Kanti
2011-09-20 11:30 ` [PATCH v16 09/12] OMAP: dmtimer: low-power mode support Tarun Kanti DebBarma
2011-09-22 1:00 ` Tony Lindgren
2011-09-22 6:07 ` DebBarma, Tarun Kanti
2011-11-15 17:57 ` Omar Ramirez Luna
2011-11-16 6:18 ` DebBarma, Tarun Kanti
2011-11-17 0:53 ` Omar Ramirez Luna
2011-11-17 9:42 ` DebBarma, Tarun Kanti
2011-11-18 2:19 ` Omar Ramirez Luna
2011-09-20 11:30 ` [PATCH v16 10/12] OMAP: dmtimer: extend spinlock in request functions Tarun Kanti DebBarma
2011-09-22 0:42 ` Tony Lindgren
2011-09-22 6:00 ` DebBarma, Tarun Kanti
2011-09-20 11:30 ` [PATCH v16 11/12] OMAP: dmtimer: add error handling to export APIs Tarun Kanti DebBarma
2011-09-20 11:30 ` [PATCH v16 12/12] OMAP: dmtimer: get rid of timer_ip_version field Tarun Kanti DebBarma
2011-09-22 1:00 ` Tony Lindgren
2011-09-22 0:59 ` [PATCH v16 00/12] OMAP: dmtimer: adaptation to platform_driver Tony Lindgren
2011-09-22 6:09 ` DebBarma, Tarun Kanti
2011-09-23 9:27 ` DebBarma, Tarun Kanti
2011-09-26 17:25 ` Tony Lindgren
2011-09-26 18:38 ` DebBarma, Tarun Kanti
2011-10-03 14:33 ` Cousson, Benoit
2011-10-04 0:36 ` Tony Lindgren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110922010005.GO2937@atomide.com \
--to=tony@atomide.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).