RE: [PATCH] clocksource/fsl: Fix errata A-007728 for flextimer
From: Meng Yi
Date: Thu Sep 08 2016 - 05:02:45 EST
> > drivers/clocksource/fsl_ftm_timer.c | 9 ++++-----
> > 1 file changed, 4 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/clocksource/fsl_ftm_timer.c
> > b/drivers/clocksource/fsl_ftm_timer.c index 738515b..ade26e5 100644
> > --- a/drivers/clocksource/fsl_ftm_timer.c
> > +++ b/drivers/clocksource/fsl_ftm_timer.c
> > @@ -83,11 +83,10 @@ static inline void ftm_counter_disable(void
> > __iomem
> > *base)
> >
> > static inline void ftm_irq_acknowledge(void __iomem *base) {
> > - u32 val;
> > -
> > - val = ftm_readl(base + FTM_SC);
> > - val &= ~FTM_SC_TOF;
> > - ftm_writel(val, base + FTM_SC);
> > + /*read and clean the FTM_SC_TOF bit until its cleared*/
> > + while (FTM_SC_TOF & ftm_readl(base + FTM_SC))
> > + ftm_writel(ftm_readl(base + FTM_SC) & (~FTM_SC_TOF),
> > + base + FTM_SC);
> > }
>
> So you are essentially polling hardware in interrupt context. Please add a
> sensible timeout to abort this loop in case of defective hardware, and maybe
> disable the interrupt in that case.
>
Oh, right. Thank for your comments. I will correct that in next version.
Best regards,
Meng