linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v16 07/12] OMAP: dmtimer: add timeout to low-level routines
Date: Wed, 21 Sep 2011 18:00:46 -0700	[thread overview]
Message-ID: <20110922010046.GS2937@atomide.com> (raw)
In-Reply-To: <1316518227-28116-8-git-send-email-tarun.kanti@ti.com>

* Tarun Kanti DebBarma <tarun.kanti@ti.com> [110920 03:57]:
> @@ -254,9 +259,15 @@ int omap_dm_timer_prepare(struct omap_dm_timer *timer);
>  static inline u32 __omap_dm_timer_read(struct omap_dm_timer *timer, u32 reg,
>  						int posted)
>  {
> -	if (posted)
> -		while (__raw_readl(timer->pend) & (reg >> WPSHIFT))
> -			cpu_relax();
> +	int i = 0;
> +
> +	if (posted) {
> +		omap_test_timeout(!(__raw_readl(timer->pend) & (reg >> WPSHIFT))
> +						, MAX_WRITE_PEND_WAIT, i);
> +
> +		if (WARN_ON_ONCE(i == MAX_WRITE_PEND_WAIT))
> +			pr_err("Read timeout!\n");
> +	}
>  
>  	return __raw_readl(timer->func_base + (reg & 0xff));
>  }
> @@ -264,9 +275,15 @@ static inline u32 __omap_dm_timer_read(struct omap_dm_timer *timer, u32 reg,
>  static inline void __omap_dm_timer_write(struct omap_dm_timer *timer,
>  					u32 reg, u32 val, int posted)
>  {
> -	if (posted)
> -		while (__raw_readl(timer->pend) & (reg >> WPSHIFT))
> -			cpu_relax();
> +	int i = 0;
> +
> +	if (posted) {
> +		omap_test_timeout(!(__raw_readl(timer->pend) & (reg >> WPSHIFT))
> +						, MAX_WRITE_PEND_WAIT, i);
> +
> +		if (WARN_ON_ONCE(i == MAX_WRITE_PEND_WAIT))
> +			pr_err("Write timeout!\n");
> +	}
>  
>  	__raw_writel(val, timer->func_base + (reg & 0xff));
>  }

Let's leave out these changes for now, they make the
omap2_gp_timer_set_next_event used for system timer interrupts
huge if you take a look at it with objdump.

Later on we might want to split the posted bit check into a separate
inline function, and then you can implement this for the device
driver where things are more likely to go wrong with more complicated
use scenarios.

Regards,

Tony

  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 [this message]
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
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=20110922010046.GS2937@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).