* Tarun Kanti DebBarma <[email protected]> [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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to