Re: [PATCH v16 07/12] OMAP: dmtimer: add timeout to low-level routines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Tarun Kanti DebBarma <tarun.kanti@xxxxxx> [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

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux